--- np2/i386c/ia32/paging.c 2003/12/08 00:55:31 1.1 +++ np2/i386c/ia32/paging.c 2004/01/13 16:37:42 1.3 @@ -1,4 +1,4 @@ -/* $Id: paging.c,v 1.1 2003/12/08 00:55:31 yui Exp $ */ +/* $Id: paging.c,v 1.3 2004/01/13 16:37:42 monaka Exp $ */ /* * Copyright (c) 2003 NONAKA Kimihiro @@ -272,8 +272,10 @@ static const BYTE page_access_bit[32] = */ static DWORD paging(DWORD laddr, int crw, int user_mode); +#if defined(IA32_SUPPORT_TLB) static BOOL tlb_lookup(DWORD vaddr, int crw, DWORD* paddr); static void tlb_update(DWORD paddr, DWORD entry, int crw); +#endif DWORD MEMCALL @@ -419,6 +421,7 @@ paging(DWORD laddr, int crw, int user_mo pde_addr = (CPU_CR3 & CPU_CR3_PD_MASK) | ((laddr >> 20) & 0xffc); pde = cpu_memoryread_d(pde_addr); if (!(pde & CPU_PDE_PRESENT)) { + VERBOSE(("PDE is not present. (laddr = 0x%08x, pde_addr = 0x%08x, pde = 0x%08x)", laddr, pde_addr, pde)); err = 0; goto pf_exception; } @@ -444,6 +447,7 @@ paging(DWORD laddr, int crw, int user_mo pte_addr = (pde & CPU_PDE_BASEADDR_MASK) | ((laddr >> 10) & 0xffc); pte = cpu_memoryread_d(pte_addr); if (!(pte & CPU_PTE_PRESENT)) { + VERBOSE(("PTE is not present. (laddr = 0x%08x, pde_addr = 0x%08x, pde = 0x%08x, pte_addr = 0x%08x, pte = 0x%08x)", laddr, pde_addr, pde, pte_addr, pte)); err = 0; goto pf_exception; } @@ -467,6 +471,7 @@ paging(DWORD laddr, int crw, int user_mo if (!(page_access_bit[bit])) #endif { + VERBOSE(("page access violation. (laddr = 0x%08x, pde_addr = 0x%08x, pde = 0x%08x, pte_addr = 0x%08x, pte = 0x%08x, paddr = 0x%08x, bit = 0x%08x)", laddr, pde_addr, pde, pte_addr, pte, paddr, bit)); err = 1; goto pf_exception; } @@ -638,8 +643,8 @@ tlb_flush_page(DWORD vaddr) } } -BOOL -tlb_lookup(DWORD vaddr, int crw, DWORD* paddr) +static BOOL +tlb_lookup(DWORD laddr, int crw, DWORD* paddr) { TLB_ENTRY_T* ep; int idx; @@ -655,9 +660,9 @@ tlb_lookup(DWORD vaddr, int crw, DWORD* idx = 0; } else { if (tlb[i].kind & TLB_KIND_SMALL) { - idx = (vaddr >> 12) & (tlb[i].idx - 1); + idx = (laddr >> 12) & (tlb[i].idx - 1); } else { - idx = (vaddr >> 22) & (tlb[i].idx - 1); + idx = (laddr >> 22) & (tlb[i].idx - 1); } } @@ -665,7 +670,7 @@ tlb_lookup(DWORD vaddr, int crw, DWORD* ep = &tlb[i].entry[idx * tlb[i].way]; for (i = 0; i < tlb[i].way; i++) { if (ep->valid) { - if ((vaddr & ep->mask) == ep->tag) { + if ((laddr & ep->mask) == ep->tag) { if (ep->score != (BYTE)~0) ep->score++; *paddr = ep->paddr; @@ -680,7 +685,7 @@ tlb_lookup(DWORD vaddr, int crw, DWORD* return FALSE; } -void +static void tlb_update(DWORD paddr, DWORD entry, int crw) { TLB_ENTRY_T* ep; @@ -750,13 +755,13 @@ void tlb_flush(BOOL allflush) { -// UNUSED(allflush); + (void)allflush; } void -tlb_flush_page(DWORD vaddr) +tlb_flush_page(DWORD laddr) { -// UNUSED(vaddr); + (void)laddr; } #endif /* IA32_SUPPORT_TLB */