/* * NiosII low-level thread information * * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch> * Copyright (C) 2004 Microtronix Datacom Ltd. * * Based on asm/thread_info_no.h from m68k which is: * * Copyright (C) 2002 David Howells <dhowells@redhat.com> * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. */ #ifndef _ASM_NIOS2_THREAD_INFO_H #define _ASM_NIOS2_THREAD_INFO_H #ifdef __KERNEL__ /* * Size of the kernel stack for each process. */ #define THREAD_SIZE_ORDER 1 #define THREAD_SIZE 8192 /* 2 * PAGE_SIZE */ #ifndef __ASSEMBLY__ typedef struct { unsigned long seg; } mm_segment_t; /* * low level task data that entry.S needs immediate access to * - this struct should fit entirely inside of one cache line * - this struct shares the supervisor stack pages * - if the contents of this structure are changed, the assembly constants * must also be changed */ struct thread_info { struct task_struct *task; /* main task structure */ unsigned long flags; /* low level flags */ __u32 cpu; /* current CPU */ int preempt_count; /* 0 => preemptable,<0 => BUG */ mm_segment_t addr_limit; /* thread address space: 0-0x7FFFFFFF for user-thead 0-0xFFFFFFFF for kernel-thread */ struct pt_regs *regs; }; /* * macros/functions for gaining access to the thread information structure * * preempt_count needs to be 1 initially, until the scheduler is functional. */ #define INIT_THREAD_INFO(tsk) \ { \ .task = &tsk, \ .flags = 0, \ .cpu = 0, \ .preempt_count = INIT_PREEMPT_COUNT, \ .addr_limit = KERNEL_DS, \ } #define init_thread_info (init_thread_union.thread_info) #define init_stack (init_thread_union.stack) /* how to get the thread information struct from C */
static inline struct thread_info *current_thread_info(void) { register unsigned long sp asm("sp"); return (struct thread_info *)(sp & ~(THREAD_SIZE - 1)); }Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ley Foon Tan | 37 | 100.00% | 1 | 100.00% |
Total | 37 | 100.00% | 1 | 100.00% |
Person | Tokens | Prop | Commits | CommitProp |
Ley Foon Tan | 218 | 99.54% | 1 | 50.00% |
Linus Torvalds | 1 | 0.46% | 1 | 50.00% |
Total | 219 | 100.00% | 2 | 100.00% |