[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 5/7] linux-user: add core dump support for MIPS
From: |
Nathan Froyd |
Subject: |
[Qemu-devel] [PATCH 5/7] linux-user: add core dump support for MIPS |
Date: |
Fri, 11 Dec 2009 09:04:49 -0800 |
Signed-off-by: Nathan Froyd <address@hidden>
---
linux-user/elfload.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 46 insertions(+), 0 deletions(-)
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 97dc3a7..eb89f5f 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -594,6 +594,52 @@ static inline void init_thread(struct target_pt_regs
*regs, struct image_info *i
regs->regs[29] = infop->start_stack;
}
+/* See linux kernel: arch/mips/include/asm/elf.h. */
+#define ELF_NREG 45
+typedef target_elf_greg_t target_elf_gregset_t[ELF_NREG];
+
+/* See linux kernel: arch/mips/include/asm/reg.h. */
+enum {
+#ifdef TARGET_MIPS64
+ TARGET_EF_R0 = 0,
+#else
+ TARGET_EF_R0 = 6,
+#endif
+ TARGET_EF_R26 = TARGET_EF_R0 + 26,
+ TARGET_EF_R27 = TARGET_EF_R0 + 27,
+ TARGET_EF_LO = TARGET_EF_R0 + 32,
+ TARGET_EF_HI = TARGET_EF_R0 + 33,
+ TARGET_EF_CP0_EPC = TARGET_EF_R0 + 34,
+ TARGET_EF_CP0_BADVADDR = TARGET_EF_R0 + 35,
+ TARGET_EF_CP0_STATUS = TARGET_EF_R0 + 36,
+ TARGET_EF_CP0_CAUSE = TARGET_EF_R0 + 37
+};
+
+/* See linux kernel: arch/mips/kernel/process.c:elf_dump_regs. */
+static void elf_core_copy_regs(target_elf_gregset_t *regs, const CPUState *env)
+{
+ int i;
+
+ for (i = 0; i < TARGET_EF_R0; i++) {
+ (*regs)[i] = 0;
+ }
+ (*regs)[TARGET_EF_R0] = 0;
+
+ for (i = 1; i < ARRAY_SIZE(env->active_tc.gpr); i++) {
+ (*regs)[TARGET_EF_R0 + i] = tswapl(env->active_tc.gpr[i]);
+ }
+
+ (*regs)[TARGET_EF_R26] = 0;
+ (*regs)[TARGET_EF_R27] = 0;
+ (*regs)[TARGET_EF_LO] = tswapl(env->active_tc.LO[0]);
+ (*regs)[TARGET_EF_HI] = tswapl(env->active_tc.HI[0]);
+ (*regs)[TARGET_EF_CP0_EPC] = tswapl(env->active_tc.PC);
+ (*regs)[TARGET_EF_CP0_BADVADDR] = tswapl(env->CP0_BadVAddr);
+ (*regs)[TARGET_EF_CP0_STATUS] = tswapl(env->CP0_Status);
+ (*regs)[TARGET_EF_CP0_CAUSE] = tswapl(env->CP0_Cause);
+}
+
+#define USE_ELF_CORE_DUMP
#define ELF_EXEC_PAGESIZE 4096
#endif /* TARGET_MIPS */
--
1.6.3.2
- [Qemu-devel] [PATCH 0/7] linux-user: core dump enhancements, Nathan Froyd, 2009/12/11
- [Qemu-devel] [PATCH 6/7] linux-user: add core dump support for M68K, Nathan Froyd, 2009/12/11
- [Qemu-devel] [PATCH 1/7] linux-user: fix ELF_USE_CORE_DUMP/USE_ELF_CORE_DUMP confusion, Nathan Froyd, 2009/12/11
- [Qemu-devel] [PATCH 5/7] linux-user: add core dump support for MIPS,
Nathan Froyd <=
- [Qemu-devel] [PATCH 7/7] linux-user: add core dump support for SH, Nathan Froyd, 2009/12/11
- [Qemu-devel] [PATCH 3/7] linux-user: fix ARM core dumps on opposite-endian hosts, Nathan Froyd, 2009/12/11
- [Qemu-devel] [PATCH 2/7] linux-user: commonify definitions of target typedefs, Nathan Froyd, 2009/12/11
- [Qemu-devel] [PATCH 4/7] linux-user: add core dump support for PPC, Nathan Froyd, 2009/12/11