static inline int ultrasparc_tag_match(SparcTLBEntry *tlb,

                                       uint64_t address, uint64_t context,

                                       target_phys_addr_t *physical,

                                       int is_nucleus)

{

    uint64_t mask;



    switch ((tlb->tte >> 61) & 3) {

    default:

    case 0x0: // 8k

        mask = 0xffffffffffffe000ULL;

        break;

    case 0x1: // 64k

        mask = 0xffffffffffff0000ULL;

        break;

    case 0x2: // 512k

        mask = 0xfffffffffff80000ULL;

        break;

    case 0x3: // 4M

        mask = 0xffffffffffc00000ULL;

        break;

    }



    // valid, context match, virtual address match?

    if (TTE_IS_VALID(tlb->tte) &&

        ((is_nucleus && compare_masked(0, tlb->tag, 0x1fff))

         || TTE_IS_GLOBAL(tlb->tte) || compare_masked(context, tlb->tag, 0x1fff))

        && compare_masked(address, tlb->tag, mask))

    {

        // decode physical address

        *physical = ((tlb->tte & mask) | (address & ~mask)) & 0x1ffffffe000ULL;

        return 1;

    }



    return 0;

}

static inline int ultrasparc_tag_match(SparcTLBEntry *tlb,

                                       uint64_t address, uint64_t context,

                                       target_phys_addr_t *physical,

                                       int is_nucleus)

{

    uint64_t mask;



    switch ((tlb->tte >> 61) & 3) {

    default:

    case 0x0: 

        mask = 0xffffffffffffe000ULL;

        break;

    case 0x1: 

        mask = 0xffffffffffff0000ULL;

        break;

    case 0x2: 

        mask = 0xfffffffffff80000ULL;

        break;

    case 0x3: 

        mask = 0xffffffffffc00000ULL;

        break;

    }



    

    if (TTE_IS_VALID(tlb->tte) &&

        ((is_nucleus && compare_masked(0, tlb->tag, 0x1fff))

         || TTE_IS_GLOBAL(tlb->tte) || compare_masked(context, tlb->tag, 0x1fff))

        && compare_masked(address, tlb->tag, mask))

    {

        

        *physical = ((tlb->tte & mask) | (address & ~mask)) & 0x1ffffffe000ULL;

        return 1;

    }



    return 0;

}

                                       target_phys_addr_t *physical,                                        int is_nucleus)         ((is_nucleus && compare_masked(0, tlb->tag, 0x1fff))          || TTE_IS_GLOBAL(tlb->tte) || compare_masked(context, tlb->tag, 0x1fff))
static inline int FUNC_0(SparcTLBEntry *VAR_0,

                                       uint64_t VAR_1, uint64_t VAR_2,

                                       target_phys_addr_t *VAR_3,

                                       int VAR_4)

{

    uint64_t mask;



    switch ((VAR_0->tte >> 61) & 3) {

    default:

    case 0x0: 

        mask = 0xffffffffffffe000ULL;

        break;

    case 0x1: 

        mask = 0xffffffffffff0000ULL;

        break;

    case 0x2: 

        mask = 0xfffffffffff80000ULL;

        break;

    case 0x3: 

        mask = 0xffffffffffc00000ULL;

        break;

    }



    

    if (TTE_IS_VALID(VAR_0->tte) &&

        ((VAR_4 && compare_masked(0, VAR_0->tag, 0x1fff))

         || TTE_IS_GLOBAL(VAR_0->tte) || compare_masked(VAR_2, VAR_0->tag, 0x1fff))

        && compare_masked(VAR_1, VAR_0->tag, mask))

    {

        

        *VAR_3 = ((VAR_0->tte & mask) | (VAR_1 & ~mask)) & 0x1ffffffe000ULL;

        return 1;

    }



    return 0;

}

static inline int FUNC_0(SparcTLBEntry *VAR_0,
uint64_t VAR_1, uint64_t VAR_2,
target_phys_addr_t *VAR_3,
int VAR_4)
{ uint64_t mask; switch ((VAR_0->tte >> 61) & 3) { default:
case 0x0:
mask = 0xffffffffffffe000ULL; break; case 0x1:
mask = 0xffffffffffff0000ULL; break; case 0x2:
mask = 0xfffffffffff80000ULL; break; case 0x3:
mask = 0xffffffffffc00000ULL; break; } if (TTE_IS_VALID(VAR_0->tte) &&
((VAR_4 && compare_masked(0, VAR_0->tag, 0x1fff))
|| TTE_IS_GLOBAL(VAR_0->tte) || compare_masked(VAR_2, VAR_0->tag, 0x1fff))
&& compare_masked(VAR_1, VAR_0->tag, mask))
{ *VAR_3 = ((VAR_0->tte & mask) | (VAR_1 & ~mask)) & 0x1ffffffe000ULL; return 1; } return 0; }