[CONNECTOR]: Update documentation to match reality.
[linux-2.6/verdex.git] / include / asm-xtensa / thread_info.h
blobaf208d41fd821e842913a326f446315cba4bf57f
1 /*
2 * include/asm-xtensa/thread_info.h
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 */
11 #ifndef _XTENSA_THREAD_INFO_H
12 #define _XTENSA_THREAD_INFO_H
14 #ifdef __KERNEL__
16 #ifndef __ASSEMBLY__
17 # include <asm/processor.h>
18 #endif
21 * low level task data that entry.S needs immediate access to
22 * - this struct should fit entirely inside of one cache line
23 * - this struct shares the supervisor stack pages
24 * - if the contents of this structure are changed, the assembly constants
25 * must also be changed
28 #ifndef __ASSEMBLY__
30 struct thread_info {
31 struct task_struct *task; /* main task structure */
32 struct exec_domain *exec_domain; /* execution domain */
33 unsigned long flags; /* low level flags */
34 unsigned long status; /* thread-synchronous flags */
35 __u32 cpu; /* current CPU */
36 __s32 preempt_count; /* 0 => preemptable,< 0 => BUG*/
38 mm_segment_t addr_limit; /* thread address space */
39 struct restart_block restart_block;
44 #else /* !__ASSEMBLY__ */
46 /* offsets into the thread_info struct for assembly code access */
47 #define TI_TASK 0x00000000
48 #define TI_EXEC_DOMAIN 0x00000004
49 #define TI_FLAGS 0x00000008
50 #define TI_STATUS 0x0000000C
51 #define TI_CPU 0x00000010
52 #define TI_PRE_COUNT 0x00000014
53 #define TI_ADDR_LIMIT 0x00000018
54 #define TI_RESTART_BLOCK 0x000001C
56 #endif
58 #define PREEMPT_ACTIVE 0x10000000
61 * macros/functions for gaining access to the thread information structure
63 * preempt_count needs to be 1 initially, until the scheduler is functional.
66 #ifndef __ASSEMBLY__
68 #define INIT_THREAD_INFO(tsk) \
69 { \
70 .task = &tsk, \
71 .exec_domain = &default_exec_domain, \
72 .flags = 0, \
73 .cpu = 0, \
74 .preempt_count = 1, \
75 .addr_limit = KERNEL_DS, \
76 .restart_block = { \
77 .fn = do_no_restart_syscall, \
78 }, \
81 #define init_thread_info (init_thread_union.thread_info)
82 #define init_stack (init_thread_union.stack)
84 /* how to get the thread information struct from C */
85 static inline struct thread_info *current_thread_info(void)
87 struct thread_info *ti;
88 __asm__("extui %0,a1,0,13\n\t"
89 "xor %0, a1, %0" : "=&r" (ti) : );
90 return ti;
93 /* thread information allocation */
94 #define alloc_thread_info(tsk) ((struct thread_info *) __get_free_pages(GFP_KERNEL,1))
95 #define free_thread_info(ti) free_pages((unsigned long) (ti), 1)
96 #define get_thread_info(ti) get_task_struct((ti)->task)
97 #define put_thread_info(ti) put_task_struct((ti)->task)
99 #else /* !__ASSEMBLY__ */
101 /* how to get the thread information struct from ASM */
102 #define GET_THREAD_INFO(reg,sp) \
103 extui reg, sp, 0, 13; \
104 xor reg, sp, reg
105 #endif
109 * thread information flags
110 * - these are process state flags that various assembly files may need to access
111 * - pending work-to-be-done flags are in LSW
112 * - other flags in MSW
114 #define TIF_SYSCALL_TRACE 0 /* syscall trace active */
115 #define TIF_NOTIFY_RESUME 1 /* resumption notification requested */
116 #define TIF_SIGPENDING 2 /* signal pending */
117 #define TIF_NEED_RESCHED 3 /* rescheduling necessary */
118 #define TIF_SINGLESTEP 4 /* restore singlestep on return to user mode */
119 #define TIF_IRET 5 /* return with iret */
120 #define TIF_MEMDIE 6
121 #define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */
123 #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
124 #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
125 #define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
126 #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
127 #define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP)
128 #define _TIF_IRET (1<<TIF_IRET)
129 #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
131 #define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */
132 #define _TIF_ALLWORK_MASK 0x0000FFFF /* work to do on any return to u-space */
135 * Thread-synchronous status.
137 * This is different from the flags in that nobody else
138 * ever touches our thread-synchronous status, so we don't
139 * have to worry about atomic accesses.
141 #define TS_USEDFPU 0x0001 /* FPU was used by this task this quantum (SMP) */
143 #define THREAD_SIZE 8192 //(2*PAGE_SIZE)
145 #endif /* __KERNEL__ */
146 #endif /* _XTENSA_THREAD_INFO */