static int vtd_page_walk(VTDContextEntry *ce, uint64_t start, uint64_t end,

                         vtd_page_walk_hook hook_fn, void *private,

                         bool notify_unmap)

{

    dma_addr_t addr = vtd_ce_get_slpt_base(ce);

    uint32_t level = vtd_ce_get_level(ce);



    if (!vtd_iova_range_check(start, ce)) {

        return -VTD_FR_ADDR_BEYOND_MGAW;

    }



    if (!vtd_iova_range_check(end, ce)) {

        /* Fix end so that it reaches the maximum */

        end = vtd_iova_limit(ce);

    }



    return vtd_page_walk_level(addr, start, end, hook_fn, private,

                               level, true, true, notify_unmap);

}

static int vtd_page_walk(VTDContextEntry *ce, uint64_t start, uint64_t end,

                         vtd_page_walk_hook hook_fn, void *private,

                         bool notify_unmap)

{

    dma_addr_t addr = vtd_ce_get_slpt_base(ce);

    uint32_t level = vtd_ce_get_level(ce);



    if (!vtd_iova_range_check(start, ce)) {

        return -VTD_FR_ADDR_BEYOND_MGAW;

    }



    if (!vtd_iova_range_check(end, ce)) {

        

        end = vtd_iova_limit(ce);

    }



    return vtd_page_walk_level(addr, start, end, hook_fn, private,

                               level, true, true, notify_unmap);

}

static int FUNC_0(VTDContextEntry *VAR_0, uint64_t VAR_1, uint64_t VAR_2,

                         vtd_page_walk_hook VAR_3, void *VAR_4,

                         bool VAR_5)

{

    dma_addr_t addr = vtd_ce_get_slpt_base(VAR_0);

    uint32_t level = vtd_ce_get_level(VAR_0);



    if (!vtd_iova_range_check(VAR_1, VAR_0)) {

        return -VTD_FR_ADDR_BEYOND_MGAW;

    }



    if (!vtd_iova_range_check(VAR_2, VAR_0)) {

        

        VAR_2 = vtd_iova_limit(VAR_0);

    }



    return vtd_page_walk_level(addr, VAR_1, VAR_2, VAR_3, VAR_4,

                               level, true, true, VAR_5);

}

static int FUNC_0(VTDContextEntry *VAR_0, uint64_t VAR_1, uint64_t VAR_2,
vtd_page_walk_hook VAR_3, void *VAR_4,
bool VAR_5)
{ dma_addr_t addr = vtd_ce_get_slpt_base(VAR_0); uint32_t level = vtd_ce_get_level(VAR_0); if (!vtd_iova_range_check(VAR_1, VAR_0)) { return -VTD_FR_ADDR_BEYOND_MGAW; } if (!vtd_iova_range_check(VAR_2, VAR_0)) { VAR_2 = vtd_iova_limit(VAR_0); } return vtd_page_walk_level(addr, VAR_1, VAR_2, VAR_3, VAR_4,
level, true, true, VAR_5); }