Add cmp_eax_imm32(0x3d) instruction

This commit is contained in:
tuz358
2018-03-06 11:44:20 +09:00
parent e38ea011d0
commit b460334d25
2 changed files with 11 additions and 0 deletions

View File

@@ -43,6 +43,7 @@ public:
void xor_r32_rm32(); // 0x33
void xor_eax_imm32(); // 0x35
void cmp_rm32_r32(); // 0x39
void cmp_eax_imm32(); // 0x3d
void inc_eax(); // 0x40
void inc_ecx(); // 0x41
void inc_edx(); // 0x42

View File

@@ -36,6 +36,8 @@ void Instructions::init_instructions(){
this->instructions[0x33] = &Instructions::xor_r32_rm32;
this->instructions[0x35] = &Instructions::xor_eax_imm32;
this->instructions[0x39] = &Instructions::cmp_rm32_r32;
this->instructions[0x3b] = &Instructions::cmp_rm32_r32;
this->instructions[0x3d] = &Instructions::cmp_eax_imm32;
this->instructions[0x40] = &Instructions::inc_eax;
this->instructions[0x41] = &Instructions::inc_ecx;
this->instructions[0x42] = &Instructions::inc_edx;
@@ -694,6 +696,14 @@ void Instructions::cmp_rm32_r32(){
}
}
void Instructions::cmp_eax_imm32(){
this->eip++;
uint32_t imm32 = memory.read_uint32(this->eip);
imm32 = swap_endian32(imm32);
uint32_t result = this->registers[0] - imm32;
set_flag(!result, ZF);
}
void Instructions::inc_eax(){
//printf("inc_eax called.\n");
this->registers[0]++;