diff options
-rw-r--r-- | arch/um/os-Linux/sys-x86_64/registers.c | 15 | ||||
-rw-r--r-- | arch/um/sys-x86_64/ptrace.c | 6 | ||||
-rw-r--r-- | include/asm-um/elf-x86_64.h | 40 |
3 files changed, 55 insertions, 6 deletions
diff --git a/arch/um/os-Linux/sys-x86_64/registers.c b/arch/um/os-Linux/sys-x86_64/registers.c index e6fc2179d1bc..9467315b8059 100644 --- a/arch/um/os-Linux/sys-x86_64/registers.c +++ b/arch/um/os-Linux/sys-x86_64/registers.c | |||
@@ -4,6 +4,7 @@ | |||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <errno.h> | 6 | #include <errno.h> |
7 | #include <sys/ptrace.h> | ||
7 | #include <string.h> | 8 | #include <string.h> |
8 | #include "ptrace_user.h" | 9 | #include "ptrace_user.h" |
9 | #include "uml-config.h" | 10 | #include "uml-config.h" |
@@ -17,6 +18,20 @@ | |||
17 | static unsigned long exec_regs[MAX_REG_NR]; | 18 | static unsigned long exec_regs[MAX_REG_NR]; |
18 | static unsigned long exec_fp_regs[HOST_FP_SIZE]; | 19 | static unsigned long exec_fp_regs[HOST_FP_SIZE]; |
19 | 20 | ||
21 | int save_fp_registers(int pid, unsigned long *fp_regs) | ||
22 | { | ||
23 | if(ptrace(PTRACE_GETFPREGS, pid, 0, fp_regs) < 0) | ||
24 | return -errno; | ||
25 | return 0; | ||
26 | } | ||
27 | |||
28 | int restore_fp_registers(int pid, unsigned long *fp_regs) | ||
29 | { | ||
30 | if(ptrace(PTRACE_SETFPREGS, pid, 0, fp_regs) < 0) | ||
31 | return -errno; | ||
32 | return 0; | ||
33 | } | ||
34 | |||
20 | void init_thread_registers(union uml_pt_regs *to) | 35 | void init_thread_registers(union uml_pt_regs *to) |
21 | { | 36 | { |
22 | memcpy(to->skas.regs, exec_regs, sizeof(to->skas.regs)); | 37 | memcpy(to->skas.regs, exec_regs, sizeof(to->skas.regs)); |
diff --git a/arch/um/sys-x86_64/ptrace.c b/arch/um/sys-x86_64/ptrace.c index 55b66e09a98c..1970d78aa528 100644 --- a/arch/um/sys-x86_64/ptrace.c +++ b/arch/um/sys-x86_64/ptrace.c | |||
@@ -156,12 +156,6 @@ int is_syscall(unsigned long addr) | |||
156 | return(instr == 0x050f); | 156 | return(instr == 0x050f); |
157 | } | 157 | } |
158 | 158 | ||
159 | int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu ) | ||
160 | { | ||
161 | panic("dump_fpu"); | ||
162 | return(1); | ||
163 | } | ||
164 | |||
165 | int get_fpregs(unsigned long buf, struct task_struct *child) | 159 | int get_fpregs(unsigned long buf, struct task_struct *child) |
166 | { | 160 | { |
167 | panic("get_fpregs"); | 161 | panic("get_fpregs"); |
diff --git a/include/asm-um/elf-x86_64.h b/include/asm-um/elf-x86_64.h index 8a8246d03936..bfe27aa2c9c4 100644 --- a/include/asm-um/elf-x86_64.h +++ b/include/asm-um/elf-x86_64.h | |||
@@ -6,7 +6,9 @@ | |||
6 | #ifndef __UM_ELF_X86_64_H | 6 | #ifndef __UM_ELF_X86_64_H |
7 | #define __UM_ELF_X86_64_H | 7 | #define __UM_ELF_X86_64_H |
8 | 8 | ||
9 | #include <linux/sched.h> | ||
9 | #include <asm/user.h> | 10 | #include <asm/user.h> |
11 | #include "skas.h" | ||
10 | 12 | ||
11 | /* x86-64 relocation types, taken from asm-x86_64/elf.h */ | 13 | /* x86-64 relocation types, taken from asm-x86_64/elf.h */ |
12 | #define R_X86_64_NONE 0 /* No reloc */ | 14 | #define R_X86_64_NONE 0 /* No reloc */ |
@@ -64,6 +66,44 @@ typedef struct { } elf_fpregset_t; | |||
64 | PT_REGS_R15(regs) = 0; \ | 66 | PT_REGS_R15(regs) = 0; \ |
65 | } while (0) | 67 | } while (0) |
66 | 68 | ||
69 | #define ELF_CORE_COPY_REGS(pr_reg, regs) \ | ||
70 | (pr_reg)[0] = (regs)->regs.gp[0]; \ | ||
71 | (pr_reg)[1] = (regs)->regs.gp[1]; \ | ||
72 | (pr_reg)[2] = (regs)->regs.gp[2]; \ | ||
73 | (pr_reg)[3] = (regs)->regs.gp[3]; \ | ||
74 | (pr_reg)[4] = (regs)->regs.gp[4]; \ | ||
75 | (pr_reg)[5] = (regs)->regs.gp[5]; \ | ||
76 | (pr_reg)[6] = (regs)->regs.gp[6]; \ | ||
77 | (pr_reg)[7] = (regs)->regs.gp[7]; \ | ||
78 | (pr_reg)[8] = (regs)->regs.gp[8]; \ | ||
79 | (pr_reg)[9] = (regs)->regs.gp[9]; \ | ||
80 | (pr_reg)[10] = (regs)->regs.gp[10]; \ | ||
81 | (pr_reg)[11] = (regs)->regs.gp[11]; \ | ||
82 | (pr_reg)[12] = (regs)->regs.gp[12]; \ | ||
83 | (pr_reg)[13] = (regs)->regs.gp[13]; \ | ||
84 | (pr_reg)[14] = (regs)->regs.gp[14]; \ | ||
85 | (pr_reg)[15] = (regs)->regs.gp[15]; \ | ||
86 | (pr_reg)[16] = (regs)->regs.gp[16]; \ | ||
87 | (pr_reg)[17] = (regs)->regs.gp[17]; \ | ||
88 | (pr_reg)[18] = (regs)->regs.gp[18]; \ | ||
89 | (pr_reg)[19] = (regs)->regs.gp[19]; \ | ||
90 | (pr_reg)[20] = (regs)->regs.gp[20]; \ | ||
91 | (pr_reg)[21] = current->thread.arch.fs; \ | ||
92 | (pr_reg)[22] = 0; \ | ||
93 | (pr_reg)[23] = 0; \ | ||
94 | (pr_reg)[24] = 0; \ | ||
95 | (pr_reg)[25] = 0; \ | ||
96 | (pr_reg)[26] = 0; | ||
97 | |||
98 | static inline int elf_core_copy_fpregs(struct task_struct *t, | ||
99 | elf_fpregset_t *fpu) | ||
100 | { | ||
101 | int cpu = current_thread->cpu; | ||
102 | return save_fp_registers(userspace_pid[cpu], (unsigned long *) fpu); | ||
103 | } | ||
104 | |||
105 | #define ELF_CORE_COPY_FPREGS(t, fpu) elf_core_copy_fpregs(t, fpu) | ||
106 | |||
67 | #ifdef TIF_IA32 /* XXX */ | 107 | #ifdef TIF_IA32 /* XXX */ |
68 | #error XXX, indeed | 108 | #error XXX, indeed |
69 | clear_thread_flag(TIF_IA32); | 109 | clear_thread_flag(TIF_IA32); |