diff --git a/linux-user/elfload.c b/linux-user/elfload.c index b17cf64a4b..78dcf6500c 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -725,6 +725,35 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i regs->pc = infop->entry; } +/* See linux kernel: arch/m68k/include/asm/elf.h. */ +#define ELF_NREG 20 +typedef target_elf_greg_t target_elf_gregset_t[ELF_NREG]; + +static void elf_core_copy_regs(target_elf_gregset_t *regs, const CPUState *env) +{ + (*regs)[0] = tswapl(env->dregs[1]); + (*regs)[1] = tswapl(env->dregs[2]); + (*regs)[2] = tswapl(env->dregs[3]); + (*regs)[3] = tswapl(env->dregs[4]); + (*regs)[4] = tswapl(env->dregs[5]); + (*regs)[5] = tswapl(env->dregs[6]); + (*regs)[6] = tswapl(env->dregs[7]); + (*regs)[7] = tswapl(env->aregs[0]); + (*regs)[8] = tswapl(env->aregs[1]); + (*regs)[9] = tswapl(env->aregs[2]); + (*regs)[10] = tswapl(env->aregs[3]); + (*regs)[11] = tswapl(env->aregs[4]); + (*regs)[12] = tswapl(env->aregs[5]); + (*regs)[13] = tswapl(env->aregs[6]); + (*regs)[14] = tswapl(env->dregs[0]); + (*regs)[15] = tswapl(env->aregs[7]); + (*regs)[16] = tswapl(env->dregs[0]); /* FIXME: orig_d0 */ + (*regs)[17] = tswapl(env->sr); + (*regs)[18] = tswapl(env->pc); + (*regs)[19] = 0; /* FIXME: regs->format | regs->vector */ +} + +#define USE_ELF_CORE_DUMP #define ELF_EXEC_PAGESIZE 8192 #endif