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

Function EwIb

source/test/testCPU.cpp:1167–1239  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1165}
1166
1167void EwIb(int instruction, int which, struct Data* data, bool includeLock = false) {
1168 while (data->valid) {
1169 int ew;
1170 int rm;
1171 U32 result;
1172
1173 for (ew = 0; ew < 8; ew++) {
1174 Reg* e;
1175
1176 rm = ew | (which << 3) | 0xC0;
1177 newInstructionWithRM(instruction, rm, data->flags);
1178 pushCode8(data->var2);
1179 e = &cpu->reg[E(rm)];
1180 e->u32 = DEFAULT;
1181 e->u16 = data->var1;
1182 runTestCPU();
1183 assertResult(data, cpu, instruction, e->u16, 0, E(rm), -1, 0, 16);
1184
1185 if (ew == 4) {
1186 continue;
1187 }
1188 newInstructionWithRM(instruction, rm, data->flags);
1189 pushCode8(data->var2);
1190 e = &cpu->reg[E(rm)];
1191 e->u32 = DEFAULT;
1192 e->u16 = data->var1;
1193 pushCode8(0x39);
1194 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
1195 runTestCPU();
1196 assertResult(data, cpu, instruction, e->u16, 0, E(rm), -1, 0, 16, true);
1197 }
1198
1199 for (int lock = 0; lock < 3; lock++) {
1200 rm = (which << 3);
1201 if (cpu->big)
1202 rm += 5;
1203 else
1204 rm += 6;
1205 newInstructionWithRM(instruction, rm, data->flags, lock ? LOCK_PREFIX : 0);
1206 U16 offset = lock == 2 ? 201 : 200;
1207
1208 if (cpu->big)
1209 pushCode32(offset);
1210 else
1211 pushCode16(offset);
1212 pushCode8(data->var2);
1213 memory->writed(cpu->seg[DS].address + offset, DEFAULT);
1214 memory->writew(cpu->seg[DS].address + offset, data->var1);
1215 runTestCPU();
1216 result = memory->readw(cpu->seg[DS].address + offset);
1217 assertResult(data, cpu, instruction, result, 0, -1, -1, cpu->seg[DS].address + offset, 16);
1218
1219 newInstructionWithRM(instruction, rm, data->flags, lock ? LOCK_PREFIX : 0);
1220 if (cpu->big)
1221 pushCode32(offset);
1222 else
1223 pushCode16(offset);
1224 pushCode8(data->var2);

Callers 2

testGrp20x0c1Function · 0.85
testGroup80x1baFunction · 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
writewMethod · 0.45
readwMethod · 0.45

Tested by

no test coverage detected