2 * Copyright 2004-2009 Analog Devices Inc.
4 * Licensed under the GPL-2 or later.
7 #ifndef _ASM_THREAD_INFO_H
8 #define _ASM_THREAD_INFO_H
11 #include <asm/entry.h>
12 #include <asm/l1layout.h>
13 #include <linux/compiler.h>
17 /* Thread Align Mask to reach to the top of the stack
20 #define ALIGN_PAGE_MASK 0xffffe000
23 * Size of kernel stack for each process. This must be a power of 2...
25 #define THREAD_SIZE_ORDER 1
26 #define THREAD_SIZE 8192 /* 2 pages */
27 #define STACK_WARN (THREAD_SIZE/8)
31 typedef unsigned long mm_segment_t;
34 * low level task data.
35 * If you change this, change the TI_* offsets below to match.
39 struct task_struct *task; /* main task structure */
40 struct exec_domain *exec_domain; /* execution domain */
41 unsigned long flags; /* low level flags */
42 int cpu; /* cpu we're on */
43 int preempt_count; /* 0 => preemptable, <0 => BUG */
44 mm_segment_t addr_limit; /* address limit */
45 struct restart_block restart_block;
47 struct l1_scratch_task_info l1_task_info;
52 * macros/functions for gaining access to the thread information structure
54 #define INIT_THREAD_INFO(tsk) \
57 .exec_domain = &default_exec_domain, \
60 .preempt_count = INIT_PREEMPT_COUNT, \
62 .fn = do_no_restart_syscall, \
65 #define init_thread_info (init_thread_union.thread_info)
66 #define init_stack (init_thread_union.stack)
68 /* Given a task stack pointer, you can find its corresponding
69 * thread_info structure just by masking it to the THREAD_SIZE
70 * boundary (currently 8K as you can see above).
73 static inline struct thread_info *current_thread_info(void)
75 struct thread_info *ti;
76 __asm__("%0 = sp;" : "=da"(ti) :
78 return (struct thread_info *)((long)ti & ~((long)THREAD_SIZE-1));
81 #endif /* __ASSEMBLY__ */
84 * Offsets in thread_info structure, used in assembly code
87 #define TI_EXECDOMAIN 4
92 #define PREEMPT_ACTIVE 0x4000000
95 * thread information flag bit numbers
97 #define TIF_SYSCALL_TRACE 0 /* syscall trace active */
98 #define TIF_SIGPENDING 1 /* signal pending */
99 #define TIF_NEED_RESCHED 2 /* rescheduling necessary */
100 #define TIF_POLLING_NRFLAG 3 /* true if poll_idle() is polling
103 #define TIF_RESTORE_SIGMASK 5 /* restore signal mask in do_signal() */
104 #define TIF_FREEZE 6 /* is freezing for suspend */
105 #define TIF_IRQ_SYNC 7 /* sync pipeline stage */
107 /* as above, but as bit values */
108 #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
109 #define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
110 #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
111 #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
112 #define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
113 #define _TIF_FREEZE (1<<TIF_FREEZE)
114 #define _TIF_IRQ_SYNC (1<<TIF_IRQ_SYNC)
116 #define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */
118 #endif /* __KERNEL__ */
120 #endif /* _ASM_THREAD_INFO_H */