From f697c519728ff7dbbe3acdccfe046d8bd74bd87f Mon Sep 17 00:00:00 2001 From: tuz358 Date: Mon, 12 Mar 2018 12:50:26 +0900 Subject: [PATCH] Add adc_eax_imm32(0x15) instruction --- include/instructions.h | 1 + instructions.cpp | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/include/instructions.h b/include/instructions.h index ce01a1d..46768eb 100644 --- a/include/instructions.h +++ b/include/instructions.h @@ -36,6 +36,7 @@ public: void or_eax_imm32(); // 0x0d void adc_rm32_r32(); // 0x11 void adc_r32_rm32(); // 0x13 + void adc_eax_imm32(); // 0x15 void and_rm32_r32(); // 0x21 void and_r32_rm32(); // 0x23 void and_eax_imm32(); // 0x25 diff --git a/instructions.cpp b/instructions.cpp index 2f13fb7..b27c2b6 100644 --- a/instructions.cpp +++ b/instructions.cpp @@ -28,6 +28,7 @@ void Instructions::init_instructions(){ this->instructions[0x0d] = &Instructions::or_eax_imm32; this->instructions[0x11] = &Instructions::adc_rm32_r32; this->instructions[0x13] = &Instructions::adc_r32_rm32; + this->instructions[0x15] = &Instructions::adc_eax_imm32; this->instructions[0x21] = &Instructions::and_rm32_r32; this->instructions[0x23] = &Instructions::and_r32_rm32; this->instructions[0x25] = &Instructions::and_eax_imm32; @@ -433,6 +434,13 @@ void Instructions::adc_r32_rm32(){ } } +void Instructions::adc_eax_imm32(){ + this->eip++; + uint32_t imm32 = memory.read_uint32(this->eip); + imm32 = swap_endian32(imm32); + this->registers[0] += imm32 + CF; +} + void Instructions::and_rm32_r32(){ //printf("and_rm32_r32 called.\n"); uint32_t addr, dst, imm32;