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

                         vtd_page_walk_hook hook_fn, void *private)

{

    dma_addr_t addr = vtd_get_slpt_base_from_context(ce);

    uint32_t level = vtd_get_level_from_context_entry(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, false);

}

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

                         vtd_page_walk_hook hook_fn, void *private)

{

    dma_addr_t addr = vtd_get_slpt_base_from_context(ce);

    uint32_t level = vtd_get_level_from_context_entry(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, false);

}

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

                         vtd_page_walk_hook VAR_3, void *VAR_4)

{

    dma_addr_t addr = vtd_get_slpt_base_from_context(VAR_0);

    uint32_t level = vtd_get_level_from_context_entry(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, false);

}

static int FUNC_0(VTDContextEntry *VAR_0, uint64_t VAR_1, uint64_t VAR_2,
vtd_page_walk_hook VAR_3, void *VAR_4)
{ dma_addr_t addr = vtd_get_slpt_base_from_context(VAR_0); uint32_t level = vtd_get_level_from_context_entry(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, false); }