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 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 45 struct thread_info { 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*/ 51 52 mm_segment_t addr_limit; /* thread address space */ 53 54 unsigned long cpenable; 55 56 /* Allocate storage for extra user states and coprocessor states. */ 57 #if XTENSA_HAVE_COPROCESSORS 58 xtregs_coprocessor_t xtregs_cp; 59 #endif 60 xtregs_user_t xtregs_user; 61 }; 62 63 #endif 64 65 /* 66 * macros/functions for gaining access to the thread information structure 67 */ 68 69 #ifndef __ASSEMBLY__ 70 71 #define INIT_THREAD_INFO(tsk) \ 72 { \ 73 .task = &tsk, \ 74 .flags = 0, \ 75 .cpu = 0, \ 76 .preempt_count = INIT_PREEMPT_COUNT, \ 77 .addr_limit = KERNEL_DS, \ 78 } 79 80 /* how to get the thread information struct from C */ 81 static inline struct thread_info *current_thread_info(void) 82 { 83 struct thread_info *ti; 84 __asm__("extui %0,a1,0,13\n\t" 85 "xor %0, a1, %0" : "=&r" (ti) : ); 86 return ti; 87 } 88 89 #else /* !__ASSEMBLY__ */ 90 91 /* how to get the thread information struct from ASM */ 92 #define GET_THREAD_INFO(reg,sp) \ 93 extui reg, sp, 0, 13; \ 94 xor reg, sp, reg 95 #endif 96 97 98 /* 99 * thread information flags 100 * - these are process state flags that various assembly files may need to access 101 * - pending work-to-be-done flags are in LSW 102 * - other flags in MSW 103 */ 104 #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ 105 #define TIF_SIGPENDING 1 /* signal pending */ 106 #define TIF_NEED_RESCHED 2 /* rescheduling necessary */ 107 #define TIF_SINGLESTEP 3 /* restore singlestep on return to user mode */ 108 #define TIF_MEMDIE 5 /* is terminating due to OOM killer */ 109 #define TIF_RESTORE_SIGMASK 6 /* restore signal mask in do_signal() */ 110 #define TIF_NOTIFY_RESUME 7 /* callback before returning to user */ 111 #define TIF_DB_DISABLED 8 /* debug trap disabled for syscall */ 112 113 #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) 114 #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) 115 #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) 116 #define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP) 117 118 #define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */ 119 #define _TIF_ALLWORK_MASK 0x0000FFFF /* work to do on any return to u-space */ 120 121 /* 122 * Thread-synchronous status. 123 * 124 * This is different from the flags in that nobody else 125 * ever touches our thread-synchronous status, so we don't 126 * have to worry about atomic accesses. 127 */ 128 #define TS_USEDFPU 0x0001 /* FPU was used by this task this quantum (SMP) */ 129 130 #define THREAD_SIZE 8192 //(2*PAGE_SIZE) 131 #define THREAD_SIZE_ORDER 1 132 133 #endif /* __KERNEL__ */ 134 #endif /* _XTENSA_THREAD_INFO */ 135