1 #ifndef _ASM_M68K_THREAD_INFO_H
2 #define _ASM_M68K_THREAD_INFO_H
3
4 #include <asm/types.h>
5 #include <asm/page.h>
6
7 /*
8 * On machines with 4k pages we default to an 8k thread size, though we
9 * allow a 4k with config option. Any other machine page size then
10 * the thread size must match the page size (which is 8k and larger here).
11 */
12 #if PAGE_SHIFT < 13
13 #ifdef CONFIG_4KSTACKS
14 #define THREAD_SIZE 4096
15 #else
16 #define THREAD_SIZE 8192
17 #endif
18 #else
19 #define THREAD_SIZE PAGE_SIZE
20 #endif
21 #define THREAD_SIZE_ORDER ((THREAD_SIZE / PAGE_SIZE) - 1)
22
23 #ifndef __ASSEMBLY__
24
25 struct thread_info {
26 struct task_struct *task; /* main task structure */
27 unsigned long flags;
28 struct exec_domain *exec_domain; /* execution domain */
29 int preempt_count; /* 0 => preemptable, <0 => BUG */
30 __u32 cpu; /* should always be 0 on m68k */
31 unsigned long tp_value; /* thread pointer */
32 struct restart_block restart_block;
33 };
34 #endif /* __ASSEMBLY__ */
35
36 #define PREEMPT_ACTIVE 0x4000000
37
38 #define INIT_THREAD_INFO(tsk) \
39 { \
40 .task = &tsk, \
41 .exec_domain = &default_exec_domain, \
42 .preempt_count = INIT_PREEMPT_COUNT, \
43 .restart_block = { \
44 .fn = do_no_restart_syscall, \
45 }, \
46 }
47
48 #define init_stack (init_thread_union.stack)
49
50 #ifdef CONFIG_MMU
51
52 #ifndef __ASSEMBLY__
53 #include <asm/current.h>
54 #endif
55
56 #ifdef ASM_OFFSETS_C
57 #define task_thread_info(tsk) ((struct thread_info *) NULL)
58 #else
59 #include <asm/asm-offsets.h>
60 #define task_thread_info(tsk) ((struct thread_info *)((char *)tsk+TASK_TINFO))
61 #endif
62
63 #define init_thread_info (init_task.thread.info)
64 #define task_stack_page(tsk) ((tsk)->stack)
65 #define current_thread_info() task_thread_info(current)
66
67 #define __HAVE_THREAD_FUNCTIONS
68
69 #define setup_thread_stack(p, org) ({ \
70 *(struct task_struct **)(p)->stack = (p); \
71 task_thread_info(p)->task = (p); \
72 })
73
74 #define end_of_stack(p) ((unsigned long *)(p)->stack + 1)
75
76 #else /* !CONFIG_MMU */
77
78 #ifndef __ASSEMBLY__
79 /* how to get the thread information struct from C */
current_thread_info(void)80 static inline struct thread_info *current_thread_info(void)
81 {
82 struct thread_info *ti;
83 __asm__(
84 "move.l %%sp, %0 \n\t"
85 "and.l %1, %0"
86 : "=&d"(ti)
87 : "di" (~(THREAD_SIZE-1))
88 );
89 return ti;
90 }
91 #endif
92
93 #define init_thread_info (init_thread_union.thread_info)
94
95 #endif /* CONFIG_MMU */
96
97 /* entry.S relies on these definitions!
98 * bits 0-7 are tested at every exception exit
99 * bits 8-15 are also tested at syscall exit
100 */
101 #define TIF_SIGPENDING 6 /* signal pending */
102 #define TIF_NEED_RESCHED 7 /* rescheduling necessary */
103 #define TIF_DELAYED_TRACE 14 /* single step a syscall */
104 #define TIF_SYSCALL_TRACE 15 /* syscall trace active */
105 #define TIF_MEMDIE 16 /* is terminating due to OOM killer */
106 #define TIF_FREEZE 17 /* thread is freezing for suspend */
107 #define TIF_RESTORE_SIGMASK 18 /* restore signal mask in do_signal */
108
109 #endif /* _ASM_M68K_THREAD_INFO_H */
110