Search
lxdream.org :: lxdream :: r972:fb948057cf08
lxdream 0.9.1
released Jun 29
Download Now
changeset972:fb948057cf08
parent971:886e1ec8447d
child973:7434ac745eff
authornkeynes
dateMon Jan 26 03:05:54 2009 +0000 (12 years ago)
Fix TLB access to SH4 peripheral control regions
src/sh4/mmux86.c
1.1 --- a/src/sh4/mmux86.c Thu Jan 22 02:58:13 2009 +0000
1.2 +++ b/src/sh4/mmux86.c Mon Jan 26 03:05:54 2009 +0000
1.3 @@ -28,13 +28,13 @@
1.4 #define ARG1 R_EDI
1.5 #define ARG2 R_ESI
1.6 #define DECODE() \
1.7 - MOV_imm64_r32((uintptr_t)ext_address_space, R_EAX); /* movq ptr, %rax */ \
1.8 + MOV_imm64_r32((uintptr_t)addr_space, R_EAX); /* movq ptr, %rax */ \
1.9 REXW(); OP(0x8B); OP(0x0C); OP(0xC8) /* movq [%rax + %rcx*8], %rcx */
1.10 #else
1.11 #define ARG1 R_EAX
1.12 #define ARG2 R_EDX
1.13 #define DECODE() \
1.14 - MOV_r32disp32x4_r32( R_ECX, (uintptr_t)ext_address_space, R_ECX );
1.15 + MOV_r32disp32x4_r32( R_ECX, (uintptr_t)addr_space, R_ECX );
1.16 #endif
1.17
1.18 void mmu_utlb_init_vtable( struct utlb_entry *ent, struct utlb_page_entry *page, gboolean writable )
1.19 @@ -42,12 +42,21 @@
1.20 uint32_t mask = ent->mask;
1.21 uint32_t vpn = ent->vpn & mask;
1.22 uint32_t ppn = ent->ppn & mask;
1.23 + struct mem_region_fn **addr_space;
1.24 + uint8_t **out = (uint8_t **)&page->fn;
1.25 + uint8_t **fn;
1.26 int inc = writable ? 1 : 2;
1.27 int i;
1.28
1.29 xlat_output = page->code;
1.30 - uint8_t **fn = (uint8_t **)ext_address_space[ppn>>12];
1.31 - uint8_t **out = (uint8_t **)&page->fn;
1.32 + if( (ppn & 0x1FFFFFFF) >= 0x1C000000 ) {
1.33 + /* SH4 control region */
1.34 + ppn |= 0xE0000000;
1.35 + addr_space = sh4_address_space;
1.36 + } else {
1.37 + addr_space = ext_address_space;
1.38 + }
1.39 + fn = (uint8_t **)addr_space[ppn>>12];
1.40
1.41 for( i=0; i<9; i+= inc, fn += inc, out += inc ) {
1.42 *out = xlat_output;
.