From 7b49d17f90f26394a116348befb5edcdffcedcb6 Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Sat, 17 Oct 2020 17:37:50 +0200 Subject: Add ret and int --- intel.cpp | 33 --------------------------------- 1 file changed, 33 deletions(-) (limited to 'intel.cpp') diff --git a/intel.cpp b/intel.cpp index 9dac6c0..9f24f1d 100644 --- a/intel.cpp +++ b/intel.cpp @@ -22,17 +22,6 @@ using namespace std::placeholders; namespace { - // binary code operators - std::vector operator+(std::vector a, const std::vector& b) { - a.insert(a.end(), b.begin(), b.end()); - return a; - } - - std::vector operator+(std::vector a, const uint8_t& b) { - a.push_back(b); - return a; - } - // REX prefix: 0b0100WRXB std::vector REX(std::string s) { uint8_t result{0b01000000}; @@ -166,23 +155,6 @@ namespace { // Call Procedure {"call", std::bind(op_jmp, _1, OP_T{}, OP_T{ 0xE8 })}, - // Interrupt - {"int", [](const std::vector& sl) -> InstructionCodeList { - if (sl.size() == 2) { - if (sl[1].value == "0") { // INT 0 - return { { std::vector{ 0xCE }} }; - } else if (sl[1].value == "1") { // INT 1 - return { { std::vector{ 0xF1 }} }; - } else if (sl[1].value == "3") { // INT 3 - return { { std::vector{ 0xCC }} }; - } else { // INT <...> - return { { std::vector{ 0xCD } +imm8(sl[2].value) } }; - } - } - - // ... TODO - throw std::runtime_error("Unknown command: "s + sl[0].value); - }}, // Unconditional Jump {"jmp", std::bind(op_jmp, _1, OP_T{ 0xEB }, OP_T{ 0xE9 })}, @@ -231,11 +203,6 @@ namespace { throw std::runtime_error("Unknown command: "s + sl[0].value); }}, - // Return from procedure - { "ret", [](const std::vector& sl) -> InstructionCodeList { - return {{ std::vector{ 0xC3 }, {}}}; // near return; TODO: far return is 0xCB - }}, - { "xor", [](const std::vector& sl) -> InstructionCodeList { if (sl.size() == 3) { return { { std::vector{ 0x33 } + ModRM(sl[1].value, sl[2].value) } }; // r8, r/m8: ModRM:reg (w), ModRM:r/m (r) -- cgit v1.2.3