[MIPS] Rest of works for migration to GENERIC_TIME
[linux-2.6/linux-mips.git] / include / asm-xtensa / thread_info.h
blob5ae34ab715972a812ef81a8e634e18d8ea50b776
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)
97 #else /* !__ASSEMBLY__ */
99 /* how to get the thread information struct from ASM */
100 #define GET_THREAD_INFO(reg,sp) \
101 extui reg, sp, 0, 13; \
102 xor reg, sp, reg
103 #endif
107 * thread information flags
108 * - these are process state flags that various assembly files may need to access
109 * - pending work-to-be-done flags are in LSW
110 * - other flags in MSW
112 #define TIF_SYSCALL_TRACE 0 /* syscall trace active */
113 #define TIF_NOTIFY_RESUME 1 /* resumption notification requested */
114 #define TIF_SIGPENDING 2 /* signal pending */
115 #define TIF_NEED_RESCHED 3 /* rescheduling necessary */
116 #define TIF_SINGLESTEP 4 /* restore singlestep on return to user mode */
117 #define TIF_IRET 5 /* return with iret */
118 #define TIF_MEMDIE 6
119 #define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */
121 #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
122 #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
123 #define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
124 #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
125 #define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP)
126 #define _TIF_IRET (1<<TIF_IRET)
127 #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
129 #define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */
130 #define _TIF_ALLWORK_MASK 0x0000FFFF /* work to do on any return to u-space */
133 * Thread-synchronous status.
135 * This is different from the flags in that nobody else
136 * ever touches our thread-synchronous status, so we don't
137 * have to worry about atomic accesses.
139 #define TS_USEDFPU 0x0001 /* FPU was used by this task this quantum (SMP) */
141 #define THREAD_SIZE 8192 //(2*PAGE_SIZE)
143 #endif /* __KERNEL__ */
144 #endif /* _XTENSA_THREAD_INFO */