aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/um/include/sysdep-x86_64/ptrace.h4
-rw-r--r--arch/um/os-Linux/skas/mem.c10
-rw-r--r--arch/um/os-Linux/skas/process.c6
-rw-r--r--arch/um/os-Linux/sys-i386/registers.c5
-rw-r--r--arch/um/os-Linux/sys-x86_64/registers.c4
5 files changed, 15 insertions, 14 deletions
diff --git a/arch/um/include/sysdep-x86_64/ptrace.h b/arch/um/include/sysdep-x86_64/ptrace.h
index 66cb400c2c92..62403bd99661 100644
--- a/arch/um/include/sysdep-x86_64/ptrace.h
+++ b/arch/um/include/sysdep-x86_64/ptrace.h
@@ -104,10 +104,6 @@ union uml_pt_regs {
104#endif 104#endif
105#ifdef UML_CONFIG_MODE_SKAS 105#ifdef UML_CONFIG_MODE_SKAS
106 struct skas_regs { 106 struct skas_regs {
107 /* x86_64 ptrace uses sizeof(user_regs_struct) as its register
108 * file size, while i386 uses FRAME_SIZE. Therefore, we need
109 * to use UM_FRAME_SIZE here instead of HOST_FRAME_SIZE.
110 */
111 unsigned long regs[MAX_REG_NR]; 107 unsigned long regs[MAX_REG_NR];
112 unsigned long fp[HOST_FP_SIZE]; 108 unsigned long fp[HOST_FP_SIZE];
113 struct faultinfo faultinfo; 109 struct faultinfo faultinfo;
diff --git a/arch/um/os-Linux/skas/mem.c b/arch/um/os-Linux/skas/mem.c
index b3c11cfa995a..9383e8751ae7 100644
--- a/arch/um/os-Linux/skas/mem.c
+++ b/arch/um/os-Linux/skas/mem.c
@@ -48,7 +48,7 @@ int multi_op_count = 0;
48static inline long do_syscall_stub(struct mm_id * mm_idp, void **addr) 48static inline long do_syscall_stub(struct mm_id * mm_idp, void **addr)
49{ 49{
50 unsigned long regs[MAX_REG_NR]; 50 unsigned long regs[MAX_REG_NR];
51 int n; 51 int n, i;
52 long ret, offset; 52 long ret, offset;
53 unsigned long * data; 53 unsigned long * data;
54 unsigned long * syscall; 54 unsigned long * syscall;
@@ -66,9 +66,13 @@ static inline long do_syscall_stub(struct mm_id * mm_idp, void **addr)
66 (unsigned long) &__syscall_stub_start); 66 (unsigned long) &__syscall_stub_start);
67 67
68 n = ptrace_setregs(pid, regs); 68 n = ptrace_setregs(pid, regs);
69 if(n < 0) 69 if(n < 0){
70 printk("Registers - \n");
71 for(i = 0; i < MAX_REG_NR; i++)
72 printk("\t%d\t0x%lx\n", i, regs[i]);
70 panic("do_syscall_stub : PTRACE_SETREGS failed, errno = %d\n", 73 panic("do_syscall_stub : PTRACE_SETREGS failed, errno = %d\n",
71 n); 74 -n);
75 }
72 76
73 wait_stub_done(pid, 0, "do_syscall_stub"); 77 wait_stub_done(pid, 0, "do_syscall_stub");
74 78
diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c
index dda06789bcb0..0564422c155f 100644
--- a/arch/um/os-Linux/skas/process.c
+++ b/arch/um/os-Linux/skas/process.c
@@ -67,7 +67,7 @@ void wait_stub_done(int pid, int sig, char * fname)
67 67
68 if((n < 0) || !WIFSTOPPED(status) || 68 if((n < 0) || !WIFSTOPPED(status) ||
69 (WSTOPSIG(status) != SIGUSR1 && WSTOPSIG(status) != SIGTRAP)){ 69 (WSTOPSIG(status) != SIGUSR1 && WSTOPSIG(status) != SIGTRAP)){
70 unsigned long regs[HOST_FRAME_SIZE]; 70 unsigned long regs[MAX_REG_NR];
71 71
72 if(ptrace(PTRACE_GETREGS, pid, 0, regs) < 0) 72 if(ptrace(PTRACE_GETREGS, pid, 0, regs) < 0)
73 printk("Failed to get registers from stub, " 73 printk("Failed to get registers from stub, "
@@ -76,7 +76,7 @@ void wait_stub_done(int pid, int sig, char * fname)
76 int i; 76 int i;
77 77
78 printk("Stub registers -\n"); 78 printk("Stub registers -\n");
79 for(i = 0; i < HOST_FRAME_SIZE; i++) 79 for(i = 0; i < ARRAY_SIZE(regs); i++)
80 printk("\t%d - %lx\n", i, regs[i]); 80 printk("\t%d - %lx\n", i, regs[i]);
81 } 81 }
82 panic("%s : failed to wait for SIGUSR1/SIGTRAP, " 82 panic("%s : failed to wait for SIGUSR1/SIGTRAP, "
@@ -328,7 +328,7 @@ void userspace(union uml_pt_regs *regs)
328int copy_context_skas0(unsigned long new_stack, int pid) 328int copy_context_skas0(unsigned long new_stack, int pid)
329{ 329{
330 int err; 330 int err;
331 unsigned long regs[HOST_FRAME_SIZE]; 331 unsigned long regs[MAX_REG_NR];
332 unsigned long fp_regs[HOST_FP_SIZE]; 332 unsigned long fp_regs[HOST_FP_SIZE];
333 unsigned long current_stack = current_stub_stack(); 333 unsigned long current_stack = current_stub_stack();
334 struct stub_data *data = (struct stub_data *) current_stack; 334 struct stub_data *data = (struct stub_data *) current_stack;
diff --git a/arch/um/os-Linux/sys-i386/registers.c b/arch/um/os-Linux/sys-i386/registers.c
index 79cd93c8c5ed..84b44f9cd42a 100644
--- a/arch/um/os-Linux/sys-i386/registers.c
+++ b/arch/um/os-Linux/sys-i386/registers.c
@@ -15,7 +15,7 @@
15 15
16/* These are set once at boot time and not changed thereafter */ 16/* These are set once at boot time and not changed thereafter */
17 17
18static unsigned long exec_regs[HOST_FRAME_SIZE]; 18static unsigned long exec_regs[MAX_REG_NR];
19static unsigned long exec_fp_regs[HOST_FP_SIZE]; 19static unsigned long exec_fp_regs[HOST_FP_SIZE];
20static unsigned long exec_fpx_regs[HOST_XFP_SIZE]; 20static unsigned long exec_fpx_regs[HOST_XFP_SIZE];
21static int have_fpx_regs = 1; 21static int have_fpx_regs = 1;
@@ -101,6 +101,7 @@ void init_registers(int pid)
101{ 101{
102 int err; 102 int err;
103 103
104 memset(exec_regs, 0, sizeof(exec_regs));
104 err = ptrace(PTRACE_GETREGS, pid, 0, exec_regs); 105 err = ptrace(PTRACE_GETREGS, pid, 0, exec_regs);
105 if(err) 106 if(err)
106 panic("check_ptrace : PTRACE_GETREGS failed, errno = %d", 107 panic("check_ptrace : PTRACE_GETREGS failed, errno = %d",
@@ -124,7 +125,7 @@ void init_registers(int pid)
124 125
125void get_safe_registers(unsigned long *regs, unsigned long *fp_regs) 126void get_safe_registers(unsigned long *regs, unsigned long *fp_regs)
126{ 127{
127 memcpy(regs, exec_regs, HOST_FRAME_SIZE * sizeof(unsigned long)); 128 memcpy(regs, exec_regs, sizeof(exec_regs));
128 if(fp_regs != NULL) 129 if(fp_regs != NULL)
129 memcpy(fp_regs, exec_fp_regs, 130 memcpy(fp_regs, exec_fp_regs,
130 HOST_FP_SIZE * sizeof(unsigned long)); 131 HOST_FP_SIZE * sizeof(unsigned long));
diff --git a/arch/um/os-Linux/sys-x86_64/registers.c b/arch/um/os-Linux/sys-x86_64/registers.c
index a2d7e0c603f7..e6fc2179d1bc 100644
--- a/arch/um/os-Linux/sys-x86_64/registers.c
+++ b/arch/um/os-Linux/sys-x86_64/registers.c
@@ -14,7 +14,7 @@
14 14
15/* These are set once at boot time and not changed thereafter */ 15/* These are set once at boot time and not changed thereafter */
16 16
17static unsigned long exec_regs[HOST_FRAME_SIZE]; 17static unsigned long exec_regs[MAX_REG_NR];
18static unsigned long exec_fp_regs[HOST_FP_SIZE]; 18static unsigned long exec_fp_regs[HOST_FP_SIZE];
19 19
20void init_thread_registers(union uml_pt_regs *to) 20void init_thread_registers(union uml_pt_regs *to)
@@ -72,7 +72,7 @@ void init_registers(int pid)
72 72
73void get_safe_registers(unsigned long *regs, unsigned long *fp_regs) 73void get_safe_registers(unsigned long *regs, unsigned long *fp_regs)
74{ 74{
75 memcpy(regs, exec_regs, HOST_FRAME_SIZE * sizeof(unsigned long)); 75 memcpy(regs, exec_regs, sizeof(exec_regs));
76 if(fp_regs != NULL) 76 if(fp_regs != NULL)
77 memcpy(fp_regs, exec_fp_regs, 77 memcpy(fp_regs, exec_fp_regs,
78 HOST_FP_SIZE * sizeof(unsigned long)); 78 HOST_FP_SIZE * sizeof(unsigned long));