static inline int ppcemb_tlb_check(CPUState *env, ppcemb_tlb_t *tlb,

                                   target_phys_addr_t *raddrp,

                                   target_ulong address, uint32_t pid, int ext,

                                   int i)

{

    target_ulong mask;



    /* Check valid flag */

    if (!(tlb->prot & PAGE_VALID)) {

        qemu_log("%s: TLB %d not valid\n", __func__, i);

        return -1;

    }

    mask = ~(tlb->size - 1);

    LOG_SWTLB("%s: TLB %d address " TARGET_FMT_lx " PID %u <=> " TARGET_FMT_lx

              " " TARGET_FMT_lx " %u\n", __func__, i, address, pid, tlb->EPN,

              mask, (uint32_t)tlb->PID);

    /* Check PID */

    if (tlb->PID != 0 && tlb->PID != pid)

        return -1;

    /* Check effective address */

    if ((address & mask) != tlb->EPN)

        return -1;

    *raddrp = (tlb->RPN & mask) | (address & ~mask);

#if (TARGET_PHYS_ADDR_BITS >= 36)

    if (ext) {

        /* Extend the physical address to 36 bits */

        *raddrp |= (target_phys_addr_t)(tlb->RPN & 0xF) << 32;

    }

#endif



    return 0;

}

static inline int ppcemb_tlb_check(CPUState *env, ppcemb_tlb_t *tlb,

                                   target_phys_addr_t *raddrp,

                                   target_ulong address, uint32_t pid, int ext,

                                   int i)

{

    target_ulong mask;



    

    if (!(tlb->prot & PAGE_VALID)) {

        qemu_log("%s: TLB %d not valid\n", __func__, i);

        return -1;

    }

    mask = ~(tlb->size - 1);

    LOG_SWTLB("%s: TLB %d address " TARGET_FMT_lx " PID %u <=> " TARGET_FMT_lx

              " " TARGET_FMT_lx " %u\n", __func__, i, address, pid, tlb->EPN,

              mask, (uint32_t)tlb->PID);

    

    if (tlb->PID != 0 && tlb->PID != pid)

        return -1;

    

    if ((address & mask) != tlb->EPN)

        return -1;

    *raddrp = (tlb->RPN & mask) | (address & ~mask);

#if (TARGET_PHYS_ADDR_BITS >= 36)

    if (ext) {

        

        *raddrp |= (target_phys_addr_t)(tlb->RPN & 0xF) << 32;

    }

#endif



    return 0;

}

static inline int FUNC_0(CPUState *VAR_0, ppcemb_tlb_t *VAR_1,

                                   target_phys_addr_t *VAR_2,

                                   target_ulong VAR_3, uint32_t VAR_4, int VAR_5,

                                   int VAR_6)

{

    target_ulong mask;



    

    if (!(VAR_1->prot & PAGE_VALID)) {

        qemu_log("%s: TLB %d not valid\n", __func__, VAR_6);

        return -1;

    }

    mask = ~(VAR_1->size - 1);

    LOG_SWTLB("%s: TLB %d VAR_3 " TARGET_FMT_lx " PID %u <=> " TARGET_FMT_lx

              " " TARGET_FMT_lx " %u\n", __func__, VAR_6, VAR_3, VAR_4, VAR_1->EPN,

              mask, (uint32_t)VAR_1->PID);

    

    if (VAR_1->PID != 0 && VAR_1->PID != VAR_4)

        return -1;

    

    if ((VAR_3 & mask) != VAR_1->EPN)

        return -1;

    *VAR_2 = (VAR_1->RPN & mask) | (VAR_3 & ~mask);

#if (TARGET_PHYS_ADDR_BITS >= 36)

    if (VAR_5) {

        

        *VAR_2 |= (target_phys_addr_t)(VAR_1->RPN & 0xF) << 32;

    }

#endif



    return 0;

}

static inline int FUNC_0(CPUState *VAR_0, ppcemb_tlb_t *VAR_1,
target_phys_addr_t *VAR_2,
target_ulong VAR_3, uint32_t VAR_4, int VAR_5,
int VAR_6)
{ target_ulong mask; if (!(VAR_1->prot & PAGE_VALID)) { qemu_log("%s: TLB %d not valid\n", __func__, VAR_6); return -1; } mask = ~(VAR_1->size - 1); LOG_SWTLB("%s: TLB %d VAR_3 " TARGET_FMT_lx " PID %u <=> " TARGET_FMT_lx
" " TARGET_FMT_lx " %u\n", __func__, VAR_6, VAR_3, VAR_4, VAR_1->EPN,
mask, (uint32_t)VAR_1->PID); if (VAR_1->PID != 0 && VAR_1->PID != VAR_4)
return -1; if ((VAR_3 & mask) != VAR_1->EPN)
return -1; *VAR_2 = (VAR_1->RPN & mask) | (VAR_3 & ~mask); #if (TARGET_PHYS_ADDR_BITS >= 36)
if (VAR_5) { *VAR_2 |= (target_phys_addr_t)(VAR_1->RPN & 0xF) << 32; } #endif
return 0; }