From 4c58ebedb7ca8dfb617cf9fc860bae2bb11b7c19 Mon Sep 17 00:00:00 2001 From: Jeffrey Lee <me@phlamethrower.co.uk> Date: Fri, 30 Apr 2021 02:28:55 +0100 Subject: [PATCH] Fix compressed ROM support When PhysRamTable was updated to store addresses in page units instead of byte units (commit df4efb6), the code which allocates the ROM decompression workspace didn't get updated, causing it to break. Add a few extra shifts to the code in order to account for the changes. Fixes issue reported on forums with (compressed) OMAP3 ROM failing to boot: https://www.riscosopen.org/forum/forums/5/topics/16446 --- s/HAL | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/s/HAL b/s/HAL index 33e2b29..4bfcc46 100644 --- a/s/HAL +++ b/s/HAL @@ -1392,22 +1392,22 @@ ROMDecompAlign_$pt * 20 STR v7, [sp, #8] ; Overwrite stacked WS size MOV v6, #ROMDecompWSAddr_$pt ; Current log addr 26 - ADD v2, v2, v5 - BIC v2, v2, v5 ; MB-aligned physram + ADD v2, v2, v5, LSR #12 + BIC v2, v2, v5, LSR #12 ; MB-aligned physram LDMIA v1, {a2, a3} - SUB a2, v2, a2 ; Amount of bank used - SUB a2, a3, a2 ; Amount of bank remaining - MOVS a2, a2, ASR #ROMDecompAlign_$pt ; Round down to nearest MB + SUB a2, v2, a2 ; Amount of bank used (page units) + RSB a2, a2, a3, LSR #12 ; Amount of bank remaining (page units) + MOVS a2, a2, ASR #ROMDecompAlign_$pt-12 ; Round down to nearest MB LDRLE v2, [v1, #8]! ; Move to next bank if 0MB left BLE %BT26 CMP a2, v7, LSR #ROMDecompAlign_$pt MOVHS a4, v7 MOVLO a4, a2, LSL #ROMDecompAlign_$pt ; a4 = amount to take - MOV a1, v2 ; set up parameters for MapIn call + MOV a1, v2, LSL #12 ; set up parameters for MapIn call MOV a2, v6 MOV a3, #OSAP_None SUB v7, v7, a4 ; Decrease amount to allocate - ADD v2, v2, a4 ; Increase physram ptr + ADD v2, v2, a4, LSR #12 ; Increase physram ptr ADD v6, v6, a4 ; Increase logram ptr BL Init_MapIn_$pt CMP v7, #0 -- GitLab