diff --git a/src/codegen_ops_x86.h b/src/codegen_ops_x86.h index 845a528..9584a4d 100644 --- a/src/codegen_ops_x86.h +++ b/src/codegen_ops_x86.h @@ -3460,13 +3460,13 @@ static void MMX_ENTER() addbyte(0x45); addbyte(cpu_state_offset(ismmx)); addbyte(1); - addbyte(0x8b); /*MOV TOP, EAX*/ + addbyte(0x89); /*MOV TOP, EAX*/ addbyte(0x45); addbyte(cpu_state_offset(TOP)); - addbyte(0x8b); /*MOV tag, EAX*/ + addbyte(0x89); /*MOV tag, EAX*/ addbyte(0x45); addbyte(cpu_state_offset(tag[0])); - addbyte(0x8b); /*MOV tag+4, EAX*/ + addbyte(0x89); /*MOV tag+4, EAX*/ addbyte(0x45); addbyte(cpu_state_offset(tag[4])); diff --git a/src/x87_ops.h b/src/x87_ops.h index ec5f772..79951c6 100644 --- a/src/x87_ops.h +++ b/src/x87_ops.h @@ -41,7 +41,7 @@ static inline void x87_set_mmx() static inline void x87_emms() { - *cpu_state.tag = 0x0303030303030303ll; + *(uint64_t *)cpu_state.tag = 0x0303030303030303ll; cpu_state.ismmx = 0; } diff --git a/src/x87_ops_misc.h b/src/x87_ops_misc.h index f40b932..553092a 100644 --- a/src/x87_ops_misc.h +++ b/src/x87_ops_misc.h @@ -36,6 +36,7 @@ static int opFINIT(uint32_t fetchdat) cpu_state.npxs = 0; *(uint64_t *)cpu_state.tag = 0x0303030303030303ll; cpu_state.TOP = 0; + cpu_state.ismmx = 0; CLOCK_CYCLES(17); return 0; } @@ -272,6 +273,14 @@ static int FSAVE() } break; } + + cpu_state.npxc = 0x37F; + cpu_state.new_npxc = (cpu_state.old_npxc & ~0xc00); + cpu_state.npxs = 0; + *(uint64_t *)cpu_state.tag = 0x0303030303030303ll; + cpu_state.TOP = 0; + cpu_state.ismmx = 0; + CLOCK_CYCLES((cr0 & 1) ? 56 : 67); return cpu_state.abrt; }