Ignore:
File:
1 edited

Legend:

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

    rcd3b380 re2a0d76  
    6363{
    6464#ifdef CONFIG_TSB
    65         uintptr_t tsb_phys =
    66             frame_alloc(SIZE2FRAMES((ITSB_ENTRY_COUNT + DTSB_ENTRY_COUNT) *
    67             sizeof(tsb_entry_t)), flags, 0);
    68         if (!tsb_phys)
     65        /*
     66         * The order must be calculated with respect to the emulated
     67         * 16K page size.
     68         *
     69         */
     70        uint8_t order = fnzb32(((ITSB_ENTRY_COUNT + DTSB_ENTRY_COUNT) *
     71            sizeof(tsb_entry_t)) >> FRAME_WIDTH);
     72       
     73        uintptr_t tsb = PA2KA(frame_alloc(order, flags, 0));
     74        if (!tsb)
    6975                return -1;
    7076       
    71         tsb_entry_t *tsb = (tsb_entry_t *) PA2KA(tsb_phys);
    72        
    73         as->arch.itsb = tsb;
    74         as->arch.dtsb = tsb + ITSB_ENTRY_COUNT;
    75        
    76         memsetb(as->arch.itsb, (ITSB_ENTRY_COUNT + DTSB_ENTRY_COUNT) *
    77             sizeof(tsb_entry_t), 0);
     77        as->arch.itsb = (tsb_entry_t *) tsb;
     78        as->arch.dtsb = (tsb_entry_t *) (tsb + ITSB_ENTRY_COUNT *
     79            sizeof(tsb_entry_t));
     80       
     81        memsetb(as->arch.itsb,
     82            (ITSB_ENTRY_COUNT + DTSB_ENTRY_COUNT) * sizeof(tsb_entry_t), 0);
    7883#endif
    7984       
     
    8489{
    8590#ifdef CONFIG_TSB
    86         size_t frames = SIZE2FRAMES((ITSB_ENTRY_COUNT + DTSB_ENTRY_COUNT) *
    87             sizeof(tsb_entry_t));
    88         frame_free(KA2PA((uintptr_t) as->arch.itsb), frames);
    89        
    90         return frames;
     91        /*
     92         * The count must be calculated with respect to the emualted 16K page
     93         * size.
     94         */
     95        size_t cnt = ((ITSB_ENTRY_COUNT + DTSB_ENTRY_COUNT) *
     96            sizeof(tsb_entry_t)) >> FRAME_WIDTH;
     97        frame_free(KA2PA((uintptr_t) as->arch.itsb));
     98       
     99        return cnt;
    91100#else
    92101        return 0;
Note: See TracChangeset for help on using the changeset viewer.