2 * NiosII low-level thread information
4 * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch>
5 * Copyright (C) 2004 Microtronix Datacom Ltd.
7 * Based on asm/thread_info_no.h from m68k which is:
9 * Copyright (C) 2002 David Howells <dhowells@redhat.com>
11 * This file is subject to the terms and conditions of the GNU General Public
12 * License. See the file "COPYING" in the main directory of this archive
16 #ifndef _ASM_NIOS2_THREAD_INFO_H
17 #define _ASM_NIOS2_THREAD_INFO_H
22 * Size of the kernel stack for each process.
24 #define THREAD_SIZE_ORDER 1
25 #define THREAD_SIZE 8192 /* 2 * PAGE_SIZE */
34 * low level task data that entry.S needs immediate access to
35 * - this struct should fit entirely inside of one cache line
36 * - this struct shares the supervisor stack pages
37 * - if the contents of this structure are changed, the assembly constants
38 * must also be changed
41 struct task_struct
*task
; /* main task structure */
42 unsigned long flags
; /* low level flags */
43 __u32 cpu
; /* current CPU */
44 int preempt_count
; /* 0 => preemptable,<0 => BUG */
45 mm_segment_t addr_limit
; /* thread address space:
46 0-0x7FFFFFFF for user-thead
47 0-0xFFFFFFFF for kernel-thread
53 * macros/functions for gaining access to the thread information structure
55 * preempt_count needs to be 1 initially, until the scheduler is functional.
57 #define INIT_THREAD_INFO(tsk) \
62 .preempt_count = INIT_PREEMPT_COUNT, \
63 .addr_limit = KERNEL_DS, \
66 /* how to get the thread information struct from C */
67 static inline struct thread_info
*current_thread_info(void)
69 register unsigned long sp
asm("sp");
71 return (struct thread_info
*)(sp
& ~(THREAD_SIZE
- 1));
73 #endif /* !__ASSEMBLY__ */
76 * thread information flags
77 * - these are process state flags that various assembly files may need to
79 * - pending work-to-be-done flags are in LSW
80 * - other flags in MSW
82 #define TIF_SYSCALL_TRACE 0 /* syscall trace active */
83 #define TIF_NOTIFY_RESUME 1 /* resumption notification requested */
84 #define TIF_SIGPENDING 2 /* signal pending */
85 #define TIF_NEED_RESCHED 3 /* rescheduling necessary */
86 #define TIF_MEMDIE 4 /* is terminating due to OOM killer */
87 #define TIF_SECCOMP 5 /* secure computing */
88 #define TIF_SYSCALL_AUDIT 6 /* syscall auditing active */
89 #define TIF_RESTORE_SIGMASK 9 /* restore signal mask in do_signal() */
91 #define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling
94 #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
95 #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
96 #define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
97 #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
98 #define _TIF_SECCOMP (1 << TIF_SECCOMP)
99 #define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT)
100 #define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK)
101 #define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG)
103 /* work to do on interrupt/exception return */
104 #define _TIF_WORK_MASK 0x0000FFFE
106 /* work to do on any return to u-space */
107 # define _TIF_ALLWORK_MASK 0x0000FFFF
109 #endif /* __KERNEL__ */
111 #endif /* _ASM_NIOS2_THREAD_INFO_H */