| 8530 | } |
| 8531 | |
| 8532 | void testJmpE32() { |
| 8533 | for (int i = 0; i < 8; i++) { |
| 8534 | U8 rm = i | (4 << 3) | 0xC0; |
| 8535 | |
| 8536 | newInstruction(0); |
| 8537 | memory->writed(cpu->seg[SS].address + 4092, DEFAULT); |
| 8538 | |
| 8539 | cpu->reg[0].u32 = 0x104; |
| 8540 | cpu->reg[i].u32 = 0x104; |
| 8541 | |
| 8542 | // call |
| 8543 | pushCode8(0xff); |
| 8544 | pushCode8(rm); |
| 8545 | |
| 8546 | for (int i = 0; i < 0x102; i++) { |
| 8547 | pushCode8(0xcd); |
| 8548 | } |
| 8549 | // call will jump to here |
| 8550 | // add ax, 0x1 |
| 8551 | pushCode8(0x83); |
| 8552 | pushCode8(0xc0); |
| 8553 | pushCode8(0x1); |
| 8554 | |
| 8555 | runTestCPU(); |
| 8556 | |
| 8557 | assertTrue(EAX == 0x105); |
| 8558 | if (i == 4) { |
| 8559 | assertTrue(ESP == 0x104); |
| 8560 | } else { |
| 8561 | assertTrue(SP == 4096); |
| 8562 | } |
| 8563 | } |
| 8564 | |
| 8565 | U8 rm = (4 << 3); |
| 8566 | if (cpu->big) |
| 8567 | rm += 5; |
| 8568 | else |
| 8569 | rm += 6; |
| 8570 | newInstructionWithRM(0xff, rm, 0); |
| 8571 | pushCode32(200); |
| 8572 | |
| 8573 | for (int i = 0; i < 0x100; i++) { |
| 8574 | pushCode8(0xcd); |
| 8575 | } |
| 8576 | // call will jump to here |
| 8577 | // add ax, 0x1 |
| 8578 | pushCode8(0x83); |
| 8579 | pushCode8(0xc0); |
| 8580 | pushCode8(0x1); |
| 8581 | |
| 8582 | memory->writed(cpu->seg[DS].address + 200, 0x106); |
| 8583 | EAX = 0x10; |
| 8584 | runTestCPU(); |
| 8585 | |
| 8586 | assertTrue(EAX == 0x11); |
| 8587 | assertTrue(ESP == 4096); |
| 8588 | } |
| 8589 |
no test coverage detected