Loading arch/sh/Kconfig +1 −1 Original line number Diff line number Diff line Loading @@ -23,7 +23,7 @@ config SUPERH32 def_bool !SUPERH64 select HAVE_KPROBES select HAVE_KRETPROBES select HAVE_ARCH_TRACEHOOK if (!SH_FPU && !SH_DSP) select HAVE_ARCH_TRACEHOOK if !SH_FPU config SUPERH64 def_bool y if CPU_SH5 Loading arch/sh/include/asm/elf.h +2 −3 Original line number Diff line number Diff line Loading @@ -108,11 +108,10 @@ typedef struct user_fpu_struct elf_fpregset_t; #define elf_check_fdpic(x) ((x)->e_flags & EF_SH_FDPIC) #define elf_check_const_displacement(x) ((x)->e_flags & EF_SH_PIC) #if defined(CONFIG_SUPERH32) && \ (!defined(CONFIG_SH_FPU) && !defined(CONFIG_SH_DSP)) #if defined(CONFIG_SUPERH32) && !defined(CONFIG_SH_FPU) /* * Enable dump using regset for general purpose registers, use this as * the default once the FPU and DSP registers are moved over also. * the default once the FPU registers are moved over also. */ #define CORE_DUMP_USE_REGSET #endif Loading arch/sh/include/asm/ptrace.h +3 −0 Original line number Diff line number Diff line Loading @@ -123,6 +123,9 @@ extern void user_disable_single_step(struct task_struct *); #define task_pt_regs(task) \ ((struct pt_regs *) (task_stack_page(task) + THREAD_SIZE \ - sizeof(struct pt_dspregs) - sizeof(unsigned long)) - 1) #define task_pt_dspregs(task) \ ((struct pt_dspregs *) (task_stack_page(task) + THREAD_SIZE \ - sizeof(unsigned long)) - 1) #else #define task_pt_regs(task) \ ((struct pt_regs *) (task_stack_page(task) + THREAD_SIZE \ Loading arch/sh/kernel/ptrace_32.c +59 −27 Original line number Diff line number Diff line Loading @@ -145,11 +145,50 @@ static int genregs_set(struct task_struct *target, return ret; } #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); int ret; ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, regs, 0, sizeof(struct pt_dspregs)); if (!ret) ret = user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf, sizeof(struct pt_dspregs), -1); return ret; } static int dspregs_set(struct task_struct *target, const struct user_regset *regset, unsigned int pos, unsigned int count, const void *kbuf, const void __user *ubuf) { struct pt_dspregs *regs = task_pt_dspregs(target); int ret; ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, regs, 0, sizeof(struct pt_dspregs)); if (!ret) ret = user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf, sizeof(struct pt_dspregs), -1); return ret; } #endif /* * These are our native regset flavours. */ enum sh_regset { REGSET_GENERAL, #ifdef CONFIG_SH_DSP REGSET_DSP, #endif }; static const struct user_regset sh_regsets[] = { Loading @@ -166,6 +205,16 @@ static const struct user_regset sh_regsets[] = { .get = genregs_get, .set = genregs_set, }, #ifdef CONFIG_SH_DSP [REGSET_DSP] = { .n = sizeof(struct pt_dspregs) / sizeof(long), .size = sizeof(long), .align = sizeof(long), .get = dspregs_get, .set = dspregs_set, }, #endif }; static const struct user_regset_view user_sh_native_view = { Loading Loading @@ -242,33 +291,16 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) 0, sizeof(struct pt_regs), (const void __user *)data); #ifdef CONFIG_SH_DSP case PTRACE_GETDSPREGS: { unsigned long dp; ret = -EIO; dp = ((unsigned long) child) + THREAD_SIZE - sizeof(struct pt_dspregs); if (*((int *) (dp - 4)) == SR_FD) { copy_to_user((void *)addr, (void *) dp, sizeof(struct pt_dspregs)); ret = 0; } break; } case PTRACE_SETDSPREGS: { unsigned long dp; ret = -EIO; dp = ((unsigned long) child) + THREAD_SIZE - sizeof(struct pt_dspregs); if (*((int *) (dp - 4)) == SR_FD) { copy_from_user((void *) dp, (void *)addr, sizeof(struct pt_dspregs)); ret = 0; } break; } case PTRACE_GETDSPREGS: return copy_regset_to_user(child, &user_sh_native_view, REGSET_DSP, 0, sizeof(struct pt_dspregs), (void __user *)data); case PTRACE_SETDSPREGS: return copy_regset_from_user(child, &user_sh_native_view, REGSET_DSP, 0, sizeof(struct pt_dspregs), (const void __user *)data); #endif #ifdef CONFIG_BINFMT_ELF_FDPIC case PTRACE_GETFDPIC: { Loading Loading
arch/sh/Kconfig +1 −1 Original line number Diff line number Diff line Loading @@ -23,7 +23,7 @@ config SUPERH32 def_bool !SUPERH64 select HAVE_KPROBES select HAVE_KRETPROBES select HAVE_ARCH_TRACEHOOK if (!SH_FPU && !SH_DSP) select HAVE_ARCH_TRACEHOOK if !SH_FPU config SUPERH64 def_bool y if CPU_SH5 Loading
arch/sh/include/asm/elf.h +2 −3 Original line number Diff line number Diff line Loading @@ -108,11 +108,10 @@ typedef struct user_fpu_struct elf_fpregset_t; #define elf_check_fdpic(x) ((x)->e_flags & EF_SH_FDPIC) #define elf_check_const_displacement(x) ((x)->e_flags & EF_SH_PIC) #if defined(CONFIG_SUPERH32) && \ (!defined(CONFIG_SH_FPU) && !defined(CONFIG_SH_DSP)) #if defined(CONFIG_SUPERH32) && !defined(CONFIG_SH_FPU) /* * Enable dump using regset for general purpose registers, use this as * the default once the FPU and DSP registers are moved over also. * the default once the FPU registers are moved over also. */ #define CORE_DUMP_USE_REGSET #endif Loading
arch/sh/include/asm/ptrace.h +3 −0 Original line number Diff line number Diff line Loading @@ -123,6 +123,9 @@ extern void user_disable_single_step(struct task_struct *); #define task_pt_regs(task) \ ((struct pt_regs *) (task_stack_page(task) + THREAD_SIZE \ - sizeof(struct pt_dspregs) - sizeof(unsigned long)) - 1) #define task_pt_dspregs(task) \ ((struct pt_dspregs *) (task_stack_page(task) + THREAD_SIZE \ - sizeof(unsigned long)) - 1) #else #define task_pt_regs(task) \ ((struct pt_regs *) (task_stack_page(task) + THREAD_SIZE \ Loading
arch/sh/kernel/ptrace_32.c +59 −27 Original line number Diff line number Diff line Loading @@ -145,11 +145,50 @@ static int genregs_set(struct task_struct *target, return ret; } #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); int ret; ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, regs, 0, sizeof(struct pt_dspregs)); if (!ret) ret = user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf, sizeof(struct pt_dspregs), -1); return ret; } static int dspregs_set(struct task_struct *target, const struct user_regset *regset, unsigned int pos, unsigned int count, const void *kbuf, const void __user *ubuf) { struct pt_dspregs *regs = task_pt_dspregs(target); int ret; ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, regs, 0, sizeof(struct pt_dspregs)); if (!ret) ret = user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf, sizeof(struct pt_dspregs), -1); return ret; } #endif /* * These are our native regset flavours. */ enum sh_regset { REGSET_GENERAL, #ifdef CONFIG_SH_DSP REGSET_DSP, #endif }; static const struct user_regset sh_regsets[] = { Loading @@ -166,6 +205,16 @@ static const struct user_regset sh_regsets[] = { .get = genregs_get, .set = genregs_set, }, #ifdef CONFIG_SH_DSP [REGSET_DSP] = { .n = sizeof(struct pt_dspregs) / sizeof(long), .size = sizeof(long), .align = sizeof(long), .get = dspregs_get, .set = dspregs_set, }, #endif }; static const struct user_regset_view user_sh_native_view = { Loading Loading @@ -242,33 +291,16 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) 0, sizeof(struct pt_regs), (const void __user *)data); #ifdef CONFIG_SH_DSP case PTRACE_GETDSPREGS: { unsigned long dp; ret = -EIO; dp = ((unsigned long) child) + THREAD_SIZE - sizeof(struct pt_dspregs); if (*((int *) (dp - 4)) == SR_FD) { copy_to_user((void *)addr, (void *) dp, sizeof(struct pt_dspregs)); ret = 0; } break; } case PTRACE_SETDSPREGS: { unsigned long dp; ret = -EIO; dp = ((unsigned long) child) + THREAD_SIZE - sizeof(struct pt_dspregs); if (*((int *) (dp - 4)) == SR_FD) { copy_from_user((void *) dp, (void *)addr, sizeof(struct pt_dspregs)); ret = 0; } break; } case PTRACE_GETDSPREGS: return copy_regset_to_user(child, &user_sh_native_view, REGSET_DSP, 0, sizeof(struct pt_dspregs), (void __user *)data); case PTRACE_SETDSPREGS: return copy_regset_from_user(child, &user_sh_native_view, REGSET_DSP, 0, sizeof(struct pt_dspregs), (const void __user *)data); #endif #ifdef CONFIG_BINFMT_ELF_FDPIC case PTRACE_GETFDPIC: { Loading