From 602c77d570fff666c430e1044f7de91e768bbf10 Mon Sep 17 00:00:00 2001 From: tuz358 Date: Mon, 5 Mar 2018 18:02:01 +0900 Subject: [PATCH] Add mov_edi_imm32(0xbf) instruction --- include/instructions.h | 1 + instructions.cpp | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/include/instructions.h b/include/instructions.h index 3c0bd35..18de43d 100644 --- a/include/instructions.h +++ b/include/instructions.h @@ -41,6 +41,7 @@ public: void mov_esp_imm32(); // 0xbc void mov_ebp_imm32(); // 0xbd void mov_esi_imm32(); // 0xbe + void mov_edi_imm32(); // 0xbf void jmp_imm8(); // 0xeb void hlt(); // 0xf4 void opcode_ff(); // 0xff diff --git a/instructions.cpp b/instructions.cpp index 958dcf0..46d87cd 100644 --- a/instructions.cpp +++ b/instructions.cpp @@ -34,6 +34,7 @@ void Instructions::init_instructions(){ this->instructions[0xbc] = &Instructions::mov_esp_imm32; this->instructions[0xbd] = &Instructions::mov_ebp_imm32; this->instructions[0xbe] = &Instructions::mov_esi_imm32; + this->instructions[0xbf] = &Instructions::mov_edi_imm32; this->instructions[0xeb] = &Instructions::jmp_imm8; this->instructions[0xf4] = &Instructions::hlt; this->instructions[0xff] = &Instructions::opcode_ff; @@ -300,6 +301,15 @@ void Instructions::mov_esi_imm32(){ this->eip += 4; } +void Instructions::mov_edi_imm32(){ + //printf("mov_edi_imm32 called.\n"); + + uint32_t imm32 = memory.read_uint32(this->eip); + imm32 = swap_endian32(imm32); + this->registers[7] = imm32; + this->eip += 4; +} + void Instructions::jmp_imm8() { //printf("jmp_imm8 called.\n");