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 #if XTENSA_HAVE_COPROCESSORS
32 typedef struct xtregs_coprocessor
{
41 } xtregs_coprocessor_t
;
46 struct task_struct
*task
; /* main task structure */
47 unsigned long flags
; /* low level flags */
48 unsigned long status
; /* thread-synchronous flags */
49 __u32 cpu
; /* current CPU */
50 __s32 preempt_count
; /* 0 => preemptable,< 0 => BUG*/
52 mm_segment_t addr_limit
; /* thread address space */
54 unsigned long cpenable
;
56 /* Allocate storage for extra user states and coprocessor states. */
57 #if XTENSA_HAVE_COPROCESSORS
58 xtregs_coprocessor_t xtregs_cp
;
60 xtregs_user_t xtregs_user
;
66 * macros/functions for gaining access to the thread information structure
71 #define INIT_THREAD_INFO(tsk) \
76 .preempt_count = INIT_PREEMPT_COUNT, \
77 .addr_limit = KERNEL_DS, \
80 #define init_thread_info (init_thread_union.thread_info)
81 #define init_stack (init_thread_union.stack)
83 /* how to get the thread information struct from C */
84 static inline struct thread_info
*current_thread_info(void)
86 struct thread_info
*ti
;
87 __asm__("extui %0,a1,0,13\n\t"
88 "xor %0, a1, %0" : "=&r" (ti
) : );
92 #else /* !__ASSEMBLY__ */
94 /* how to get the thread information struct from ASM */
95 #define GET_THREAD_INFO(reg,sp) \
96 extui reg, sp, 0, 13; \
102 * thread information flags
103 * - these are process state flags that various assembly files may need to access
104 * - pending work-to-be-done flags are in LSW
105 * - other flags in MSW
107 #define TIF_SYSCALL_TRACE 0 /* syscall trace active */
108 #define TIF_SIGPENDING 1 /* signal pending */
109 #define TIF_NEED_RESCHED 2 /* rescheduling necessary */
110 #define TIF_SINGLESTEP 3 /* restore singlestep on return to user mode */
111 #define TIF_MEMDIE 5 /* is terminating due to OOM killer */
112 #define TIF_RESTORE_SIGMASK 6 /* restore signal mask in do_signal() */
113 #define TIF_NOTIFY_RESUME 7 /* callback before returning to user */
115 #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
116 #define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
117 #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
118 #define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP)
120 #define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */
121 #define _TIF_ALLWORK_MASK 0x0000FFFF /* work to do on any return to u-space */
124 * Thread-synchronous status.
126 * This is different from the flags in that nobody else
127 * ever touches our thread-synchronous status, so we don't
128 * have to worry about atomic accesses.
130 #define TS_USEDFPU 0x0001 /* FPU was used by this task this quantum (SMP) */
132 #define THREAD_SIZE 8192 //(2*PAGE_SIZE)
133 #define THREAD_SIZE_ORDER 1
135 #endif /* __KERNEL__ */
136 #endif /* _XTENSA_THREAD_INFO */