diff options
author | Al Viro <viro@ftp.linux.org.uk> | 2006-01-12 04:05:44 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-12 12:08:52 -0500 |
commit | 3cf0f4ece9f1680e54b154b1e38baaf6ace20a62 (patch) | |
tree | eaebb77428101f5093aa7c0fa8cbc008c9d61ba2 /arch/sh | |
parent | 26ecbdea4bf46b0165db4aafd8e4981b4db53936 (diff) |
[PATCH] sh: task_pt_regs()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/sh')
-rw-r--r-- | arch/sh/kernel/process.c | 42 | ||||
-rw-r--r-- | arch/sh/kernel/ptrace.c | 14 |
2 files changed, 8 insertions, 48 deletions
diff --git a/arch/sh/kernel/process.c b/arch/sh/kernel/process.c index 8a2bea34ddd2..8c0060ce6c02 100644 --- a/arch/sh/kernel/process.c +++ b/arch/sh/kernel/process.c | |||
@@ -191,13 +191,8 @@ void flush_thread(void) | |||
191 | { | 191 | { |
192 | #if defined(CONFIG_SH_FPU) | 192 | #if defined(CONFIG_SH_FPU) |
193 | struct task_struct *tsk = current; | 193 | struct task_struct *tsk = current; |
194 | struct pt_regs *regs = (struct pt_regs *) | ||
195 | ((unsigned long)tsk->thread_info | ||
196 | + THREAD_SIZE - sizeof(struct pt_regs) | ||
197 | - sizeof(unsigned long)); | ||
198 | |||
199 | /* Forget lazy FPU state */ | 194 | /* Forget lazy FPU state */ |
200 | clear_fpu(tsk, regs); | 195 | clear_fpu(tsk, task_pt_regs(tsk)); |
201 | clear_used_math(); | 196 | clear_used_math(); |
202 | #endif | 197 | #endif |
203 | } | 198 | } |
@@ -232,13 +227,7 @@ int dump_task_regs(struct task_struct *tsk, elf_gregset_t *regs) | |||
232 | { | 227 | { |
233 | struct pt_regs ptregs; | 228 | struct pt_regs ptregs; |
234 | 229 | ||
235 | ptregs = *(struct pt_regs *) | 230 | ptregs = *task_pt_regs(tsk); |
236 | ((unsigned long)tsk->thread_info + THREAD_SIZE | ||
237 | - sizeof(struct pt_regs) | ||
238 | #ifdef CONFIG_SH_DSP | ||
239 | - sizeof(struct pt_dspregs) | ||
240 | #endif | ||
241 | - sizeof(unsigned long)); | ||
242 | elf_core_copy_regs(regs, &ptregs); | 231 | elf_core_copy_regs(regs, &ptregs); |
243 | 232 | ||
244 | return 1; | 233 | return 1; |
@@ -252,11 +241,7 @@ dump_task_fpu (struct task_struct *tsk, elf_fpregset_t *fpu) | |||
252 | #if defined(CONFIG_SH_FPU) | 241 | #if defined(CONFIG_SH_FPU) |
253 | fpvalid = !!tsk_used_math(tsk); | 242 | fpvalid = !!tsk_used_math(tsk); |
254 | if (fpvalid) { | 243 | if (fpvalid) { |
255 | struct pt_regs *regs = (struct pt_regs *) | 244 | unlazy_fpu(tsk, task_pt_regs(tsk)); |
256 | ((unsigned long)tsk->thread_info | ||
257 | + THREAD_SIZE - sizeof(struct pt_regs) | ||
258 | - sizeof(unsigned long)); | ||
259 | unlazy_fpu(tsk, regs); | ||
260 | memcpy(fpu, &tsk->thread.fpu.hard, sizeof(*fpu)); | 245 | memcpy(fpu, &tsk->thread.fpu.hard, sizeof(*fpu)); |
261 | } | 246 | } |
262 | #endif | 247 | #endif |
@@ -279,12 +264,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp, | |||
279 | copy_to_stopped_child_used_math(p); | 264 | copy_to_stopped_child_used_math(p); |
280 | #endif | 265 | #endif |
281 | 266 | ||
282 | childregs = ((struct pt_regs *) | 267 | childregs = task_pt_regs(p); |
283 | (THREAD_SIZE + (unsigned long) p->thread_info) | ||
284 | #ifdef CONFIG_SH_DSP | ||
285 | - sizeof(struct pt_dspregs) | ||
286 | #endif | ||
287 | - sizeof(unsigned long)) - 1; | ||
288 | *childregs = *regs; | 268 | *childregs = *regs; |
289 | 269 | ||
290 | if (user_mode(regs)) { | 270 | if (user_mode(regs)) { |
@@ -333,11 +313,7 @@ ubc_set_tracing(int asid, unsigned long pc) | |||
333 | struct task_struct *__switch_to(struct task_struct *prev, struct task_struct *next) | 313 | struct task_struct *__switch_to(struct task_struct *prev, struct task_struct *next) |
334 | { | 314 | { |
335 | #if defined(CONFIG_SH_FPU) | 315 | #if defined(CONFIG_SH_FPU) |
336 | struct pt_regs *regs = (struct pt_regs *) | 316 | unlazy_fpu(prev, task_pt_regs(prev)); |
337 | ((unsigned long)prev->thread_info | ||
338 | + THREAD_SIZE - sizeof(struct pt_regs) | ||
339 | - sizeof(unsigned long)); | ||
340 | unlazy_fpu(prev, regs); | ||
341 | #endif | 317 | #endif |
342 | 318 | ||
343 | #ifdef CONFIG_PREEMPT | 319 | #ifdef CONFIG_PREEMPT |
@@ -346,13 +322,7 @@ struct task_struct *__switch_to(struct task_struct *prev, struct task_struct *ne | |||
346 | struct pt_regs *regs; | 322 | struct pt_regs *regs; |
347 | 323 | ||
348 | local_irq_save(flags); | 324 | local_irq_save(flags); |
349 | regs = (struct pt_regs *) | 325 | regs = task_pt_regs(prev); |
350 | ((unsigned long)prev->thread_info | ||
351 | + THREAD_SIZE - sizeof(struct pt_regs) | ||
352 | #ifdef CONFIG_SH_DSP | ||
353 | - sizeof(struct pt_dspregs) | ||
354 | #endif | ||
355 | - sizeof(unsigned long)); | ||
356 | if (user_mode(regs) && regs->regs[15] >= 0xc0000000) { | 326 | if (user_mode(regs) && regs->regs[15] >= 0xc0000000) { |
357 | int offset = (int)regs->regs[15]; | 327 | int offset = (int)regs->regs[15]; |
358 | 328 | ||
diff --git a/arch/sh/kernel/ptrace.c b/arch/sh/kernel/ptrace.c index 1a8be06519ec..3887b4f6feb2 100644 --- a/arch/sh/kernel/ptrace.c +++ b/arch/sh/kernel/ptrace.c | |||
@@ -41,12 +41,7 @@ static inline int get_stack_long(struct task_struct *task, int offset) | |||
41 | { | 41 | { |
42 | unsigned char *stack; | 42 | unsigned char *stack; |
43 | 43 | ||
44 | stack = (unsigned char *) | 44 | stack = (unsigned char *)task_pt_regs(task); |
45 | task->thread_info + THREAD_SIZE - sizeof(struct pt_regs) | ||
46 | #ifdef CONFIG_SH_DSP | ||
47 | - sizeof(struct pt_dspregs) | ||
48 | #endif | ||
49 | - sizeof(unsigned long); | ||
50 | stack += offset; | 45 | stack += offset; |
51 | return (*((int *)stack)); | 46 | return (*((int *)stack)); |
52 | } | 47 | } |
@@ -59,12 +54,7 @@ static inline int put_stack_long(struct task_struct *task, int offset, | |||
59 | { | 54 | { |
60 | unsigned char *stack; | 55 | unsigned char *stack; |
61 | 56 | ||
62 | stack = (unsigned char *) | 57 | stack = (unsigned char *)task_pt_regs(task); |
63 | task->thread_info + THREAD_SIZE - sizeof(struct pt_regs) | ||
64 | #ifdef CONFIG_SH_DSP | ||
65 | - sizeof(struct pt_dspregs) | ||
66 | #endif | ||
67 | - sizeof(unsigned long); | ||
68 | stack += offset; | 58 | stack += offset; |
69 | *(unsigned long *) stack = data; | 59 | *(unsigned long *) stack = data; |
70 | return 0; | 60 | return 0; |