Linux 4.18.10
[linux/fpc-iii.git] / arch / xtensa / include / asm / thread_info.h
blob2bd19ae61e476972e6adeccf706f94e626fc9c66
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 #include <asm/kmem_layout.h>
16 #define CURRENT_SHIFT KERNEL_STACK_SHIFT
18 #ifndef __ASSEMBLY__
19 # include <asm/processor.h>
20 #endif
23 * low level task data that entry.S needs immediate access to
24 * - this struct should fit entirely inside of one cache line
25 * - this struct shares the supervisor stack pages
26 * - if the contents of this structure are changed, the assembly constants
27 * must also be changed
30 #ifndef __ASSEMBLY__
32 #if XTENSA_HAVE_COPROCESSORS
34 typedef struct xtregs_coprocessor {
35 xtregs_cp0_t cp0;
36 xtregs_cp1_t cp1;
37 xtregs_cp2_t cp2;
38 xtregs_cp3_t cp3;
39 xtregs_cp4_t cp4;
40 xtregs_cp5_t cp5;
41 xtregs_cp6_t cp6;
42 xtregs_cp7_t cp7;
43 } xtregs_coprocessor_t;
45 #endif
47 struct thread_info {
48 struct task_struct *task; /* main task structure */
49 unsigned long flags; /* low level flags */
50 unsigned long status; /* thread-synchronous flags */
51 __u32 cpu; /* current CPU */
52 __s32 preempt_count; /* 0 => preemptable,< 0 => BUG*/
54 mm_segment_t addr_limit; /* thread address space */
56 unsigned long cpenable;
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;
65 #endif
68 * macros/functions for gaining access to the thread information structure
71 #ifndef __ASSEMBLY__
73 #define INIT_THREAD_INFO(tsk) \
74 { \
75 .task = &tsk, \
76 .flags = 0, \
77 .cpu = 0, \
78 .preempt_count = INIT_PREEMPT_COUNT, \
79 .addr_limit = KERNEL_DS, \
82 /* how to get the thread information struct from C */
83 static inline struct thread_info *current_thread_info(void)
85 struct thread_info *ti;
86 __asm__("extui %0, a1, 0, "__stringify(CURRENT_SHIFT)"\n\t"
87 "xor %0, a1, %0" : "=&r" (ti) : );
88 return ti;
91 #else /* !__ASSEMBLY__ */
93 /* how to get the thread information struct from ASM */
94 #define GET_THREAD_INFO(reg,sp) \
95 extui reg, sp, 0, CURRENT_SHIFT; \
96 xor reg, sp, reg
97 #endif
101 * thread information flags
102 * - these are process state flags that various assembly files may need to access
103 * - pending work-to-be-done flags are in LSW
104 * - other flags in MSW
106 #define TIF_SYSCALL_TRACE 0 /* syscall trace active */
107 #define TIF_SIGPENDING 1 /* signal pending */
108 #define TIF_NEED_RESCHED 2 /* rescheduling necessary */
109 #define TIF_SINGLESTEP 3 /* restore singlestep on return to user mode */
110 #define TIF_MEMDIE 5 /* is terminating due to OOM killer */
111 #define TIF_RESTORE_SIGMASK 6 /* restore signal mask in do_signal() */
112 #define TIF_NOTIFY_RESUME 7 /* callback before returning to user */
113 #define TIF_DB_DISABLED 8 /* debug trap disabled for syscall */
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 KERNEL_STACK_SIZE
133 #define THREAD_SIZE_ORDER (KERNEL_STACK_SHIFT - PAGE_SHIFT)
135 #endif /* _XTENSA_THREAD_INFO */