int kvm_arch_on_sigbus(int code, void *addr)

{

#ifdef KVM_CAP_MCE

    if ((first_cpu->mcg_cap & MCG_SER_P) && addr && code == BUS_MCEERR_AO) {

        ram_addr_t ram_addr;

        target_phys_addr_t paddr;



        /* Hope we are lucky for AO MCE */

        if (qemu_ram_addr_from_host(addr, &ram_addr) ||

            !kvm_physical_memory_addr_from_ram(first_cpu->kvm_state, ram_addr,

                                               &paddr)) {

            fprintf(stderr, "Hardware memory error for memory used by "

                    "QEMU itself instead of guest system!: %p\n", addr);

            return 0;

        }


        kvm_mce_inject(first_cpu, paddr, code);

    } else

#endif /* KVM_CAP_MCE */

    {

        if (code == BUS_MCEERR_AO) {

            return 0;

        } else if (code == BUS_MCEERR_AR) {

            hardware_memory_error();

        } else {

            return 1;

        }

    }

    return 0;

}
int kvm_arch_on_sigbus(int code, void *addr)

{

#ifdef KVM_CAP_MCE

    if ((first_cpu->mcg_cap & MCG_SER_P) && addr && code == BUS_MCEERR_AO) {

        ram_addr_t ram_addr;

        target_phys_addr_t paddr;



        

        if (qemu_ram_addr_from_host(addr, &ram_addr) ||

            !kvm_physical_memory_addr_from_ram(first_cpu->kvm_state, ram_addr,

                                               &paddr)) {

            fprintf(stderr, "Hardware memory error for memory used by "

                    "QEMU itself instead of guest system!: %p\n", addr);

            return 0;

        }


        kvm_mce_inject(first_cpu, paddr, code);

    } else

#endif 

    {

        if (code == BUS_MCEERR_AO) {

            return 0;

        } else if (code == BUS_MCEERR_AR) {

            hardware_memory_error();

        } else {

            return 1;

        }

    }

    return 0;

}
int FUNC_0(int VAR_0, void *VAR_1)

{

#ifdef KVM_CAP_MCE

    if ((first_cpu->mcg_cap & MCG_SER_P) && VAR_1 && VAR_0 == BUS_MCEERR_AO) {

        ram_addr_t ram_addr;

        target_phys_addr_t paddr;



        

        if (qemu_ram_addr_from_host(VAR_1, &ram_addr) ||

            !kvm_physical_memory_addr_from_ram(first_cpu->kvm_state, ram_addr,

                                               &paddr)) {

            fprintf(stderr, "Hardware memory error for memory used by "

                    "QEMU itself instead of guest system!: %p\n", VAR_1);

            return 0;

        }


        kvm_mce_inject(first_cpu, paddr, VAR_0);

    } else

#endif 

    {

        if (VAR_0 == BUS_MCEERR_AO) {

            return 0;

        } else if (VAR_0 == BUS_MCEERR_AR) {

            hardware_memory_error();

        } else {

            return 1;

        }

    }

    return 0;

}
int FUNC_0(int VAR_0, void *VAR_1)
{ #ifdef KVM_CAP_MCE
if ((first_cpu->mcg_cap & MCG_SER_P) && VAR_1 && VAR_0 == BUS_MCEERR_AO) { ram_addr_t ram_addr; target_phys_addr_t paddr; if (qemu_ram_addr_from_host(VAR_1, &ram_addr) ||
!kvm_physical_memory_addr_from_ram(first_cpu->kvm_state, ram_addr,
&paddr)) { fprintf(stderr, "Hardware memory error for memory used by "
"QEMU itself instead of guest system!: %p\n", VAR_1); return 0; } kvm_mce_inject(first_cpu, paddr, VAR_0); } else #endif
{ if (VAR_0 == BUS_MCEERR_AO) { return 0; } else if (VAR_0 == BUS_MCEERR_AR) { hardware_memory_error(); } else { return 1; } } return 0; }