diff options
author | Andreas Kling <kling@serenityos.org> | 2020-07-11 17:12:21 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-07-11 17:12:21 +0200 |
commit | 55d2bd9eec204224052b0a3a677b4f8f66d35879 (patch) | |
tree | ff162931dc0a0c342cd399d6b2bb77245d8e4942 /DevTools | |
parent | 42787ae3097d021e003ec0d6b7c0c320424675ee (diff) | |
download | serenity-55d2bd9eec204224052b0a3a677b4f8f66d35879.zip |
UserspaceEmulator: Implement short-range jump instructions
Diffstat (limited to 'DevTools')
-rw-r--r-- | DevTools/UserspaceEmulator/SoftCPU.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/DevTools/UserspaceEmulator/SoftCPU.cpp b/DevTools/UserspaceEmulator/SoftCPU.cpp index 5a187d271c..1c6c89c578 100644 --- a/DevTools/UserspaceEmulator/SoftCPU.cpp +++ b/DevTools/UserspaceEmulator/SoftCPU.cpp @@ -587,9 +587,20 @@ void SoftCPU::JMP_imm16(const X86::Instruction&) { TODO(); } void SoftCPU::JMP_imm16_imm16(const X86::Instruction&) { TODO(); } void SoftCPU::JMP_imm16_imm32(const X86::Instruction&) { TODO(); } void SoftCPU::JMP_imm32(const X86::Instruction&) { TODO(); } -void SoftCPU::JMP_short_imm8(const X86::Instruction&) { TODO(); } + +void SoftCPU::JMP_short_imm8(const X86::Instruction& insn) +{ + set_eip(eip() + (i8)insn.imm8()); +} + void SoftCPU::Jcc_NEAR_imm(const X86::Instruction&) { TODO(); } -void SoftCPU::Jcc_imm8(const X86::Instruction&) { TODO(); } + +void SoftCPU::Jcc_imm8(const X86::Instruction& insn) +{ + if (evaluate_condition(insn.cc())) + set_eip(eip() + (i8)insn.imm8()); +} + void SoftCPU::LAHF(const X86::Instruction&) { TODO(); } void SoftCPU::LAR_reg16_RM16(const X86::Instruction&) { TODO(); } void SoftCPU::LAR_reg32_RM32(const X86::Instruction&) { TODO(); } |