diff options
author | Ian Moffett <ian@osmora.org> | 2025-07-22 02:59:19 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2025-07-22 02:59:19 -0400 |
commit | cf3b1238d3ebdf6184a9977ee6e0d3057313444c (patch) | |
tree | 63e0e85528410bd643f6fe17ead02611a510176e | |
parent | 8b7558a31bd06d815b138661be0af543cd596ec5 (diff) |
oemu: cpu: Add CPU register dump
Signed-off-by: Ian Moffett <ian@osmora.org>
-rw-r--r-- | usr.bin/oemu/cpu.c | 27 | ||||
-rw-r--r-- | usr.bin/oemu/include/oemu/cpu.h | 1 |
2 files changed, 28 insertions, 0 deletions
diff --git a/usr.bin/oemu/cpu.c b/usr.bin/oemu/cpu.c index 5689953..58dd134 100644 --- a/usr.bin/oemu/cpu.c +++ b/usr.bin/oemu/cpu.c @@ -210,6 +210,31 @@ cpu_reset(struct oemu_cpu *cpu) memset(regs->xreg, 0x0, sizeof(regs->xreg)); } +void +cpu_regdump(struct oemu_cpu *cpu) +{ + struct cpu_regs *regs; + + regs = &cpu->regs; + printf( + "X0=%p, X1=%p, X2=%p\n" + "X3=%p, X4=%p, X5=%p\n" + "X6=%p, X7=%p, X8=%p\n" + "X9=%p, X10=%p, X11=%p\n" + "X12=%p, X13=%p, X14=%p\n" + "X15=%p, IP=%p\n", + regs->xreg[0], regs->xreg[1], + regs->xreg[2], regs->xreg[3], + regs->xreg[4], regs->xreg[5], + regs->xreg[6], regs->xreg[7], + regs->xreg[8], regs->xreg[9], + regs->xreg[10], regs->xreg[11], + regs->xreg[12], regs->xreg[13], + regs->xreg[14], regs->xreg[15], + regs->ip + ); +} + /* * Main instruction execution loop. */ @@ -259,4 +284,6 @@ cpu_kick(struct oemu_cpu *cpu, struct sysmem *mem) regs->ip += sizeof(*inst); } + + cpu_regdump(cpu); } diff --git a/usr.bin/oemu/include/oemu/cpu.h b/usr.bin/oemu/include/oemu/cpu.h index df4cc80..78b92da 100644 --- a/usr.bin/oemu/include/oemu/cpu.h +++ b/usr.bin/oemu/include/oemu/cpu.h @@ -63,6 +63,7 @@ struct oemu_cpu { struct cpu_regs regs; }; +void cpu_regdump(struct oemu_cpu *cpu); void cpu_reset(struct oemu_cpu *cpu); void cpu_kick(struct oemu_cpu *cpu, struct sysmem *mem); |