static int kvm_get_msr(CPUState *env, struct kvm_msr_entry *msrs, int n)

{

    struct kvm_msrs *kmsrs = qemu_malloc(sizeof *kmsrs + n * sizeof *msrs);

    int r;



    kmsrs->nmsrs = n;

    memcpy(kmsrs->entries, msrs, n * sizeof *msrs);

    r = kvm_vcpu_ioctl(env, KVM_GET_MSRS, kmsrs);

    memcpy(msrs, kmsrs->entries, n * sizeof *msrs);

    free(kmsrs);

    return r;

}

static int kvm_get_msr(CPUState *env, struct kvm_msr_entry *msrs, int n)

{

    struct kvm_msrs *kmsrs = qemu_malloc(sizeof *kmsrs + n * sizeof *msrs);

    int r;



    kmsrs->nmsrs = n;

    memcpy(kmsrs->entries, msrs, n * sizeof *msrs);

    r = kvm_vcpu_ioctl(env, KVM_GET_MSRS, kmsrs);

    memcpy(msrs, kmsrs->entries, n * sizeof *msrs);

    free(kmsrs);

    return r;

}

static int FUNC_0(CPUState *VAR_0, struct kvm_msr_entry *VAR_1, int VAR_2)

{

    struct kvm_msrs *VAR_3 = qemu_malloc(sizeof *VAR_3 + VAR_2 * sizeof *VAR_1);

    int VAR_4;



    VAR_3->nmsrs = VAR_2;

    memcpy(VAR_3->entries, VAR_1, VAR_2 * sizeof *VAR_1);

    VAR_4 = kvm_vcpu_ioctl(VAR_0, KVM_GET_MSRS, VAR_3);

    memcpy(VAR_1, VAR_3->entries, VAR_2 * sizeof *VAR_1);

    free(VAR_3);

    return VAR_4;

}

static int FUNC_0(CPUState *VAR_0, struct kvm_msr_entry *VAR_1, int VAR_2)
{ struct kvm_msrs *VAR_3 = qemu_malloc(sizeof *VAR_3 + VAR_2 * sizeof *VAR_1); int VAR_4; VAR_3->nmsrs = VAR_2; memcpy(VAR_3->entries, VAR_1, VAR_2 * sizeof *VAR_1); VAR_4 = kvm_vcpu_ioctl(VAR_0, KVM_GET_MSRS, VAR_3); memcpy(VAR_1, VAR_3->entries, VAR_2 * sizeof *VAR_1); free(VAR_3); return VAR_4; }