Search
lxdream.org :: lxdream :: r973:7434ac745eff
lxdream 0.9.1
released Jun 29
Download Now
changeset973:7434ac745eff
parent972:fb948057cf08
child974:16b079ed11bb
authornkeynes
dateMon Jan 26 03:08:08 2009 +0000 (11 years ago)
Fix mmu_utlb_entry_for_vpn (failed to take 1k page entries into account)
Increment mmu_urc on tlb exceptions for consistency
src/sh4/mmu.c
1.1 --- a/src/sh4/mmu.c Mon Jan 26 03:05:54 2009 +0000
1.2 +++ b/src/sh4/mmu.c Mon Jan 26 03:08:08 2009 +0000
1.3 @@ -857,9 +857,16 @@
1.4 */
1.5 int mmu_utlb_entry_for_vpn( uint32_t vpn )
1.6 {
1.7 + mmu_urc++;
1.8 mem_region_fn_t fn = sh4_address_space[vpn>>12];
1.9 if( fn >= &mmu_utlb_pages[0].fn && fn < &mmu_utlb_pages[UTLB_ENTRY_COUNT].fn ) {
1.10 return ((struct utlb_page_entry *)fn) - &mmu_utlb_pages[0];
1.11 + } else if( fn >= &mmu_utlb_1k_pages[0].fn && fn < &mmu_utlb_1k_pages[UTLB_ENTRY_COUNT].fn ) {
1.12 + struct utlb_1k_entry *ent = (struct utlb_1k_entry *)fn;
1.13 + fn = ent->subpages[(vpn>>10)&0x03];
1.14 + if( fn >= &mmu_utlb_pages[0].fn && fn < &mmu_utlb_pages[UTLB_ENTRY_COUNT].fn ) {
1.15 + return ((struct utlb_page_entry *)fn) - &mmu_utlb_pages[0];
1.16 + }
1.17 } else if( fn == &mem_region_tlb_multihit ) {
1.18 return -2;
1.19 } else {
1.20 @@ -1393,24 +1400,28 @@
1.21
1.22 static void FASTCALL tlb_miss_read( sh4addr_t addr, void *exc )
1.23 {
1.24 + mmu_urc++;
1.25 RAISE_TLB_ERROR(EXC_TLB_MISS_READ, addr);
1.26 EXCEPTION_EXIT();
1.27 }
1.28
1.29 static void FASTCALL tlb_miss_read_burst( unsigned char *dest, sh4addr_t addr, void *exc )
1.30 {
1.31 + mmu_urc++;
1.32 RAISE_TLB_ERROR(EXC_TLB_MISS_READ, addr);
1.33 EXCEPTION_EXIT();
1.34 }
1.35
1.36 static void FASTCALL tlb_miss_write( sh4addr_t addr, uint32_t val, void *exc )
1.37 {
1.38 + mmu_urc++;
1.39 RAISE_TLB_ERROR(EXC_TLB_MISS_WRITE, addr);
1.40 EXCEPTION_EXIT();
1.41 }
1.42
1.43 static int32_t FASTCALL tlb_protected_read( sh4addr_t addr, void *exc )
1.44 {
1.45 + mmu_urc++;
1.46 RAISE_MEM_ERROR(EXC_TLB_PROT_READ, addr);
1.47 EXCEPTION_EXIT();
1.48 return 0;
1.49 @@ -1418,6 +1429,7 @@
1.50
1.51 static int32_t FASTCALL tlb_protected_read_burst( unsigned char *dest, sh4addr_t addr, void *exc )
1.52 {
1.53 + mmu_urc++;
1.54 RAISE_MEM_ERROR(EXC_TLB_PROT_READ, addr);
1.55 EXCEPTION_EXIT();
1.56 return 0;
1.57 @@ -1425,12 +1437,14 @@
1.58
1.59 static void FASTCALL tlb_protected_write( sh4addr_t addr, uint32_t val, void *exc )
1.60 {
1.61 + mmu_urc++;
1.62 RAISE_MEM_ERROR(EXC_TLB_PROT_WRITE, addr);
1.63 EXCEPTION_EXIT();
1.64 }
1.65
1.66 static void FASTCALL tlb_initial_write( sh4addr_t addr, uint32_t val, void *exc )
1.67 {
1.68 + mmu_urc++;
1.69 RAISE_MEM_ERROR(EXC_INIT_PAGE_WRITE, addr);
1.70 EXCEPTION_EXIT();
1.71 }
.