static unsigned hpte_page_shift(const struct ppc_one_seg_page_size *sps,

    uint64_t pte0, uint64_t pte1)

{

    int i;



    if (!(pte0 & HPTE64_V_LARGE)) {

        if (sps->page_shift != 12) {

            /* 4kiB page in a non 4kiB segment */

            return 0;

        }

        /* Normal 4kiB page */

        return 12;

    }



    for (i = 0; i < PPC_PAGE_SIZES_MAX_SZ; i++) {

        const struct ppc_one_page_size *ps = &sps->enc[i];

        uint64_t mask;



        if (!ps->page_shift) {

            break;

        }



        if (ps->page_shift == 12) {

            /* L bit is set so this can't be a 4kiB page */

            continue;

        }



        mask = ((1ULL << ps->page_shift) - 1) & HPTE64_R_RPN;



        if ((pte1 & mask) == (ps->pte_enc << HPTE64_R_RPN_SHIFT)) {

            return ps->page_shift;

        }

    }



    return 0; /* Bad page size encoding */

}

static unsigned hpte_page_shift(const struct ppc_one_seg_page_size *sps,

    uint64_t pte0, uint64_t pte1)

{

    int i;



    if (!(pte0 & HPTE64_V_LARGE)) {

        if (sps->page_shift != 12) {

            

            return 0;

        }

        

        return 12;

    }



    for (i = 0; i < PPC_PAGE_SIZES_MAX_SZ; i++) {

        const struct ppc_one_page_size *ps = &sps->enc[i];

        uint64_t mask;



        if (!ps->page_shift) {

            break;

        }



        if (ps->page_shift == 12) {

            

            continue;

        }



        mask = ((1ULL << ps->page_shift) - 1) & HPTE64_R_RPN;



        if ((pte1 & mask) == (ps->pte_enc << HPTE64_R_RPN_SHIFT)) {

            return ps->page_shift;

        }

    }



    return 0; 

}

        if ((pte1 & mask) == (ps->pte_enc << HPTE64_R_RPN_SHIFT)) {
static unsigned FUNC_0(const struct ppc_one_seg_page_size *VAR_0,

    uint64_t VAR_1, uint64_t VAR_2)

{

    int VAR_3;



    if (!(VAR_1 & HPTE64_V_LARGE)) {

        if (VAR_0->page_shift != 12) {

            

            return 0;

        }

        

        return 12;

    }



    for (VAR_3 = 0; VAR_3 < PPC_PAGE_SIZES_MAX_SZ; VAR_3++) {

        const struct ppc_one_page_size *ps = &VAR_0->enc[VAR_3];

        uint64_t mask;



        if (!ps->page_shift) {

            break;

        }



        if (ps->page_shift == 12) {

            

            continue;

        }



        mask = ((1ULL << ps->page_shift) - 1) & HPTE64_R_RPN;



        if ((VAR_2 & mask) == (ps->pte_enc << HPTE64_R_RPN_SHIFT)) {

            return ps->page_shift;

        }

    }



    return 0; 

}

static unsigned FUNC_0(const struct ppc_one_seg_page_size *VAR_0,
uint64_t VAR_1, uint64_t VAR_2)
{ int VAR_3; if (!(VAR_1 & HPTE64_V_LARGE)) { if (VAR_0->page_shift != 12) { return 0; } return 12; } for (VAR_3 = 0; VAR_3 < PPC_PAGE_SIZES_MAX_SZ; VAR_3++) { const struct ppc_one_page_size *ps = &VAR_0->enc[VAR_3]; uint64_t mask; if (!ps->page_shift) { break; } if (ps->page_shift == 12) { continue; } mask = ((1ULL << ps->page_shift) - 1) & HPTE64_R_RPN; if ((VAR_2 & mask) == (ps->pte_enc << HPTE64_R_RPN_SHIFT)) { return ps->page_shift; } } return 0; }