| 3674 | #endif |
| 3675 | |
| 3676 | void fpu_reset (void) |
| 3677 | { |
| 3678 | #ifndef CPU_TESTER |
| 3679 | currprefs.fpu_mode = changed_prefs.fpu_mode; |
| 3680 | if (currprefs.fpu_mode > 0) { |
| 3681 | #ifdef WITH_SOFTFLOAT |
| 3682 | fp_init_softfloat(currprefs.fpu_model); |
| 3683 | #endif |
| 3684 | #ifdef MSVC_LONG_DOUBLE |
| 3685 | use_long_double = false; |
| 3686 | } else if (currprefs.fpu_mode < 0) { |
| 3687 | use_long_double = true; |
| 3688 | if (!fp_init_native_80()) { |
| 3689 | use_long_double = false; |
| 3690 | fp_init_softfloat(currprefs.fpu_model); |
| 3691 | } |
| 3692 | #endif |
| 3693 | } else { |
| 3694 | #ifdef MSVC_LONG_DOUBLE |
| 3695 | use_long_double = false; |
| 3696 | #endif |
| 3697 | fp_init_native(); |
| 3698 | } |
| 3699 | |
| 3700 | #if defined(CPU_i386) || defined(CPU_x86_64) |
| 3701 | #ifndef __MACH__ |
| 3702 | #ifndef __ANDROID__ |
| 3703 | init_fpucw_x87(); |
| 3704 | #endif |
| 3705 | #endif |
| 3706 | |
| 3707 | #ifdef MSVC_LONG_DOUBLE |
| 3708 | init_fpucw_x87_80(); |
| 3709 | #endif |
| 3710 | #endif |
| 3711 | #else |
| 3712 | fp_init_softfloat(currprefs.fpu_model); |
| 3713 | use_long_double = false; |
| 3714 | #endif |
| 3715 | |
| 3716 | regs.fpu_exp_state = 0; |
| 3717 | regs.fp_unimp_pend = 0; |
| 3718 | regs.fp_ea_set = false; |
| 3719 | get_features(); |
| 3720 | fpp_set_fpcr (0); |
| 3721 | fpp_set_fpsr (0); |
| 3722 | fpp_set_fpiar (0); |
| 3723 | #ifndef AMIBERRY |
| 3724 | fpux_restore (NULL); |
| 3725 | #endif |
| 3726 | // reset precision |
| 3727 | fpp_set_mode(0x00000080 | 0x00000010); |
| 3728 | fpp_set_mode(0x00000000); |
| 3729 | |
| 3730 | #if FPU_TEST |
| 3731 | fpu_test(); |
| 3732 | #endif |
| 3733 | |