Commit | Line | Data |
---|---|---|
9a8fd558 CZ |
1 | /* |
2 | * include/asm-xtensa/thread_info.h | |
3 | * | |
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. | |
7 | * | |
8 | * Copyright (C) 2001 - 2005 Tensilica Inc. | |
9 | */ | |
10 | ||
11 | #ifndef _XTENSA_THREAD_INFO_H | |
12 | #define _XTENSA_THREAD_INFO_H | |
13 | ||
14 | #ifdef __KERNEL__ | |
15 | ||
16 | #ifndef __ASSEMBLY__ | |
17 | # include <asm/processor.h> | |
18 | #endif | |
19 | ||
20 | /* | |
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 | |
26 | */ | |
27 | ||
28 | #ifndef __ASSEMBLY__ | |
29 | ||
c658eac6 CZ |
30 | #if XTENSA_HAVE_COPROCESSORS |
31 | ||
32 | typedef struct xtregs_coprocessor { | |
33 | xtregs_cp0_t cp0; | |
34 | xtregs_cp1_t cp1; | |
35 | xtregs_cp2_t cp2; | |
36 | xtregs_cp3_t cp3; | |
37 | xtregs_cp4_t cp4; | |
38 | xtregs_cp5_t cp5; | |
39 | xtregs_cp6_t cp6; | |
40 | xtregs_cp7_t cp7; | |
41 | } xtregs_coprocessor_t; | |
42 | ||
43 | #endif | |
44 | ||
9a8fd558 CZ |
45 | struct thread_info { |
46 | struct task_struct *task; /* main task structure */ | |
47 | struct exec_domain *exec_domain; /* execution domain */ | |
48 | unsigned long flags; /* low level flags */ | |
49 | unsigned long status; /* thread-synchronous flags */ | |
50 | __u32 cpu; /* current CPU */ | |
51 | __s32 preempt_count; /* 0 => preemptable,< 0 => BUG*/ | |
52 | ||
53 | mm_segment_t addr_limit; /* thread address space */ | |
54 | struct restart_block restart_block; | |
55 | ||
c658eac6 | 56 | unsigned long cpenable; |
9a8fd558 | 57 | |
c658eac6 CZ |
58 | /* Allocate storage for extra user states and coprocessor states. */ |
59 | #if XTENSA_HAVE_COPROCESSORS | |
60 | xtregs_coprocessor_t xtregs_cp; | |
61 | #endif | |
62 | xtregs_user_t xtregs_user; | |
9a8fd558 CZ |
63 | }; |
64 | ||
65 | #else /* !__ASSEMBLY__ */ | |
66 | ||
67 | /* offsets into the thread_info struct for assembly code access */ | |
68 | #define TI_TASK 0x00000000 | |
69 | #define TI_EXEC_DOMAIN 0x00000004 | |
70 | #define TI_FLAGS 0x00000008 | |
71 | #define TI_STATUS 0x0000000C | |
72 | #define TI_CPU 0x00000010 | |
73 | #define TI_PRE_COUNT 0x00000014 | |
74 | #define TI_ADDR_LIMIT 0x00000018 | |
75 | #define TI_RESTART_BLOCK 0x000001C | |
76 | ||
77 | #endif | |
78 | ||
79 | #define PREEMPT_ACTIVE 0x10000000 | |
80 | ||
81 | /* | |
82 | * macros/functions for gaining access to the thread information structure | |
83 | * | |
84 | * preempt_count needs to be 1 initially, until the scheduler is functional. | |
85 | */ | |
86 | ||
87 | #ifndef __ASSEMBLY__ | |
88 | ||
89 | #define INIT_THREAD_INFO(tsk) \ | |
90 | { \ | |
91 | .task = &tsk, \ | |
92 | .exec_domain = &default_exec_domain, \ | |
93 | .flags = 0, \ | |
94 | .cpu = 0, \ | |
95 | .preempt_count = 1, \ | |
96 | .addr_limit = KERNEL_DS, \ | |
97 | .restart_block = { \ | |
98 | .fn = do_no_restart_syscall, \ | |
99 | }, \ | |
100 | } | |
101 | ||
102 | #define init_thread_info (init_thread_union.thread_info) | |
103 | #define init_stack (init_thread_union.stack) | |
104 | ||
105 | /* how to get the thread information struct from C */ | |
106 | static inline struct thread_info *current_thread_info(void) | |
107 | { | |
108 | struct thread_info *ti; | |
109 | __asm__("extui %0,a1,0,13\n\t" | |
110 | "xor %0, a1, %0" : "=&r" (ti) : ); | |
111 | return ti; | |
112 | } | |
113 | ||
9a8fd558 CZ |
114 | #else /* !__ASSEMBLY__ */ |
115 | ||
116 | /* how to get the thread information struct from ASM */ | |
117 | #define GET_THREAD_INFO(reg,sp) \ | |
118 | extui reg, sp, 0, 13; \ | |
119 | xor reg, sp, reg | |
120 | #endif | |
121 | ||
122 | ||
123 | /* | |
124 | * thread information flags | |
125 | * - these are process state flags that various assembly files may need to access | |
126 | * - pending work-to-be-done flags are in LSW | |
127 | * - other flags in MSW | |
128 | */ | |
129 | #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ | |
a583f1b5 SE |
130 | #define TIF_SIGPENDING 1 /* signal pending */ |
131 | #define TIF_NEED_RESCHED 2 /* rescheduling necessary */ | |
132 | #define TIF_SINGLESTEP 3 /* restore singlestep on return to user mode */ | |
133 | #define TIF_IRET 4 /* return with iret */ | |
134 | #define TIF_MEMDIE 5 | |
135 | #define TIF_RESTORE_SIGMASK 6 /* restore signal mask in do_signal() */ | |
9a8fd558 | 136 | #define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */ |
83224b08 | 137 | #define TIF_FREEZE 17 /* is freezing for suspend */ |
9a8fd558 CZ |
138 | |
139 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) | |
9a8fd558 CZ |
140 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) |
141 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) | |
142 | #define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP) | |
143 | #define _TIF_IRET (1<<TIF_IRET) | |
144 | #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) | |
de4f6e5b | 145 | #define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK) |
83224b08 | 146 | #define _TIF_FREEZE (1<<TIF_FREEZE) |
9a8fd558 CZ |
147 | |
148 | #define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */ | |
149 | #define _TIF_ALLWORK_MASK 0x0000FFFF /* work to do on any return to u-space */ | |
150 | ||
151 | /* | |
152 | * Thread-synchronous status. | |
153 | * | |
154 | * This is different from the flags in that nobody else | |
155 | * ever touches our thread-synchronous status, so we don't | |
156 | * have to worry about atomic accesses. | |
157 | */ | |
158 | #define TS_USEDFPU 0x0001 /* FPU was used by this task this quantum (SMP) */ | |
159 | ||
160 | #define THREAD_SIZE 8192 //(2*PAGE_SIZE) | |
b69c49b7 | 161 | #define THREAD_SIZE_ORDER 1 |
9a8fd558 CZ |
162 | |
163 | #endif /* __KERNEL__ */ | |
164 | #endif /* _XTENSA_THREAD_INFO */ |