static int kvm_put_fpu(X86CPU *cpu)

{

    CPUX86State *env = &cpu->env;

    struct kvm_fpu fpu;

    int i;



    memset(&fpu, 0, sizeof fpu);

    fpu.fsw = env->fpus & ~(7 << 11);

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

    fpu.fcw = env->fpuc;

    fpu.last_opcode = env->fpop;

    fpu.last_ip = env->fpip;

    fpu.last_dp = env->fpdp;

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

        fpu.ftwx |= (!env->fptags[i]) << i;

    }

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

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

    fpu.mxcsr = env->mxcsr;



    return kvm_vcpu_ioctl(CPU(cpu), KVM_SET_FPU, &fpu);

}

static int kvm_put_fpu(X86CPU *cpu)

{

    CPUX86State *env = &cpu->env;

    struct kvm_fpu fpu;

    int i;



    memset(&fpu, 0, sizeof fpu);

    fpu.fsw = env->fpus & ~(7 << 11);

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

    fpu.fcw = env->fpuc;

    fpu.last_opcode = env->fpop;

    fpu.last_ip = env->fpip;

    fpu.last_dp = env->fpdp;

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

        fpu.ftwx |= (!env->fptags[i]) << i;

    }

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

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

    fpu.mxcsr = env->mxcsr;



    return kvm_vcpu_ioctl(CPU(cpu), KVM_SET_FPU, &fpu);

}

static int FUNC_0(X86CPU *VAR_0)

{

    CPUX86State *env = &VAR_0->env;

    struct kvm_fpu VAR_1;

    int VAR_2;



    memset(&VAR_1, 0, sizeof VAR_1);

    VAR_1.fsw = env->fpus & ~(7 << 11);

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

    VAR_1.fcw = env->fpuc;

    VAR_1.last_opcode = env->fpop;

    VAR_1.last_ip = env->fpip;

    VAR_1.last_dp = env->fpdp;

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

        VAR_1.ftwx |= (!env->fptags[VAR_2]) << VAR_2;

    }

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

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

    VAR_1.mxcsr = env->mxcsr;



    return kvm_vcpu_ioctl(CPU(VAR_0), KVM_SET_FPU, &VAR_1);

}

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