diff options
Diffstat (limited to 'src')
| -rwxr-xr-x | src/dynarec/dynarec_arm64_00.c | 16 | ||||
| -rwxr-xr-x | src/emu/x64run.c | 14 |
2 files changed, 28 insertions, 2 deletions
diff --git a/src/dynarec/dynarec_arm64_00.c b/src/dynarec/dynarec_arm64_00.c index 88d4f8f9..5b0015cc 100755 --- a/src/dynarec/dynarec_arm64_00.c +++ b/src/dynarec/dynarec_arm64_00.c @@ -1016,7 +1016,21 @@ uintptr_t dynarec64_00(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin ORRw_mask(xFlags, xFlags, 0b011111, 0); //mask=0x00000002 SET_DFNONE(x1); break; - + case 0x9E: + INST_NAME("SAHF"); + SETFLAGS(X_CF|X_PF|X_AF|X_ZF|X_SF, SF_SUBSET); + MOV32w(x2, 0b11010101); + BICw_REG(xFlags, xFlags, x2); + UBFXx(x1, xRAX, 8, 8); + ANDw_REG(x1, x1, x2); + ORRw_REG(xFlags, xFlags, x1); + SET_DFNONE(x1); + break; + case 0x9F: + INST_NAME("LAHF"); + READFLAGS(X_CF|X_PF|X_AF|X_ZF|X_SF); + BFIx(xRAX, xFlags, 8, 8); + break; case 0xA0: INST_NAME("MOV AL,Ob"); u64 = F64; diff --git a/src/emu/x64run.c b/src/emu/x64run.c index 471aa8f2..c08c1ac0 100755 --- a/src/emu/x64run.c +++ b/src/emu/x64run.c @@ -538,7 +538,19 @@ x64emurun: emu->eflags.x64 = ((Pop(emu) & 0x3F7FD7)/* & (0xffff-40)*/ ) | 0x2; // mask off res2 and res3 and on res1 RESET_FLAGS(emu); break; - + case 0x9E: /* SAHF */ + tmp8u = emu->regs[_AX].byte[1]; + CONDITIONAL_SET_FLAG(tmp8u&0x01, F_CF); + CONDITIONAL_SET_FLAG(tmp8u&0x04, F_PF); + CONDITIONAL_SET_FLAG(tmp8u&0x10, F_AF); + CONDITIONAL_SET_FLAG(tmp8u&0x40, F_ZF); + CONDITIONAL_SET_FLAG(tmp8u&0x80, F_SF); + RESET_FLAGS(emu); + break; + case 0x9F: /* LAHF */ + CHECK_FLAGS(emu); + R_AH = (uint8_t)emu->eflags.x64; + break; case 0xA0: /* MOV AL,Ob */ R_AL = *(uint8_t*)F64; break; |