Commit b4cf3959 authored by Jeffrey Lee's avatar Jeffrey Lee
Browse files

Add SWI error pointer validation, SeriousErrorV hooks, and OS_ReadSysInfo 15

Detail:
  Resources/UK/Messages, hdr/KernelWS, s/Kernel - On return from a SWI with V set, do some basic validity checks on the error pointer in order to try and catch buggy SWIs that return bad pointers or invalid error blocks. If a bad pointer is found we'll substitute it with a pointer to a different error block, which has the SWI number in the error message, to allow the user to identify the source of the problem. (There's also a chance we'll crash when investigating a bad pointer, but crashing here in the kernel is preferable to crashing elsewhere because R12 should still contain the SWI number)
  hdr/OSMisc - Define SeriousErrorV reason codes and extended ROM footer entry IDs
  hdr/Options - Remove HangWatch integration flag, obsolete now that SeriousErrorV is available
  s/ArthurSWIs - Keep defaultvectab up to date with vector allocations
  s/Middle - Update serious error handling to call SeriousErrorV at several key points. This allows for accurate crash dumps to be obtained, along with a mechanism to warn low-level components such as RTSupport that the privileged mode stacks are being flattened.
  s/Middle - Add OS_ReadSysInfo 15, for enumerating extended ROM footer entries
  s/PMF/osbyte - Update InitNewFX0Error to use the ROM footer entry ID defined in hdr/OSMisc
Admin:
  Tested on Pi 1B, 2B, 3B


Version 5.35, 4.79.2.313. Tagged as 'Kernel-5_35-4_79_2_313'
parent 6fe31841
master HAL RISC_OS-5_26 SMP SMP_bp Kernel-6_65 Kernel-6_64 Kernel-6_63 Kernel-6_62 Kernel-6_61 Kernel-6_60 Kernel-6_59 Kernel-6_58 Kernel-6_57 Kernel-6_56 Kernel-6_55 Kernel-6_54 Kernel-6_53 Kernel-6_52 Kernel-6_51 Kernel-6_50 Kernel-6_49 Kernel-6_48 Kernel-6_47 Kernel-6_46 Kernel-6_45 Kernel-6_44 Kernel-6_43 Kernel-6_43-1 Kernel-6_42 Kernel-6_41 Kernel-6_40 Kernel-6_39 Kernel-6_38 Kernel-6_37 Kernel-6_36 Kernel-6_35 Kernel-6_34 Kernel-6_33 Kernel-6_32 Kernel-6_31 Kernel-6_30 Kernel-6_29 Kernel-6_28 Kernel-6_27 Kernel-6_26 Kernel-6_25 Kernel-6_24 Kernel-6_23 Kernel-6_22 Kernel-6_21 Kernel-6_20 Kernel-6_19 Kernel-6_18 Kernel-6_17 Kernel-6_16 Kernel-6_15 Kernel-6_14 Kernel-6_13 Kernel-6_12 Kernel-6_11 Kernel-6_10 Kernel-6_09 Kernel-6_08 Kernel-6_08-4_129_2_10 Kernel-6_08-4_129_2_9 Kernel-6_07 Kernel-6_06 Kernel-6_05 Kernel-6_05-4_129_2_8 Kernel-6_04 Kernel-6_03 Kernel-6_02 Kernel-6_01 Kernel-6_01-3 Kernel-6_01-2 Kernel-6_01-1 Kernel-6_00 Kernel-5_99 Kernel-5_98 Kernel-5_97 Kernel-5_97-4_129_2_7 Kernel-5_96 Kernel-5_95 Kernel-5_94 Kernel-5_93 Kernel-5_92 Kernel-5_91 Kernel-5_90 Kernel-5_89 Kernel-5_89-4_129_2_6 Kernel-5_88 Kernel-5_88-4_129_2_5 Kernel-5_88-4_129_2_4 Kernel-5_87 Kernel-5_86 Kernel-5_86-4_129_2_3 Kernel-5_86-4_129_2_2 Kernel-5_86-4_129_2_1 Kernel-5_85 Kernel-5_84 Kernel-5_83 Kernel-5_82 Kernel-5_81 Kernel-5_80 Kernel-5_79 Kernel-5_78 Kernel-5_77 Kernel-5_76 Kernel-5_75 Kernel-5_74 Kernel-5_73 Kernel-5_72 Kernel-5_71 Kernel-5_70 Kernel-5_69 Kernel-5_68 Kernel-5_67 Kernel-5_66 Kernel-5_65 Kernel-5_64 Kernel-5_63 Kernel-5_62 Kernel-5_61 Kernel-5_60 Kernel-5_59 Kernel-5_58 Kernel-5_57 Kernel-5_56 Kernel-5_55 Kernel-5_54 Kernel-5_54-1 Kernel-5_53 Kernel-5_52 Kernel-5_51 Kernel-5_50 Kernel-5_49 Kernel-5_48 Kernel-5_35-4_79_2_327 Kernel-5_35-4_79_2_326 Kernel-5_35-4_79_2_325 Kernel-5_35-4_79_2_324 Kernel-5_35-4_79_2_323 Kernel-5_35-4_79_2_322 Kernel-5_35-4_79_2_321 Kernel-5_35-4_79_2_320 Kernel-5_35-4_79_2_319 Kernel-5_35-4_79_2_318 Kernel-5_35-4_79_2_317 Kernel-5_35-4_79_2_316 Kernel-5_35-4_79_2_315 Kernel-5_35-4_79_2_314 Kernel-5_35-4_79_2_313 HAL_merge
No related merge requests found
...@@ -166,6 +166,7 @@ UnConv:Unsupported conversion ...@@ -166,6 +166,7 @@ UnConv:Unsupported conversion
BadKeyHandler:Bad key handler BadKeyHandler:Bad key handler
BadGDriver:Bad graphics driver number BadGDriver:Bad graphics driver number
TooManyGDrivers:Too many graphics drivers TooManyGDrivers:Too many graphics drivers
BadErrPtr:SWI &%0 returned a bad error pointer
600:ARM 600 Processor 600:ARM 600 Processor
610:ARM 610 Processor 610:ARM 610 Processor
......
...@@ -13,11 +13,11 @@ ...@@ -13,11 +13,11 @@
GBLS Module_ComponentPath GBLS Module_ComponentPath
Module_MajorVersion SETS "5.35" Module_MajorVersion SETS "5.35"
Module_Version SETA 535 Module_Version SETA 535
Module_MinorVersion SETS "4.79.2.312" Module_MinorVersion SETS "4.79.2.313"
Module_Date SETS "05 Apr 2016" Module_Date SETS "05 Apr 2016"
Module_ApplicationDate SETS "05-Apr-16" Module_ApplicationDate SETS "05-Apr-16"
Module_ComponentName SETS "Kernel" Module_ComponentName SETS "Kernel"
Module_ComponentPath SETS "castle/RiscOS/Sources/Kernel" Module_ComponentPath SETS "castle/RiscOS/Sources/Kernel"
Module_FullVersion SETS "5.35 (4.79.2.312)" Module_FullVersion SETS "5.35 (4.79.2.313)"
Module_HelpVersion SETS "5.35 (05 Apr 2016) 4.79.2.312" Module_HelpVersion SETS "5.35 (05 Apr 2016) 4.79.2.313"
END END
...@@ -5,12 +5,12 @@ ...@@ -5,12 +5,12 @@
* *
*/ */
#define Module_MajorVersion_CMHG 5.35 #define Module_MajorVersion_CMHG 5.35
#define Module_MinorVersion_CMHG 4.79.2.312 #define Module_MinorVersion_CMHG 4.79.2.313
#define Module_Date_CMHG 05 Apr 2016 #define Module_Date_CMHG 05 Apr 2016
#define Module_MajorVersion "5.35" #define Module_MajorVersion "5.35"
#define Module_Version 535 #define Module_Version 535
#define Module_MinorVersion "4.79.2.312" #define Module_MinorVersion "4.79.2.313"
#define Module_Date "05 Apr 2016" #define Module_Date "05 Apr 2016"
#define Module_ApplicationDate "05-Apr-16" #define Module_ApplicationDate "05-Apr-16"
...@@ -18,6 +18,6 @@ ...@@ -18,6 +18,6 @@
#define Module_ComponentName "Kernel" #define Module_ComponentName "Kernel"
#define Module_ComponentPath "castle/RiscOS/Sources/Kernel" #define Module_ComponentPath "castle/RiscOS/Sources/Kernel"
#define Module_FullVersion "5.35 (4.79.2.312)" #define Module_FullVersion "5.35 (4.79.2.313)"
#define Module_HelpVersion "5.35 (05 Apr 2016) 4.79.2.312" #define Module_HelpVersion "5.35 (05 Apr 2016) 4.79.2.313"
#define Module_LibraryVersionInfo "5:35" #define Module_LibraryVersionInfo "5:35"
...@@ -1832,12 +1832,12 @@ SvcTable |#| &400 ...@@ -1832,12 +1832,12 @@ SvcTable |#| &400
] ]
[ SupportARMT [ SupportARMT
[ ZeroPage = 0 [ ZeroPage = 0
SWIDespatch_Size * 32*4 SWIDespatch_Size * 38*4
| |
SWIDespatch_Size * 33*4 SWIDespatch_Size * 39*4
] ]
| |
SWIDespatch_Size * 30*4 ; can save 2 instructions if no Thumb SWIDespatch_Size * 36*4 ; can save 2 instructions if no Thumb
] ]
SWIDespatch |#| SWIDespatch_Size SWIDespatch |#| SWIDespatch_Size
......
...@@ -80,4 +80,21 @@ ARMop_DMB_Read # 1 ; 20 ...@@ -80,4 +80,21 @@ ARMop_DMB_Read # 1 ; 20
ARMop_Cache_CleanInvalidateRange # 1 ; 21 ARMop_Cache_CleanInvalidateRange # 1 ; 21
ARMop_Max # 0 ARMop_Max # 0
; SeriousErrorV reason codes (R2)
^ 0
SeriousErrorV_Collect # 1 ; ABT mode, IRQ disabled (maybe FIQ disabled too), R0=reg dump, R1=(untranslated) error block
SeriousErrorV_Recover # 1 ; SVC mode, IRQ disabled, R0=translated error block
SeriousErrorV_Report # 1 ; SVC mode, IRQ enabled, R0=translated error block
SeriousErrorV_CustomReport # 1 ; SVC mode, IRQ enabled, R0=translated error, R1=flags, R3=callback function, R4=callback R0
SeriousErrorV_CustomReport_Annotated * 1 ; 1 => Produce annotated text dump
; 0 => Produce raw binary dump
; Have more flags to control which items are included in the annotated dump?
; Extended ROM footer entries
^ 0
ExtROMFooter_BuildDate # 1
ExtROMFooter_CompressedROMHints # 1
ExtROMFooter_DebugSymbols # 1
END END
...@@ -302,9 +302,6 @@ HiProcVecs SETL "$Machine"="Tungsten" :LOR: :LNOT: NoARMv6 ...@@ -302,9 +302,6 @@ HiProcVecs SETL "$Machine"="Tungsten" :LOR: :LNOT: NoARMv6
GBLL DebugForcedReset ; debug forced hard resets GBLL DebugForcedReset ; debug forced hard resets
DebugForcedReset SETL {FALSE} DebugForcedReset SETL {FALSE}
GBLL HangWatch ; Issue HangWatch_Dump on serious errors (data abort, etc.)
HangWatch SETL {FALSE}
GBLA FirstUnpluggableModule GBLA FirstUnpluggableModule
FirstUnpluggableModule SETA 8 ; Podule, FileSwitch, ResourceFS, Messages, MessageTrans, FirstUnpluggableModule SETA 8 ; Podule, FileSwitch, ResourceFS, Messages, MessageTrans,
; TerritoryManager, UK. Moot now the keyboard and mouse aren't ; TerritoryManager, UK. Moot now the keyboard and mouse aren't
......
...@@ -643,9 +643,9 @@ defaultvectab ...@@ -643,9 +643,9 @@ defaultvectab
& 0, 0, NaffVector ; &29 & 0, 0, NaffVector ; &29
& 0, ZeroPage+VduDriverWorkSpace, MOSGraphicsV ; GraphicsV * &2a & 0, ZeroPage+VduDriverWorkSpace, MOSGraphicsV ; GraphicsV * &2a
& 0, 0, NaffVector ; UnthreadV * &2b & 0, 0, NaffVector ; UnthreadV * &2b
& 0, 0, NaffVector ; SeriousErrorV * &2c
; the spares ; the spares
& 0, 0, NaffVector ; &2c
& 0, 0, NaffVector ; &2d & 0, 0, NaffVector ; &2d
& 0, 0, NaffVector ; &2e & 0, 0, NaffVector ; &2e
& 0, 0, NaffVector ; &2f & 0, 0, NaffVector ; &2f
......
...@@ -556,7 +556,17 @@ SWIReturnWithCallBackFlag * {PC}-SWIRelocation ...@@ -556,7 +556,17 @@ SWIReturnWithCallBackFlag * {PC}-SWIRelocation
B callback_checking + SWIRelocation B callback_checking + SWIRelocation
! 0,"VSetReturn at ":CC:(:STR:({PC}-SWIRelocation)) ! 0,"VSetReturn at ":CC:(:STR:({PC}-SWIRelocation))
50 TST r12, #Auto_Error_SWI_bit 50
; Attempt to detect bad error pointers - both to try and avoid crashing
; and to make bad pointers easier to debug
CMP r0, #&4000
BLO BadErrPtr + SWIRelocation
TST r0, #3
LDREQ r10, [r0] ; If we crash here, R12 will be the SWI number that returned the bad pointer (better than crashing later with no clue what SWI caused the problem)
TSTEQ r10, #&7f :SHL: 24 ; Check reserved bits in error number
BNE BadErrPtr + SWIRelocation
BadErrPtrReturn * {PC}-SWIRelocation
TST r12, #Auto_Error_SWI_bit
[ FixCallBacks [ FixCallBacks
BNE callback_checking + SWIRelocation ; we need to do this for X errors even if the callback flags BNE callback_checking + SWIRelocation ; we need to do this for X errors even if the callback flags
; are all clear, so that the postpone flag can be set ; are all clear, so that the postpone flag can be set
...@@ -829,6 +839,31 @@ VSet_GenerateError ROUT ...@@ -829,6 +839,31 @@ VSet_GenerateError ROUT
LDRB r11, [r10, #CallBack_Flag] LDRB r11, [r10, #CallBack_Flag]
B SWIReturnWithCallBackFlag B SWIReturnWithCallBackFlag
; In: r10-r12 stacked
; r12 = SWI number
; lr has SPSR for SWI return
BadErrPtr ROUT
Push "r1-r4,lr"
SUB sp, sp, #12
MOV r1, sp
MOV r2, #12
BIC r0, r12, #Auto_Error_SWI_bit
SWI XOS_ConvertHex6 ; SWI argument is 00xxxxxx
MOV r4, r0 ; now strip leading 0s
02 LDRB r2, [r4], #1
CMP r2, #"0"
BEQ %BT02
SUB r4,r4,#1
ADR r0, ErrorBlock_BadErrPtr
BL TranslateError_UseR4
ADD sp, sp, #12
Pull "r1-r4,lr"
B BadErrPtrReturn
MakeErrorBlock BadErrPtr
LTORG LTORG
; ....................... default owner of ErrorV ............................. ; ....................... default owner of ErrorV .............................
...@@ -927,6 +962,9 @@ ErrHandler ROUT ...@@ -927,6 +962,9 @@ ErrHandler ROUT
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; check for CallBack possible ; check for CallBack possible
; r0 = SWI error ptr
; r11 = CallBack_Flag
; lr = PSR
callback_checking callback_checking
...@@ -942,6 +980,7 @@ callback_checking ...@@ -942,6 +980,7 @@ callback_checking
; Further checks: postpone callback if returning V set and R0->RAM ; Further checks: postpone callback if returning V set and R0->RAM
TST lr, #V_bit ; if no error then do callbacks TST lr, #V_bit ; if no error then do callbacks
LDR r10, =ZeroPage
BEQ Do_CallBack BEQ Do_CallBack
TST r11, #CBack_Postpone TST r11, #CBack_Postpone
[ FixCallBacks [ FixCallBacks
...@@ -974,7 +1013,7 @@ back_to_user_irqs_already_off ...@@ -974,7 +1013,7 @@ back_to_user_irqs_already_off
Do_CallBack ; CallBack allowed: Do_CallBack ; CallBack allowed:
[ FixCallBacks [ FixCallBacks
; Entered in SVC32 mode with IRQs off, r10 = 0 ; Entered in SVC32 mode with IRQs off, r10 = ZeroPage
TST r11, #CBack_Postpone TST r11, #CBack_Postpone
BICNE r11, r11, #CBack_Postpone BICNE r11, r11, #CBack_Postpone
STRNEB r11, [r10, #CallBack_Flag] STRNEB r11, [r10, #CallBack_Flag]
......
...@@ -671,7 +671,7 @@ DumpyTheRegisters ROUT ...@@ -671,7 +671,7 @@ DumpyTheRegisters ROUT
; R1 is PSR ; R1 is PSR
; R14 points at error block ; R14 points at error block
; In ABT32 or UND32 ; In ABT32 or UND32
MOV R4, R14 ; put error address into unbanked register MOV R7, R14 ; put error address into unbanked register
TST R1, #&0F TST R1, #&0F
[ SASTMhatbroken [ SASTMhatbroken
STMEQIA R0!,{R8-R12} STMEQIA R0!,{R8-R12}
...@@ -693,7 +693,7 @@ DumpyTheRegisters ROUT ...@@ -693,7 +693,7 @@ DumpyTheRegisters ROUT
STR R14, [R0, #6*4] STR R14, [R0, #6*4]
BNE UNDEF2 BNE UNDEF2
MSR CPSR_c, #I32_bit+F32_bit+SVC32_mode ; into SVC mode so we have a stack MSR CPSR_c, #I32_bit+F32_bit+ABT32_mode ; into ABT mode so we have a stack (try and preserve SVC stack for any exception dump that's produced)
Push "r0" Push "r0"
[ ZeroPage <> 0 [ ZeroPage <> 0
LDR R2, =ZeroPage LDR R2, =ZeroPage
...@@ -702,27 +702,22 @@ DumpyTheRegisters ROUT ...@@ -702,27 +702,22 @@ DumpyTheRegisters ROUT
CallHAL HAL_FIQDisableAll CallHAL HAL_FIQDisableAll
Pull "r0" Pull "r0"
UNDEF2 UNDEF2
MSR CPSR_c, #I32_bit+F32_bit+SVC32_mode ; into SVC mode
[ HangWatch
; Preserve some registers for inclusion in the HangWatch dump
MOV R2, R13
MOV R3, R14
MRS R5, SPSR
]
MOV R14, R4 ; corrupt R14_SVC (but already saved if we were in SVC)
; ... and fall into ; ... and fall into
UNDEF1 UNDEF1
[ HangWatch ; R0 points at R8 in register dump
LDR sp, =SVCSTK-SVCStackSize+512 ; HangWatch doesn't need much stack space, so use the low part, as it's the area that's least likely to contain something useful to the dump ; R7 points at error block
SWI &59283 ; XHangWatch_Dump MSR CPSR_c, #I32_bit+F32_bit+ABT32_mode ; into ABT mode for exception dump
] SUB R0, R0, #8*4 ; Make R0 sensible for vector
MOV R1, R7
MOV R2, #SeriousErrorV_Collect
MOV R10, #SeriousErrorV
BL CallVector
MSR CPSR_c, #I32_bit+F32_bit+SVC32_mode ; into SVC mode
LDR sp, =SVCSTK ; Flatten superstack LDR sp, =SVCSTK ; Flatten superstack
; Check that ExceptionDump is safe to use ; Check that ExceptionDump is safe to use
Push "R14" ; Preserve error ptr Push "R7" ; Preserve error ptr
LDR R4, =ZeroPage LDR R4, =ZeroPage
MOV R3, R0 MOV R3, R0
LDR R1, [R4, #ExceptionDump] LDR R1, [R4, #ExceptionDump]
...@@ -742,11 +737,11 @@ UNDEF1 ...@@ -742,11 +737,11 @@ UNDEF1
LDR R1, =ZeroPage+DUMPER LDR R1, =ZeroPage+DUMPER
SWI XOS_ChangeEnvironment SWI XOS_ChangeEnvironment
05 05
Pull "R14" Pull "R14" ; Restore error ptr
; Copy the dump from the stack to ExceptionDump ; Copy the dump from the stack to ExceptionDump
LDR R0, [R4, #ExceptionDump] LDR R0, [R4, #ExceptionDump]
LDMDB R3, {R1-R2,R4-R9} ; R0-R7 LDMIA R3!, {R1-R2,R4-R9} ; R0-R7
STMIA R0!, {R1-R2,R4-R9} STMIA R0!, {R1-R2,R4-R9}
LDMIA R3, {R1-R2,R4-R10} ; R8-R15, PSR LDMIA R3, {R1-R2,R4-R10} ; R8-R15, PSR
STMIA R0, {R1-R2,R4-R10} STMIA R0, {R1-R2,R4-R10}
...@@ -790,9 +785,30 @@ UNDEF1 ...@@ -790,9 +785,30 @@ UNDEF1
LDRB r4, [r4, #ErrorSemaphore] LDRB r4, [r4, #ErrorSemaphore]
TEQ r4, #0 TEQ r4, #0
LDRNE R0, =GeneralMOSBuffer+128 LDRNE R0, =GeneralMOSBuffer+128
MOVEQ R4, R0 BNE %FT20
MOVEQ R0, R10 MOV R4, R0
BLEQ TranslateError_UseR4 MOV R0, R10
BL TranslateError_UseR4
; If the exception dump processing takes too long then there's a good
; chance the error buffer MessageTrans gave us will get overwritten
; before we're able to call OS_GenerateError. Copy the error to the
; stack, then copy it back into a MessageTrans block before calling
; OS_GenerateError.
EORS R4, R0, R10 ; Did TranslateError work?
BEQ %FT20
SUB SP, SP, #256
MOV R4, SP
MOV R5, #4
LDR R6, [R0]
STR R6, [R4]
11
LDRB R6, [R0, R5]
CMP R6, #0
STRB R6, [R4, R5]
ADD R5, R5, #1
BNE %BT11
MOV R0, R4
20
| |
LDR R0, =GeneralMOSBuffer+128 LDR R0, =GeneralMOSBuffer+128
] ]
...@@ -813,10 +829,39 @@ UNDEF1 ...@@ -813,10 +829,39 @@ UNDEF1
[ ZeroPage = 0 [ ZeroPage = 0
STR R1, [R1, #IRQsema] STR R1, [R1, #IRQsema]
| |
MOV R2, #0 MOV R3, #0
STR R2, [R1, #IRQsema] STR R3, [R1, #IRQsema]
] ]
LDR r13_irq, =IRQSTK LDR r13_irq, =IRQSTK
; Trigger exception dump processing
ORR R3, R2, #SVC32_mode
MSR CPSR_c, R3
; Let everyone know that the stacks have been reset
MOV R2, #SeriousErrorV_Recover
MOV R10, #SeriousErrorV
BL CallVector
; Now enable IRQs and trigger exception dump processing
MSR CPSR_c, #SVC32_mode
MOV R2, #SeriousErrorV_Report
MOV R10, #SeriousErrorV
BL CallVector
[ International
; Try and copy error block from stack back to MessageTrans
LDR R3, =ZeroPage
LDRB R3, [R3, #ErrorSemaphore]
TEQ R3, #0
BNE %FT30
CMP R4, #0 ; Check if original TranslateError call worked (if not, no error block to copy)
BEQ %FT30
SWI XMessageTrans_CopyError
; If TranslateError worked, assume MessageTrans_CopyError worked too
ADD SP, SP, #256
30
]
SWI OS_GenerateError SWI OS_GenerateError
LTORG LTORG
...@@ -928,7 +973,8 @@ Branch0_FromTrampoline ...@@ -928,7 +973,8 @@ Branch0_FromTrampoline
LDR R0, [R0, #ExceptionDump] LDR R0, [R0, #ExceptionDump]
ADD R0, R0, #8*4 ADD R0, R0, #8*4
BL UNDEF1 ADR R7, ErrorBlock_BranchThrough0
B UNDEF1
MakeErrorBlock BranchThrough0 MakeErrorBlock BranchThrough0
[ :LNOT: No26bitCode [ :LNOT: No26bitCode
...@@ -1248,7 +1294,7 @@ dhte ...@@ -1248,7 +1294,7 @@ dhte
; Out r0 = sysinfo for r0in ; Out r0 = sysinfo for r0in
ReadSysInfo_Code ROUT ReadSysInfo_Code ROUT
CMP r0,#15 ;R0 > 14, so illegal value CMP r0,#16 ;R0 > 15, so illegal value
ADDLO PC, PC, R0,LSL #2 ADDLO PC, PC, R0,LSL #2
B ReadSysInfo_InvalidReason B ReadSysInfo_InvalidReason
...@@ -1267,6 +1313,7 @@ ReadSysInfo_Code ROUT ...@@ -1267,6 +1313,7 @@ ReadSysInfo_Code ROUT
B %FT120 B %FT120
B %FT130 B %FT130
B %FT140 B %FT140
B %FT150
ReadSysInfo_InvalidReason ReadSysInfo_InvalidReason
ADR r0, ErrorBlock_BadReadSysInfo ADR r0, ErrorBlock_BadReadSysInfo
...@@ -2028,7 +2075,7 @@ osri6_maxvalue * (.-4-osri6_table) :SHR: 2 ...@@ -2028,7 +2075,7 @@ osri6_maxvalue * (.-4-osri6_table) :SHR: 2
BNE %FT95 BNE %FT95
; Build date string hasn't been generated yet. Generate it. ; Build date string hasn't been generated yet. Generate it.
Push "r0-r3,lr" Push "r0-r3,lr"
MOV R0, #0 MOV R0, #ExtROMFooter_BuildDate
BL ExtendedROMFooter_FindTag BL ExtendedROMFooter_FindTag
CMP R0, #0 ; Found it? CMP R0, #0 ; Found it?
STREQ R0, [R13] STREQ R0, [R13]
...@@ -2162,6 +2209,41 @@ RSI_DebugRX ...@@ -2162,6 +2209,41 @@ RSI_DebugRX
Pull "r1-r3,sb,lr" Pull "r1-r3,sb,lr"
ExitSWIHandler ExitSWIHandler
; OS_ReadSysInfo 15 - Enumerate extended ROM footer entries
;
; On entry:
; r0 = 15 (reason code 15)
; r1 = location to start (from previous call) or 0 to begin
;
; On exit:
; r1 = data pointer, or 0 if end
; r2 = entry ID (corrupt if r1 == 0)
; r3 = entry length (corrupt if r1 == 0)
150
Push "lr"
BL ExtendedROMFooter_Find
CMP r0, #-1
BEQ %FT158
MOV lr, r0 ; Footer end
CMP r1, #0
LDREQ r1, [lr]
MOVEQ r1, r1, LSL #16
SUBEQ r1, lr, r1, LSR #16 ; Footer start
LDRNEB r3, [r1, #-1]
ADDNE r1, r1, r3 ; If not starting enumeration, advance by length of previous entry
CMP r1, lr
BEQ %FT158
LDRB r2, [r1], #1
LDRB r3, [r1], #1
B %FT159
158
MOV r1, #0
159
MOV r0, #15
Pull "lr"
ExitSWIHandler
; ;
; Extended ROM footer functions ; Extended ROM footer functions
; ;
...@@ -2180,6 +2262,8 @@ RSI_DebugRX ...@@ -2180,6 +2262,8 @@ RSI_DebugRX
; 0 ROM build date, stored as 5-byte time (length = 5) ; 0 ROM build date, stored as 5-byte time (length = 5)
; 1 Compressed ROM softload hint (length = 8). First word is negative ; 1 Compressed ROM softload hint (length = 8). First word is negative
; checksum of uncompressed image, second word is OS header offset. ; checksum of uncompressed image, second word is OS header offset.
; 2 Debug symbols offset (length = 4). Byte offset from the start of the ROM
; to the debug symbols.
; ;
ExtendedROMFooter_Find ROUT ExtendedROMFooter_Find ROUT
......
...@@ -251,7 +251,7 @@ Osbyte00 ROUT ...@@ -251,7 +251,7 @@ Osbyte00 ROUT
[ UseNewFX0Error [ UseNewFX0Error
InitNewFX0Error ROUT InitNewFX0Error ROUT
Push "r0-r4,lr" Push "r0-r4,lr"
MOV r0, #0 MOV r0, #ExtROMFooter_BuildDate
BL ExtendedROMFooter_FindTag BL ExtendedROMFooter_FindTag
CMP r0, #0 CMP r0, #0
BEQ %FT10 BEQ %FT10
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment