uint64_t kvmppc_hash64_read_pteg(PowerPCCPU *cpu, target_ulong pte_index)

{

    int htab_fd;

    struct kvm_get_htab_fd ghf;

    struct kvm_get_htab_buf  *hpte_buf;



    ghf.flags = 0;

    ghf.start_index = pte_index;

    htab_fd = kvm_vm_ioctl(kvm_state, KVM_PPC_GET_HTAB_FD, &ghf);

    if (htab_fd < 0) {

        goto error_out;

    }



    hpte_buf = g_malloc0(sizeof(*hpte_buf));

    /*

     * Read the hpte group

     */

    if (read(htab_fd, hpte_buf, sizeof(*hpte_buf)) < 0) {

        goto out_close;

    }



    close(htab_fd);

    return (uint64_t)(uintptr_t) hpte_buf->hpte;



out_close:

    g_free(hpte_buf);

    close(htab_fd);

error_out:

    return 0;

}

uint64_t kvmppc_hash64_read_pteg(PowerPCCPU *cpu, target_ulong pte_index)

{

    int htab_fd;

    struct kvm_get_htab_fd ghf;

    struct kvm_get_htab_buf  *hpte_buf;



    ghf.flags = 0;

    ghf.start_index = pte_index;

    htab_fd = kvm_vm_ioctl(kvm_state, KVM_PPC_GET_HTAB_FD, &ghf);

    if (htab_fd < 0) {

        goto error_out;

    }



    hpte_buf = g_malloc0(sizeof(*hpte_buf));

    





    if (read(htab_fd, hpte_buf, sizeof(*hpte_buf)) < 0) {

        goto out_close;

    }



    close(htab_fd);

    return (uint64_t)(uintptr_t) hpte_buf->hpte;



out_close:

    g_free(hpte_buf);

    close(htab_fd);

error_out:

    return 0;

}

uint64_t FUNC_0(PowerPCCPU *cpu, target_ulong pte_index)

{

    int VAR_0;

    struct kvm_get_htab_fd VAR_1;

    struct kvm_get_htab_buf  *VAR_2;



    VAR_1.flags = 0;

    VAR_1.start_index = pte_index;

    VAR_0 = kvm_vm_ioctl(kvm_state, KVM_PPC_GET_HTAB_FD, &VAR_1);

    if (VAR_0 < 0) {

        goto error_out;

    }



    VAR_2 = g_malloc0(sizeof(*VAR_2));

    





    if (read(VAR_0, VAR_2, sizeof(*VAR_2)) < 0) {

        goto out_close;

    }



    close(VAR_0);

    return (uint64_t)(uintptr_t) VAR_2->hpte;



out_close:

    g_free(VAR_2);

    close(VAR_0);

error_out:

    return 0;

}

uint64_t FUNC_0(PowerPCCPU *cpu, target_ulong pte_index)
{ int VAR_0; struct kvm_get_htab_fd VAR_1; struct kvm_get_htab_buf  *VAR_2; VAR_1.flags = 0; VAR_1.start_index = pte_index; VAR_0 = kvm_vm_ioctl(kvm_state, KVM_PPC_GET_HTAB_FD, &VAR_1); if (VAR_0 < 0) { goto error_out; } VAR_2 = g_malloc0(sizeof(*VAR_2)); if (read(VAR_0, VAR_2, sizeof(*VAR_2)) < 0) { goto out_close; } close(VAR_0); return (uint64_t)(uintptr_t) VAR_2->hpte; out_close:
g_free(VAR_2); close(VAR_0); error_out:
return 0; }