diff options
author | Jeff Dike <jdike@addtoit.com> | 2007-08-31 02:56:20 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-08-31 04:42:22 -0400 |
commit | d1254b12c93e1e586137a2ffef71fd33cf273f35 (patch) | |
tree | b122f08030c920608996eb52cce1068030ffd3b6 /include/asm-um | |
parent | c7ec16da5adc1c1b341b2a83bde7add17dcf811a (diff) |
uml: fix x86_64 core dump crash
Stop UML crashing when trying to dump a process core on x86_64. This is the
minimal fix to stop the crash - more things are broken here, and patches are
forthcoming.
The immediate thing to do is define ELF_CORE_COPY_REGS and
ELF_CORE_COPY_FPREGS. Defining ELF_CORE_COPY_FPREGS allows dump_fpu to go
away. It is defined in terms of save_fp_registers, so that needs to be added.
Signed-off-by: Jeff Dike <jdike@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/asm-um')
-rw-r--r-- | include/asm-um/elf-x86_64.h | 40 |
1 files changed, 40 insertions, 0 deletions
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); |