From 7d0bda78ce92f8c9cba4ec3b3e55faee79f3b8b7 Mon Sep 17 00:00:00 2001 From: tuz358 Date: Tue, 13 Mar 2018 11:04:09 +0900 Subject: [PATCH] Add sbb_eax_imm32(0x1d) instruction --- include/instructions.h | 1 + instructions.cpp | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/include/instructions.h b/include/instructions.h index 05c1e7d..f02828a 100644 --- a/include/instructions.h +++ b/include/instructions.h @@ -39,6 +39,7 @@ public: void adc_eax_imm32(); // 0x15 void sbb_rm32_r32(); // 0x19 void sbb_r32_rm32(); // 0x1b + void sbb_eax_imm32(); // 0x1d void and_rm32_r32(); // 0x21 void and_r32_rm32(); // 0x23 void and_eax_imm32(); // 0x25 diff --git a/instructions.cpp b/instructions.cpp index 7e3a85c..28a2e32 100644 --- a/instructions.cpp +++ b/instructions.cpp @@ -31,6 +31,7 @@ void Instructions::init_instructions(){ this->instructions[0x15] = &Instructions::adc_eax_imm32; this->instructions[0x19] = &Instructions::sbb_rm32_r32; this->instructions[0x1b] = &Instructions::sbb_r32_rm32; + this->instructions[0x1d] = &Instructions::sbb_eax_imm32; this->instructions[0x21] = &Instructions::and_rm32_r32; this->instructions[0x23] = &Instructions::and_r32_rm32; this->instructions[0x25] = &Instructions::and_eax_imm32; @@ -543,6 +544,13 @@ void Instructions::sbb_r32_rm32(){ } } +void Instructions::sbb_eax_imm32(){ + this->eip++; + uint32_t imm32 = memory.read_uint32(this->eip); + imm32 = swap_endian32(imm32); + this->registers[0] -= imm32 + get_flag(CF); +} + void Instructions::and_rm32_r32(){ //printf("and_rm32_r32 called.\n"); uint32_t addr, dst, imm32;