MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / EbIb

Function EbIb

source/test/testCPU.cpp:705–769  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

703}
704
705void EbIb(int instruction, int which, struct Data* data, bool address32, bool includeLock = false) {
706 while (data->valid) {
707 int eb;
708 int rm;
709 U32 result;
710
711 for (int setsFlags = 0; setsFlags < 3; setsFlags++) {
712 for (eb = 0; eb < 8; eb++) {
713 U8* e;
714
715 rm = eb | (which << 3) | 0xC0;
716 newInstructionWithRM(instruction, rm, data->flags);
717 pushCode8(data->var2);
718 e = cpu->reg8[E(rm)];
719 cpu->reg[E8(rm)].u32 = DEFAULT;
720 *e = data->var1;
721
722 if (setsFlags == 0) {
723 pushCode8(0x39);
724 pushCode8(0xc0); // cmp eax, eax: this will overwrite flags so the above code might take a different path in the dynamic cores that optimize away flag calculation
725 } else if (setsFlags == 2) {
726 // flags will be calculate in JIT
727 U8 reg = 5;
728 if (eb == 5) {
729 reg = 6;
730 }
731 pushCode8(0x9c); // push flags
732 pushCode8(0x58 + reg); // pop reg
733 }
734
735 runTestCPU();
736 assertResult(data, cpu, instruction, *e, 0, E8(rm), -1, 0, 8, setsFlags == 0);
737 }
738 }
739
740 for (int lock = 0; lock < 3; lock++) {
741 rm = (which << 3);
742 if (address32) {
743 rm += 5;
744 } else {
745 rm += 6;
746 }
747 bool isBig = cpu->big ? true : false;
748 bool needPrefix = address32 != isBig;
749 newInstructionWithRM(instruction, rm, data->flags, (needPrefix ? 0x67 : 0), lock ? LOCK_PREFIX : 0);
750 U16 offset = lock == 2 ? 201 : 200;
751
752 if (address32) {
753 pushCode32(offset);
754 } else {
755 pushCode16(offset);
756 }
757 pushCode8(data->var2);
758 memory->writed(cpu->seg[DS].address + offset, DEFAULT);
759 memory->writeb(cpu->seg[DS].address + offset, data->var1);
760 runTestCPU();
761 result = memory->readb(cpu->seg[DS].address + offset);
762 assertResult(data, cpu, instruction, result, 0, -1, -1, cpu->seg[DS].address + offset, 8);

Callers 12

testGrp10x080Function · 0.85
testGrp10x280Function · 0.85
testGrp10x082Function · 0.85
testGrp10x282Function · 0.85
testGrp20x0c0Function · 0.85
testGrp20x2c0Function · 0.85
testMovEbIb0x0c6Function · 0.85
testMovEbIb0x2c6Function · 0.85
testGrp30x0f6Function · 0.85
testGrp30x2f6Function · 0.85
testAddressPrefix0x067Function · 0.85
testAddressPrefix0x267Function · 0.85

Calls 9

newInstructionWithRMFunction · 0.85
pushCode8Function · 0.85
runTestCPUFunction · 0.85
assertResultFunction · 0.85
pushCode32Function · 0.85
pushCode16Function · 0.85
writedMethod · 0.45
writebMethod · 0.45
readbMethod · 0.45

Tested by

no test coverage detected