Changeset f47fd19 in mainline for kernel/arch/sparc64/src/mm/tlb.c


Ignore:
Timestamp:
2006-08-21T13:36:34Z (18 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a796127
Parents:
ee289cf0
Message:

sparc64 work.
Define the istate structure.
Move the identity-mapping handler to assembly.
Make the preemptible handler more general so that TL=1 MMU exceptions can make use of it.

Little bit of formatting and indentation.

File:
1 edited

Legend:

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

    ree289cf0 rf47fd19  
    3535#include <arch/mm/tlb.h>
    3636#include <mm/tlb.h>
     37#include <mm/as.h>
     38#include <mm/asid.h>
    3739#include <arch/mm/frame.h>
    3840#include <arch/mm/page.h>
    3941#include <arch/mm/mmu.h>
    40 #include <mm/asid.h>
     42#include <arch/interrupt.h>
     43#include <arch.h>
    4144#include <print.h>
    4245#include <arch/types.h>
     
    4750#include <arch/asm.h>
    4851#include <symtab.h>
     52
     53static void dtlb_pte_copy(pte_t *t);
     54static void do_fast_data_access_mmu_miss_fault(istate_t *istate, const char *str);
    4955
    5056char *context_encoding[] = {
     
    100106}
    101107
     108void dtlb_pte_copy(pte_t *t)
     109{
     110}
     111
    102112/** ITLB miss handler. */
    103 void fast_instruction_access_mmu_miss(void)
     113void fast_instruction_access_mmu_miss(int n, istate_t *istate)
    104114{
    105115        panic("%s\n", __FUNCTION__);
    106116}
    107117
    108 /** DTLB miss handler. */
    109 void fast_data_access_mmu_miss(void)
     118/** DTLB miss handler.
     119 *
     120 * Note that some faults (e.g. kernel faults) were already resolved
     121 * by the low-level, assembly language part of the fast_data_access_mmu_miss
     122 * handler.
     123 */
     124void fast_data_access_mmu_miss(int n, istate_t *istate)
    110125{
    111126        tlb_tag_access_reg_t tag;
    112         uintptr_t tpc;
    113         char *tpc_str;
     127        uintptr_t va;
     128        pte_t *t;
    114129
    115130        tag.value = dtlb_tag_access_read();
    116         if (tag.context != ASID_KERNEL || tag.vpn == 0) {
    117                 tpc = tpc_read();
    118                 tpc_str = get_symtab_entry(tpc);
    119 
    120                 printf("Faulting page: %p, ASID=%d\n", tag.vpn * PAGE_SIZE, tag.context);
    121                 printf("TPC=%p, (%s)\n", tpc, tpc_str ? tpc_str : "?");
    122                 panic("%s\n", __FUNCTION__);
    123         }
    124 
    125         /*
    126          * Identity map piece of faulting kernel address space.
    127          */
    128         dtlb_insert_mapping(tag.vpn * PAGE_SIZE, tag.vpn * FRAME_SIZE, PAGESIZE_8K, false, true);
     131        va = tag.vpn * PAGE_SIZE;
     132        if (tag.context == ASID_KERNEL) {
     133                if (!tag.vpn) {
     134                        /* NULL access in kernel */
     135                        do_fast_data_access_mmu_miss_fault(istate, __FUNCTION__);
     136                }
     137                do_fast_data_access_mmu_miss_fault(istate, "Unexpected kernel page fault.");
     138        }
     139
     140        page_table_lock(AS, true);
     141        t = page_mapping_find(AS, va);
     142        if (t) {
     143                /*
     144                 * The mapping was found in the software page hash table.
     145                 * Insert it into DTLB.
     146                 */
     147                dtlb_pte_copy(t);
     148                page_table_unlock(AS, true);
     149        } else {
     150                /*
     151                 * Forward the page fault to the address space page fault handler.
     152                 */             
     153                page_table_unlock(AS, true);
     154                if (as_page_fault(va, PF_ACCESS_READ, istate) == AS_PF_FAULT) {
     155                        do_fast_data_access_mmu_miss_fault(istate, __FUNCTION__);
     156                }
     157        }
    129158}
    130159
    131160/** DTLB protection fault handler. */
    132 void fast_data_access_protection(void)
     161void fast_data_access_protection(int n, istate_t *istate)
    133162{
    134163        panic("%s\n", __FUNCTION__);
     
    162191}
    163192
     193void do_fast_data_access_mmu_miss_fault(istate_t *istate, const char *str)
     194{
     195        tlb_tag_access_reg_t tag;
     196        uintptr_t va;
     197        char *tpc_str = get_symtab_entry(istate->tpc);
     198
     199        tag.value = dtlb_tag_access_read();
     200        va = tag.vpn * PAGE_SIZE;
     201
     202        printf("Faulting page: %p, ASID=%d\n", va, tag.context);
     203        printf("TPC=%p, (%s)\n", istate->tpc, tpc_str);
     204        panic("%s\n", str);
     205}
     206
    164207/** Invalidate all unlocked ITLB and DTLB entries. */
    165208void tlb_invalidate_all(void)
Note: See TracChangeset for help on using the changeset viewer.