parent
4c3a867bf1
commit
eb45b315b6
|
@ -1,7 +1,7 @@
|
|||
//: operating on memory at the address provided by some register
|
||||
//: we'll now start providing data in a separate segment
|
||||
|
||||
void test_add_r32_to_mem_at_r32() {
|
||||
void test_add_r32_to_mem_at_rm32() {
|
||||
Reg[EBX].i = 0x10;
|
||||
Reg[EAX].i = 0x2000;
|
||||
run(
|
||||
|
@ -36,7 +36,7 @@ case 0: // indirect addressing
|
|||
put_new(Name, "03", "add rm32 to r32 (add)");
|
||||
|
||||
:(code)
|
||||
void test_add_mem_at_r32_to_r32() {
|
||||
void test_add_mem_at_rm32_to_r32() {
|
||||
Reg[EAX].i = 0x2000;
|
||||
Reg[EBX].i = 0x10;
|
||||
run(
|
||||
|
@ -77,7 +77,7 @@ case 0x03: { // add r/m32 to r32
|
|||
}
|
||||
|
||||
:(code)
|
||||
void test_add_mem_at_r32_to_r32_signed_overflow() {
|
||||
void test_add_mem_at_rm32_to_r32_signed_overflow() {
|
||||
Reg[EAX].i = 0x2000;
|
||||
Reg[EBX].i = 0x7fffffff; // largest positive signed integer
|
||||
run(
|
||||
|
@ -97,7 +97,7 @@ void test_add_mem_at_r32_to_r32_signed_overflow() {
|
|||
);
|
||||
}
|
||||
|
||||
void test_add_mem_at_r32_to_r32_unsigned_overflow() {
|
||||
void test_add_mem_at_rm32_to_r32_unsigned_overflow() {
|
||||
Reg[EAX].u = 0x2000;
|
||||
Reg[EBX].u = 0xffffffff; // largest unsigned number
|
||||
run(
|
||||
|
@ -117,7 +117,7 @@ void test_add_mem_at_r32_to_r32_unsigned_overflow() {
|
|||
);
|
||||
}
|
||||
|
||||
void test_add_mem_at_r32_to_r32_unsigned_and_signed_overflow() {
|
||||
void test_add_mem_at_rm32_to_r32_unsigned_and_signed_overflow() {
|
||||
Reg[EAX].u = 0x2000;
|
||||
Reg[EBX].u = 0x80000000; // smallest negative signed integer
|
||||
run(
|
||||
|
@ -140,7 +140,7 @@ void test_add_mem_at_r32_to_r32_unsigned_and_signed_overflow() {
|
|||
//:: subtract
|
||||
|
||||
:(code)
|
||||
void test_subtract_r32_from_mem_at_r32() {
|
||||
void test_subtract_r32_from_mem_at_rm32() {
|
||||
Reg[EAX].i = 0x2000;
|
||||
Reg[EBX].i = 1;
|
||||
run(
|
||||
|
@ -164,7 +164,7 @@ void test_subtract_r32_from_mem_at_r32() {
|
|||
put_new(Name, "2b", "subtract rm32 from r32 (sub)");
|
||||
|
||||
:(code)
|
||||
void test_subtract_mem_at_r32_from_r32() {
|
||||
void test_subtract_mem_at_rm32_from_r32() {
|
||||
Reg[EAX].i = 0x2000;
|
||||
Reg[EBX].i = 10;
|
||||
run(
|
||||
|
@ -205,7 +205,7 @@ case 0x2b: { // subtract r/m32 from r32
|
|||
}
|
||||
|
||||
:(code)
|
||||
void test_subtract_mem_at_r32_from_r32_signed_overflow() {
|
||||
void test_subtract_mem_at_rm32_from_r32_signed_overflow() {
|
||||
Reg[EAX].i = 0x2000;
|
||||
Reg[EBX].i = 0x80000000; // smallest negative signed integer
|
||||
run(
|
||||
|
@ -225,7 +225,7 @@ void test_subtract_mem_at_r32_from_r32_signed_overflow() {
|
|||
);
|
||||
}
|
||||
|
||||
void test_subtract_mem_at_r32_from_r32_unsigned_overflow() {
|
||||
void test_subtract_mem_at_rm32_from_r32_unsigned_overflow() {
|
||||
Reg[EAX].i = 0x2000;
|
||||
Reg[EBX].i = 0;
|
||||
run(
|
||||
|
@ -245,7 +245,7 @@ void test_subtract_mem_at_r32_from_r32_unsigned_overflow() {
|
|||
);
|
||||
}
|
||||
|
||||
void test_subtract_mem_at_r32_from_r32_signed_and_unsigned_overflow() {
|
||||
void test_subtract_mem_at_rm32_from_r32_signed_and_unsigned_overflow() {
|
||||
Reg[EAX].i = 0x2000;
|
||||
Reg[EBX].i = 0;
|
||||
run(
|
||||
|
@ -267,7 +267,7 @@ void test_subtract_mem_at_r32_from_r32_signed_and_unsigned_overflow() {
|
|||
|
||||
//:: and
|
||||
:(code)
|
||||
void test_and_r32_with_mem_at_r32() {
|
||||
void test_and_r32_with_mem_at_rm32() {
|
||||
Reg[EAX].i = 0x2000;
|
||||
Reg[EBX].i = 0xff;
|
||||
run(
|
||||
|
@ -291,7 +291,7 @@ void test_and_r32_with_mem_at_r32() {
|
|||
put_new(Name, "23", "r32 = bitwise AND of r32 with rm32 (and)");
|
||||
|
||||
:(code)
|
||||
void test_and_mem_at_r32_with_r32() {
|
||||
void test_and_mem_at_rm32_with_r32() {
|
||||
Reg[EAX].i = 0x2000;
|
||||
Reg[EBX].i = 0x0a0b0c0d;
|
||||
run(
|
||||
|
@ -330,7 +330,7 @@ case 0x23: { // and r/m32 with r32
|
|||
//:: or
|
||||
|
||||
:(code)
|
||||
void test_or_r32_with_mem_at_r32() {
|
||||
void test_or_r32_with_mem_at_rm32() {
|
||||
Reg[EAX].i = 0x2000;
|
||||
Reg[EBX].i = 0xa0b0c0d0;
|
||||
run(
|
||||
|
@ -354,7 +354,7 @@ void test_or_r32_with_mem_at_r32() {
|
|||
put_new(Name, "0b", "r32 = bitwise OR of r32 with rm32 (or)");
|
||||
|
||||
:(code)
|
||||
void test_or_mem_at_r32_with_r32() {
|
||||
void test_or_mem_at_rm32_with_r32() {
|
||||
Reg[EAX].i = 0x2000;
|
||||
Reg[EBX].i = 0xa0b0c0d0;
|
||||
run(
|
||||
|
@ -393,7 +393,7 @@ case 0x0b: { // or r/m32 with r32
|
|||
//:: xor
|
||||
|
||||
:(code)
|
||||
void test_xor_r32_with_mem_at_r32() {
|
||||
void test_xor_r32_with_mem_at_rm32() {
|
||||
Reg[EAX].i = 0x2000;
|
||||
Reg[EBX].i = 0xa0b0c0d0;
|
||||
run(
|
||||
|
@ -416,7 +416,7 @@ void test_xor_r32_with_mem_at_r32() {
|
|||
put_new(Name, "33", "r32 = bitwise XOR of r32 with rm32 (xor)");
|
||||
|
||||
:(code)
|
||||
void test_xor_mem_at_r32_with_r32() {
|
||||
void test_xor_mem_at_rm32_with_r32() {
|
||||
Reg[EAX].i = 0x2000;
|
||||
Reg[EBX].i = 0xa0b0c0d0;
|
||||
run(
|
||||
|
@ -455,7 +455,7 @@ case 0x33: { // xor r/m32 with r32
|
|||
//:: not
|
||||
|
||||
:(code)
|
||||
void test_not_of_mem_at_r32() {
|
||||
void test_not_of_mem_at_rm32() {
|
||||
Reg[EBX].i = 0x2000;
|
||||
run(
|
||||
"== code 0x1\n"
|
||||
|
@ -476,7 +476,7 @@ void test_not_of_mem_at_r32() {
|
|||
//:: compare (cmp)
|
||||
|
||||
:(code)
|
||||
void test_compare_mem_at_r32_with_r32_greater() {
|
||||
void test_compare_mem_at_rm32_with_r32_greater() {
|
||||
Reg[EAX].i = 0x2000;
|
||||
Reg[EBX].i = 0x0a0b0c07;
|
||||
run(
|
||||
|
@ -495,7 +495,7 @@ void test_compare_mem_at_r32_with_r32_greater() {
|
|||
}
|
||||
|
||||
:(code)
|
||||
void test_compare_mem_at_r32_with_r32_lesser() {
|
||||
void test_compare_mem_at_rm32_with_r32_lesser() {
|
||||
Reg[EAX].i = 0x2000;
|
||||
Reg[EBX].i = 0x0a0b0c0d;
|
||||
run(
|
||||
|
@ -514,7 +514,7 @@ void test_compare_mem_at_r32_with_r32_lesser() {
|
|||
}
|
||||
|
||||
:(code)
|
||||
void test_compare_mem_at_r32_with_r32_equal() {
|
||||
void test_compare_mem_at_rm32_with_r32_equal() {
|
||||
Reg[EAX].i = 0x2000;
|
||||
Reg[EBX].i = 0x0a0b0c0d;
|
||||
run(
|
||||
|
@ -672,7 +672,7 @@ void test_compare_r32_with_mem_at_rm32_equal() {
|
|||
|
||||
//:: copy (mov)
|
||||
|
||||
void test_copy_r32_to_mem_at_r32() {
|
||||
void test_copy_r32_to_mem_at_rm32() {
|
||||
Reg[EBX].i = 0xaf;
|
||||
Reg[EAX].i = 0x60;
|
||||
run(
|
||||
|
@ -694,7 +694,7 @@ void test_copy_r32_to_mem_at_r32() {
|
|||
put_new(Name, "8b", "copy rm32 to r32 (mov)");
|
||||
|
||||
:(code)
|
||||
void test_copy_mem_at_r32_to_r32() {
|
||||
void test_copy_mem_at_rm32_to_r32() {
|
||||
Reg[EAX].i = 0x2000;
|
||||
run(
|
||||
"== code 0x1\n"
|
||||
|
@ -724,7 +724,7 @@ case 0x8b: { // copy r32 to r/m32
|
|||
//:: jump
|
||||
|
||||
:(code)
|
||||
void test_jump_mem_at_r32() {
|
||||
void test_jump_mem_at_rm32() {
|
||||
Reg[EAX].i = 0x2000;
|
||||
run(
|
||||
"== code 0x1\n"
|
||||
|
@ -758,7 +758,7 @@ case 4: { // jump to r/m32
|
|||
//:: push
|
||||
|
||||
:(code)
|
||||
void test_push_mem_at_r32() {
|
||||
void test_push_mem_at_rm32() {
|
||||
Reg[EAX].i = 0x2000;
|
||||
Mem.push_back(vma(0xbd000000)); // manually allocate memory
|
||||
Reg[ESP].u = 0xbd000014;
|
||||
|
@ -791,7 +791,7 @@ case 6: { // push r/m32 to stack
|
|||
put_new(Name, "8f", "pop top of stack to rm32 (pop)");
|
||||
|
||||
:(code)
|
||||
void test_pop_mem_at_r32() {
|
||||
void test_pop_mem_at_rm32() {
|
||||
Reg[EAX].i = 0x60;
|
||||
Mem.push_back(vma(0xbd000000)); // manually allocate memory
|
||||
Reg[ESP].u = 0xbd000000;
|
||||
|
@ -854,7 +854,7 @@ case 5: // exception: mod 0b00 rm 0b101 => incoming disp32
|
|||
//:
|
||||
|
||||
:(code)
|
||||
void test_add_r32_to_mem_at_r32_plus_disp8() {
|
||||
void test_add_r32_to_mem_at_rm32_plus_disp8() {
|
||||
Reg[EBX].i = 0x10; // source
|
||||
Reg[EAX].i = 0x1ffe; // dest
|
||||
run(
|
||||
|
@ -894,7 +894,7 @@ case 1: { // indirect + disp8 addressing
|
|||
}
|
||||
|
||||
:(code)
|
||||
void test_add_r32_to_mem_at_r32_plus_negative_disp8() {
|
||||
void test_add_r32_to_mem_at_rm32_plus_negative_disp8() {
|
||||
Reg[EBX].i = 0x10; // source
|
||||
Reg[EAX].i = 0x2001; // dest
|
||||
run(
|
||||
|
@ -916,7 +916,7 @@ void test_add_r32_to_mem_at_r32_plus_negative_disp8() {
|
|||
//:
|
||||
|
||||
:(code)
|
||||
void test_add_r32_to_mem_at_r32_plus_disp32() {
|
||||
void test_add_r32_to_mem_at_rm32_plus_disp32() {
|
||||
Reg[EBX].i = 0x10; // source
|
||||
Reg[EAX].i = 0x1ffe; // dest
|
||||
run(
|
||||
|
@ -956,7 +956,7 @@ case 2: { // indirect + disp32 addressing
|
|||
}
|
||||
|
||||
:(code)
|
||||
void test_add_r32_to_mem_at_r32_plus_negative_disp32() {
|
||||
void test_add_r32_to_mem_at_rm32_plus_negative_disp32() {
|
||||
Reg[EBX].i = 0x10; // source
|
||||
Reg[EAX].i = 0x2001; // dest
|
||||
run(
|
||||
|
|
|
@ -183,7 +183,7 @@ void test_add_imm32_to_r32_unsigned_and_signed_overflow() {
|
|||
//:
|
||||
|
||||
:(code)
|
||||
void test_add_imm32_to_mem_at_r32() {
|
||||
void test_add_imm32_to_mem_at_rm32() {
|
||||
Reg[EBX].i = 0x2000;
|
||||
run(
|
||||
"== code 0x1\n"
|
||||
|
@ -286,7 +286,7 @@ void test_subtract_imm32_from_EAX_signed_and_unsigned_overflow() {
|
|||
|
||||
//:
|
||||
|
||||
void test_subtract_imm32_from_mem_at_r32() {
|
||||
void test_subtract_imm32_from_mem_at_rm32() {
|
||||
Reg[EBX].i = 0x2000;
|
||||
run(
|
||||
"== code 0x1\n"
|
||||
|
@ -326,7 +326,7 @@ case 5: {
|
|||
}
|
||||
|
||||
:(code)
|
||||
void test_subtract_imm32_from_mem_at_r32_signed_overflow() {
|
||||
void test_subtract_imm32_from_mem_at_rm32_signed_overflow() {
|
||||
Reg[EBX].i = 0x2000;
|
||||
run(
|
||||
"== code 0x1\n"
|
||||
|
@ -347,7 +347,7 @@ void test_subtract_imm32_from_mem_at_r32_signed_overflow() {
|
|||
);
|
||||
}
|
||||
|
||||
void test_subtract_imm32_from_mem_at_r32_unsigned_overflow() {
|
||||
void test_subtract_imm32_from_mem_at_rm32_unsigned_overflow() {
|
||||
Reg[EBX].i = 0x2000;
|
||||
run(
|
||||
"== code 0x1\n"
|
||||
|
@ -368,7 +368,7 @@ void test_subtract_imm32_from_mem_at_r32_unsigned_overflow() {
|
|||
);
|
||||
}
|
||||
|
||||
void test_subtract_imm32_from_mem_at_r32_signed_and_unsigned_overflow() {
|
||||
void test_subtract_imm32_from_mem_at_rm32_signed_and_unsigned_overflow() {
|
||||
Reg[EBX].i = 0x2000;
|
||||
run(
|
||||
"== code 0x1\n"
|
||||
|
@ -646,7 +646,7 @@ case 0x25: { // and imm32 with EAX
|
|||
//:
|
||||
|
||||
:(code)
|
||||
void test_and_imm32_with_mem_at_r32() {
|
||||
void test_and_imm32_with_mem_at_rm32() {
|
||||
Reg[EBX].i = 0x2000;
|
||||
run(
|
||||
"== code 0x1\n"
|
||||
|
@ -738,7 +738,7 @@ case 0x0d: { // or imm32 with EAX
|
|||
//:
|
||||
|
||||
:(code)
|
||||
void test_or_imm32_with_mem_at_r32() {
|
||||
void test_or_imm32_with_mem_at_rm32() {
|
||||
Reg[EBX].i = 0x2000;
|
||||
run(
|
||||
"== code 0x1\n"
|
||||
|
@ -828,7 +828,7 @@ case 0x35: { // xor imm32 with EAX
|
|||
//:
|
||||
|
||||
:(code)
|
||||
void test_xor_imm32_with_mem_at_r32() {
|
||||
void test_xor_imm32_with_mem_at_rm32() {
|
||||
Reg[EBX].i = 0x2000;
|
||||
run(
|
||||
"== code 0x1\n"
|
||||
|
@ -1106,7 +1106,7 @@ void test_compare_imm32_with_r32_equal() {
|
|||
}
|
||||
|
||||
:(code)
|
||||
void test_compare_imm32_with_mem_at_r32_greater() {
|
||||
void test_compare_imm32_with_mem_at_rm32_greater() {
|
||||
Reg[EBX].i = 0x2000;
|
||||
run(
|
||||
"== code 0x1\n"
|
||||
|
@ -1125,7 +1125,7 @@ void test_compare_imm32_with_mem_at_r32_greater() {
|
|||
}
|
||||
|
||||
:(code)
|
||||
void test_compare_imm32_with_mem_at_r32_lesser() {
|
||||
void test_compare_imm32_with_mem_at_rm32_lesser() {
|
||||
Reg[EAX].i = 0x2000;
|
||||
run(
|
||||
"== code 0x1\n"
|
||||
|
@ -1144,7 +1144,7 @@ void test_compare_imm32_with_mem_at_r32_lesser() {
|
|||
}
|
||||
|
||||
:(code)
|
||||
void test_compare_imm32_with_mem_at_r32_equal() {
|
||||
void test_compare_imm32_with_mem_at_rm32_equal() {
|
||||
Reg[EBX].i = 0x0d0c0b0a;
|
||||
Reg[EBX].i = 0x2000;
|
||||
run(
|
||||
|
@ -1208,7 +1208,7 @@ case 0xbf: { // copy imm32 to r32
|
|||
put_new(Name, "c7", "copy imm32 to rm32 with subop 0 (mov)");
|
||||
|
||||
:(code)
|
||||
void test_copy_imm32_to_mem_at_r32() {
|
||||
void test_copy_imm32_to_mem_at_rm32() {
|
||||
Reg[EBX].i = 0x60;
|
||||
run(
|
||||
"== code 0x1\n"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//: operating on memory at the address provided by some register plus optional scale and offset
|
||||
|
||||
:(code)
|
||||
void test_add_r32_to_mem_at_r32_with_sib() {
|
||||
void test_add_r32_to_mem_at_rm32_with_sib() {
|
||||
Reg[EBX].i = 0x10;
|
||||
Reg[EAX].i = 0x2000;
|
||||
run(
|
||||
|
|
|
@ -67,7 +67,7 @@ case 2: { // call function pointer at r/m32
|
|||
}
|
||||
|
||||
:(code)
|
||||
void test_call_mem_at_r32() {
|
||||
void test_call_mem_at_rm32() {
|
||||
Mem.push_back(vma(0xbd000000)); // manually allocate memory
|
||||
Reg[ESP].u = 0xbd000064;
|
||||
Reg[EBX].u = 0x2000;
|
||||
|
|
|
@ -41,7 +41,7 @@ uint8_t* reg_8bit(uint8_t rm) {
|
|||
put_new(Name, "88", "copy r8 to r8/m8-at-r32");
|
||||
|
||||
:(code)
|
||||
void test_copy_r8_to_mem_at_r32() {
|
||||
void test_copy_r8_to_mem_at_rm32() {
|
||||
Reg[EBX].i = 0x224488ab;
|
||||
Reg[EAX].i = 0x2000;
|
||||
run(
|
||||
|
@ -79,7 +79,7 @@ case 0x88: { // copy r8 to r/m8
|
|||
put_new(Name, "8a", "copy r8/m8-at-r32 to r8");
|
||||
|
||||
:(code)
|
||||
void test_copy_mem_at_r32_to_r8() {
|
||||
void test_copy_mem_at_rm32_to_r8() {
|
||||
Reg[EBX].i = 0xaabbcc0f; // one nibble each of lowest byte set to all 0s and all 1s, to maximize value of this test
|
||||
Reg[EAX].i = 0x2000;
|
||||
run(
|
||||
|
@ -139,7 +139,7 @@ void test_cannot_copy_byte_to_ESP_EBP_ESI_EDI() {
|
|||
put_new(Name, "c6", "copy imm8 to r8/m8-at-r32 (mov)");
|
||||
|
||||
:(code)
|
||||
void test_copy_imm8_to_mem_at_r32() {
|
||||
void test_copy_imm8_to_mem_at_rm32() {
|
||||
Reg[EAX].i = 0x2000;
|
||||
run(
|
||||
"== code 0x1\n"
|
||||
|
|
Loading…
Reference in New Issue