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 #include <asm/segment.h>
7 
8 /*
9  * On machines with 4k pages we default to an 8k thread size, though we
10  * allow a 4k with config option. Any other machine page size then
11  * the thread size must match the page size (which is 8k and larger here).
12  */
13 #if PAGE_SHIFT < 13
14 #ifdef CONFIG_4KSTACKS
15 #define THREAD_SIZE	4096
16 #else
17 #define THREAD_SIZE	8192
18 #endif
19 #else
20 #define THREAD_SIZE	PAGE_SIZE
21 #endif
22 #define THREAD_SIZE_ORDER	((THREAD_SIZE / PAGE_SIZE) - 1)
23 
24 #ifndef __ASSEMBLY__
25 
26 struct thread_info {
27 	struct task_struct	*task;		/* main task structure */
28 	unsigned long		flags;
29 	struct exec_domain	*exec_domain;	/* execution domain */
30 	mm_segment_t		addr_limit;	/* thread address space */
31 	int			preempt_count;	/* 0 => preemptable, <0 => BUG */
32 	__u32			cpu;		/* should always be 0 on m68k */
33 	unsigned long		tp_value;	/* thread pointer */
34 	struct restart_block    restart_block;
35 };
36 #endif /* __ASSEMBLY__ */
37 
38 #define PREEMPT_ACTIVE		0x4000000
39 
40 #define INIT_THREAD_INFO(tsk)			\
41 {						\
42 	.task		= &tsk,			\
43 	.exec_domain	= &default_exec_domain,	\
44 	.addr_limit	= KERNEL_DS,		\
45 	.preempt_count	= INIT_PREEMPT_COUNT,	\
46 	.restart_block = {			\
47 		.fn = do_no_restart_syscall,	\
48 	},					\
49 }
50 
51 #define init_stack		(init_thread_union.stack)
52 
53 #ifndef __ASSEMBLY__
54 /* how to get the thread information struct from C */
55 static inline struct thread_info *current_thread_info(void)
56 {
57 	struct thread_info *ti;
58 	__asm__(
59 		"move.l %%sp, %0 \n\t"
60 		"and.l  %1, %0"
61 		: "=&d"(ti)
62 		: "di" (~(THREAD_SIZE-1))
63 		);
64 	return ti;
65 }
66 #endif
67 
68 #define init_thread_info	(init_thread_union.thread_info)
69 
70 /* entry.S relies on these definitions!
71  * bits 0-7 are tested at every exception exit
72  * bits 8-15 are also tested at syscall exit
73  */
74 #define TIF_NOTIFY_RESUME	5	/* callback before returning to user */
75 #define TIF_SIGPENDING		6	/* signal pending */
76 #define TIF_NEED_RESCHED	7	/* rescheduling necessary */
77 #define TIF_DELAYED_TRACE	14	/* single step a syscall */
78 #define TIF_SYSCALL_TRACE	15	/* syscall trace active */
79 #define TIF_MEMDIE		16	/* is terminating due to OOM killer */
80 #define TIF_RESTORE_SIGMASK	18	/* restore signal mask in do_signal */
81 
82 #endif	/* _ASM_M68K_THREAD_INFO_H */
83