From dba6f9b24b020462de312b51631d26d2d70cf5dc Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 13 Jul 2020 13:40:45 +0200 Subject: [PATCH] UserspaceEmulator: Add the NOT instruction (with bonus: NOP!) --- DevTools/UserspaceEmulator/SoftCPU.cpp | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/DevTools/UserspaceEmulator/SoftCPU.cpp b/DevTools/UserspaceEmulator/SoftCPU.cpp index 2ddc1ccac4..02cdb3f9c7 100644 --- a/DevTools/UserspaceEmulator/SoftCPU.cpp +++ b/DevTools/UserspaceEmulator/SoftCPU.cpp @@ -1272,10 +1272,25 @@ void SoftCPU::NEG_RM8(const X86::Instruction& insn) insn.modrm().write8(*this, insn, op_sub(*this, 0, insn.modrm().read8(*this, insn))); } -void SoftCPU::NOP(const X86::Instruction&) { TODO(); } -void SoftCPU::NOT_RM16(const X86::Instruction&) { TODO(); } -void SoftCPU::NOT_RM32(const X86::Instruction&) { TODO(); } -void SoftCPU::NOT_RM8(const X86::Instruction&) { TODO(); } +void SoftCPU::NOP(const X86::Instruction&) +{ +} + +void SoftCPU::NOT_RM16(const X86::Instruction& insn) +{ + insn.modrm().write16(*this, insn, ~insn.modrm().read16(*this, insn)); +} + +void SoftCPU::NOT_RM32(const X86::Instruction& insn) +{ + insn.modrm().write32(*this, insn, ~insn.modrm().read32(*this, insn)); +} + +void SoftCPU::NOT_RM8(const X86::Instruction& insn) +{ + insn.modrm().write8(*this, insn, ~insn.modrm().read8(*this, insn)); +} + void SoftCPU::OUTSB(const X86::Instruction&) { TODO(); } void SoftCPU::OUTSD(const X86::Instruction&) { TODO(); } void SoftCPU::OUTSW(const X86::Instruction&) { TODO(); }