static int kvm_get_fpu(X86CPU *cpu)

{

    CPUX86State *env = &cpu->env;

    struct kvm_fpu fpu;

    int i, ret;



    ret = kvm_vcpu_ioctl(CPU(cpu), KVM_GET_FPU, &fpu);

    if (ret < 0) {

        return ret;

    }



    env->fpstt = (fpu.fsw >> 11) & 7;

    env->fpus = fpu.fsw;

    env->fpuc = fpu.fcw;

    env->fpop = fpu.last_opcode;

    env->fpip = fpu.last_ip;

    env->fpdp = fpu.last_dp;

    for (i = 0; i < 8; ++i) {

        env->fptags[i] = !((fpu.ftwx >> i) & 1);

    }

    memcpy(env->fpregs, fpu.fpr, sizeof env->fpregs);

    memcpy(env->xmm_regs, fpu.xmm, sizeof env->xmm_regs);

    env->mxcsr = fpu.mxcsr;



    return 0;

}

static int kvm_get_fpu(X86CPU *cpu)

{

    CPUX86State *env = &cpu->env;

    struct kvm_fpu fpu;

    int i, ret;



    ret = kvm_vcpu_ioctl(CPU(cpu), KVM_GET_FPU, &fpu);

    if (ret < 0) {

        return ret;

    }



    env->fpstt = (fpu.fsw >> 11) & 7;

    env->fpus = fpu.fsw;

    env->fpuc = fpu.fcw;

    env->fpop = fpu.last_opcode;

    env->fpip = fpu.last_ip;

    env->fpdp = fpu.last_dp;

    for (i = 0; i < 8; ++i) {

        env->fptags[i] = !((fpu.ftwx >> i) & 1);

    }

    memcpy(env->fpregs, fpu.fpr, sizeof env->fpregs);

    memcpy(env->xmm_regs, fpu.xmm, sizeof env->xmm_regs);

    env->mxcsr = fpu.mxcsr;



    return 0;

}

static int FUNC_0(X86CPU *VAR_0)

{

    CPUX86State *env = &VAR_0->env;

    struct kvm_fpu VAR_1;

    int VAR_2, VAR_3;



    VAR_3 = kvm_vcpu_ioctl(CPU(VAR_0), KVM_GET_FPU, &VAR_1);

    if (VAR_3 < 0) {

        return VAR_3;

    }



    env->fpstt = (VAR_1.fsw >> 11) & 7;

    env->fpus = VAR_1.fsw;

    env->fpuc = VAR_1.fcw;

    env->fpop = VAR_1.last_opcode;

    env->fpip = VAR_1.last_ip;

    env->fpdp = VAR_1.last_dp;

    for (VAR_2 = 0; VAR_2 < 8; ++VAR_2) {

        env->fptags[VAR_2] = !((VAR_1.ftwx >> VAR_2) & 1);

    }

    memcpy(env->fpregs, VAR_1.fpr, sizeof env->fpregs);

    memcpy(env->xmm_regs, VAR_1.xmm, sizeof env->xmm_regs);

    env->mxcsr = VAR_1.mxcsr;



    return 0;

}

static int FUNC_0(X86CPU *VAR_0)
{ CPUX86State *env = &VAR_0->env; struct kvm_fpu VAR_1; int VAR_2, VAR_3; VAR_3 = kvm_vcpu_ioctl(CPU(VAR_0), KVM_GET_FPU, &VAR_1); if (VAR_3 < 0) { return VAR_3; } env->fpstt = (VAR_1.fsw >> 11) & 7; env->fpus = VAR_1.fsw; env->fpuc = VAR_1.fcw; env->fpop = VAR_1.last_opcode; env->fpip = VAR_1.last_ip; env->fpdp = VAR_1.last_dp; for (VAR_2 = 0; VAR_2 < 8; ++VAR_2) { env->fptags[VAR_2] = !((VAR_1.ftwx >> VAR_2) & 1); } memcpy(env->fpregs, VAR_1.fpr, sizeof env->fpregs); memcpy(env->xmm_regs, VAR_1.xmm, sizeof env->xmm_regs); env->mxcsr = VAR_1.mxcsr; return 0; }