aboutsummaryrefslogtreecommitdiff
path: root/linux-user
diff options
context:
space:
mode:
authorNathan Froyd <froydnj@codesourcery.com>2009-12-11 09:04:51 -0800
committerAurelien Jarno <aurelien@aurel32.net>2009-12-19 20:29:18 +0100
commit7631c97ec9648da7b3420a925e8d95e8bd3f444e (patch)
tree8d931b75af5843697884af90037b90817b16b071 /linux-user
parent7a93cc55e9af661949cb9a56866b5652667294c9 (diff)
linux-user: add core dump support for SH
Signed-off-by: Nathan Froyd <froydnj@codesourcery.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Diffstat (limited to 'linux-user')
-rw-r--r--linux-user/elfload.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 78dcf6500c..b90604b447 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -682,6 +682,39 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i
regs->regs[15] = infop->start_stack;
}
+/* See linux kernel: arch/sh/include/asm/elf.h. */
+#define ELF_NREG 23
+typedef target_elf_greg_t target_elf_gregset_t[ELF_NREG];
+
+/* See linux kernel: arch/sh/include/asm/ptrace.h. */
+enum {
+ TARGET_REG_PC = 16,
+ TARGET_REG_PR = 17,
+ TARGET_REG_SR = 18,
+ TARGET_REG_GBR = 19,
+ TARGET_REG_MACH = 20,
+ TARGET_REG_MACL = 21,
+ TARGET_REG_SYSCALL = 22
+};
+
+static inline void elf_core_copy_regs(target_elf_gregset_t *regs, const CPUState *env)
+{
+ int i;
+
+ for (i = 0; i < 16; i++) {
+ (*regs[i]) = tswapl(env->gregs[i]);
+ }
+
+ (*regs)[TARGET_REG_PC] = tswapl(env->pc);
+ (*regs)[TARGET_REG_PR] = tswapl(env->pr);
+ (*regs)[TARGET_REG_SR] = tswapl(env->sr);
+ (*regs)[TARGET_REG_GBR] = tswapl(env->gbr);
+ (*regs)[TARGET_REG_MACH] = tswapl(env->mach);
+ (*regs)[TARGET_REG_MACL] = tswapl(env->macl);
+ (*regs)[TARGET_REG_SYSCALL] = 0; /* FIXME */
+}
+
+#define USE_ELF_CORE_DUMP
#define ELF_EXEC_PAGESIZE 4096
#endif