diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2025-02-17 14:18:49 +0100 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2025-02-17 14:18:49 +0100 |
| commit | d49fc437917cbbad9ea556fa373f8a08dafeda65 (patch) | |
| tree | 92b94cd4c416c1feebdac5bd7e16c449ad71911f /src/emu | |
| parent | 9ec7930eb1618cb7ebbdd769681ffe4e6c3e0d4d (diff) | |
| download | box64-d49fc437917cbbad9ea556fa373f8a08dafeda65.tar.gz box64-d49fc437917cbbad9ea556fa373f8a08dafeda65.zip | |
[ARM64_DYNAREC] Continue work on UD flags
Diffstat (limited to 'src/emu')
| -rw-r--r-- | src/emu/x64primop.c | 40 |
1 files changed, 29 insertions, 11 deletions
diff --git a/src/emu/x64primop.c b/src/emu/x64primop.c index e1961434..9c1f2865 100644 --- a/src/emu/x64primop.c +++ b/src/emu/x64primop.c @@ -543,7 +543,10 @@ uint16_t rcl16(x64emu_t *emu, uint16_t d, uint8_t s) res |= 1 << (cnt - 1); } CONDITIONAL_SET_FLAG(cf, F_CF); - CONDITIONAL_SET_FLAG((cf ^ (res >> 15)) & 0x1, F_OF); + if(BOX64ENV(cputype)) + CONDITIONAL_SET_FLAG((cf ^ (res >> 15)) & 0x1, F_OF); + else + CONDITIONAL_SET_FLAG((XOR2(d >> 14)), F_OF); } return (uint16_t)res; } @@ -564,7 +567,10 @@ uint32_t rcl32(x64emu_t *emu, uint32_t d, uint8_t s) res |= 1 << (cnt - 1); } CONDITIONAL_SET_FLAG(cf, F_CF); - CONDITIONAL_SET_FLAG((cf ^ (res >> 31)) & 0x1, F_OF); + if(BOX64ENV(cputype)) + CONDITIONAL_SET_FLAG((cf ^ (res >> 31)) & 0x1, F_OF); + else + CONDITIONAL_SET_FLAG((XOR2(d >> 30)), F_OF); } return res; } @@ -585,7 +591,10 @@ uint64_t rcl64(x64emu_t *emu, uint64_t d, uint8_t s) res |= 1LL << (cnt - 1); } CONDITIONAL_SET_FLAG(cf, F_CF); - CONDITIONAL_SET_FLAG((cf ^ (res >> 63)) & 0x1, F_OF); + if(BOX64ENV(cputype)) + CONDITIONAL_SET_FLAG((cf ^ (res >> 63)) & 0x1, F_OF); + else + CONDITIONAL_SET_FLAG((XOR2(d >> 62)), F_OF); } return res; } @@ -630,8 +639,8 @@ uint8_t rcr8(x64emu_t *emu, uint8_t d, uint8_t s) /* OVERFLOW is set *IFF* cnt==1, then it is the xor of CF and the most significant bit. Blecck. */ /* parenthesized... */ - CONDITIONAL_SET_FLAG((ocf ^ (d >> 7)) & 0x1, - F_OF); + if(!BOX64ENV(cputype)) + CONDITIONAL_SET_FLAG((ocf ^ (d >> 7)) & 0x1, F_OF); if (cnt == 1) { cf = d & 0x1; /* note hackery here. Access_flag(..) evaluates to either @@ -669,6 +678,9 @@ uint8_t rcr8(x64emu_t *emu, uint8_t d, uint8_t s) } /* set the new carry flag, based on the variable "cf" */ CONDITIONAL_SET_FLAG(cf, F_CF); + + if(BOX64ENV(cputype)) + CONDITIONAL_SET_FLAG((XOR2(res >> 6)), F_OF); } return (uint8_t)res; } @@ -684,8 +696,8 @@ uint16_t rcr16(x64emu_t *emu, uint16_t d, uint8_t s) res = d; if ((cnt = s % 17) != 0) { ocf = ACCESS_FLAG(F_CF) != 0; - CONDITIONAL_SET_FLAG((ocf ^ (d >> 15)) & 0x1, - F_OF); + if(!BOX64ENV(cputype)) + CONDITIONAL_SET_FLAG((ocf ^ (d >> 15)) & 0x1, F_OF); if (cnt == 1) { cf = d & 0x1; } else @@ -697,6 +709,8 @@ uint16_t rcr16(x64emu_t *emu, uint16_t d, uint8_t s) res |= 1 << (16 - cnt); } CONDITIONAL_SET_FLAG(cf, F_CF); + if(BOX64ENV(cputype)) + CONDITIONAL_SET_FLAG((XOR2(res >> 14)), F_OF); } return (uint16_t)res; } @@ -712,8 +726,8 @@ uint32_t rcr32(x64emu_t *emu, uint32_t d, uint8_t s) res = d; if ((cnt = s) != 0) { ocf = ACCESS_FLAG(F_CF) != 0; - CONDITIONAL_SET_FLAG((ocf ^ (d >> 31)) & 0x1, - F_OF); + if(!BOX64ENV(cputype)) + CONDITIONAL_SET_FLAG((ocf ^ (d >> 31)) & 0x1, F_OF); if (cnt == 1) { cf = d & 0x1; } else { @@ -727,6 +741,8 @@ uint32_t rcr32(x64emu_t *emu, uint32_t d, uint8_t s) res |= 1 << (32 - cnt); } CONDITIONAL_SET_FLAG(cf, F_CF); + if(BOX64ENV(cputype)) + CONDITIONAL_SET_FLAG((XOR2(res >> 30)), F_OF); } return res; } @@ -742,8 +758,8 @@ uint64_t rcr64(x64emu_t *emu, uint64_t d, uint8_t s) res = d; if ((cnt = s) != 0) { ocf = ACCESS_FLAG(F_CF) != 0; - CONDITIONAL_SET_FLAG((ocf ^ (d >> 63)) & 0x1, - F_OF); + if(!BOX64ENV(cputype)) + CONDITIONAL_SET_FLAG((ocf ^ (d >> 63)) & 0x1, F_OF); if (cnt == 1) { cf = d & 0x1; } else { @@ -757,6 +773,8 @@ uint64_t rcr64(x64emu_t *emu, uint64_t d, uint8_t s) res |= 1LL << (64 - cnt); } CONDITIONAL_SET_FLAG(cf, F_CF); + if(BOX64ENV(cputype)) + CONDITIONAL_SET_FLAG((XOR2(res >> 62)), F_OF); } return res; } |