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

Function EdIb

source/test/testCPU.cpp:2190–2260  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2188}
2189
2190void EdIb(int instruction, int which, struct Data* data, bool includeLock = false) {
2191 while (data->valid) {
2192 int ed;
2193 int rm;
2194 U32 result;
2195
2196 for (ed = 0; ed < 8; ed++) {
2197 Reg* e;
2198
2199 rm = ed | (which << 3) | 0xC0;
2200 newInstructionWithRM(instruction, rm, data->flags);
2201 pushCode8(data->var2);
2202 e = &cpu->reg[ed];
2203 e->u32 = data->var1;
2204 runTestCPU();
2205 assertResult(data, cpu, instruction, e->u32, 0, ed, -1, 0, 32);
2206
2207 if (ed == 4) {
2208 continue;
2209 }
2210 newInstructionWithRM(instruction, rm, data->flags);
2211 pushCode8(data->var2);
2212 e = &cpu->reg[ed];
2213 e->u32 = data->var1;
2214 pushCode8(0x39);
2215 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
2216 runTestCPU();
2217 assertResult(data, cpu, instruction, e->u32, 0, ed, -1, 0, 32, true);
2218 }
2219
2220 for (int lock = 0; lock < 2; lock++) {
2221 rm = (which << 3);
2222 if (cpu->big)
2223 rm += 5;
2224 else
2225 rm += 6;
2226 newInstructionWithRM(instruction, rm, data->flags, lock ? LOCK_PREFIX : 0);
2227 U16 addressOffset = lock == 2 ? 202 : 200;
2228
2229 if (cpu->big)
2230 pushCode32(addressOffset);
2231 else
2232 pushCode16(addressOffset);
2233 pushCode8(data->var2);
2234 memory->writed(cpu->seg[DS].address + addressOffset, DEFAULT);
2235 memory->writed(cpu->seg[DS].address + addressOffset, data->var1);
2236 runTestCPU();
2237 result = memory->readd(cpu->seg[DS].address + addressOffset);
2238 assertResult(data, cpu, instruction, result, 0, -1, -1, cpu->seg[DS].address + addressOffset, 32);
2239
2240 newInstructionWithRM(instruction, rm, data->flags, lock ? LOCK_PREFIX : 0);
2241 if (cpu->big)
2242 pushCode32(addressOffset);
2243 else
2244 pushCode16(addressOffset);
2245 pushCode8(data->var2);
2246 memory->writed(cpu->seg[DS].address + addressOffset, DEFAULT);
2247 memory->writed(cpu->seg[DS].address + addressOffset, data->var1);

Callers 2

testGrp20x2c1Function · 0.85
testGroup80x3baFunction · 0.85

Calls 8

newInstructionWithRMFunction · 0.85
pushCode8Function · 0.85
runTestCPUFunction · 0.85
assertResultFunction · 0.85
pushCode32Function · 0.85
pushCode16Function · 0.85
writedMethod · 0.45
readdMethod · 0.45

Tested by

no test coverage detected