Changeset e41455d in mainline


Ignore:
Timestamp:
2007-04-17T18:53:58Z (18 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
2e915f2
Parents:
9a7a970
Message:

Add few assertions to tsb.c and clean it up a little bit.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/sparc64/src/mm/tsb.c

    r9a7a970 re41455d  
    6262       
    6363        i0 = (page >> MMU_PAGE_WIDTH) & TSB_INDEX_MASK;
     64        ASSERT(i0 < ITSB_ENTRY_COUNT && i0 < DTSB_ENTRY_COUNT);
     65
    6466        if (pages == (count_t) -1 || (pages * 2) > ITSB_ENTRY_COUNT)
    6567                cnt = ITSB_ENTRY_COUNT;
     
    8587        tsb_entry_t *tsb;
    8688        index_t entry;
     89
     90        ASSERT(index <= 1);
    8791       
    8892        as = t->as;
    8993        entry = ((t->page >> MMU_PAGE_WIDTH) + index) & TSB_INDEX_MASK;
     94        ASSERT(entry < ITSB_ENTRY_COUNT);
    9095        tsb = &as->arch.itsb[entry];
    9196
     
    103108
    104109        tsb->tag.context = as->asid;
    105         tsb->tag.va_tag = (t->page + (index << MMU_PAGE_WIDTH)) >>
    106             VA_TAG_PAGE_SHIFT;
     110        /* the shift is bigger than PAGE_WIDTH, do not bother with index  */
     111        tsb->tag.va_tag = t->page >> VA_TAG_PAGE_SHIFT;
    107112        tsb->data.value = 0;
    108113        tsb->data.size = PAGESIZE_8K;
     
    129134        index_t entry;
    130135       
     136        ASSERT(index <= 1);
     137
    131138        as = t->as;
    132139        entry = ((t->page >> MMU_PAGE_WIDTH) + index) & TSB_INDEX_MASK;
     140        ASSERT(entry < DTSB_ENTRY_COUNT);
    133141        tsb = &as->arch.dtsb[entry];
    134142
     
    146154
    147155        tsb->tag.context = as->asid;
    148         tsb->tag.va_tag = (t->page + (index << MMU_PAGE_WIDTH)) >>
    149             VA_TAG_PAGE_SHIFT;
     156        /* the shift is bigger than PAGE_WIDTH, do not bother with index */
     157        tsb->tag.va_tag = t->page >> VA_TAG_PAGE_SHIFT;
    150158        tsb->data.value = 0;
    151159        tsb->data.size = PAGESIZE_8K;
Note: See TracChangeset for help on using the changeset viewer.