Commit ba236131 authored by Timothy E Baldwin's avatar Timothy E Baldwin Committed by ROOL

Adjust exception error messages to show correct address.

Detail:
  Add offset parameter to DumpyTheRegisters in R4
  Shuffle internal register use up one
  Set R4 to offset before calling.
  Arbitrary offset of 0 for unreachable address exception handler.

Admin:
  Tested in RPCEmu.
parent 484c275e
......@@ -619,6 +619,7 @@ PrintErrorString
DumpyTheRegisters ROUT
; R0 points at r8 in register dump. r0-r7, PC, PSR saved
; R1 is PSR
; R4 is offset from saved PC for error message
; R14 points at error block
; In ABT32 or UND32
MOV R7, R14 ; put error address into unbanked register
......@@ -675,9 +676,9 @@ UNDEF1
; Check that ExceptionDump is safe to use
Push "R7" ; Preserve error ptr
LDR R4, =ZeroPage
LDR R5, =ZeroPage
MOV R3, R0
LDR R1, [R4, #ExceptionDump]
LDR R1, [R5, #ExceptionDump]
MOV R0, #24
ADD R2, R1, #17*4
; Must be SVC-writable, user+SVC readable, word aligned
......@@ -697,15 +698,15 @@ UNDEF1
Pull "R14" ; Restore error ptr
; Copy the dump from the stack to ExceptionDump
LDR R0, [R4, #ExceptionDump]
LDMIA R3!, {R1-R2,R4-R9} ; R0-R7
STMIA R0!, {R1-R2,R4-R9}
LDMIA R3, {R1-R2,R4-R10} ; R8-R15, PSR
STMIA R0, {R1-R2,R4-R10}
LDR R0, [R5, #ExceptionDump]
LDMIA R3!, {R1-R2,R5-R10} ; R0-R7
STMIA R0!, {R1-R2,R5-R10}
LDMIA R3, {R1-R2,R5-R11} ; R8-R15, PSR
STMIA R0, {R1-R2,R5-R11}
SUB R0, R0, #8*4
; try and put back user R10-R12
Push "R4-R6" ; for error handler to find on stack
Push "R5-R7" ; for error handler to find on stack
LDR R1, [R0, #15*4]
Push R1
......@@ -735,6 +736,7 @@ UNDEF1
LDR R0, =ZeroPage
LDR R0, [R0, #ExceptionDump]
LDR R0, [R0, #15*4] ; saved PC
SUB R0, R0, R4
SWI XOS_ConvertHex8
[ International
......@@ -834,6 +836,7 @@ UNDEF ROUT
MRS R1, SPSR
STR R1, [R14, #(16-8)*4] ; save PSR
MOV R0, R14
MOV R4, #4
BL DumpyTheRegisters
MakeErrorBlock UndefinedInstruction
......@@ -847,6 +850,7 @@ ABORTP ROUT
MRS R1, SPSR
STR R1, [R14, #(16-8)*4] ; save PSR
MOV R0, R14
MOV R4, #4
BL DumpyTheRegisters
MakeErrorBlock InstructionAbort
......@@ -860,6 +864,7 @@ ABORTD ROUT
MRS R1, SPSR
STR R1, [R14, #(16-8)*4] ; save PSR
MOV R0, R14
MOV R4, #8
BL DumpyTheRegisters
MakeErrorBlock DataAbort
......@@ -875,6 +880,7 @@ ADDREX ROUT
MRS R1, SPSR
STR R1, [R14, #(16-8)*4] ; save PSR
MOV R0, R14
MOV R4, #0
BL DumpyTheRegisters
MakeErrorBlock AddressException
......@@ -921,6 +927,7 @@ Branch0_FromTrampoline
ADD R0, R0, #8*4
ADR R7, ErrorBlock_BranchThrough0
MOV R4, #0
B UNDEF1
MakeErrorBlock BranchThrough0
......
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