From a0f4966c2b84225b34e216cfd2f04b32c90bae68 Mon Sep 17 00:00:00 2001 From: Mike Stephens <mstephen@gitlab.riscosopen.org> Date: Wed, 13 Jun 2001 16:37:53 +0000 Subject: [PATCH] Changes to Lazy task swapping to support abort handler in abort mode (now that we can count to 32). LazyFixup now ensures all app pages are mapped in before handing on a real (no-lazy) abort. This allows an abort handler in app space itself, without scrambling the details of the original abort (via a lazy abort in abort mode). Many a happy minute spent coding and testing for recursive aborts and fixups, but lets just pretend it doesn't happen shall we. Tested with simple popbang code on ARM9 desktop build. Version 5.35, 4.79.2.36. Tagged as 'Kernel-5_35-4_79_2_36' --- VersionASM | 6 +++--- VersionNum | 8 ++++---- s/AMBControl/memmap | 35 ++++++++++++++++++++++++++++------- 3 files changed, 35 insertions(+), 14 deletions(-) diff --git a/VersionASM b/VersionASM index 6b18d74..d28c88b 100644 --- a/VersionASM +++ b/VersionASM @@ -13,12 +13,12 @@ GBLS Module_ComponentPath Module_MajorVersion SETS "5.35" Module_Version SETA 535 -Module_MinorVersion SETS "4.79.2.35" +Module_MinorVersion SETS "4.79.2.36" Module_Date SETS "13 Jun 2001" Module_ApplicationDate2 SETS "13-Jun-01" Module_ApplicationDate4 SETS "13-Jun-2001" Module_ComponentName SETS "Kernel" Module_ComponentPath SETS "RiscOS/Sources/Kernel" -Module_FullVersion SETS "5.35 (4.79.2.35)" -Module_HelpVersion SETS "5.35 (13 Jun 2001) 4.79.2.35" +Module_FullVersion SETS "5.35 (4.79.2.36)" +Module_HelpVersion SETS "5.35 (13 Jun 2001) 4.79.2.36" END diff --git a/VersionNum b/VersionNum index c323df6..22ed655 100644 --- a/VersionNum +++ b/VersionNum @@ -4,12 +4,12 @@ * */ #define Module_MajorVersion_CMHG 5.35 -#define Module_MinorVersion_CMHG 4.79.2.35 +#define Module_MinorVersion_CMHG 4.79.2.36 #define Module_Date_CMHG 13 Jun 2001 #define Module_MajorVersion "5.35" #define Module_Version 535 -#define Module_MinorVersion "4.79.2.35" +#define Module_MinorVersion "4.79.2.36" #define Module_Date "13 Jun 2001" #define Module_ApplicationDate2 "13-Jun-01" @@ -18,5 +18,5 @@ #define Module_ComponentName "Kernel" #define Module_ComponentPath "RiscOS/Sources/Kernel" -#define Module_FullVersion "5.35 (4.79.2.35)" -#define Module_HelpVersion "5.35 (13 Jun 2001) (4.79.2.35)" +#define Module_FullVersion "5.35 (4.79.2.36)" +#define Module_HelpVersion "5.35 (13 Jun 2001) (4.79.2.36)" diff --git a/s/AMBControl/memmap b/s/AMBControl/memmap index 3a3a1a4..c8b8735 100644 --- a/s/AMBControl/memmap +++ b/s/AMBControl/memmap @@ -63,19 +63,19 @@ AMB_LazyFixUp ROUT MOV r12,#AMBControl_ws LDR r12,[r12] CMP r12,#0 - BEQ %FT20 + BEQ %FT90 ;not initialised! LDR r1,AMBFlags TST r1,#AMBFlag_LazyMapIn_disable :OR: AMBFlag_LazyMapIn_suspend - BNE %FT20 - SUBS r0,r0,#ApplicationStart - BMI %FT20 - MOV r0,r0,LSR #Log2PageSize ;address now in terms of pages from ApplicationStart + BNE %FT90 ;not active LDR r1,AMBMappedInNode CMP r1,#0 - BEQ %FT20 + BEQ %FT90 ;no current node LDR r2,[r1,#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 CMP r2,r0 - BLS %FT20 + BLS %FT20 ;abort not in current app space ; ; check/update the MappedIn bitmap ; @@ -119,7 +119,28 @@ AMB_LazyFixUp ROUT STMIA r5,{r0,r1} ;update CAM entry MOV r12,r7 MOV pc,lr ;r0 is non-zero, NE status +; +; not our abort, but is possible that client abort handler is in app space, so force all +; app space pages in now (so that client abort handler does not cause lazy abort, scribbling over original abort details) +; + ASSERT No26bitCode ;assumes we have an abort stack! (recursive lazy fixup aborts may occur) 20 + MOV r1,#ApplicationStart ;good old page walk to provoke lazy fixups + LDR r2,AMBMappedInNode + LDR r2,[r2,#AMBNode_Npages] + CMP r2,#0 + BEQ %FT90 + MRS r0,SPSR ;preserve SPSR_abort for original abort details + MOV r4,lr ;preserve lr_abort so we can return properly (!) +30 + LDR r3,[r1] ;bring that page in by the magic of aborts + SUBS r2,r2,#1 + ADD r1,r1,#PageSize + BNE %BT30 + MSR SPSR_all,r0 ;SPSR for original abort + MOV lr,r4 ;restore return address +; +90 MOVS r0,#0 MOV r12,r7 MOV pc,lr ;r0 is zero, EQ status -- GitLab