diff options
Diffstat (limited to 'usr.bin/oemu')
-rw-r--r-- | usr.bin/oemu/cpu.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/usr.bin/oemu/cpu.c b/usr.bin/oemu/cpu.c index 5a2c761..49d4671 100644 --- a/usr.bin/oemu/cpu.c +++ b/usr.bin/oemu/cpu.c @@ -377,6 +377,10 @@ cpu_kick(struct oemu_cpu *cpu, struct sysmem *mem) inst = (inst_t *)&memp[regs->ip]; switch (inst->opcode) { + case INST_NOP: + /* NOP */ + regs->ip += sizeof(*inst); + continue; case INST_MOV_IMM: cpu_mov_imm(cpu, inst); break; @@ -408,6 +412,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"); |