diff options
author | Roman Zippel <zippel@linux-m68k.org> | 2005-11-13 19:06:59 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-13 21:14:14 -0500 |
commit | 3b66a1edb01b82269a668a478625765b1fa4936f (patch) | |
tree | 417ead0264e34fdd1ec345a26d8670427be4829c /include/asm-m68k | |
parent | abd03753bd1532c05eb13231569a5257b007e29c (diff) |
[PATCH] m68k: convert thread flags to use bit fields
Remove task_work structure, use the standard thread flags functions and use
shifts in entry.S to test the thread flags. Add a few local labels to entry.S
to allow gas to generate short jumps.
Finally it changes a number of inline functions in thread_info.h to macros to
delay the current_thread_info() usage, which requires on m68k a structure
(task_struct) not yet defined at this point.
Signed-off-by: Roman Zippel <zippel@linux-m68k.org>
Cc: Al Viro <viro@parcelfarce.linux.theplanet.co.uk>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/asm-m68k')
-rw-r--r-- | include/asm-m68k/processor.h | 12 | ||||
-rw-r--r-- | include/asm-m68k/thread_info.h | 81 |
2 files changed, 9 insertions, 84 deletions
diff --git a/include/asm-m68k/processor.h b/include/asm-m68k/processor.h index 84b4b26df04c..7982285e84ed 100644 --- a/include/asm-m68k/processor.h +++ b/include/asm-m68k/processor.h | |||
@@ -56,17 +56,6 @@ static inline void wrusp(unsigned long usp) | |||
56 | #endif | 56 | #endif |
57 | #define TASK_UNMAPPED_ALIGN(addr, off) PAGE_ALIGN(addr) | 57 | #define TASK_UNMAPPED_ALIGN(addr, off) PAGE_ALIGN(addr) |
58 | 58 | ||
59 | struct task_work { | ||
60 | unsigned char sigpending; | ||
61 | unsigned char notify_resume; /* request for notification on | ||
62 | userspace execution resumption */ | ||
63 | char need_resched; | ||
64 | unsigned char delayed_trace; /* single step a syscall */ | ||
65 | unsigned char syscall_trace; /* count of syscall interceptors */ | ||
66 | unsigned char memdie; /* task was selected to be killed */ | ||
67 | unsigned char pad[2]; | ||
68 | }; | ||
69 | |||
70 | struct thread_struct { | 59 | struct thread_struct { |
71 | unsigned long ksp; /* kernel stack pointer */ | 60 | unsigned long ksp; /* kernel stack pointer */ |
72 | unsigned long usp; /* user stack pointer */ | 61 | unsigned long usp; /* user stack pointer */ |
@@ -79,7 +68,6 @@ struct thread_struct { | |||
79 | unsigned long fp[8*3]; | 68 | unsigned long fp[8*3]; |
80 | unsigned long fpcntl[3]; /* fp control regs */ | 69 | unsigned long fpcntl[3]; /* fp control regs */ |
81 | unsigned char fpstate[FPSTATESIZE]; /* floating point state */ | 70 | unsigned char fpstate[FPSTATESIZE]; /* floating point state */ |
82 | struct task_work work; | ||
83 | struct thread_info info; | 71 | struct thread_info info; |
84 | }; | 72 | }; |
85 | 73 | ||
diff --git a/include/asm-m68k/thread_info.h b/include/asm-m68k/thread_info.h index 4fdbf55f95e5..9532ca3c45cb 100644 --- a/include/asm-m68k/thread_info.h +++ b/include/asm-m68k/thread_info.h | |||
@@ -6,12 +6,11 @@ | |||
6 | 6 | ||
7 | struct thread_info { | 7 | struct thread_info { |
8 | struct task_struct *task; /* main task structure */ | 8 | struct task_struct *task; /* main task structure */ |
9 | unsigned long flags; | ||
9 | struct exec_domain *exec_domain; /* execution domain */ | 10 | struct exec_domain *exec_domain; /* execution domain */ |
10 | int preempt_count; /* 0 => preemptable, <0 => BUG */ | 11 | int preempt_count; /* 0 => preemptable, <0 => BUG */ |
11 | __u32 cpu; /* should always be 0 on m68k */ | 12 | __u32 cpu; /* should always be 0 on m68k */ |
12 | struct restart_block restart_block; | 13 | struct restart_block restart_block; |
13 | |||
14 | __u8 supervisor_stack[0]; | ||
15 | }; | 14 | }; |
16 | 15 | ||
17 | #define PREEMPT_ACTIVE 0x4000000 | 16 | #define PREEMPT_ACTIVE 0x4000000 |
@@ -49,76 +48,14 @@ struct thread_info { | |||
49 | 48 | ||
50 | #define end_of_stack(p) ((unsigned long *)(p)->thread_info + 1) | 49 | #define end_of_stack(p) ((unsigned long *)(p)->thread_info + 1) |
51 | 50 | ||
52 | #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ | 51 | /* entry.S relies on these definitions! |
53 | #define TIF_DELAYED_TRACE 1 /* single step a syscall */ | 52 | * bits 0-7 are tested at every exception exit |
54 | #define TIF_NOTIFY_RESUME 2 /* resumption notification requested */ | 53 | * bits 8-15 are also tested at syscall exit |
55 | #define TIF_SIGPENDING 3 /* signal pending */ | ||
56 | #define TIF_NEED_RESCHED 4 /* rescheduling necessary */ | ||
57 | #define TIF_MEMDIE 5 | ||
58 | |||
59 | extern int thread_flag_fixme(void); | ||
60 | |||
61 | /* | ||
62 | * flag set/clear/test wrappers | ||
63 | * - pass TIF_xxxx constants to these functions | ||
64 | */ | 54 | */ |
65 | 55 | #define TIF_SIGPENDING 6 /* signal pending */ | |
66 | #define __set_tsk_thread_flag(tsk, flag, val) ({ \ | 56 | #define TIF_NEED_RESCHED 7 /* rescheduling necessary */ |
67 | switch (flag) { \ | 57 | #define TIF_DELAYED_TRACE 14 /* single step a syscall */ |
68 | case TIF_SIGPENDING: \ | 58 | #define TIF_SYSCALL_TRACE 15 /* syscall trace active */ |
69 | tsk->thread.work.sigpending = val; \ | 59 | #define TIF_MEMDIE 16 |
70 | break; \ | ||
71 | case TIF_NEED_RESCHED: \ | ||
72 | tsk->thread.work.need_resched = val; \ | ||
73 | break; \ | ||
74 | case TIF_SYSCALL_TRACE: \ | ||
75 | tsk->thread.work.syscall_trace = val; \ | ||
76 | break; \ | ||
77 | case TIF_MEMDIE: \ | ||
78 | tsk->thread.work.memdie = val; \ | ||
79 | break; \ | ||
80 | default: \ | ||
81 | thread_flag_fixme(); \ | ||
82 | } \ | ||
83 | }) | ||
84 | |||
85 | #define __get_tsk_thread_flag(tsk, flag) ({ \ | ||
86 | int ___res; \ | ||
87 | switch (flag) { \ | ||
88 | case TIF_SIGPENDING: \ | ||
89 | ___res = tsk->thread.work.sigpending; \ | ||
90 | break; \ | ||
91 | case TIF_NEED_RESCHED: \ | ||
92 | ___res = tsk->thread.work.need_resched; \ | ||
93 | break; \ | ||
94 | case TIF_SYSCALL_TRACE: \ | ||
95 | ___res = tsk->thread.work.syscall_trace;\ | ||
96 | break; \ | ||
97 | case TIF_MEMDIE: \ | ||
98 | ___res = tsk->thread.work.memdie;\ | ||
99 | break; \ | ||
100 | default: \ | ||
101 | ___res = thread_flag_fixme(); \ | ||
102 | } \ | ||
103 | ___res; \ | ||
104 | }) | ||
105 | |||
106 | #define __get_set_tsk_thread_flag(tsk, flag, val) ({ \ | ||
107 | int __res = __get_tsk_thread_flag(tsk, flag); \ | ||
108 | __set_tsk_thread_flag(tsk, flag, val); \ | ||
109 | __res; \ | ||
110 | }) | ||
111 | |||
112 | #define set_tsk_thread_flag(tsk, flag) __set_tsk_thread_flag(tsk, flag, ~0) | ||
113 | #define clear_tsk_thread_flag(tsk, flag) __set_tsk_thread_flag(tsk, flag, 0) | ||
114 | #define test_and_set_tsk_thread_flag(tsk, flag) __get_set_tsk_thread_flag(tsk, flag, ~0) | ||
115 | #define test_tsk_thread_flag(tsk, flag) __get_tsk_thread_flag(tsk, flag) | ||
116 | |||
117 | #define set_thread_flag(flag) set_tsk_thread_flag(current, flag) | ||
118 | #define clear_thread_flag(flag) clear_tsk_thread_flag(current, flag) | ||
119 | #define test_thread_flag(flag) test_tsk_thread_flag(current, flag) | ||
120 | |||
121 | #define set_need_resched() set_thread_flag(TIF_NEED_RESCHED) | ||
122 | #define clear_need_resched() clear_thread_flag(TIF_NEED_RESCHED) | ||
123 | 60 | ||
124 | #endif /* _ASM_M68K_THREAD_INFO_H */ | 61 | #endif /* _ASM_M68K_THREAD_INFO_H */ |