Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 1858 → Rev 1859

/trunk/kernel/arch/sparc64/include/trap/interrupt.h
84,10 → 84,7
.endm
 
.macro INTERRUPT_VECTOR_TRAP_HANDLER
save %sp, -STACK_WINDOW_SAVE_AREA_SIZE, %sp
SIMPLE_HANDLER interrupt
restore
retry
PREEMPTIBLE_HANDLER interrupt
.endm
#endif /* __ASM__ */
 
/trunk/kernel/arch/sparc64/include/trap/mmu.h
34,8 → 34,8
* @brief This file contains fast MMU trap handlers.
*/
 
#ifndef __sparc64_MMU_TRAP_H__
#define __sparc64_MMU_TRAP_H__
#ifndef KERN_sparc64_MMU_TRAP_H_
#define KERN_sparc64_MMU_TRAP_H_
 
#include <arch/stack.h>
#include <arch/regdef.h>
51,11 → 51,13
 
#ifdef __ASM__
.macro FAST_INSTRUCTION_ACCESS_MMU_MISS_HANDLER
save %sp, -STACK_WINDOW_SAVE_AREA_SIZE, %sp
call fast_instruction_access_mmu_miss
nop
restore
retry
/*
* First, try to refill TLB from TSB.
*/
! TODO
 
wrpr %g0, PSTATE_PRIV_BIT | PSTATE_AG_BIT, %pstate
PREEMPTIBLE_HANDLER fast_instruction_access_mmu_miss
.endm
 
.macro FAST_DATA_ACCESS_MMU_MISS_HANDLER
101,11 → 103,8
.endm
 
.macro FAST_DATA_ACCESS_PROTECTION_HANDLER
save %sp, -STACK_WINDOW_SAVE_AREA_SIZE, %sp
call fast_data_access_protection
nop
restore
retry
wrpr %g0, PSTATE_PRIV_BIT | PSTATE_AG_BIT, %pstate
PREEMPTIBLE_HANDLER fast_data_access_protection
.endm
#endif /* __ASM__ */
 
/trunk/kernel/arch/sparc64/src/mm/tlb.c
54,6 → 54,7
static void itlb_pte_copy(pte_t *t);
static void do_fast_data_access_mmu_miss_fault(istate_t *istate, const char *str);
static void do_fast_instruction_access_mmu_miss_fault(istate_t *istate, const char *str);
static void do_fast_data_access_protection_fault(istate_t *istate, const char *str);
 
char *context_encoding[] = {
"Primary",
245,7 → 246,34
/** DTLB protection fault handler. */
void fast_data_access_protection(int n, istate_t *istate)
{
panic("%s\n", __FUNCTION__);
tlb_tag_access_reg_t tag;
uintptr_t va;
pte_t *t;
 
tag.value = dtlb_tag_access_read();
va = tag.vpn * PAGE_SIZE;
 
page_table_lock(AS, true);
t = page_mapping_find(AS, va);
if (t && PTE_WRITABLE(t)) {
/*
* The mapping was found in the software page hash table and is writable.
* Demap the old mapping and insert an updated mapping into DTLB.
*/
t->a = true;
t->d = true;
dtlb_demap(TLB_DEMAP_PAGE, TLB_DEMAP_SECONDARY, va);
dtlb_pte_copy(t, false);
page_table_unlock(AS, true);
} else {
/*
* Forward the page fault to the address space page fault handler.
*/
page_table_unlock(AS, true);
if (as_page_fault(va, PF_ACCESS_WRITE, istate) == AS_PF_FAULT) {
do_fast_data_access_protection_fault(istate, __FUNCTION__);
}
}
}
 
/** Print contents of both TLBs. */
297,6 → 325,20
panic("%s\n", str);
}
 
void do_fast_data_access_protection_fault(istate_t *istate, const char *str)
{
tlb_tag_access_reg_t tag;
uintptr_t va;
char *tpc_str = get_symtab_entry(istate->tpc);
 
tag.value = dtlb_tag_access_read();
va = tag.vpn * PAGE_SIZE;
 
printf("Faulting page: %p, ASID=%d\n", va, tag.context);
printf("TPC=%p, (%s)\n", istate->tpc, tpc_str);
panic("%s\n", str);
}
 
/** Invalidate all unlocked ITLB and DTLB entries. */
void tlb_invalidate_all(void)
{