static int xen_pt_pci_config_access_check(PCIDevice *d, uint32_t addr, int len)

{

    /* check offset range */

    if (addr >= 0xFF) {

        XEN_PT_ERR(d, "Failed to access register with offset exceeding 0xFF. "

                   "(addr: 0x%02x, len: %d)\n", addr, len);

        return -1;

    }



    /* check read size */

    if ((len != 1) && (len != 2) && (len != 4)) {

        XEN_PT_ERR(d, "Failed to access register with invalid access length. "

                   "(addr: 0x%02x, len: %d)\n", addr, len);

        return -1;

    }



    /* check offset alignment */

    if (addr & (len - 1)) {

        XEN_PT_ERR(d, "Failed to access register with invalid access size "

                   "alignment. (addr: 0x%02x, len: %d)\n", addr, len);

        return -1;

    }



    return 0;

}

static int xen_pt_pci_config_access_check(PCIDevice *d, uint32_t addr, int len)

{

    

    if (addr >= 0xFF) {

        XEN_PT_ERR(d, "Failed to access register with offset exceeding 0xFF. "

                   "(addr: 0x%02x, len: %d)\n", addr, len);

        return -1;

    }



    

    if ((len != 1) && (len != 2) && (len != 4)) {

        XEN_PT_ERR(d, "Failed to access register with invalid access length. "

                   "(addr: 0x%02x, len: %d)\n", addr, len);

        return -1;

    }



    

    if (addr & (len - 1)) {

        XEN_PT_ERR(d, "Failed to access register with invalid access size "

                   "alignment. (addr: 0x%02x, len: %d)\n", addr, len);

        return -1;

    }



    return 0;

}

static int FUNC_0(PCIDevice *VAR_0, uint32_t VAR_1, int VAR_2)

{

    

    if (VAR_1 >= 0xFF) {

        XEN_PT_ERR(VAR_0, "Failed to access register with offset exceeding 0xFF. "

                   "(VAR_1: 0x%02x, VAR_2: %VAR_0)\n", VAR_1, VAR_2);

        return -1;

    }



    

    if ((VAR_2 != 1) && (VAR_2 != 2) && (VAR_2 != 4)) {

        XEN_PT_ERR(VAR_0, "Failed to access register with invalid access length. "

                   "(VAR_1: 0x%02x, VAR_2: %VAR_0)\n", VAR_1, VAR_2);

        return -1;

    }



    

    if (VAR_1 & (VAR_2 - 1)) {

        XEN_PT_ERR(VAR_0, "Failed to access register with invalid access size "

                   "alignment. (VAR_1: 0x%02x, VAR_2: %VAR_0)\n", VAR_1, VAR_2);

        return -1;

    }



    return 0;

}

static int FUNC_0(PCIDevice *VAR_0, uint32_t VAR_1, int VAR_2)
{ if (VAR_1 >= 0xFF) { XEN_PT_ERR(VAR_0, "Failed to access register with offset exceeding 0xFF. "
"(VAR_1: 0x%02x, VAR_2: %VAR_0)\n", VAR_1, VAR_2); return -1; } if ((VAR_2 != 1) && (VAR_2 != 2) && (VAR_2 != 4)) { XEN_PT_ERR(VAR_0, "Failed to access register with invalid access length. "
"(VAR_1: 0x%02x, VAR_2: %VAR_0)\n", VAR_1, VAR_2); return -1; } if (VAR_1 & (VAR_2 - 1)) { XEN_PT_ERR(VAR_0, "Failed to access register with invalid access size "
"alignment. (VAR_1: 0x%02x, VAR_2: %VAR_0)\n", VAR_1, VAR_2); return -1; } return 0; }