Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 18066
b: refs/heads/master
c: 3cf0f4e
h: refs/heads/master
v: v3
  • Loading branch information
Al Viro authored and Linus Torvalds committed Jan 12, 2006
1 parent 46f4ef8 commit e3c7f83
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 49 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 26ecbdea4bf46b0165db4aafd8e4981b4db53936
refs/heads/master: 3cf0f4ece9f1680e54b154b1e38baaf6ace20a62
42 changes: 6 additions & 36 deletions trunk/arch/sh/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,8 @@ void flush_thread(void)
{
#if defined(CONFIG_SH_FPU)
struct task_struct *tsk = current;
struct pt_regs *regs = (struct pt_regs *)
((unsigned long)tsk->thread_info
+ THREAD_SIZE - sizeof(struct pt_regs)
- sizeof(unsigned long));

/* Forget lazy FPU state */
clear_fpu(tsk, regs);
clear_fpu(tsk, task_pt_regs(tsk));
clear_used_math();
#endif
}
Expand Down Expand Up @@ -232,13 +227,7 @@ int dump_task_regs(struct task_struct *tsk, elf_gregset_t *regs)
{
struct pt_regs ptregs;

ptregs = *(struct pt_regs *)
((unsigned long)tsk->thread_info + THREAD_SIZE
- sizeof(struct pt_regs)
#ifdef CONFIG_SH_DSP
- sizeof(struct pt_dspregs)
#endif
- sizeof(unsigned long));
ptregs = *task_pt_regs(tsk);
elf_core_copy_regs(regs, &ptregs);

return 1;
Expand All @@ -252,11 +241,7 @@ dump_task_fpu (struct task_struct *tsk, elf_fpregset_t *fpu)
#if defined(CONFIG_SH_FPU)
fpvalid = !!tsk_used_math(tsk);
if (fpvalid) {
struct pt_regs *regs = (struct pt_regs *)
((unsigned long)tsk->thread_info
+ THREAD_SIZE - sizeof(struct pt_regs)
- sizeof(unsigned long));
unlazy_fpu(tsk, regs);
unlazy_fpu(tsk, task_pt_regs(tsk));
memcpy(fpu, &tsk->thread.fpu.hard, sizeof(*fpu));
}
#endif
Expand All @@ -279,12 +264,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
copy_to_stopped_child_used_math(p);
#endif

childregs = ((struct pt_regs *)
(THREAD_SIZE + (unsigned long) p->thread_info)
#ifdef CONFIG_SH_DSP
- sizeof(struct pt_dspregs)
#endif
- sizeof(unsigned long)) - 1;
childregs = task_pt_regs(p);
*childregs = *regs;

if (user_mode(regs)) {
Expand Down Expand Up @@ -333,11 +313,7 @@ ubc_set_tracing(int asid, unsigned long pc)
struct task_struct *__switch_to(struct task_struct *prev, struct task_struct *next)
{
#if defined(CONFIG_SH_FPU)
struct pt_regs *regs = (struct pt_regs *)
((unsigned long)prev->thread_info
+ THREAD_SIZE - sizeof(struct pt_regs)
- sizeof(unsigned long));
unlazy_fpu(prev, regs);
unlazy_fpu(prev, task_pt_regs(prev));
#endif

#ifdef CONFIG_PREEMPT
Expand All @@ -346,13 +322,7 @@ struct task_struct *__switch_to(struct task_struct *prev, struct task_struct *ne
struct pt_regs *regs;

local_irq_save(flags);
regs = (struct pt_regs *)
((unsigned long)prev->thread_info
+ THREAD_SIZE - sizeof(struct pt_regs)
#ifdef CONFIG_SH_DSP
- sizeof(struct pt_dspregs)
#endif
- sizeof(unsigned long));
regs = task_pt_regs(prev);
if (user_mode(regs) && regs->regs[15] >= 0xc0000000) {
int offset = (int)regs->regs[15];

Expand Down
14 changes: 2 additions & 12 deletions trunk/arch/sh/kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,7 @@ static inline int get_stack_long(struct task_struct *task, int offset)
{
unsigned char *stack;

stack = (unsigned char *)
task->thread_info + THREAD_SIZE - sizeof(struct pt_regs)
#ifdef CONFIG_SH_DSP
- sizeof(struct pt_dspregs)
#endif
- sizeof(unsigned long);
stack = (unsigned char *)task_pt_regs(task);
stack += offset;
return (*((int *)stack));
}
Expand All @@ -59,12 +54,7 @@ static inline int put_stack_long(struct task_struct *task, int offset,
{
unsigned char *stack;

stack = (unsigned char *)
task->thread_info + THREAD_SIZE - sizeof(struct pt_regs)
#ifdef CONFIG_SH_DSP
- sizeof(struct pt_dspregs)
#endif
- sizeof(unsigned long);
stack = (unsigned char *)task_pt_regs(task);
stack += offset;
*(unsigned long *) stack = data;
return 0;
Expand Down
10 changes: 10 additions & 0 deletions trunk/include/asm-sh/ptrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,16 @@ struct pt_dspregs {
#define instruction_pointer(regs) ((regs)->pc)
extern void show_regs(struct pt_regs *);

#ifdef CONFIG_SH_DSP
#define task_pt_regs(task) \
((struct pt_regs *) ((unsigned long)(task)->thread_info + THREAD_SIZE \
- sizeof(struct pt_dspregs) - sizeof(unsigned long)) - 1)
#else
#define task_pt_regs(task) \
((struct pt_regs *) ((unsigned long)(task)->thread_info + THREAD_SIZE \
- sizeof(unsigned long)) - 1)
#endif

static inline unsigned long profile_pc(struct pt_regs *regs)
{
unsigned long pc = instruction_pointer(regs);
Expand Down

0 comments on commit e3c7f83

Please sign in to comment.