| 8340 | } |
| 8341 | |
| 8342 | void testCallE32() { |
| 8343 | for (int i = 0; i < 8; i++) { |
| 8344 | U8 rm = i | (2 << 3) | 0xC0; |
| 8345 | |
| 8346 | newInstruction(0); |
| 8347 | memory->writed(cpu->seg[SS].address + 4092, DEFAULT); |
| 8348 | |
| 8349 | cpu->reg[0].u32 = 0x104; |
| 8350 | cpu->reg[i].u32 = 0x104; |
| 8351 | |
| 8352 | // call |
| 8353 | pushCode8(0xff); |
| 8354 | pushCode8(rm); |
| 8355 | |
| 8356 | for (int i = 0; i < 0x102; i++) { |
| 8357 | pushCode8(0xcd); |
| 8358 | } |
| 8359 | // call will jump to here |
| 8360 | // add ax, 0x1 |
| 8361 | pushCode8(0x83); |
| 8362 | pushCode8(0xc0); |
| 8363 | pushCode8(0x1); |
| 8364 | |
| 8365 | runTestCPU(); |
| 8366 | |
| 8367 | assertTrue(EAX == 0x105); |
| 8368 | if (i == 4) { |
| 8369 | assertTrue(memory->readd(cpu->seg[SS].address + 0x100) == 0x2); // eip after calljw |
| 8370 | assertTrue(ESP == 0x100); |
| 8371 | } else { |
| 8372 | assertTrue(memory->readw(cpu->seg[SS].address + 4092) == 0x2); // eip after calljw |
| 8373 | assertTrue(SP == 4092); |
| 8374 | } |
| 8375 | } |
| 8376 | |
| 8377 | U8 rm = (2 << 3); |
| 8378 | if (cpu->big) |
| 8379 | rm += 5; |
| 8380 | else |
| 8381 | rm += 6; |
| 8382 | newInstructionWithRM(0xff, rm, 0); |
| 8383 | pushCode32(200); |
| 8384 | |
| 8385 | for (int i = 0; i < 0x100; i++) { |
| 8386 | pushCode8(0xcd); |
| 8387 | } |
| 8388 | // call will jump to here |
| 8389 | // add ax, 0x1 |
| 8390 | pushCode8(0x83); |
| 8391 | pushCode8(0xc0); |
| 8392 | pushCode8(0x1); |
| 8393 | |
| 8394 | memory->writed(cpu->seg[DS].address + 200, 0x106); |
| 8395 | EAX = 0x10; |
| 8396 | runTestCPU(); |
| 8397 | |
| 8398 | assertTrue(EAX == 0x11); |
| 8399 | assertTrue(memory->readd(cpu->seg[SS].address + 4092) == 0x6); // eip after calljw |
no test coverage detected