summaryrefslogtreecommitdiff
path: root/usr.bin/oemu/cpu.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/oemu/cpu.c')
-rw-r--r--usr.bin/oemu/cpu.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/usr.bin/oemu/cpu.c b/usr.bin/oemu/cpu.c
index 5a2c761..fefdd4c 100644
--- a/usr.bin/oemu/cpu.c
+++ b/usr.bin/oemu/cpu.c
@@ -408,6 +408,13 @@ cpu_kick(struct oemu_cpu *cpu, struct sysmem *mem)
break;
}
+ /*
+ * X0 is readonly and should always be zero, undo
+ * any writes or side effects from any operations
+ * upon this register.
+ */
+ regs->xreg[0] = 0;
+
/* Is this a halt instruction? */
if (inst->opcode == INST_HLT) {
printf("HALTED\n");