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
14 #include <linux/stringify.h>
15 #include <asm/kmem_layout.h>
17 #define CURRENT_SHIFT KERNEL_STACK_SHIFT
20 # include <asm/processor.h>
24 * low level task data that entry.S needs immediate access to
25 * - this struct should fit entirely inside of one cache line
26 * - this struct shares the supervisor stack pages
27 * - if the contents of this structure are changed, the assembly constants
28 * must also be changed
33 #if XTENSA_HAVE_COPROCESSORS
35 typedef struct xtregs_coprocessor {
44 } xtregs_coprocessor_t;
49 struct task_struct *task; /* main task structure */
50 unsigned long flags; /* low level flags */
51 unsigned long status; /* thread-synchronous flags */
52 __u32 cpu; /* current CPU */
53 __s32 preempt_count; /* 0 => preemptable,< 0 => BUG*/
55 #if XCHAL_HAVE_EXCLUSIVE
56 /* result of the most recent exclusive store */
57 unsigned long atomctl8;
59 #ifdef CONFIG_USER_ABI_CALL0_PROBE
60 /* Address where PS.WOE was enabled by the ABI probing code */
61 unsigned long ps_woe_fix_addr;
65 * If i-th bit is set then coprocessor state is loaded into the
66 * coprocessor i on CPU cp_owner_cpu.
68 unsigned long cpenable;
70 /* Allocate storage for extra user states and coprocessor states. */
71 #if XTENSA_HAVE_COPROCESSORS
72 xtregs_coprocessor_t xtregs_cp;
74 xtregs_user_t xtregs_user;
80 * macros/functions for gaining access to the thread information structure
85 #define INIT_THREAD_INFO(tsk) \
90 .preempt_count = INIT_PREEMPT_COUNT, \
93 /* how to get the thread information struct from C */
94 static inline struct thread_info *current_thread_info(void)
96 struct thread_info *ti;
97 __asm__("extui %0, a1, 0, "__stringify(CURRENT_SHIFT)"\n\t"
98 "xor %0, a1, %0" : "=&r" (ti) : );
102 #else /* !__ASSEMBLY__ */
104 /* how to get the thread information struct from ASM */
105 #define GET_THREAD_INFO(reg,sp) \
106 extui reg, sp, 0, CURRENT_SHIFT; \
112 * thread information flags
113 * - these are process state flags that various assembly files may need to access
115 #define TIF_SYSCALL_TRACE 0 /* syscall trace active */
116 #define TIF_SIGPENDING 1 /* signal pending */
117 #define TIF_NEED_RESCHED 2 /* rescheduling necessary */
118 #define TIF_SINGLESTEP 3 /* restore singlestep on return to user mode */
119 #define TIF_SYSCALL_TRACEPOINT 4 /* syscall tracepoint instrumentation */
120 #define TIF_NOTIFY_SIGNAL 5 /* signal notifications exist */
121 #define TIF_RESTORE_SIGMASK 6 /* restore signal mask in do_signal() */
122 #define TIF_NOTIFY_RESUME 7 /* callback before returning to user */
123 #define TIF_DB_DISABLED 8 /* debug trap disabled for syscall */
124 #define TIF_SYSCALL_AUDIT 9 /* syscall auditing active */
125 #define TIF_SECCOMP 10 /* secure computing */
126 #define TIF_MEMDIE 11 /* is terminating due to OOM killer */
128 #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
129 #define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
130 #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
131 #define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP)
132 #define _TIF_SYSCALL_TRACEPOINT (1<<TIF_SYSCALL_TRACEPOINT)
133 #define _TIF_NOTIFY_SIGNAL (1<<TIF_NOTIFY_SIGNAL)
134 #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
135 #define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
136 #define _TIF_SECCOMP (1<<TIF_SECCOMP)
138 #define _TIF_WORK_MASK (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP | \
139 _TIF_SYSCALL_TRACEPOINT | \
140 _TIF_SYSCALL_AUDIT | _TIF_SECCOMP)
142 #define THREAD_SIZE KERNEL_STACK_SIZE
143 #define THREAD_SIZE_ORDER (KERNEL_STACK_SHIFT - PAGE_SHIFT)
145 #endif /* _XTENSA_THREAD_INFO */