MOXA linux-2.6.x / linux-2.6.9-uc0 from sdlinux-moxaart.tgz
[linux-2.6.9-moxart.git] / include / asm-m68k / thread_info.h
blob6a4367e3504e1f8688a748abc3e30c174ff0cbdb
1 #ifndef _ASM_M68K_THREAD_INFO_H
2 #define _ASM_M68K_THREAD_INFO_H
4 #include <asm/types.h>
5 #include <asm/processor.h>
6 #include <asm/page.h>
8 struct thread_info {
9 struct task_struct *task; /* main task structure */
10 struct exec_domain *exec_domain; /* execution domain */
11 __s32 preempt_count; /* 0 => preemptable, <0 => BUG */
12 __u32 cpu; /* should always be 0 on m68k */
13 struct restart_block restart_block;
15 __u8 supervisor_stack[0];
18 #define PREEMPT_ACTIVE 0x4000000
20 #define INIT_THREAD_INFO(tsk) \
21 { \
22 .task = &tsk, \
23 .exec_domain = &default_exec_domain, \
24 .restart_block = { \
25 .fn = do_no_restart_syscall, \
26 }, \
29 /* THREAD_SIZE should be 8k, so handle differently for 4k and 8k machines */
30 #if PAGE_SHIFT == 13 /* 8k machines */
31 #define alloc_thread_info(tsk) ((struct thread_info *)__get_free_pages(GFP_KERNEL,0))
32 #define free_thread_info(ti) free_pages((unsigned long)(ti),0)
33 #else /* otherwise assume 4k pages */
34 #define alloc_thread_info(tsk) ((struct thread_info *)__get_free_pages(GFP_KERNEL,1))
35 #define free_thread_info(ti) free_pages((unsigned long)(ti),1)
36 #endif /* PAGE_SHIFT == 13 */
38 //#define init_thread_info (init_task.thread.info)
39 #define init_stack (init_thread_union.stack)
41 #define current_thread_info() (current->thread_info)
44 #define __HAVE_THREAD_FUNCTIONS
46 #define TIF_SYSCALL_TRACE 0 /* syscall trace active */
47 #define TIF_DELAYED_TRACE 1 /* single step a syscall */
48 #define TIF_NOTIFY_RESUME 2 /* resumption notification requested */
49 #define TIF_SIGPENDING 3 /* signal pending */
50 #define TIF_NEED_RESCHED 4 /* rescheduling necessary */
52 extern int thread_flag_fixme(void);
55 * flag set/clear/test wrappers
56 * - pass TIF_xxxx constants to these functions
59 #define __set_tsk_thread_flag(tsk, flag, val) ({ \
60 switch (flag) { \
61 case TIF_SIGPENDING: \
62 tsk->thread.work.sigpending = val; \
63 break; \
64 case TIF_NEED_RESCHED: \
65 tsk->thread.work.need_resched = val; \
66 break; \
67 case TIF_SYSCALL_TRACE: \
68 tsk->thread.work.syscall_trace = val; \
69 break; \
70 default: \
71 thread_flag_fixme(); \
72 } \
75 #define __get_tsk_thread_flag(tsk, flag) ({ \
76 int ___res; \
77 switch (flag) { \
78 case TIF_SIGPENDING: \
79 ___res = tsk->thread.work.sigpending; \
80 break; \
81 case TIF_NEED_RESCHED: \
82 ___res = tsk->thread.work.need_resched; \
83 break; \
84 case TIF_SYSCALL_TRACE: \
85 ___res = tsk->thread.work.syscall_trace;\
86 break; \
87 default: \
88 ___res = thread_flag_fixme(); \
89 } \
90 ___res; \
93 #define __get_set_tsk_thread_flag(tsk, flag, val) ({ \
94 int __res = __get_tsk_thread_flag(tsk, flag); \
95 __set_tsk_thread_flag(tsk, flag, val); \
96 __res; \
99 #define set_tsk_thread_flag(tsk, flag) __set_tsk_thread_flag(tsk, flag, ~0)
100 #define clear_tsk_thread_flag(tsk, flag) __set_tsk_thread_flag(tsk, flag, 0)
101 #define test_and_set_tsk_thread_flag(tsk, flag) __get_set_tsk_thread_flag(tsk, flag, ~0)
102 #define test_tsk_thread_flag(tsk, flag) __get_tsk_thread_flag(tsk, flag)
104 #define set_thread_flag(flag) set_tsk_thread_flag(current, flag)
105 #define clear_thread_flag(flag) clear_tsk_thread_flag(current, flag)
106 #define test_thread_flag(flag) test_tsk_thread_flag(current, flag)
108 #define set_need_resched() set_thread_flag(TIF_NEED_RESCHED)
109 #define clear_need_resched() clear_thread_flag(TIF_NEED_RESCHED)
111 #endif /* _ASM_M68K_THREAD_INFO_H */