From 782dc3d046007c25b32aae0fc1c4e23cd26420ed Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sun, 3 Jan 2021 19:37:37 -0500 Subject: [PATCH] Distinguishes inter- and intra-segment RET. --- Processors/Decoders/x86/x86.cpp | 3 +++ Processors/Decoders/x86/x86.hpp | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Processors/Decoders/x86/x86.cpp b/Processors/Decoders/x86/x86.cpp index 403841d3a..9eb37f99b 100644 --- a/Processors/Decoders/x86/x86.cpp +++ b/Processors/Decoders/x86/x86.cpp @@ -182,6 +182,9 @@ Instruction Decoder::decode(uint8_t *source, size_t length) { MapRegData(0xbc, MOV, true, SP); MapRegData(0xbd, MOV, true, BP); MapRegData(0xbe, MOV, true, SI); MapRegData(0xbf, MOV, true, DI); + MapComplete(0xc3, RETIntra, None, None); + MapComplete(0xcb, RETInter, None, None); + // Other prefix bytes. case 0xf0: lock_ = true; break; case 0xf2: repetition_ = Repetition::RepNE; break; diff --git a/Processors/Decoders/x86/x86.hpp b/Processors/Decoders/x86/x86.hpp index 3661aa834..f123eb025 100644 --- a/Processors/Decoders/x86/x86.hpp +++ b/Processors/Decoders/x86/x86.hpp @@ -37,9 +37,12 @@ enum class Operation: uint8_t { JMP, JCXZ, LAHF, LDS, LEA, LODS, LOOPE, LOOPNE, MOV, MOVS, MUL, NEG, NOP, NOT, OR, OUT, - POP, POPF, PUSH, PUSHF, RCL, RCR, REP, RET, ROL, ROR, SAHF, + POP, POPF, PUSH, PUSHF, RCL, RCR, REP, ROL, ROR, SAHF, SAR, SBB, SCAS, SHL, SHR, STC, STD, STI, STOS, SUB, TEST, - WAIT, XCHG, XLAT, XOR + WAIT, XCHG, XLAT, XOR, + + RETInter, + RETIntra, }; enum class Size: uint8_t {