2 * Copyright (C) 2006 Atmark Techno, Inc.
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
9 #ifndef _ASM_MICROBLAZE_THREAD_INFO_H
10 #define _ASM_MICROBLAZE_THREAD_INFO_H
14 /* we have 8k stack */
15 #define THREAD_SHIFT 13
16 #define THREAD_SIZE (1 << THREAD_SHIFT)
17 #define THREAD_SIZE_ORDER 1
20 # include <linux/types.h>
21 # include <asm/processor.h>
22 # include <asm/segment.h>
25 * low level task data that entry.S needs immediate access to
26 * - this struct should fit entirely inside of one cache line
27 * - this struct shares the supervisor stack pages
28 * - if the contents of this structure are changed, the assembly constants
29 * must also be changed
33 __u32 r1
; /* stack pointer */
35 /* dedicated registers */
42 /* non-volatile registers */
55 /* r31 is used as current task pointer */
56 /* special purpose registers */
64 struct task_struct
*task
; /* main task structure */
65 struct exec_domain
*exec_domain
; /* execution domain */
66 unsigned long flags
; /* low level flags */
67 unsigned long status
; /* thread-synchronous flags */
68 __u32 cpu
; /* current CPU */
69 __s32 preempt_count
; /* 0 => preemptable,< 0 => BUG*/
70 mm_segment_t addr_limit
; /* thread address space */
71 struct restart_block restart_block
;
73 struct cpu_context cpu_context
;
77 * macros/functions for gaining access to the thread information structure
79 #define INIT_THREAD_INFO(tsk) \
82 .exec_domain = &default_exec_domain, \
85 .preempt_count = INIT_PREEMPT_COUNT, \
86 .addr_limit = KERNEL_DS, \
88 .fn = do_no_restart_syscall, \
92 #define init_thread_info (init_thread_union.thread_info)
93 #define init_stack (init_thread_union.stack)
95 /* how to get the thread information struct from C */
96 static inline struct thread_info
*current_thread_info(void)
98 register unsigned long sp
asm("r1");
100 return (struct thread_info
*)(sp
& ~(THREAD_SIZE
-1));
103 /* thread information allocation */
104 #endif /* __ASSEMBLY__ */
106 #define PREEMPT_ACTIVE 0x10000000
109 * thread information flags
110 * - these are process state flags that various assembly files may
112 * - pending work-to-be-done flags are in LSW
113 * - other flags in MSW
115 #define TIF_SYSCALL_TRACE 0 /* syscall trace active */
116 #define TIF_NOTIFY_RESUME 1 /* resumption notification requested */
117 #define TIF_SIGPENDING 2 /* signal pending */
118 #define TIF_NEED_RESCHED 3 /* rescheduling necessary */
119 /* restore singlestep on return to user mode */
120 #define TIF_SINGLESTEP 4
121 #define TIF_IRET 5 /* return with iret */
123 #define TIF_SYSCALL_AUDIT 9 /* syscall auditing active */
124 #define TIF_SECCOMP 10 /* secure computing */
125 #define TIF_FREEZE 14 /* Freezing for suspend */
127 /* FIXME change in entry.S */
128 #define TIF_KERNEL_TRACE 8 /* kernel trace active */
130 /* true if poll_idle() is polling TIF_NEED_RESCHED */
131 #define TIF_POLLING_NRFLAG 16
133 #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
134 #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
135 #define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
136 #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
137 #define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP)
138 #define _TIF_IRET (1<<TIF_IRET)
139 #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
140 #define _TIF_FREEZE (1<<TIF_FREEZE)
141 #define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT)
142 #define _TIF_SECCOMP (1 << TIF_SECCOMP)
143 #define _TIF_KERNEL_TRACE (1 << TIF_KERNEL_TRACE)
145 /* work to do in syscall trace */
146 #define _TIF_WORK_SYSCALL_MASK (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP | \
147 _TIF_SYSCALL_AUDIT | _TIF_SECCOMP)
149 /* work to do on interrupt/exception return */
150 #define _TIF_WORK_MASK 0x0000FFFE
152 /* work to do on any return to u-space */
153 #define _TIF_ALLWORK_MASK 0x0000FFFF
156 * Thread-synchronous status.
158 * This is different from the flags in that nobody else
159 * ever touches our thread-synchronous status, so we don't
160 * have to worry about atomic accesses.
162 /* FPU was used by this task this quantum (SMP) */
163 #define TS_USEDFPU 0x0001
164 #define TS_RESTORE_SIGMASK 0x0002
167 #define HAVE_SET_RESTORE_SIGMASK 1
168 static inline void set_restore_sigmask(void)
170 struct thread_info
*ti
= current_thread_info();
171 ti
->status
|= TS_RESTORE_SIGMASK
;
172 set_bit(TIF_SIGPENDING
, (unsigned long *)&ti
->flags
);
176 #endif /* __KERNEL__ */
177 #endif /* _ASM_MICROBLAZE_THREAD_INFO_H */