aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorRoman Zippel <zippel@linux-m68k.org>2005-11-13 19:06:59 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-13 21:14:14 -0500
commit3b66a1edb01b82269a668a478625765b1fa4936f (patch)
tree417ead0264e34fdd1ec345a26d8670427be4829c /include
parentabd03753bd1532c05eb13231569a5257b007e29c (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')
-rw-r--r--include/asm-m68k/processor.h12
-rw-r--r--include/asm-m68k/thread_info.h81
-rw-r--r--include/linux/thread_info.h47
3 files changed, 22 insertions, 118 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
59struct 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
70struct thread_struct { 59struct 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
7struct thread_info { 7struct 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
59extern 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 */
diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h
index d252f45a0f9b..1c4eb41dbd89 100644
--- a/include/linux/thread_info.h
+++ b/include/linux/thread_info.h
@@ -27,31 +27,6 @@ extern long do_no_restart_syscall(struct restart_block *parm);
27 * - pass TIF_xxxx constants to these functions 27 * - pass TIF_xxxx constants to these functions
28 */ 28 */
29 29
30static inline void set_thread_flag(int flag)
31{
32 set_bit(flag,&current_thread_info()->flags);
33}
34
35static inline void clear_thread_flag(int flag)
36{
37 clear_bit(flag,&current_thread_info()->flags);
38}
39
40static inline int test_and_set_thread_flag(int flag)
41{
42 return test_and_set_bit(flag,&current_thread_info()->flags);
43}
44
45static inline int test_and_clear_thread_flag(int flag)
46{
47 return test_and_clear_bit(flag,&current_thread_info()->flags);
48}
49
50static inline int test_thread_flag(int flag)
51{
52 return test_bit(flag,&current_thread_info()->flags);
53}
54
55static inline void set_ti_thread_flag(struct thread_info *ti, int flag) 30static inline void set_ti_thread_flag(struct thread_info *ti, int flag)
56{ 31{
57 set_bit(flag,&ti->flags); 32 set_bit(flag,&ti->flags);
@@ -77,15 +52,19 @@ static inline int test_ti_thread_flag(struct thread_info *ti, int flag)
77 return test_bit(flag,&ti->flags); 52 return test_bit(flag,&ti->flags);
78} 53}
79 54
80static inline void set_need_resched(void) 55#define set_thread_flag(flag) \
81{ 56 set_ti_thread_flag(current_thread_info(), flag)
82 set_thread_flag(TIF_NEED_RESCHED); 57#define clear_thread_flag(flag) \
83} 58 clear_ti_thread_flag(current_thread_info(), flag)
84 59#define test_and_set_thread_flag(flag) \
85static inline void clear_need_resched(void) 60 test_and_set_ti_thread_flag(current_thread_info(), flag)
86{ 61#define test_and_clear_thread_flag(flag) \
87 clear_thread_flag(TIF_NEED_RESCHED); 62 test_and_clear_ti_thread_flag(current_thread_info(), flag)
88} 63#define test_thread_flag(flag) \
64 test_ti_thread_flag(current_thread_info(), flag)
65
66#define set_need_resched() set_thread_flag(TIF_NEED_RESCHED)
67#define clear_need_resched() clear_thread_flag(TIF_NEED_RESCHED)
89 68
90#endif 69#endif
91 70