m68k: Make thread_info.h usable from assembly.
[linux-2.6.git] / arch / m68k / include / asm / thread_info_mm.h
1 #ifndef _ASM_M68K_THREAD_INFO_H
2 #define _ASM_M68K_THREAD_INFO_H
3
4 #ifndef ASM_OFFSETS_C
5 #include <asm/asm-offsets.h>
6 #endif
7 #include <asm/types.h>
8 #include <asm/page.h>
9
10 #ifndef __ASSEMBLY__
11 #include <asm/current.h>
12
13 struct thread_info {
14         struct task_struct      *task;          /* main task structure */
15         unsigned long           flags;
16         struct exec_domain      *exec_domain;   /* execution domain */
17         int                     preempt_count;  /* 0 => preemptable, <0 => BUG */
18         __u32 cpu; /* should always be 0 on m68k */
19         struct restart_block    restart_block;
20 };
21 #endif /* __ASSEMBLY__ */
22
23 #define PREEMPT_ACTIVE          0x4000000
24
25 #define INIT_THREAD_INFO(tsk)                   \
26 {                                               \
27         .task           = &tsk,                 \
28         .exec_domain    = &default_exec_domain, \
29         .preempt_count  = INIT_PREEMPT_COUNT,   \
30         .restart_block = {                      \
31                 .fn = do_no_restart_syscall,    \
32         },                                      \
33 }
34
35 /* THREAD_SIZE should be 8k, so handle differently for 4k and 8k machines */
36 #define THREAD_SIZE_ORDER (13 - PAGE_SHIFT)
37
38 #define init_thread_info        (init_task.thread.info)
39 #define init_stack              (init_thread_union.stack)
40
41 #ifdef ASM_OFFSETS_C
42 #define task_thread_info(tsk)   ((struct thread_info *) NULL)
43 #else
44 #define task_thread_info(tsk)   ((struct thread_info *)((char *)tsk+TASK_TINFO))
45 #endif
46
47 #define task_stack_page(tsk)    ((tsk)->stack)
48 #define current_thread_info()   task_thread_info(current)
49
50 #define __HAVE_THREAD_FUNCTIONS
51
52 #define setup_thread_stack(p, org) ({                   \
53         *(struct task_struct **)(p)->stack = (p);       \
54         task_thread_info(p)->task = (p);                \
55 })
56
57 #define end_of_stack(p) ((unsigned long *)(p)->stack + 1)
58
59 /* entry.S relies on these definitions!
60  * bits 0-7 are tested at every exception exit
61  * bits 8-15 are also tested at syscall exit
62  */
63 #define TIF_SIGPENDING          6       /* signal pending */
64 #define TIF_NEED_RESCHED        7       /* rescheduling necessary */
65 #define TIF_DELAYED_TRACE       14      /* single step a syscall */
66 #define TIF_SYSCALL_TRACE       15      /* syscall trace active */
67 #define TIF_MEMDIE              16
68 #define TIF_FREEZE              17      /* thread is freezing for suspend */
69
70 #endif  /* _ASM_M68K_THREAD_INFO_H */