diff options
-rw-r--r-- | usr.bin/oemu/cpu.c | 6 | ||||
-rw-r--r-- | usr.bin/oemu/include/oemu/osmx64.h | 1 |
2 files changed, 7 insertions, 0 deletions
diff --git a/usr.bin/oemu/cpu.c b/usr.bin/oemu/cpu.c index 9b8c622..8ec106a 100644 --- a/usr.bin/oemu/cpu.c +++ b/usr.bin/oemu/cpu.c @@ -163,6 +163,12 @@ cpu_kick(struct oemu_cpu *cpu, struct sysmem *mem) break; } + /* Is this a halt instruction? */ + if (inst->opcode == INST_HLT) { + printf("HALTED\n"); + break; + } + if (regs->ip >= MEMORY_SIZE) { break; } diff --git a/usr.bin/oemu/include/oemu/osmx64.h b/usr.bin/oemu/include/oemu/osmx64.h index d7ea8b1..e9baae0 100644 --- a/usr.bin/oemu/include/oemu/osmx64.h +++ b/usr.bin/oemu/include/oemu/osmx64.h @@ -47,6 +47,7 @@ #define INST_SLL 0x11 /* Shift left logical operation */ #define INST_SRL 0x12 /* Shift right logical operation */ #define INST_MOV_IMM 0x13 /* Data move operation from IMM */ +#define INST_HLT 0x14 /* Halt */ /* Registers */ #define REG_X0 0x00 |