From c31e0d587f372c65b0a4776f5378ed114910fc04 Mon Sep 17 00:00:00 2001 From: Dan Ellis <dellis@gitlab.riscosopen.org> Date: Mon, 20 Nov 2000 17:27:37 +0000 Subject: [PATCH] Improved abort handling Detail: * One check for 26-bit mode wan't being made, leading to the runtime reporting 'Uncaught trap:' when a trap should have been catching the abort. This prevented signal handlers from trapping some aborts. * When an abort was occuring in SVC mode, the stack wasn't being flattened, resulting in all sorts of nasty things when you tried to carry on from a signal handler (probably the main reason why you ever see 'No stack for trap handler'). SVC and undefined stacks are now flattened. Further work should be done to restore the state of the OS after an abort, but this probably requires a new OS call to tidy itself up adequately. Admin: Built 26-bit versions of the library with new 32-bit compatible entry points and checked abort handling with both sharedclibrary and ansilib. Version 5.22. Tagged as 'RISC_OSLib-5_22' --- VersionASM | 14 +++++++------- VersionNum | 20 ++++++++++---------- kernel/s/k_body | 18 ++++++++++++++++-- 3 files changed, 33 insertions(+), 19 deletions(-) diff --git a/VersionASM b/VersionASM index f442b3a..14b1057 100644 --- a/VersionASM +++ b/VersionASM @@ -11,14 +11,14 @@ GBLS Module_HelpVersion GBLS Module_ComponentName GBLS Module_ComponentPath -Module_MajorVersion SETS "5.21" -Module_Version SETA 521 +Module_MajorVersion SETS "5.22" +Module_Version SETA 522 Module_MinorVersion SETS "" -Module_Date SETS "08 Nov 2000" -Module_ApplicationDate2 SETS "08-Nov-00" -Module_ApplicationDate4 SETS "08-Nov-2000" +Module_Date SETS "20 Nov 2000" +Module_ApplicationDate2 SETS "20-Nov-00" +Module_ApplicationDate4 SETS "20-Nov-2000" Module_ComponentName SETS "RISC_OSLib" Module_ComponentPath SETS "RiscOS/Sources/Lib/RISC_OSLib" -Module_FullVersion SETS "5.21" -Module_HelpVersion SETS "5.21 (08 Nov 2000)" +Module_FullVersion SETS "5.22" +Module_HelpVersion SETS "5.22 (20 Nov 2000)" END diff --git a/VersionNum b/VersionNum index 9437910..3ae29c1 100644 --- a/VersionNum +++ b/VersionNum @@ -1,22 +1,22 @@ -/* (5.21) +/* (5.22) * * This file is automatically maintained by srccommit, do not edit manually. * */ -#define Module_MajorVersion_CMHG 5.21 +#define Module_MajorVersion_CMHG 5.22 #define Module_MinorVersion_CMHG -#define Module_Date_CMHG 08 Nov 2000 +#define Module_Date_CMHG 20 Nov 2000 -#define Module_MajorVersion "5.21" -#define Module_Version 521 +#define Module_MajorVersion "5.22" +#define Module_Version 522 #define Module_MinorVersion "" -#define Module_Date "08 Nov 2000" +#define Module_Date "20 Nov 2000" -#define Module_ApplicationDate2 "08-Nov-00" -#define Module_ApplicationDate4 "08-Nov-2000" +#define Module_ApplicationDate2 "20-Nov-00" +#define Module_ApplicationDate4 "20-Nov-2000" #define Module_ComponentName "RISC_OSLib" #define Module_ComponentPath "RiscOS/Sources/Lib/RISC_OSLib" -#define Module_FullVersion "5.21" -#define Module_HelpVersion "5.21 (08 Nov 2000)" +#define Module_FullVersion "5.22" +#define Module_HelpVersion "5.22 (20 Nov 2000)" diff --git a/kernel/s/k_body b/kernel/s/k_body index b07e874..8e2f5c1 100644 --- a/kernel/s/k_body +++ b/kernel/s/k_body @@ -915,15 +915,25 @@ Aborted Keep STR r1, [r6, #pc*4] ; PC as user R14 STR r2, [r6, #r0*4] STREQ r3, [r6, #r12*4] - BEQ AbortFindHandler + BEQ AbortFlattenStacks LDR r4, [r12, #O_svcStack] SUB r1, r4, sp CMP r1, #3 * 4 - BCC AbortFindHandler + BCC AbortFlattenStacks LDMEA r4, {r1, r2, r3} ADD r4, r6, #10 * 4 STMIA r4, {r1, r2, r3} +; should really fall through to error handler and let the OS clean up, +; but this is a lot better than it was! +AbortFlattenStacks + MRS r4, CPSR ; MRS and MSR here will be NOPs on + ORR r1, r4, #PSR32UNDMode ; ARM2/3, so we'll end up setting + MSR CPSR_c, r1 ; R13_svc twice; just make sure + LDR sp, [r12, #O_undStack] ; we set the real value last. + MSR CPSR_c, r4 + LDR sp, [r12, #O_svcStack] + AbortFindHandler Keep ; We can only call an abort handler if we had a stack at the ; time of the abort. If not, we have to say 'uncaught trap'. @@ -1173,6 +1183,10 @@ FindAndCallHandlers Keep FCH_NextFrame [ {CONFIG}=26 BIC r1, r1, #PSRBits + | + MRS v4, CPSR + TST v4, #2_11100 + BICEQ r1, r1, #PSRBits ] LDMIB v6, {v4, v5} FCH_NextLanguage Keep -- GitLab