Move dsp register and fix access function
Subsystems (2)
RFC PATCH v2 1/1 Move dsp register and fix access function
This patch is only a request for comment. I do some change of the code. Move the dsp registers on task's private data
Signed-not-really-of-by Michael Trimarchi <[email protected]>
---
arch/sh/include/asm/processor_32.h +17 -0
@@ -57,6 +57,18 @@ asmlinkage void __init sh_cpu_init(void);#define SR_IMASK 0x000000f0#define SR_FD 0x00008000 +#ifdef CONFIG_SH_DSP +/* +* DSP structure and data +*/ + +struct sh_dsp_struct { +unsigned long dsp_regs[14 ]; +long status; +}; + +#endif +/* * FPU structure and data */
@@ -96,6 +108,11 @@ struct thread_struct {/* floating point info */ union sh_fpu_union fpu; + +#ifdef CONFIG_SH_DSP +/* Dsp status information */ +struct sh_dsp_struct dsp_status; +#endif };/* Count of active tasks with UBC settings */
arch/sh/include/asm/ptrace.h +0 -8
@@ -119,16 +119,8 @@ struct task_struct;extern void user_enable_single_step (struct task_struct *);extern void user_disable_single_step (struct task_struct *); -#ifdef CONFIG_SH_DSP -#define task_pt_regs (task) \ - ((struct pt_regs *) (task_stack_page(task) + THREAD_SIZE \ - - sizeof(struct pt_dspregs)) - 1) -#define task_pt_dspregs (task) \ - ((struct pt_dspregs *) (task_stack_page(task) + THREAD_SIZE) - 1) -#else #define task_pt_regs (task) \ ((struct pt_regs *) (task_stack_page(task) + THREAD_SIZE) - 1) -#endif static inline unsigned long profile_pc (struct pt_regs *regs) {
arch/sh/include/asm/system_32.h +124 -47
185 lines not on this page · raw message
arch/sh/kernel/cpu/sh3/entry.S +7 -80
130 lines not on this page · raw message
arch/sh/kernel/process_32.c +5 -0
@@ -184,6 +184,11 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,copy_to_stopped_child_used_math (p);#endif +#if defined(CONFIG_SH_DSP ) +if (is_dsp_enabled (p)) +__save_dsp (p); +#endif + childregs =task_pt_regs (p); *childregs = *regs;
arch/sh/kernel/ptrace_32.c +4 -2
@@ -195,12 +195,14 @@ static int fpregs_active(struct task_struct *target,#endif #ifdef CONFIG_SH_DSP +static int dspregs_get (struct task_struct *target,const struct user_regset *regset,unsigned int pos,unsigned int count,void *kbuf,void __user *ubuf) { -const struct pt_dspregs *regs =task_pt_dspregs (target); + const struct pt_dspregs *regs + (struct pt_dspregs *)&target->thread.dsp_status.dsp_regs;int ret; ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, regs,
@@ -217,7 +219,8 @@ static int dspregs_set(struct task_struct *target, unsigned int pos, unsigned int count, const void *kbuf, const void __user *ubuf) { - struct pt_dspregs *regs = task_pt_dspregs(target); + struct pt_dspregs *regs + (struct pt_dspregs *)&target->thread.dsp_status.dsp_regs;int ret; ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, regs,
@@ -236,6 +239,7 @@ static int dspregs_active(struct task_struct *target, return regs->sr & SR_DSP ? regset->n : 0; } +#endif /*
arch/sh/kernel/traps_32.c +2 -0
@@ -664,6 +664,8 @@ asmlinkage void do_reserved_inst(unsigned long r4, unsigned long r5,if (is_dsp_inst (regs)) {/* Enable DSP mode, and restart instruction. */ regs->sr |=SR_DSP ; +/* Save DSP mode */ + tsk->thread.dsp_status.status |=SR_DSP ;return ; }#endif