diff --git a/ld/pd.ld b/ld/pd.ld index 59a32cf05..ae4613875 100644 --- a/ld/pd.ld +++ b/ld/pd.ld @@ -153,7 +153,7 @@ SECTIONS * due to it not being TLB mapped yet. So we set up this variable to allow * this to happen. */ - tlbInitFromPreamble = tlbInit + 0x10000000; + tlbInitFromPreamble = tlbInit; /*************************************************************************** * lib @@ -168,7 +168,7 @@ SECTIONS PLACEHOLDER_SEGMENT(libzip, ROMALLOCATION_LIB) __rompos = ROM_SIZE * 1024 * 1024; - __rampos = 0x70001050; + __rampos = 0x80001050; BEGIN_SEG(lib) SUBALIGN(0x10) { @@ -245,7 +245,7 @@ SECTIONS */ __savedrompos = __rompos; - __rampos = 0x70200000; + __rampos = 0x80200000; __rompos = _datazipSegmentRomEnd; BEGIN_SEG(inflate) @@ -269,7 +269,7 @@ SECTIONS PLACEHOLDER_SEGMENT(gamezip, ROMALLOCATION_GAME) __rompos = __savedrompos; - __rampos = 0x7f000000; + __rampos = 0x80240000; BEGIN_SEG(game) { diff --git a/src/lib/boot.c b/src/lib/boot.c index 110052d70..38c1bb491 100644 --- a/src/lib/boot.c +++ b/src/lib/boot.c @@ -104,9 +104,9 @@ void bootPhase1(void) inflatelen = (s32) &_inflateSegmentRomEnd - (s32) &_inflateSegmentRomStart; copylen = datacomplen + inflatelen; libram = (u32 *) ((u32) &_libSegmentStart + 0x2000); - libzipram = (u32 *) 0x70280000; - dataziprom = (u8 *) ((s32) &_datazipSegmentRomStart | 0x70000000); - datazipram = (u8 *) (0x70200000 - datacomplen); + libzipram = (u32 *) 0x80280000; + dataziprom = (u8 *) ((s32) &_datazipSegmentRomStart | 0x80000000); + datazipram = (u8 *) (0x80200000 - datacomplen); dataram = (u32) &_dataSegmentStart; for (i = copylen - 1; i >= 0; i--) { diff --git a/src/lib/tlb.s b/src/lib/tlb.s index 25467e8bc..2a8561231 100644 --- a/src/lib/tlb.s +++ b/src/lib/tlb.s @@ -53,22 +53,6 @@ glabel var8008d268 * Sets up TLB index 0 (0x70000000), then calls bootPhase1. */ glabel tlbInit - li $t0, OS_PM_4M - mtc0 $t0, C0_PAGEMASK - lui $t0, 0x7000 - mtc0 $t0, C0_ENTRYHI - addiu $t0, $zero, 0x1f - mtc0 $t0, C0_ENTRYLO0 - lui $t0, 0x1 - ori $t0, $t0, 0x1f - mtc0 $t0, C0_ENTRYLO1 - addiu $t0, $zero, 0 - mtc0 $t0, C0_INX - nop - tlbwi - nop - nop - nop lui $t0, %hi(bootPhase1) addiu $t0, $t0, %lo(bootPhase1) jr $t0 diff --git a/src/lib/vm.c b/src/lib/vm.c index f5f64ffb3..2ec7b23ea 100644 --- a/src/lib/vm.c +++ b/src/lib/vm.c @@ -868,10 +868,12 @@ void vmInit(void) t8 = (u32)((&_gameSegmentEnd - &_gameSegmentStart) + (PAGE_SIZE - 1)) / PAGE_SIZE; s7 = (u8 *)(STACK_START - 8); - gameseg = (u8 *) ((u32) (s7 - (u8 *) ALIGN64((u32) &_gameSegmentEnd - (u32) &_gameSegmentStart)) & 0xfffe0000); + + // 0x803c0000 - (_gameSegmentLen aligned to 0x20000) + gameseg = (u8 *) 0x80240000; s5 = (u32 *) (((u32) gameseg - ((t8 + 5) << 2)) & ~0xf); - g_VmMarker = gameseg; + g_VmMarker = (u8 *) 0x80240000; sp1474 = t8 + 1; // Load gamezips pointer list @@ -891,24 +893,6 @@ void vmInit(void) dmaExec(chunkbuffer, s5[i], ALIGN16(s5[i + 1] - s5[i])); \ s2 += rzipInflate(zip, s2, sp68); } - - // This loop sets the following TLB entries: - // entry 2: 0x7f000000 to 0x7f010000 and 0x7f010000 to 0x7f020000 - // entry 3: 0x7f020000 to 0x7f030000 and 0x7f030000 to 0x7f040000 - // ... - // entry 14: 0x7f1a0000 to 0x7f1b0000 and 0x7f1b0000 to 0x7f1c0000 - s1 = (u8 *) 0x7f000000; - i = 2; - - while (gameseg <= s7) { - osMapTLB(i, OS_PM_64K, s1, - osVirtualToPhysical((void *) gameseg), - osVirtualToPhysical((void *) (gameseg + 0x10000)), -1); - - gameseg += 0x20000; - s1 += 0x20000; - i++; - } } g_VmNumTlbMisses = 0;