|
|
| version 1.1, 2003/12/08 00:55:31 | version 1.3, 2004/01/13 16:37:42 |
|---|---|
| Line 272 static const BYTE page_access_bit[32] = | Line 272 static const BYTE page_access_bit[32] = |
| */ | */ |
| static DWORD paging(DWORD laddr, int crw, int user_mode); | 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 BOOL tlb_lookup(DWORD vaddr, int crw, DWORD* paddr); |
| static void tlb_update(DWORD paddr, DWORD entry, int crw); | static void tlb_update(DWORD paddr, DWORD entry, int crw); |
| #endif | |
| DWORD MEMCALL | DWORD MEMCALL |
| Line 419 paging(DWORD laddr, int crw, int user_mo | Line 421 paging(DWORD laddr, int crw, int user_mo |
| pde_addr = (CPU_CR3 & CPU_CR3_PD_MASK) | ((laddr >> 20) & 0xffc); | pde_addr = (CPU_CR3 & CPU_CR3_PD_MASK) | ((laddr >> 20) & 0xffc); |
| pde = cpu_memoryread_d(pde_addr); | pde = cpu_memoryread_d(pde_addr); |
| if (!(pde & CPU_PDE_PRESENT)) { | 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; | err = 0; |
| goto pf_exception; | goto pf_exception; |
| } | } |
| Line 444 paging(DWORD laddr, int crw, int user_mo | Line 447 paging(DWORD laddr, int crw, int user_mo |
| pte_addr = (pde & CPU_PDE_BASEADDR_MASK) | ((laddr >> 10) & 0xffc); | pte_addr = (pde & CPU_PDE_BASEADDR_MASK) | ((laddr >> 10) & 0xffc); |
| pte = cpu_memoryread_d(pte_addr); | pte = cpu_memoryread_d(pte_addr); |
| if (!(pte & CPU_PTE_PRESENT)) { | 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; | err = 0; |
| goto pf_exception; | goto pf_exception; |
| } | } |
| Line 467 paging(DWORD laddr, int crw, int user_mo | Line 471 paging(DWORD laddr, int crw, int user_mo |
| if (!(page_access_bit[bit])) | if (!(page_access_bit[bit])) |
| #endif | #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; | err = 1; |
| goto pf_exception; | goto pf_exception; |
| } | } |
| Line 638 tlb_flush_page(DWORD vaddr) | Line 643 tlb_flush_page(DWORD vaddr) |
| } | } |
| } | } |
| BOOL | static BOOL |
| tlb_lookup(DWORD vaddr, int crw, DWORD* paddr) | tlb_lookup(DWORD laddr, int crw, DWORD* paddr) |
| { | { |
| TLB_ENTRY_T* ep; | TLB_ENTRY_T* ep; |
| int idx; | int idx; |
| Line 655 tlb_lookup(DWORD vaddr, int crw, DWORD* | Line 660 tlb_lookup(DWORD vaddr, int crw, DWORD* |
| idx = 0; | idx = 0; |
| } else { | } else { |
| if (tlb[i].kind & TLB_KIND_SMALL) { | if (tlb[i].kind & TLB_KIND_SMALL) { |
| idx = (vaddr >> 12) & (tlb[i].idx - 1); | idx = (laddr >> 12) & (tlb[i].idx - 1); |
| } else { | } else { |
| idx = (vaddr >> 22) & (tlb[i].idx - 1); | idx = (laddr >> 22) & (tlb[i].idx - 1); |
| } | } |
| } | } |
| Line 665 tlb_lookup(DWORD vaddr, int crw, DWORD* | Line 670 tlb_lookup(DWORD vaddr, int crw, DWORD* |
| ep = &tlb[i].entry[idx * tlb[i].way]; | ep = &tlb[i].entry[idx * tlb[i].way]; |
| for (i = 0; i < tlb[i].way; i++) { | for (i = 0; i < tlb[i].way; i++) { |
| if (ep->valid) { | if (ep->valid) { |
| if ((vaddr & ep->mask) == ep->tag) { | if ((laddr & ep->mask) == ep->tag) { |
| if (ep->score != (BYTE)~0) | if (ep->score != (BYTE)~0) |
| ep->score++; | ep->score++; |
| *paddr = ep->paddr; | *paddr = ep->paddr; |
| Line 680 tlb_lookup(DWORD vaddr, int crw, DWORD* | Line 685 tlb_lookup(DWORD vaddr, int crw, DWORD* |
| return FALSE; | return FALSE; |
| } | } |
| void | static void |
| tlb_update(DWORD paddr, DWORD entry, int crw) | tlb_update(DWORD paddr, DWORD entry, int crw) |
| { | { |
| TLB_ENTRY_T* ep; | TLB_ENTRY_T* ep; |
| Line 750 void | Line 755 void |
| tlb_flush(BOOL allflush) | tlb_flush(BOOL allflush) |
| { | { |
| // UNUSED(allflush); | (void)allflush; |
| } | } |
| void | void |
| tlb_flush_page(DWORD vaddr) | tlb_flush_page(DWORD laddr) |
| { | { |
| // UNUSED(vaddr); | (void)laddr; |
| } | } |
| #endif /* IA32_SUPPORT_TLB */ | #endif /* IA32_SUPPORT_TLB */ |