diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2024-12-11 17:56:05 +0100 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2024-12-11 17:56:05 +0100 |
| commit | bd7ff2efd626ec5e1d73539e23ba4f921b06d812 (patch) | |
| tree | 3d40c8c69ecaf2703ca1b35f07a9eff400f6f0d0 /src | |
| parent | ed2134299523036989ecd140c2cd3dbff9378e14 (diff) | |
| download | box64-bd7ff2efd626ec5e1d73539e23ba4f921b06d812.tar.gz box64-bd7ff2efd626ec5e1d73539e23ba4f921b06d812.zip | |
[ARM64_DYNAREC] Force flags to be at least defered when priv opcode is run on safeflags=2
Diffstat (limited to 'src')
| -rw-r--r-- | src/dynarec/arm64/dynarec_arm64_00.c | 54 | ||||
| -rw-r--r-- | src/dynarec/arm64/dynarec_arm64_0f.c | 24 | ||||
| -rw-r--r-- | src/dynarec/arm64/dynarec_arm64_64.c | 12 |
3 files changed, 75 insertions, 15 deletions
diff --git a/src/dynarec/arm64/dynarec_arm64_00.c b/src/dynarec/arm64/dynarec_arm64_00.c index d09d135e..4abbaeaf 100644 --- a/src/dynarec/arm64/dynarec_arm64_00.c +++ b/src/dynarec/arm64/dynarec_arm64_00.c @@ -945,7 +945,11 @@ uintptr_t dynarec64_00(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin case 0x6C: case 0x6D: INST_NAME(opcode == 0x6C ? "INSB" : "INSD"); - SETFLAGS(X_ALL, SF_SET_NODF); // Hack to set flags in "don't care" state + if(box64_dynarec_safeflags>1) { + READFLAGS(X_PEND); + } else { + SETFLAGS(X_ALL, SF_SET_NODF); // Hack to set flags in "don't care" state + } GETIP(ip); STORE_XEMU_CALL(xRIP); CALL(native_priv, -1); @@ -957,7 +961,11 @@ uintptr_t dynarec64_00(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin case 0x6E: case 0x6F: INST_NAME(opcode == 0x6C ? "OUTSB" : "OUTSD"); - SETFLAGS(X_ALL, SF_SET_NODF); // Hack to set flags in "don't care" state + if(box64_dynarec_safeflags>1) { + READFLAGS(X_PEND); + } else { + SETFLAGS(X_ALL, SF_SET_NODF); // Hack to set flags in "don't care" state + } GETIP(ip); STORE_XEMU_CALL(xRIP); CALL(native_priv, -1); @@ -2434,7 +2442,11 @@ uintptr_t dynarec64_00(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin jump_to_epilog(dyn, 0, xRIP, ninst); } else if(u8==0x03) { INST_NAME("INT 3"); - SETFLAGS(X_ALL, SF_SET_NODF); // Hack to set flags in "don't care" state + if(box64_dynarec_safeflags>1) { + READFLAGS(X_PEND); + } else { + SETFLAGS(X_ALL, SF_SET_NODF); // Hack to set flags in "don't care" state + } GETIP(addr); STORE_XEMU_CALL(xRIP); CALL(native_int3, -1); @@ -2444,7 +2456,11 @@ uintptr_t dynarec64_00(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin *ok = 0; } else { INST_NAME("INT n"); - SETFLAGS(X_ALL, SF_SET_NODF); // Hack to set flags in "don't care" state + if(box64_dynarec_safeflags>1) { + READFLAGS(X_PEND); + } else { + SETFLAGS(X_ALL, SF_SET_NODF); // Hack to set flags in "don't care" state + } if(rex.is32bits && u8==0x04) { GETIP(addr); } else { @@ -3006,7 +3022,11 @@ uintptr_t dynarec64_00(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin { F8; } else { - SETFLAGS(X_ALL, SF_SET_NODF); // Hack to set flags in "don't care" state + if(box64_dynarec_safeflags>1) { + READFLAGS(X_PEND); + } else { + SETFLAGS(X_ALL, SF_SET_NODF); // Hack to set flags in "don't care" state + } u8 = F8; GETIP(ip); STORE_XEMU_CALL(xRIP); @@ -3192,7 +3212,11 @@ uintptr_t dynarec64_00(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin INST_NAME(opcode==0xEC?"IN AL, DX":(opcode==0xED?"IN EAX, DX":(opcode==0xEE?"OUT DX, AL":"OUT DX, EAX"))); if(rex.is32bits && box64_ignoreint3) {} else { - SETFLAGS(X_ALL, SF_SET_NODF); // Hack to set flags in "don't care" state + if(box64_dynarec_safeflags>1) { + READFLAGS(X_PEND); + } else { + SETFLAGS(X_ALL, SF_SET_NODF); // Hack to set flags in "don't care" state + } GETIP(ip); STORE_XEMU_CALL(xRIP); CALL(native_priv, -1); @@ -3208,7 +3232,11 @@ uintptr_t dynarec64_00(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin break; case 0xF1: INST_NAME("INT1"); - SETFLAGS(X_ALL, SF_SET_NODF); // Hack to set flags in "don't care" state + if(box64_dynarec_safeflags>1) { + READFLAGS(X_PEND); + } else { + SETFLAGS(X_ALL, SF_SET_NODF); // Hack to set flags in "don't care" state + } GETIP(ip); STORE_XEMU_CALL(xRIP); CALL(native_priv, -1); // is that a privileged opcodes or an int 1?? @@ -3220,7 +3248,11 @@ uintptr_t dynarec64_00(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin case 0xF4: INST_NAME("HLT"); - SETFLAGS(X_ALL, SF_SET_NODF); // Hack to set flags in "don't care" state + if(box64_dynarec_safeflags>1) { + READFLAGS(X_PEND); + } else { + SETFLAGS(X_ALL, SF_SET_NODF); // Hack to set flags in "don't care" state + } GETIP(ip); STORE_XEMU_CALL(xRIP); CALL(native_priv, -1); @@ -3610,7 +3642,11 @@ uintptr_t dynarec64_00(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin INST_NAME(opcode==0xFA?"CLI":"STI"); if(rex.is32bits && box64_ignoreint3) {} else { - SETFLAGS(X_ALL, SF_SET_NODF); // Hack to set flags in "don't care" state + if(box64_dynarec_safeflags>1) { + READFLAGS(X_PEND); + } else { + SETFLAGS(X_ALL, SF_SET_NODF); // Hack to set flags in "don't care" state + } GETIP(ip); STORE_XEMU_CALL(xRIP); CALL(native_priv, -1); diff --git a/src/dynarec/arm64/dynarec_arm64_0f.c b/src/dynarec/arm64/dynarec_arm64_0f.c index 5b885ba4..c19f4857 100644 --- a/src/dynarec/arm64/dynarec_arm64_0f.c +++ b/src/dynarec/arm64/dynarec_arm64_0f.c @@ -165,7 +165,11 @@ uintptr_t dynarec64_0F(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin case 0x09: INST_NAME("WBINVD"); - SETFLAGS(X_ALL, SF_SET_NODF); // Hack to set flags in "don't care" state + if(box64_dynarec_safeflags>1) { + READFLAGS(X_PEND); + } else { + SETFLAGS(X_ALL, SF_SET_NODF); // Hack to set flags in "don't care" state + } GETIP(ip); STORE_XEMU_CALL(xRIP); CALL(native_ud, -1); @@ -177,7 +181,11 @@ uintptr_t dynarec64_0F(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin case 0x0B: INST_NAME("UD2"); - SETFLAGS(X_ALL, SF_SET_NODF); // Hack to set flags in "don't care" state + if(box64_dynarec_safeflags>1) { + READFLAGS(X_PEND); + } else { + SETFLAGS(X_ALL, SF_SET_NODF); // Hack to set flags in "don't care" state + } GETIP(ip); STORE_XEMU_CALL(xRIP); CALL(native_ud, -1); @@ -212,7 +220,11 @@ uintptr_t dynarec64_0F(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin break; case 0x0E: INST_NAME("femms"); - SETFLAGS(X_ALL, SF_SET_NODF); // Hack to set flags in "don't care" state + if(box64_dynarec_safeflags>1) { + READFLAGS(X_PEND); + } else { + SETFLAGS(X_ALL, SF_SET_NODF); // Hack to set flags in "don't care" state + } GETIP(ip); STORE_XEMU_CALL(xRIP); CALL(native_ud, -1); @@ -503,7 +515,11 @@ uintptr_t dynarec64_0F(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin break; case 0x30: INST_NAME("WRMSR"); - SETFLAGS(X_ALL, SF_SET_NODF); // Hack to set flags in "don't care" state + if(box64_dynarec_safeflags>1) { + READFLAGS(X_PEND); + } else { + SETFLAGS(X_ALL, SF_SET_NODF); // Hack to set flags in "don't care" state + } GETIP(ip); STORE_XEMU_CALL(xRIP); CALL(native_priv, -1); diff --git a/src/dynarec/arm64/dynarec_arm64_64.c b/src/dynarec/arm64/dynarec_arm64_64.c index fd9580d3..a6389861 100644 --- a/src/dynarec/arm64/dynarec_arm64_64.c +++ b/src/dynarec/arm64/dynarec_arm64_64.c @@ -596,7 +596,11 @@ uintptr_t dynarec64_64(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin case 0x6C: case 0x6D: INST_NAME(opcode == 0x6C ? "INSB" : "INSD"); - SETFLAGS(X_ALL, SF_SET_NODF); // Hack to set flags in "don't care" state + if(box64_dynarec_safeflags>1) { + READFLAGS(X_PEND); + } else { + SETFLAGS(X_ALL, SF_SET_NODF); // Hack to set flags in "don't care" state + } GETIP(ip); STORE_XEMU_CALL(xRIP); CALL(native_priv, -1); @@ -608,7 +612,11 @@ uintptr_t dynarec64_64(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin case 0x6E: case 0x6F: INST_NAME(opcode == 0x6C ? "OUTSB" : "OUTSD"); - SETFLAGS(X_ALL, SF_SET_NODF); // Hack to set flags in "don't care" state + if(box64_dynarec_safeflags>1) { + READFLAGS(X_PEND); + } else { + SETFLAGS(X_ALL, SF_SET_NODF); // Hack to set flags in "don't care" state + } GETIP(ip); STORE_XEMU_CALL(xRIP); CALL(native_priv, -1); |