summaryrefslogtreecommitdiff
path: root/usr.bin/oemu/cpu.c
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-07-21 09:18:51 -0400
committerIan Moffett <ian@osmora.org>2025-07-21 09:18:51 -0400
commitcf0acae537a4664948485bc9e9a370fe7d100803 (patch)
tree5575808d7a7431f4eb3827b7d3d8e7da11e52002 /usr.bin/oemu/cpu.c
parent3ab5f07bac34bc9de5b9038407353c707f3f4c2f (diff)
oemu: cpu: Decode and process HLT instruction
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'usr.bin/oemu/cpu.c')
-rw-r--r--usr.bin/oemu/cpu.c6
1 files changed, 6 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;
}