target/i386: Split out do_fninit

Do not call helper_fninit directly from helper_xrstor.
Do call the new helper from do_fsave.

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
Richard Henderson 2021-07-07 14:45:19 -07:00
parent 505910a6e2
commit bbdda9b74f

View File

@ -727,7 +727,7 @@ void helper_fwait(CPUX86State *env)
} }
} }
void helper_fninit(CPUX86State *env) static void do_fninit(CPUX86State *env)
{ {
env->fpus = 0; env->fpus = 0;
env->fpstt = 0; env->fpstt = 0;
@ -742,6 +742,11 @@ void helper_fninit(CPUX86State *env)
env->fptags[7] = 1; env->fptags[7] = 1;
} }
void helper_fninit(CPUX86State *env)
{
do_fninit(env);
}
/* BCD ops */ /* BCD ops */
void helper_fbld_ST0(CPUX86State *env, target_ulong ptr) void helper_fbld_ST0(CPUX86State *env, target_ulong ptr)
@ -2451,18 +2456,7 @@ static void do_fsave(CPUX86State *env, target_ulong ptr, int data32,
ptr += 10; ptr += 10;
} }
/* fninit */ do_fninit(env);
env->fpus = 0;
env->fpstt = 0;
cpu_set_fpuc(env, 0x37f);
env->fptags[0] = 1;
env->fptags[1] = 1;
env->fptags[2] = 1;
env->fptags[3] = 1;
env->fptags[4] = 1;
env->fptags[5] = 1;
env->fptags[6] = 1;
env->fptags[7] = 1;
} }
void helper_fsave(CPUX86State *env, target_ulong ptr, int data32) void helper_fsave(CPUX86State *env, target_ulong ptr, int data32)
@ -2834,7 +2828,7 @@ void helper_xrstor(CPUX86State *env, target_ulong ptr, uint64_t rfbm)
if (xstate_bv & XSTATE_FP_MASK) { if (xstate_bv & XSTATE_FP_MASK) {
do_xrstor_fpu(env, ptr, ra); do_xrstor_fpu(env, ptr, ra);
} else { } else {
helper_fninit(env); do_fninit(env);
memset(env->fpregs, 0, sizeof(env->fpregs)); memset(env->fpregs, 0, sizeof(env->fpregs));
} }
} }