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
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
11 #ifndef _XTENSA_THREAD_INFO_H
12 #define _XTENSA_THREAD_INFO_H
17 # include <asm/processor.h>
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
30 <<<<<<< HEAD
:include
/asm-xtensa
/thread_info
.h
32 #if XTENSA_HAVE_COPROCESSORS
34 typedef struct xtregs_coprocessor
{
43 } xtregs_coprocessor_t
;
47 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a
:include
/asm-xtensa
/thread_info
.h
49 struct task_struct
*task
; /* main task structure */
50 struct exec_domain
*exec_domain
; /* execution domain */
51 unsigned long flags
; /* low level flags */
52 unsigned long status
; /* thread-synchronous flags */
53 __u32 cpu
; /* current CPU */
54 __s32 preempt_count
; /* 0 => preemptable,< 0 => BUG*/
56 mm_segment_t addr_limit
; /* thread address space */
57 struct restart_block restart_block
;
59 <<<<<<< HEAD
:include
/asm-xtensa
/thread_info
.h
61 unsigned long cpenable
;
62 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a
:include
/asm-xtensa
/thread_info
.h
64 <<<<<<< HEAD
:include
/asm-xtensa
/thread_info
.h
66 /* Allocate storage for extra user states and coprocessor states. */
67 #if XTENSA_HAVE_COPROCESSORS
68 xtregs_coprocessor_t xtregs_cp
;
70 xtregs_user_t xtregs_user
;
71 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a
:include
/asm-xtensa
/thread_info
.h
74 #else /* !__ASSEMBLY__ */
76 /* offsets into the thread_info struct for assembly code access */
77 #define TI_TASK 0x00000000
78 #define TI_EXEC_DOMAIN 0x00000004
79 #define TI_FLAGS 0x00000008
80 #define TI_STATUS 0x0000000C
81 #define TI_CPU 0x00000010
82 #define TI_PRE_COUNT 0x00000014
83 #define TI_ADDR_LIMIT 0x00000018
84 #define TI_RESTART_BLOCK 0x000001C
88 #define PREEMPT_ACTIVE 0x10000000
91 * macros/functions for gaining access to the thread information structure
93 * preempt_count needs to be 1 initially, until the scheduler is functional.
98 #define INIT_THREAD_INFO(tsk) \
101 .exec_domain = &default_exec_domain, \
104 .preempt_count = 1, \
105 .addr_limit = KERNEL_DS, \
107 .fn = do_no_restart_syscall, \
111 #define init_thread_info (init_thread_union.thread_info)
112 #define init_stack (init_thread_union.stack)
114 /* how to get the thread information struct from C */
115 static inline struct thread_info
*current_thread_info(void)
117 struct thread_info
*ti
;
118 __asm__("extui %0,a1,0,13\n\t"
119 "xor %0, a1, %0" : "=&r" (ti
) : );
123 /* thread information allocation */
124 #define alloc_thread_info(tsk) ((struct thread_info *) __get_free_pages(GFP_KERNEL,1))
125 #define free_thread_info(ti) free_pages((unsigned long) (ti), 1)
127 #else /* !__ASSEMBLY__ */
129 /* how to get the thread information struct from ASM */
130 #define GET_THREAD_INFO(reg,sp) \
131 extui reg, sp, 0, 13; \
137 * thread information flags
138 * - these are process state flags that various assembly files may need to access
139 * - pending work-to-be-done flags are in LSW
140 * - other flags in MSW
142 #define TIF_SYSCALL_TRACE 0 /* syscall trace active */
143 #define TIF_SIGPENDING 1 /* signal pending */
144 #define TIF_NEED_RESCHED 2 /* rescheduling necessary */
145 #define TIF_SINGLESTEP 3 /* restore singlestep on return to user mode */
146 #define TIF_IRET 4 /* return with iret */
148 #define TIF_RESTORE_SIGMASK 6 /* restore signal mask in do_signal() */
149 #define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */
151 #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
152 #define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
153 #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
154 #define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP)
155 #define _TIF_IRET (1<<TIF_IRET)
156 #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
157 #define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
159 #define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */
160 #define _TIF_ALLWORK_MASK 0x0000FFFF /* work to do on any return to u-space */
163 * Thread-synchronous status.
165 * This is different from the flags in that nobody else
166 * ever touches our thread-synchronous status, so we don't
167 * have to worry about atomic accesses.
169 #define TS_USEDFPU 0x0001 /* FPU was used by this task this quantum (SMP) */
171 #define THREAD_SIZE 8192 //(2*PAGE_SIZE)
173 #endif /* __KERNEL__ */
174 #endif /* _XTENSA_THREAD_INFO */