diff options
author | Greg Ungerer <gerg@uclinux.org> | 2011-09-02 00:29:34 -0400 |
---|---|---|
committer | Greg Ungerer <gerg@uclinux.org> | 2011-12-24 06:47:56 -0500 |
commit | d25ba98afce7c87afa39f553a3ff8effed87db03 (patch) | |
tree | e7158225d753e7dad7b885116672b4485fb3809e /arch/m68k/kernel | |
parent | 8d362b0dea1a35bea8d7d281317eb7ccb713edcb (diff) |
m68k: remove thread_info struct from thread struct
Currently on m68k we have a comeplete thread_info structure stored inside
of the thread_struct, and we also have it in the initial part of the kernel
stack. Mostly the code currently uses the one inside of the thread_struct,
only using the "task" pointer from the stack based one.
This is wasteful and confusing, we should only have the single instance of
thread_info inside the stack page. And this is the norm for all other
architectures.
This change makes m68k handle thread_info consistently on both MMU enabled
and non-MMU setups.
Signed-off-by: Greg Ungerer <gerg@uclinux.org>
Diffstat (limited to 'arch/m68k/kernel')
-rw-r--r-- | arch/m68k/kernel/asm-offsets.c | 2 | ||||
-rw-r--r-- | arch/m68k/kernel/entry_mm.S | 31 |
2 files changed, 22 insertions, 11 deletions
diff --git a/arch/m68k/kernel/asm-offsets.c b/arch/m68k/kernel/asm-offsets.c index f6a54e203e8e..a972b00cd77d 100644 --- a/arch/m68k/kernel/asm-offsets.c +++ b/arch/m68k/kernel/asm-offsets.c | |||
@@ -24,7 +24,7 @@ int main(void) | |||
24 | /* offsets into the task struct */ | 24 | /* offsets into the task struct */ |
25 | DEFINE(TASK_THREAD, offsetof(struct task_struct, thread)); | 25 | DEFINE(TASK_THREAD, offsetof(struct task_struct, thread)); |
26 | DEFINE(TASK_MM, offsetof(struct task_struct, mm)); | 26 | DEFINE(TASK_MM, offsetof(struct task_struct, mm)); |
27 | DEFINE(TASK_INFO, offsetof(struct task_struct, thread.info)); | 27 | DEFINE(TASK_STACK, offsetof(struct task_struct, stack)); |
28 | 28 | ||
29 | /* offsets into the thread struct */ | 29 | /* offsets into the thread struct */ |
30 | DEFINE(THREAD_KSP, offsetof(struct thread_struct, ksp)); | 30 | DEFINE(THREAD_KSP, offsetof(struct thread_struct, ksp)); |
diff --git a/arch/m68k/kernel/entry_mm.S b/arch/m68k/kernel/entry_mm.S index c713f514843d..675a854966a6 100644 --- a/arch/m68k/kernel/entry_mm.S +++ b/arch/m68k/kernel/entry_mm.S | |||
@@ -99,7 +99,8 @@ do_trace_exit: | |||
99 | jra .Lret_from_exception | 99 | jra .Lret_from_exception |
100 | 100 | ||
101 | ENTRY(ret_from_signal) | 101 | ENTRY(ret_from_signal) |
102 | tstb %curptr@(TASK_INFO+TINFO_FLAGS+2) | 102 | movel %curptr@(TASK_STACK),%a1 |
103 | tstb %a1@(TINFO_FLAGS+2) | ||
103 | jge 1f | 104 | jge 1f |
104 | jbsr syscall_trace | 105 | jbsr syscall_trace |
105 | 1: RESTORE_SWITCH_STACK | 106 | 1: RESTORE_SWITCH_STACK |
@@ -120,11 +121,13 @@ ENTRY(system_call) | |||
120 | SAVE_ALL_SYS | 121 | SAVE_ALL_SYS |
121 | 122 | ||
122 | GET_CURRENT(%d1) | 123 | GET_CURRENT(%d1) |
124 | movel %d1,%a1 | ||
125 | |||
123 | | save top of frame | 126 | | save top of frame |
124 | movel %sp,%curptr@(TASK_THREAD+THREAD_ESP0) | 127 | movel %sp,%curptr@(TASK_THREAD+THREAD_ESP0) |
125 | 128 | ||
126 | | syscall trace? | 129 | | syscall trace? |
127 | tstb %curptr@(TASK_INFO+TINFO_FLAGS+2) | 130 | tstb %a1@(TINFO_FLAGS+2) |
128 | jmi do_trace_entry | 131 | jmi do_trace_entry |
129 | cmpl #NR_syscalls,%d0 | 132 | cmpl #NR_syscalls,%d0 |
130 | jcc badsys | 133 | jcc badsys |
@@ -133,7 +136,8 @@ syscall: | |||
133 | movel %d0,%sp@(PT_OFF_D0) | save the return value | 136 | movel %d0,%sp@(PT_OFF_D0) | save the return value |
134 | ret_from_syscall: | 137 | ret_from_syscall: |
135 | |oriw #0x0700,%sr | 138 | |oriw #0x0700,%sr |
136 | movew %curptr@(TASK_INFO+TINFO_FLAGS+2),%d0 | 139 | movel %curptr@(TASK_STACK),%a1 |
140 | movew %a1@(TINFO_FLAGS+2),%d0 | ||
137 | jne syscall_exit_work | 141 | jne syscall_exit_work |
138 | 1: RESTORE_ALL | 142 | 1: RESTORE_ALL |
139 | 143 | ||
@@ -159,7 +163,8 @@ ENTRY(ret_from_exception) | |||
159 | andw #ALLOWINT,%sr | 163 | andw #ALLOWINT,%sr |
160 | 164 | ||
161 | resume_userspace: | 165 | resume_userspace: |
162 | moveb %curptr@(TASK_INFO+TINFO_FLAGS+3),%d0 | 166 | movel %curptr@(TASK_STACK),%a1 |
167 | moveb %a1@(TINFO_FLAGS+3),%d0 | ||
163 | jne exit_work | 168 | jne exit_work |
164 | 1: RESTORE_ALL | 169 | 1: RESTORE_ALL |
165 | 170 | ||
@@ -199,7 +204,8 @@ do_delayed_trace: | |||
199 | ENTRY(auto_inthandler) | 204 | ENTRY(auto_inthandler) |
200 | SAVE_ALL_INT | 205 | SAVE_ALL_INT |
201 | GET_CURRENT(%d0) | 206 | GET_CURRENT(%d0) |
202 | addqb #1,%curptr@(TASK_INFO+TINFO_PREEMPT+1) | 207 | movel %d0,%a1 |
208 | addqb #1,%a1@(TINFO_PREEMPT+1) | ||
203 | | put exception # in d0 | 209 | | put exception # in d0 |
204 | bfextu %sp@(PT_OFF_FORMATVEC){#4,#10},%d0 | 210 | bfextu %sp@(PT_OFF_FORMATVEC){#4,#10},%d0 |
205 | subw #VEC_SPUR,%d0 | 211 | subw #VEC_SPUR,%d0 |
@@ -211,7 +217,8 @@ auto_irqhandler_fixup = . + 2 | |||
211 | addql #8,%sp | pop parameters off stack | 217 | addql #8,%sp | pop parameters off stack |
212 | 218 | ||
213 | ret_from_interrupt: | 219 | ret_from_interrupt: |
214 | subqb #1,%curptr@(TASK_INFO+TINFO_PREEMPT+1) | 220 | movel %curptr@(TASK_STACK),%a1 |
221 | subqb #1,%a1@(TINFO_PREEMPT+1) | ||
215 | jeq ret_from_last_interrupt | 222 | jeq ret_from_last_interrupt |
216 | 2: RESTORE_ALL | 223 | 2: RESTORE_ALL |
217 | 224 | ||
@@ -232,7 +239,8 @@ ret_from_last_interrupt: | |||
232 | ENTRY(user_inthandler) | 239 | ENTRY(user_inthandler) |
233 | SAVE_ALL_INT | 240 | SAVE_ALL_INT |
234 | GET_CURRENT(%d0) | 241 | GET_CURRENT(%d0) |
235 | addqb #1,%curptr@(TASK_INFO+TINFO_PREEMPT+1) | 242 | movel %d0,%a1 |
243 | addqb #1,%a1@(TINFO_PREEMPT+1) | ||
236 | | put exception # in d0 | 244 | | put exception # in d0 |
237 | bfextu %sp@(PT_OFF_FORMATVEC){#4,#10},%d0 | 245 | bfextu %sp@(PT_OFF_FORMATVEC){#4,#10},%d0 |
238 | user_irqvec_fixup = . + 2 | 246 | user_irqvec_fixup = . + 2 |
@@ -243,7 +251,8 @@ user_irqvec_fixup = . + 2 | |||
243 | jsr do_IRQ | process the IRQ | 251 | jsr do_IRQ | process the IRQ |
244 | addql #8,%sp | pop parameters off stack | 252 | addql #8,%sp | pop parameters off stack |
245 | 253 | ||
246 | subqb #1,%curptr@(TASK_INFO+TINFO_PREEMPT+1) | 254 | movel %curptr@(TASK_STACK),%a1 |
255 | subqb #1,%a1@(TINFO_PREEMPT+1) | ||
247 | jeq ret_from_last_interrupt | 256 | jeq ret_from_last_interrupt |
248 | RESTORE_ALL | 257 | RESTORE_ALL |
249 | 258 | ||
@@ -252,13 +261,15 @@ user_irqvec_fixup = . + 2 | |||
252 | ENTRY(bad_inthandler) | 261 | ENTRY(bad_inthandler) |
253 | SAVE_ALL_INT | 262 | SAVE_ALL_INT |
254 | GET_CURRENT(%d0) | 263 | GET_CURRENT(%d0) |
255 | addqb #1,%curptr@(TASK_INFO+TINFO_PREEMPT+1) | 264 | movel %d0,%a1 |
265 | addqb #1,%a1@(TINFO_PREEMPT+1) | ||
256 | 266 | ||
257 | movel %sp,%sp@- | 267 | movel %sp,%sp@- |
258 | jsr handle_badint | 268 | jsr handle_badint |
259 | addql #4,%sp | 269 | addql #4,%sp |
260 | 270 | ||
261 | subqb #1,%curptr@(TASK_INFO+TINFO_PREEMPT+1) | 271 | movel %curptr@(TASK_STACK),%a1 |
272 | subqb #1,%a1@(TINFO_PREEMPT+1) | ||
262 | jeq ret_from_last_interrupt | 273 | jeq ret_from_last_interrupt |
263 | RESTORE_ALL | 274 | RESTORE_ALL |
264 | 275 | ||