aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc64/kernel/ptrace.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sparc64/kernel/ptrace.c')
-rw-r--r--arch/sparc64/kernel/ptrace.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/arch/sparc64/kernel/ptrace.c b/arch/sparc64/kernel/ptrace.c
index 9a1ba1fe859d..aaae865e7932 100644
--- a/arch/sparc64/kernel/ptrace.c
+++ b/arch/sparc64/kernel/ptrace.c
@@ -35,6 +35,9 @@
35#include <asm/spitfire.h> 35#include <asm/spitfire.h>
36#include <asm/page.h> 36#include <asm/page.h>
37#include <asm/cpudata.h> 37#include <asm/cpudata.h>
38#include <asm/cacheflush.h>
39
40#include "entry.h"
38 41
39/* #define ALLOW_INIT_TRACING */ 42/* #define ALLOW_INIT_TRACING */
40 43
@@ -67,6 +70,8 @@ void flush_ptrace_access(struct vm_area_struct *vma, struct page *page,
67 if (tlb_type == hypervisor) 70 if (tlb_type == hypervisor)
68 return; 71 return;
69 72
73 preempt_disable();
74
70#ifdef DCACHE_ALIASING_POSSIBLE 75#ifdef DCACHE_ALIASING_POSSIBLE
71 /* If bit 13 of the kernel address we used to access the 76 /* If bit 13 of the kernel address we used to access the
72 * user page is the same as the virtual address that page 77 * user page is the same as the virtual address that page
@@ -105,6 +110,8 @@ void flush_ptrace_access(struct vm_area_struct *vma, struct page *page,
105 for (; start < end; start += icache_line_size) 110 for (; start < end; start += icache_line_size)
106 flushi(start); 111 flushi(start);
107 } 112 }
113
114 preempt_enable();
108} 115}
109 116
110enum sparc_regset { 117enum sparc_regset {
@@ -382,6 +389,7 @@ static const struct user_regset_view user_sparc64_view = {
382 .regsets = sparc64_regsets, .n = ARRAY_SIZE(sparc64_regsets) 389 .regsets = sparc64_regsets, .n = ARRAY_SIZE(sparc64_regsets)
383}; 390};
384 391
392#ifdef CONFIG_COMPAT
385static int genregs32_get(struct task_struct *target, 393static int genregs32_get(struct task_struct *target,
386 const struct user_regset *regset, 394 const struct user_regset *regset,
387 unsigned int pos, unsigned int count, 395 unsigned int pos, unsigned int count,
@@ -676,14 +684,18 @@ static const struct user_regset_view user_sparc32_view = {
676 .name = "sparc", .e_machine = EM_SPARC, 684 .name = "sparc", .e_machine = EM_SPARC,
677 .regsets = sparc32_regsets, .n = ARRAY_SIZE(sparc32_regsets) 685 .regsets = sparc32_regsets, .n = ARRAY_SIZE(sparc32_regsets)
678}; 686};
687#endif /* CONFIG_COMPAT */
679 688
680const struct user_regset_view *task_user_regset_view(struct task_struct *task) 689const struct user_regset_view *task_user_regset_view(struct task_struct *task)
681{ 690{
691#ifdef CONFIG_COMPAT
682 if (test_tsk_thread_flag(task, TIF_32BIT)) 692 if (test_tsk_thread_flag(task, TIF_32BIT))
683 return &user_sparc32_view; 693 return &user_sparc32_view;
694#endif
684 return &user_sparc64_view; 695 return &user_sparc64_view;
685} 696}
686 697
698#ifdef CONFIG_COMPAT
687struct compat_fps { 699struct compat_fps {
688 unsigned int regs[32]; 700 unsigned int regs[32];
689 unsigned int fsr; 701 unsigned int fsr;
@@ -798,6 +810,7 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
798 810
799 return ret; 811 return ret;
800} 812}
813#endif /* CONFIG_COMPAT */
801 814
802struct fps { 815struct fps {
803 unsigned int regs[64]; 816 unsigned int regs[64];
@@ -807,11 +820,14 @@ struct fps {
807long arch_ptrace(struct task_struct *child, long request, long addr, long data) 820long arch_ptrace(struct task_struct *child, long request, long addr, long data)
808{ 821{
809 const struct user_regset_view *view = task_user_regset_view(child); 822 const struct user_regset_view *view = task_user_regset_view(child);
810 struct pt_regs __user *pregs = (struct pt_regs __user *) addr;
811 unsigned long addr2 = task_pt_regs(current)->u_regs[UREG_I4]; 823 unsigned long addr2 = task_pt_regs(current)->u_regs[UREG_I4];
812 struct fps __user *fps = (struct fps __user *) addr; 824 struct pt_regs __user *pregs;
825 struct fps __user *fps;
813 int ret; 826 int ret;
814 827
828 pregs = (struct pt_regs __user *) (unsigned long) addr;
829 fps = (struct fps __user *) (unsigned long) addr;
830
815 switch (request) { 831 switch (request) {
816 case PTRACE_PEEKUSR: 832 case PTRACE_PEEKUSR:
817 ret = (addr != 0) ? -EIO : 0; 833 ret = (addr != 0) ? -EIO : 0;