Commit 982426fe authored by Ben Avison's avatar Ben Avison
Browse files

In the No26bitCode case (ie when abort handlers are entered in ABT32 mode), if...

In the No26bitCode case (ie when abort handlers are entered in ABT32 mode), if lazy task swapping was enabled and a data abort occurred that was not a page translation fault, then the code in AMB_LazyFixUp to map in the whole application slot was being circumvented, leading to problems for abort handlers in application space because r14_abt was corrupted by any abort due to accessing the abort handler itself. The test of the FSR (to compensate for the FAR being unusable for external aborts) which prompted the circumvention has therefore been moved inside AMB_LazyFixup.

Also now preserves the FSR and FAR across AMB_LazyFixUp, so they are now
visible from application abort handlers if desired.

Version 5.35, 4.79.2.50. Tagged as 'Kernel-5_35-4_79_2_50'
parent 14a44ef3
......@@ -13,11 +13,11 @@
GBLS Module_ComponentPath
Module_MajorVersion SETS "5.35"
Module_Version SETA 535
Module_MinorVersion SETS "4.79.2.49"
Module_Date SETS "16 Oct 2002"
Module_ApplicationDate SETS "16-Oct-02"
Module_MinorVersion SETS "4.79.2.50"
Module_Date SETS "28 Oct 2002"
Module_ApplicationDate SETS "28-Oct-02"
Module_ComponentName SETS "Kernel"
Module_ComponentPath SETS "RiscOS/Sources/Kernel"
Module_FullVersion SETS "5.35 (4.79.2.49)"
Module_HelpVersion SETS "5.35 (16 Oct 2002) 4.79.2.49"
Module_FullVersion SETS "5.35 (4.79.2.50)"
Module_HelpVersion SETS "5.35 (28 Oct 2002) 4.79.2.50"
END
......@@ -5,19 +5,19 @@
*
*/
#define Module_MajorVersion_CMHG 5.35
#define Module_MinorVersion_CMHG 4.79.2.49
#define Module_Date_CMHG 16 Oct 2002
#define Module_MinorVersion_CMHG 4.79.2.50
#define Module_Date_CMHG 28 Oct 2002
#define Module_MajorVersion "5.35"
#define Module_Version 535
#define Module_MinorVersion "4.79.2.49"
#define Module_Date "16 Oct 2002"
#define Module_MinorVersion "4.79.2.50"
#define Module_Date "28 Oct 2002"
#define Module_ApplicationDate "16-Oct-02"
#define Module_ApplicationDate "28-Oct-02"
#define Module_ComponentName "Kernel"
#define Module_ComponentPath "RiscOS/Sources/Kernel"
#define Module_FullVersion "5.35 (4.79.2.49)"
#define Module_HelpVersion "5.35 (16 Oct 2002) 4.79.2.49"
#define Module_FullVersion "5.35 (4.79.2.50)"
#define Module_HelpVersion "5.35 (28 Oct 2002) 4.79.2.50"
#define Module_LibraryVersionInfo "5:35"
......@@ -98,18 +98,30 @@ C15 CN 15
MCR$cond ARM_config_cp,0,$reg,ARM_control_reg,C0,0
MEND
;read MMU fault status
;read MMU/external fault status
MACRO
ARM_read_FSR $reg,$cond
MRC$cond ARM_config_cp,0,$reg,ARM_FSR_reg,C0,0
MEND
;read MMU fault address
;set MMU/external fault status
MACRO
ARM_write_FSR $reg,$cond
MCR$cond ARM_config_cp,0,$reg,ARM_FSR_reg,C0,0
MEND
;read MMU/external fault address
MACRO
ARM_read_FAR $reg,$cond
MRC$cond ARM_config_cp,0,$reg,ARM_FAR_reg,C0,0
MEND
; set MMU/external fault address
MACRO
ARM_write_FAR $reg,$cond
MCR$cond ARM_config_cp,0,$reg,ARM_FAR_reg,C0,0
MEND
;read ID register to register $id
;bits 15:12 of returned ID will be 0,7,8,10 for ARM 6,7,8,A
MACRO
......
......@@ -56,7 +56,10 @@
;
; entry: r0 = aborting address (data address for data abort, instruction address
; for prefetch abort), r1-r7 trashable, no stack
; r1 = 1 for prefetch abort, 0 for data abort
; FSR valid for data aborts, unpredictable for prefetch aborts
; exit: r0 = non-zero (NE status) if abort was expected and fixed up, zero (EQ status) if not
; FAR,FSR,SPSR_abt,lr_abt preserved
;
AMB_LazyFixUp ROUT
MOV r7,r12
......@@ -64,13 +67,18 @@ AMB_LazyFixUp ROUT
LDR r12,[r12]
CMP r12,#0
BEQ %FT90 ;not initialised!
LDR r1,AMBFlags
TST r1,#AMBFlag_LazyMapIn_disable :OR: AMBFlag_LazyMapIn_suspend
LDR r2,AMBFlags
TST r2,#AMBFlag_LazyMapIn_disable :OR: AMBFlag_LazyMapIn_suspend
BNE %FT90 ;not active
LDR r1,AMBMappedInNode
CMP r1,#0
LDR r2,AMBMappedInNode
CMP r2,#0
BEQ %FT90 ;no current node
LDR r2,[r1,#AMBNode_Npages]
ARM_read_FSR r6 ;hang onto FSR in case we have to preserve it
TEQ r1,#1 ;if data abort
ANDNE r3,r6,#&F
TEQNE r3,#7 ; and not a page translation fault
BNE %FT20 ; then not a lazy abort (and FAR may be invalid anyway)
LDR r2,[r2,#AMBNode_Npages]
SUBS r0,r0,#ApplicationStart
BMI %FT20 ;abort not in current app space
MOV r0,r0,LSR #Log2PageSize ;address now in terms of pages from ApplicationStart
......@@ -132,6 +140,8 @@ AMB_LazyFixUp ROUT
BEQ %FT90
MRS r0,SPSR ;preserve SPSR_abort for original abort details
MOV r4,lr ;preserve lr_abort so we can return properly (!)
ARM_read_FAR r5 ;preserve FAR in case client abort handler wants to read it
;preserve FSR (already in r6) similarly
30
LDR r3,[r1] ;bring that page in by the magic of aborts
SUBS r2,r2,#1
......@@ -139,6 +149,8 @@ AMB_LazyFixUp ROUT
BNE %BT30
MSR SPSR_cxsf,r0 ;SPSR for original abort
MOV lr,r4 ;restore return address
ARM_write_FAR r5 ;restore FAR
ARM_write_FSR r6 ;restore FSR
;
90
MOVS r0,#0
......
......@@ -2458,6 +2458,7 @@ UndPreVeneer ROUT
PAbPreVeneer ROUT
Push "r0-r7, lr" ; wahey, we have an abort stack
SUB r0, lr_abort, #4 ; aborting address
MOV r1,#1
BL AMB_LazyFixUp ; can trash r0-r7, returns NE status if claimed and fixed up
Pull "r0-r7, lr", NE ; restore regs and
SUBNES pc, lr_abort, #4 ; restart aborting instruction if fixed up
......@@ -2524,17 +2525,13 @@ DAbPreVeneer ROUT
STR lr_abort, [r13_abort, #15*4] ; save old PC, ie instruction address
[ ChocolateAMB
ARM_read_FSR r0
AND r0, r0, #&F
TEQ r0, #7
BNE DAb_NotTranslationFault
ARM_read_FAR r0 ; aborting address
MOV r1,#0
BL AMB_LazyFixUp ; can trash r0-r7, returns NE status if claimed and fixed up
LDR lr_abort, [r13_abort, #15*4] ; restore lr_abort
LDMIA r13_abort, {r0-r7} ; restore regs
ADDNE r13_abort, r13_abort, #17*4 ; if fixed up, restore r13_abort
SUBNES pc, lr_abort, #8 ; and restart aborting instruction
DAb_NotTranslationFault
]
MRS r0, SPSR ; r0 = PSR when we aborted
......
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