Changeset 2057572 in mainline for kernel/arch/sparc64/src


Ignore:
Timestamp:
2007-03-27T23:40:25Z (18 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
399ece9
Parents:
8d37a06
Message:

The Ultimate Solution To Illegal Virtual Aliases.
It is better to avoid them completely than to fight them.
Switch the sparc64 port to 16K pages. The TLBs and TSBs
continue to operate with 8K pages only. Page tables and
other generic parts operate with 16K pages.

Because the MMU doesn't support 16K directly, each 16K
page is emulated by a pair of 8K pages. With 16K pages,
illegal aliases cannot be created in 16K D-cache.

Location:
kernel/arch/sparc64/src
Files:
1 deleted
7 edited
1 moved

Legend:

Unmodified
Added
Removed
  • kernel/arch/sparc64/src/cpu/cpu.c

    r8d37a06 r2057572  
    5252        CPU->arch.mid = upa_config.mid;
    5353       
    54 #if (defined(CONFIG_SMP) && defined(CONFIG_VIRT_IDX_DCACHE))
    55         CPU->arch.dcache_active = 1;
    56         CPU->arch.dcache_message_count = 0;
    57 #endif
    58 
    5954        /*
    6055         * Detect processor frequency.
  • kernel/arch/sparc64/src/mm/as.c

    r8d37a06 r2057572  
    6363#ifdef CONFIG_TSB
    6464        int order = fnzb32(((ITSB_ENTRY_COUNT + DTSB_ENTRY_COUNT) *
    65                 sizeof(tsb_entry_t)) >> FRAME_WIDTH);
     65                sizeof(tsb_entry_t)) >> MMU_FRAME_WIDTH);
    6666        uintptr_t tsb = (uintptr_t) frame_alloc(order, flags | FRAME_KA);
    6767
     
    7272        as->arch.dtsb = (tsb_entry_t *) (tsb + ITSB_ENTRY_COUNT *
    7373                sizeof(tsb_entry_t));
    74         memsetb((uintptr_t) as->arch.itsb, (ITSB_ENTRY_COUNT + DTSB_ENTRY_COUNT)
    75                 * sizeof(tsb_entry_t), 0);
     74        memsetb((uintptr_t) as->arch.itsb,
     75            (ITSB_ENTRY_COUNT + DTSB_ENTRY_COUNT) * sizeof(tsb_entry_t), 0);
    7676#endif
    7777        return 0;
     
    8282#ifdef CONFIG_TSB
    8383        count_t cnt = ((ITSB_ENTRY_COUNT + DTSB_ENTRY_COUNT) *
    84                 sizeof(tsb_entry_t)) >> FRAME_WIDTH;
     84                sizeof(tsb_entry_t)) >> MMU_FRAME_WIDTH;
    8585        frame_free(KA2PA((uintptr_t) as->arch.itsb));
    8686        return cnt;
     
    140140        uintptr_t tsb = (uintptr_t) as->arch.itsb;
    141141               
    142         if (!overlaps(tsb, 8 * PAGE_SIZE, base, 1 << KERNEL_PAGE_WIDTH)) {
     142        if (!overlaps(tsb, 8 * MMU_PAGE_SIZE, base, 1 << KERNEL_PAGE_WIDTH)) {
    143143                /*
    144144                 * TSBs were allocated from memory not covered
     
    159159        tsb_base.split = 0;
    160160
    161         tsb_base.base = ((uintptr_t) as->arch.itsb) >> PAGE_WIDTH;
     161        tsb_base.base = ((uintptr_t) as->arch.itsb) >> MMU_PAGE_WIDTH;
    162162        itsb_base_write(tsb_base.value);
    163         tsb_base.base = ((uintptr_t) as->arch.dtsb) >> PAGE_WIDTH;
     163        tsb_base.base = ((uintptr_t) as->arch.dtsb) >> MMU_PAGE_WIDTH;
    164164        dtsb_base_write(tsb_base.value);
    165165#endif
     
    190190        uintptr_t tsb = (uintptr_t) as->arch.itsb;
    191191               
    192         if (!overlaps(tsb, 8 * PAGE_SIZE, base, 1 << KERNEL_PAGE_WIDTH)) {
     192        if (!overlaps(tsb, 8 * MMU_PAGE_SIZE, base, 1 << KERNEL_PAGE_WIDTH)) {
    193193                /*
    194194                 * TSBs were allocated from memory not covered
  • kernel/arch/sparc64/src/mm/page.c

    r8d37a06 r2057572  
    7474                for (i = 0; i < bsp_locked_dtlb_entries; i++) {
    7575                        dtlb_insert_mapping(bsp_locked_dtlb_entry[i].virt_page,
    76                                 bsp_locked_dtlb_entry[i].phys_page,
    77                                 bsp_locked_dtlb_entry[i].pagesize_code, true,
    78                                 false);
     76                            bsp_locked_dtlb_entry[i].phys_page,
     77                            bsp_locked_dtlb_entry[i].pagesize_code, true,
     78                            false);
    7979                }
    8080#endif 
     
    108108                count_t count;
    109109        } sizemap[] = {
    110                 { PAGESIZE_8K, 0, 1 },                  /* 8K */
    111                 { PAGESIZE_8K, PAGE_SIZE, 2 },          /* 16K */
    112                 { PAGESIZE_8K, PAGE_SIZE, 4 },          /* 32K */
    113                 { PAGESIZE_64K, 0, 1},                  /* 64K */
    114                 { PAGESIZE_64K, 8 * PAGE_SIZE, 2 },     /* 128K */
    115                 { PAGESIZE_64K, 8 * PAGE_SIZE, 4 },     /* 256K */
    116                 { PAGESIZE_512K, 0, 1 },                /* 512K */
    117                 { PAGESIZE_512K, 64 * PAGE_SIZE, 2 },   /* 1M */
    118                 { PAGESIZE_512K, 64 * PAGE_SIZE, 4 },   /* 2M */
    119                 { PAGESIZE_4M, 0, 1 },                  /* 4M */
    120                 { PAGESIZE_4M, 512 * PAGE_SIZE, 2 }     /* 8M */
     110                { PAGESIZE_8K, 0, 1 },                          /* 8K */
     111                { PAGESIZE_8K, MMU_PAGE_SIZE, 2 },              /* 16K */
     112                { PAGESIZE_8K, MMU_PAGE_SIZE, 4 },              /* 32K */
     113                { PAGESIZE_64K, 0, 1},                          /* 64K */
     114                { PAGESIZE_64K, 8 * MMU_PAGE_SIZE, 2 },         /* 128K */
     115                { PAGESIZE_64K, 8 * MMU_PAGE_SIZE, 4 },         /* 256K */
     116                { PAGESIZE_512K, 0, 1 },                        /* 512K */
     117                { PAGESIZE_512K, 64 * MMU_PAGE_SIZE, 2 },       /* 1M */
     118                { PAGESIZE_512K, 64 * MMU_PAGE_SIZE, 4 },       /* 2M */
     119                { PAGESIZE_4M, 0, 1 },                          /* 4M */
     120                { PAGESIZE_4M, 512 * MMU_PAGE_SIZE, 2 }         /* 8M */
    121121        };
    122122       
    123         ASSERT(ALIGN_UP(physaddr, PAGE_SIZE) == physaddr);
     123        ASSERT(ALIGN_UP(physaddr, MMU_PAGE_SIZE) == physaddr);
    124124        ASSERT(size <= 8 * 1024 * 1024);
    125125       
    126         if (size <= FRAME_SIZE)
     126        if (size <= MMU_FRAME_SIZE)
    127127                order = 0;
    128128        else
    129                 order = (fnzb64(size - 1) + 1) - FRAME_WIDTH;
     129                order = (fnzb64(size - 1) + 1) - MMU_FRAME_WIDTH;
    130130
    131131        /*
     
    135135         */
    136136        ASSERT(PA2KA(last_frame));
    137         uintptr_t virtaddr = ALIGN_UP(PA2KA(last_frame), 1 << (order + FRAME_WIDTH));
    138         last_frame = ALIGN_UP(KA2PA(virtaddr) + size, 1 << (order + FRAME_WIDTH));
     137        uintptr_t virtaddr = ALIGN_UP(PA2KA(last_frame),
     138            1 << (order + FRAME_WIDTH));
     139        last_frame = ALIGN_UP(KA2PA(virtaddr) + size,
     140            1 << (order + FRAME_WIDTH));
    139141       
    140142        for (i = 0; i < sizemap[order].count; i++) {
     
    143145                 */
    144146                dtlb_insert_mapping(virtaddr + i * sizemap[order].increment,
    145                         physaddr + i * sizemap[order].increment,
    146                         sizemap[order].pagesize_code, true, false);
     147                    physaddr + i * sizemap[order].increment,
     148                    sizemap[order].pagesize_code, true, false);
    147149       
    148150#ifdef CONFIG_SMP       
     
    151153                 */
    152154                bsp_locked_dtlb_entry[bsp_locked_dtlb_entries].virt_page =
    153                         virtaddr + i * sizemap[order].increment;
     155                    virtaddr + i * sizemap[order].increment;
    154156                bsp_locked_dtlb_entry[bsp_locked_dtlb_entries].phys_page =
    155                         physaddr + i * sizemap[order].increment;
     157                    physaddr + i * sizemap[order].increment;
    156158                bsp_locked_dtlb_entry[bsp_locked_dtlb_entries].pagesize_code =
    157                         sizemap[order].pagesize_code;
     159                    sizemap[order].pagesize_code;
    158160                bsp_locked_dtlb_entries++;
    159161#endif
  • kernel/arch/sparc64/src/mm/tlb.c

    r8d37a06 r2057572  
    5555#endif
    5656
    57 static void dtlb_pte_copy(pte_t *t, bool ro);
    58 static void itlb_pte_copy(pte_t *t);
    59 static void do_fast_instruction_access_mmu_miss_fault(istate_t *istate, const
    60         char *str);
     57static void dtlb_pte_copy(pte_t *t, index_t index, bool ro);
     58static void itlb_pte_copy(pte_t *t, index_t index);
     59static void do_fast_instruction_access_mmu_miss_fault(istate_t *istate,
     60    const char *str);
    6161static void do_fast_data_access_mmu_miss_fault(istate_t *istate,
    62         tlb_tag_access_reg_t tag, const char *str);
     62    tlb_tag_access_reg_t tag, const char *str);
    6363static void do_fast_data_access_protection_fault(istate_t *istate,
    64         tlb_tag_access_reg_t tag, const char *str);
     64    tlb_tag_access_reg_t tag, const char *str);
    6565
    6666char *context_encoding[] = {
     
    9393 * @param cacheable True if the mapping is cacheable, false otherwise.
    9494 */
    95 void dtlb_insert_mapping(uintptr_t page, uintptr_t frame, int pagesize, bool
    96         locked, bool cacheable)
     95void dtlb_insert_mapping(uintptr_t page, uintptr_t frame, int pagesize,
     96    bool locked, bool cacheable)
    9797{
    9898        tlb_tag_access_reg_t tag;
     
    127127/** Copy PTE to TLB.
    128128 *
    129  * @param t Page Table Entry to be copied.
    130  * @param ro If true, the entry will be created read-only, regardless of its w
    131  *      field.
    132  */
    133 void dtlb_pte_copy(pte_t *t, bool ro)
     129 * @param t     Page Table Entry to be copied.
     130 * @param index Zero if lower 8K-subpage, one if higher 8K-subpage.
     131 * @param ro    If true, the entry will be created read-only, regardless of its
     132 *              w field.
     133 */
     134void dtlb_pte_copy(pte_t *t, index_t index, bool ro)
    134135{
    135136        tlb_tag_access_reg_t tag;
     
    138139        frame_address_t fr;
    139140
    140         pg.address = t->page;
    141         fr.address = t->frame;
     141        pg.address = t->page + (index << MMU_PAGE_WIDTH);
     142        fr.address = t->frame + (index << MMU_PAGE_WIDTH);
    142143
    143144        tag.value = 0;
    144145        tag.context = t->as->asid;
    145146        tag.vpn = pg.vpn;
    146        
     147
    147148        dtlb_tag_access_write(tag.value);
    148        
     149
    149150        data.value = 0;
    150151        data.v = true;
     
    159160        data.w = ro ? false : t->w;
    160161        data.g = t->g;
    161        
     162
    162163        dtlb_data_in_write(data.value);
    163164}
     
    165166/** Copy PTE to ITLB.
    166167 *
    167  * @param t Page Table Entry to be copied.
    168  */
    169 void itlb_pte_copy(pte_t *t)
     168 * @param t     Page Table Entry to be copied.
     169 * @param index Zero if lower 8K-subpage, one if higher 8K-subpage.
     170 */
     171void itlb_pte_copy(pte_t *t, index_t index)
    170172{
    171173        tlb_tag_access_reg_t tag;
     
    174176        frame_address_t fr;
    175177
    176         pg.address = t->page;
    177         fr.address = t->frame;
     178        pg.address = t->page + (index << MMU_PAGE_WIDTH);
     179        fr.address = t->frame + (index << MMU_PAGE_WIDTH);
    178180
    179181        tag.value = 0;
     
    200202{
    201203        uintptr_t va = ALIGN_DOWN(istate->tpc, PAGE_SIZE);
     204        index_t index = (istate->tpc >> MMU_PAGE_WIDTH) % MMU_PAGES_PER_PAGE;
    202205        pte_t *t;
    203206
     
    210213                 */
    211214                t->a = true;
    212                 itlb_pte_copy(t);
     215                itlb_pte_copy(t, index);
    213216#ifdef CONFIG_TSB
    214                 itsb_pte_copy(t);
     217                itsb_pte_copy(t, index);
    215218#endif
    216219                page_table_unlock(AS, true);
     
    223226                if (as_page_fault(va, PF_ACCESS_EXEC, istate) == AS_PF_FAULT) {
    224227                        do_fast_instruction_access_mmu_miss_fault(istate,
    225                                 __FUNCTION__);
     228                            __FUNCTION__);
    226229                }
    227230        }
     
    237240        tlb_tag_access_reg_t tag;
    238241        uintptr_t va;
     242        index_t index;
    239243        pte_t *t;
    240244
    241245        tag.value = dtlb_tag_access_read();
    242         va = tag.vpn << PAGE_WIDTH;
     246        va = ALIGN_DOWN((uint64_t) tag.vpn << MMU_PAGE_WIDTH, PAGE_SIZE);
     247        index = tag.vpn % MMU_PAGES_PER_PAGE;
    243248
    244249        if (tag.context == ASID_KERNEL) {
     
    246251                        /* NULL access in kernel */
    247252                        do_fast_data_access_mmu_miss_fault(istate, tag,
    248                                 __FUNCTION__);
     253                            __FUNCTION__);
    249254                }
    250255                do_fast_data_access_mmu_miss_fault(istate, tag, "Unexpected "
    251                         "kernel page fault.");
     256                    "kernel page fault.");
    252257        }
    253258
     
    260265                 */
    261266                t->a = true;
    262                 dtlb_pte_copy(t, true);
     267                dtlb_pte_copy(t, index, true);
    263268#ifdef CONFIG_TSB
    264                 dtsb_pte_copy(t, true);
     269                dtsb_pte_copy(t, index, true);
    265270#endif
    266271                page_table_unlock(AS, true);
    267272        } else {
    268273                /*
    269                  * Forward the page fault to the address space page fault handler.
     274                 * Forward the page fault to the address space page fault
     275                 * handler.
    270276                 */             
    271277                page_table_unlock(AS, true);
    272278                if (as_page_fault(va, PF_ACCESS_READ, istate) == AS_PF_FAULT) {
    273279                        do_fast_data_access_mmu_miss_fault(istate, tag,
    274                                 __FUNCTION__);
     280                            __FUNCTION__);
    275281                }
    276282        }
     
    282288        tlb_tag_access_reg_t tag;
    283289        uintptr_t va;
     290        index_t index;
    284291        pte_t *t;
    285292
    286293        tag.value = dtlb_tag_access_read();
    287         va = tag.vpn << PAGE_WIDTH;
     294        va = ALIGN_DOWN((uint64_t) tag.vpn << MMU_PAGE_WIDTH, PAGE_SIZE);
     295        index = tag.vpn % MMU_PAGES_PER_PAGE;   /* 16K-page emulation */
    288296
    289297        page_table_lock(AS, true);
     
    297305                t->a = true;
    298306                t->d = true;
    299                 dtlb_demap(TLB_DEMAP_PAGE, TLB_DEMAP_SECONDARY, va);
    300                 dtlb_pte_copy(t, false);
     307                dtlb_demap(TLB_DEMAP_PAGE, TLB_DEMAP_SECONDARY,
     308                    va + index * MMU_PAGE_SIZE);
     309                dtlb_pte_copy(t, index, false);
    301310#ifdef CONFIG_TSB
    302                 dtsb_pte_copy(t, false);
     311                dtsb_pte_copy(t, index, false);
    303312#endif
    304313                page_table_unlock(AS, true);
     
    311320                if (as_page_fault(va, PF_ACCESS_WRITE, istate) == AS_PF_FAULT) {
    312321                        do_fast_data_access_protection_fault(istate, tag,
    313                                 __FUNCTION__);
     322                            __FUNCTION__);
    314323                }
    315324        }
     
    329338
    330339                printf("%d: vpn=%#llx, context=%d, v=%d, size=%d, nfo=%d, "
    331                         "ie=%d, soft2=%#x, diag=%#x, pfn=%#x, soft=%#x, l=%d, "
    332                         "cp=%d, cv=%d, e=%d, p=%d, w=%d, g=%d\n", i, t.vpn,
    333                         t.context, d.v, d.size, d.nfo, d.ie, d.soft2, d.diag,
    334                         d.pfn, d.soft, d.l, d.cp, d.cv, d.e, d.p, d.w, d.g);
     340                    "ie=%d, soft2=%#x, diag=%#x, pfn=%#x, soft=%#x, l=%d, "
     341                    "cp=%d, cv=%d, e=%d, p=%d, w=%d, g=%d\n", i, t.vpn,
     342                    t.context, d.v, d.size, d.nfo, d.ie, d.soft2, d.diag,
     343                    d.pfn, d.soft, d.l, d.cp, d.cv, d.e, d.p, d.w, d.g);
    335344        }
    336345
     
    341350               
    342351                printf("%d: vpn=%#llx, context=%d, v=%d, size=%d, nfo=%d, "
    343                         "ie=%d, soft2=%#x, diag=%#x, pfn=%#x, soft=%#x, l=%d, "
    344                         "cp=%d, cv=%d, e=%d, p=%d, w=%d, g=%d\n", i, t.vpn,
    345                         t.context, d.v, d.size, d.nfo, d.ie, d.soft2, d.diag,
    346                         d.pfn, d.soft, d.l, d.cp, d.cv, d.e, d.p, d.w, d.g);
    347         }
    348 
    349 }
    350 
    351 void do_fast_instruction_access_mmu_miss_fault(istate_t *istate, const char
    352         *str)
     352                    "ie=%d, soft2=%#x, diag=%#x, pfn=%#x, soft=%#x, l=%d, "
     353                    "cp=%d, cv=%d, e=%d, p=%d, w=%d, g=%d\n", i, t.vpn,
     354                    t.context, d.v, d.size, d.nfo, d.ie, d.soft2, d.diag,
     355                    d.pfn, d.soft, d.l, d.cp, d.cv, d.e, d.p, d.w, d.g);
     356        }
     357
     358}
     359
     360void do_fast_instruction_access_mmu_miss_fault(istate_t *istate,
     361    const char *str)
    353362{
    354363        fault_if_from_uspace(istate, "%s\n", str);
     
    357366}
    358367
    359 void do_fast_data_access_mmu_miss_fault(istate_t *istate, tlb_tag_access_reg_t
    360         tag, const char *str)
     368void do_fast_data_access_mmu_miss_fault(istate_t *istate,
     369    tlb_tag_access_reg_t tag, const char *str)
    361370{
    362371        uintptr_t va;
    363372
    364         va = tag.vpn << PAGE_WIDTH;
     373        va = tag.vpn << MMU_PAGE_WIDTH;
    365374
    366375        fault_if_from_uspace(istate, "%s, Page=%p (ASID=%d)\n", str, va,
    367                 tag.context);
     376            tag.context);
    368377        dump_istate(istate);
    369378        printf("Faulting page: %p, ASID=%d\n", va, tag.context);
     
    371380}
    372381
    373 void do_fast_data_access_protection_fault(istate_t *istate, tlb_tag_access_reg_t
    374         tag, const char *str)
     382void do_fast_data_access_protection_fault(istate_t *istate,
     383    tlb_tag_access_reg_t tag, const char *str)
    375384{
    376385        uintptr_t va;
    377386
    378         va = tag.vpn << PAGE_WIDTH;
     387        va = tag.vpn << MMU_PAGE_WIDTH;
    379388
    380389        fault_if_from_uspace(istate, "%s, Page=%p (ASID=%d)\n", str, va,
    381                 tag.context);
     390            tag.context);
    382391        printf("Faulting page: %p, ASID=%d\n", va, tag.context);
    383392        dump_istate(istate);
     
    394403       
    395404        printf("DTLB SFSR: asi=%#x, ft=%#x, e=%d, ct=%d, pr=%d, w=%d, ow=%d, "
    396                 "fv=%d\n", sfsr.asi, sfsr.ft, sfsr.e, sfsr.ct, sfsr.pr, sfsr.w,
    397                 sfsr.ow, sfsr.fv);
     405            "fv=%d\n", sfsr.asi, sfsr.ft, sfsr.e, sfsr.ct, sfsr.pr, sfsr.w,
     406            sfsr.ow, sfsr.fv);
    398407        printf("DTLB SFAR: address=%p\n", sfar);
    399408       
     
    482491        mmu_primary_context_write(ctx.v);
    483492       
    484         for (i = 0; i < cnt; i++) {
     493        for (i = 0; i < cnt * MMU_PAGES_PER_PAGE; i++) {
    485494                itlb_demap(TLB_DEMAP_PAGE, TLB_DEMAP_PRIMARY,
    486                     page + i * PAGE_SIZE);
     495                    page + i * MMU_PAGE_SIZE);
    487496                dtlb_demap(TLB_DEMAP_PAGE, TLB_DEMAP_PRIMARY,
    488                     page + i * PAGE_SIZE);
     497                    page + i * MMU_PAGE_SIZE);
    489498        }
    490499       
  • kernel/arch/sparc64/src/mm/tsb.c

    r8d37a06 r2057572  
    3535#include <arch/mm/tsb.h>
    3636#include <arch/mm/tlb.h>
     37#include <arch/mm/page.h>
    3738#include <arch/barrier.h>
    3839#include <mm/as.h>
     
    4142#include <debug.h>
    4243
    43 #define TSB_INDEX_MASK          ((1 << (21 + 1 + TSB_SIZE - PAGE_WIDTH)) - 1)
     44#define TSB_INDEX_MASK  ((1 << (21 + 1 + TSB_SIZE - MMU_PAGE_WIDTH)) - 1)
    4445
    4546/** Invalidate portion of TSB.
     
    6061        ASSERT(as->arch.itsb && as->arch.dtsb);
    6162       
    62         i0 = (page >> PAGE_WIDTH) & TSB_INDEX_MASK;
    63         cnt = min(pages, ITSB_ENTRY_COUNT);
     63        i0 = (page >> MMU_PAGE_WIDTH) & TSB_INDEX_MASK;
     64        cnt = min(pages * MMU_PAGES_PER_PAGE, ITSB_ENTRY_COUNT);
    6465       
    6566        for (i = 0; i < cnt; i++) {
    6667                as->arch.itsb[(i0 + i) & (ITSB_ENTRY_COUNT - 1)].tag.invalid =
    67                         true;
     68                    true;
    6869                as->arch.dtsb[(i0 + i) & (DTSB_ENTRY_COUNT - 1)].tag.invalid =
    69                         true;
     70                    true;
    7071        }
    7172}
     
    7374/** Copy software PTE to ITSB.
    7475 *
    75  * @param t Software PTE.
     76 * @param t     Software PTE.
     77 * @param index Zero if lower 8K-subpage, one if higher 8K subpage.
    7678 */
    77 void itsb_pte_copy(pte_t *t)
     79void itsb_pte_copy(pte_t *t, index_t index)
    7880{
    7981        as_t *as;
    8082        tsb_entry_t *tsb;
     83        index_t entry;
    8184       
    8285        as = t->as;
    83         tsb = &as->arch.itsb[(t->page >> PAGE_WIDTH) & TSB_INDEX_MASK];
     86        entry = ((t->page >> MMU_PAGE_WIDTH) + index) & TSB_INDEX_MASK;
     87        tsb = &as->arch.itsb[entry];
    8488
    8589        /*
     
    96100
    97101        tsb->tag.context = as->asid;
    98         tsb->tag.va_tag = t->page >> VA_TAG_PAGE_SHIFT;
     102        tsb->tag.va_tag = (t->page + (index << MMU_PAGE_WIDTH)) >>
     103            VA_TAG_PAGE_SHIFT;
    99104        tsb->data.value = 0;
    100105        tsb->data.size = PAGESIZE_8K;
    101         tsb->data.pfn = t->frame >> FRAME_WIDTH;
     106        tsb->data.pfn = (t->frame >> MMU_FRAME_WIDTH) + index;
    102107        tsb->data.cp = t->c;
    103108        tsb->data.p = t->k;             /* p as privileged */
     
    111116/** Copy software PTE to DTSB.
    112117 *
    113  * @param t Software PTE.
    114  * @param ro If true, the mapping is copied read-only.
     118 * @param t     Software PTE.
     119 * @param index Zero if lower 8K-subpage, one if higher 8K-subpage.
     120 * @param ro    If true, the mapping is copied read-only.
    115121 */
    116 void dtsb_pte_copy(pte_t *t, bool ro)
     122void dtsb_pte_copy(pte_t *t, index_t index, bool ro)
    117123{
    118124        as_t *as;
    119125        tsb_entry_t *tsb;
     126        index_t entry;
    120127       
    121128        as = t->as;
    122         tsb = &as->arch.dtsb[(t->page >> PAGE_WIDTH) & TSB_INDEX_MASK];
     129        entry = ((t->page >> MMU_PAGE_WIDTH) + index) & TSB_INDEX_MASK;
     130        tsb = &as->arch.dtsb[entry];
    123131
    124132        /*
     
    135143
    136144        tsb->tag.context = as->asid;
    137         tsb->tag.va_tag = t->page >> VA_TAG_PAGE_SHIFT;
     145        tsb->tag.va_tag = (t->page + (index << MMU_PAGE_WIDTH)) >>
     146            VA_TAG_PAGE_SHIFT;
    138147        tsb->data.value = 0;
    139148        tsb->data.size = PAGESIZE_8K;
    140         tsb->data.pfn = t->frame >> FRAME_WIDTH;
     149        tsb->data.pfn = (t->frame >> MMU_FRAME_WIDTH) + index;
    141150        tsb->data.cp = t->c;
    142151#ifdef CONFIG_VIRT_IDX_DCACHE
  • kernel/arch/sparc64/src/smp/ipi.c

    r8d37a06 r2057572  
    4040#include <config.h>
    4141#include <mm/tlb.h>
    42 #include <arch/mm/cache.h>
    4342#include <arch/interrupt.h>
    4443#include <arch/trap/interrupt.h>
     
    126125                func = tlb_shootdown_ipi_recv;
    127126                break;
    128 #if (defined(CONFIG_SMP) && (defined(CONFIG_VIRT_IDX_DCACHE)))
    129         case IPI_DCACHE_SHOOTDOWN:
    130                 func = dcache_shootdown_ipi_recv;
    131                 break;
    132 #endif
    133127        default:
    134128                panic("Unknown IPI (%d).\n", ipi);
  • kernel/arch/sparc64/src/trap/interrupt.c

    r8d37a06 r2057572  
    4545#include <arch.h>
    4646#include <mm/tlb.h>
    47 #include <arch/mm/cache.h>
    4847#include <config.h>
    4948#include <synch/spinlock.h>
     
    9291                if (data0 == (uintptr_t) tlb_shootdown_ipi_recv) {
    9392                        tlb_shootdown_ipi_recv();
    94 #ifdef CONFIG_VIRT_IDX_DCACHE
    95                 } else if (data0 == (uintptr_t) dcache_shootdown_ipi_recv) {
    96                         dcache_shootdown_ipi_recv();
    97 #endif
    9893                }
    9994#endif
Note: See TracChangeset for help on using the changeset viewer.