Add sub_eax_imm32(0x2d) instruction

This commit is contained in:
tuz358
2018-03-06 11:19:45 +09:00
parent 700b19eae7
commit 9c186fd247
2 changed files with 9 additions and 0 deletions

View File

@@ -38,6 +38,7 @@ public:
void and_eax_imm32(); // 0x25 void and_eax_imm32(); // 0x25
void sub_rm32_r32(); // 0x29 void sub_rm32_r32(); // 0x29
void sub_r32_rm32(); // 0x2b void sub_r32_rm32(); // 0x2b
void sub_eax_imm32(); // 0x2d
void xor_rm32_r32(); // 0x31 void xor_rm32_r32(); // 0x31
void inc_eax(); // 0x40 void inc_eax(); // 0x40
void inc_ecx(); // 0x41 void inc_ecx(); // 0x41

View File

@@ -31,6 +31,7 @@ void Instructions::init_instructions(){
this->instructions[0x25] = &Instructions::and_eax_imm32; this->instructions[0x25] = &Instructions::and_eax_imm32;
this->instructions[0x29] = &Instructions::sub_rm32_r32; this->instructions[0x29] = &Instructions::sub_rm32_r32;
this->instructions[0x2b] = &Instructions::sub_r32_rm32; this->instructions[0x2b] = &Instructions::sub_r32_rm32;
this->instructions[0x2d] = &Instructions::sub_eax_imm32;
this->instructions[0x31] = &Instructions::xor_rm32_r32; this->instructions[0x31] = &Instructions::xor_rm32_r32;
this->instructions[0x40] = &Instructions::inc_eax; this->instructions[0x40] = &Instructions::inc_eax;
this->instructions[0x41] = &Instructions::inc_ecx; this->instructions[0x41] = &Instructions::inc_ecx;
@@ -524,6 +525,13 @@ void Instructions::sub_r32_rm32(){
} }
} }
void Instructions::sub_eax_imm32(){
this->eip++;
uint32_t imm32 = memory.read_uint32(this->eip);
imm32 = swap_endian32(imm32);
this->registers[0] -= imm32;
}
void Instructions::xor_rm32_r32(){ void Instructions::xor_rm32_r32(){
//printf("xor_rm32_r32 called.\n"); //printf("xor_rm32_r32 called.\n");
uint32_t addr, dst, imm32; uint32_t addr, dst, imm32;