From 029fe56d69cc35a5ae7997b11b8f415bf95bb239 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Wed, 15 Jul 2020 17:16:11 +0200 Subject: [PATCH] UserspaceEmulator: Implement the 32-bit BSWAP instruction :^) --- DevTools/UserspaceEmulator/SoftCPU.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/DevTools/UserspaceEmulator/SoftCPU.cpp b/DevTools/UserspaceEmulator/SoftCPU.cpp index e20a2bbcef..1deeeec984 100644 --- a/DevTools/UserspaceEmulator/SoftCPU.cpp +++ b/DevTools/UserspaceEmulator/SoftCPU.cpp @@ -726,7 +726,12 @@ void SoftCPU::BSF_reg16_RM16(const X86::Instruction&) { TODO(); } void SoftCPU::BSF_reg32_RM32(const X86::Instruction&) { TODO(); } void SoftCPU::BSR_reg16_RM16(const X86::Instruction&) { TODO(); } void SoftCPU::BSR_reg32_RM32(const X86::Instruction&) { TODO(); } -void SoftCPU::BSWAP_reg32(const X86::Instruction&) { TODO(); } + +void SoftCPU::BSWAP_reg32(const X86::Instruction& insn) +{ + gpr32(insn.reg32()) = __builtin_bswap32(gpr32(insn.reg32())); +} + void SoftCPU::BTC_RM16_imm8(const X86::Instruction&) { TODO(); } void SoftCPU::BTC_RM16_reg16(const X86::Instruction&) { TODO(); } void SoftCPU::BTC_RM32_imm8(const X86::Instruction&) { TODO(); }