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

Use official error block. Disallow instantiation. Warn clients before finalising.

Detail:
  Resources/UK/Messages, s/Errors, hdr/VFPSupport - Errors now declared in public header. New/updated error messages and symbols.
  s/GetAll - Changed GET order to work with errors in header file
  s/Module - Disallow instantiation. Manually issue Service_ModulePostFinal during finalisation, to give clients slightly more warning than the kernel does.
Admin:
  Tested in OMAP3 ROM


Version 0.03. Tagged as 'VFPSupport-0_03'
parent 45287c9a
#{DictTokens}
NoVFP:No VFP/NEON hardware present
BadVFP:Unsupported VFP/NEON version
FeatureUnavailable:A requested feature is unavailable
BadContext:Bad context
BadFeature:Bad VFPSupport_Features reason code
E00:No VFP/NEON hardware present
E01:Unsupported VFP/NEON version
E02:A requested VFP/NEON feature is unavailable
E03:Bad VFP context
E04:Bad VFPSupport_Features reason code
E06:Only one instance of VFPSupport can be active at a time
......@@ -11,13 +11,13 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "0.02"
Module_Version SETA 2
Module_MajorVersion SETS "0.03"
Module_Version SETA 3
Module_MinorVersion SETS ""
Module_Date SETS "01 Feb 2011"
Module_ApplicationDate SETS "01-Feb-11"
Module_Date SETS "20 Mar 2012"
Module_ApplicationDate SETS "20-Mar-12"
Module_ComponentName SETS "VFPSupport"
Module_ComponentPath SETS "bsd/RiscOS/Sources/HWSupport/VFPSupport"
Module_FullVersion SETS "0.02"
Module_HelpVersion SETS "0.02 (01 Feb 2011)"
Module_FullVersion SETS "0.03"
Module_HelpVersion SETS "0.03 (20 Mar 2012)"
END
/* (0.02)
/* (0.03)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 0.02
#define Module_MajorVersion_CMHG 0.03
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 01 Feb 2011
#define Module_Date_CMHG 20 Mar 2012
#define Module_MajorVersion "0.02"
#define Module_Version 2
#define Module_MajorVersion "0.03"
#define Module_Version 3
#define Module_MinorVersion ""
#define Module_Date "01 Feb 2011"
#define Module_Date "20 Mar 2012"
#define Module_ApplicationDate "01-Feb-11"
#define Module_ApplicationDate "20-Mar-12"
#define Module_ComponentName "VFPSupport"
#define Module_ComponentPath "bsd/RiscOS/Sources/HWSupport/VFPSupport"
#define Module_FullVersion "0.02"
#define Module_HelpVersion "0.02 (01 Feb 2011)"
#define Module_LibraryVersionInfo "0:2"
#define Module_FullVersion "0.03"
#define Module_HelpVersion "0.03 (20 Mar 2012)"
#define Module_LibraryVersionInfo "0:3"
......@@ -133,5 +133,16 @@ FPSCR_Z * 1 :SHL: 30
FPSCR_N * 1 :SHL: 31
; Errors
^ ErrorBase_VFPSupport
AddError VFPSupport_NoHW, "No VFP/NEON hardware present"
AddError VFPSupport_BadHW, "Unsupported VFP/NEON version"
AddError VFPSupport_FeatureUnavailable, "A requested VFP/NEON feature is unavailable"
AddError VFPSupport_BadContext, "Bad VFP context"
AddError VFPSupport_BadFeature, "Bad VFPSupport_Features reason code"
AddError VFPSupport_NoHW2, "VFPSupport module or VFP/NEON coprocessor not found" ; Generic error for VFP/NEON dependent programs to use. Where possible programs should use custom error text to specify the exact hardware required - VFPv1, NEON, etc.
AddError VFPSupport_Instanced, "Only one instance of VFPSupport can be active at a time"
OPT OldOpt
END
......@@ -26,18 +26,18 @@
; POSSIBILITY OF SUCH DAMAGE.
;
^ 0 ; TODO - sort out error base
AddError NoVFP, "No VFP/NEON hardware present"
AddError BadVFP, "Unsupported VFP/NEON version"
AddError FeatureUnavailable, "A requested feature is unavailable"
AddError BadContext, "Bad context"
AddError BadFeature, "Bad VFPSupport_Features reason code"
; VFPSupport errors
MakeInternatErrorBlock VFPSupport_NoHW,,E00
MakeInternatErrorBlock VFPSupport_BadHW,,E01
MakeInternatErrorBlock VFPSupport_FeatureUnavailable,,E02
MakeInternatErrorBlock VFPSupport_BadContext,,E03
MakeInternatErrorBlock VFPSupport_BadFeature,,E04
; MakeInternatErrorBlock VFPSupport_NoHW2,,E05 - not used internally
MakeInternatErrorBlock VFPSupport_Instanced,,E06
; Other errors
MakeInternatErrorBlock NoVFP
MakeInternatErrorBlock BadVFP
MakeInternatErrorBlock FeatureUnavailable
MakeInternatErrorBlock ModuleBadSWI
MakeInternatErrorBlock BadContext
MakeInternatErrorBlock BadFeature
END
......@@ -41,10 +41,10 @@
GET Hdr:Symbols
GET Hdr:ResourceFS
GET Hdr:MsgTrans
GET Hdr:VFPSupport
GET Hdr:FSNumbers
GET Hdr:HighFSI
GET Hdr:NewErrors
GET Hdr:VFPSupport
GET VersionASM
......
......@@ -116,11 +116,12 @@ InitModule
[ standalone
ADRL R0,ResourceFSFiles
SWI XResourceFS_RegisterFiles
EXIT VS
]
MOV r0, #ModHandReason_Claim
LDR r3, =WSSize
SWI XOS_Module
BVS %FT20
EXIT VS
STR r2, [r12]
MOV r12, r2
......@@ -129,11 +130,26 @@ InitModule
STR r0, [r12, r3]
BNE %BT10
; Check for multiple instantiation; must be done after workspace setup
CMP r11, #0
ADRNEL r0, ErrorBlock_VFPSupport_Instanced
BLNE ReturnError_LR
BVS %FT20
BL CheckHardware
BLVC InstallHandler
20
EXIT VC
Push "r0"
BL CloseMessages
[ standalone
ADRL R0,ResourceFSFiles
SWI XResourceFS_DeregisterFiles
]
Pull "r0"
SETV
EXIT
CheckHardware
......@@ -198,7 +214,7 @@ IsARMv5
NoVFP_v6v7
MSR CPSR_c, r1 ; restore interrupts
NoVFP
ADRL r0, ErrorBlock_NoVFP
ADRL r0, ErrorBlock_VFPSupport_NoHW
B ReturnError_Stacked
ARMv5Und
......@@ -230,7 +246,7 @@ BadVFP
myISB GE,r0 ; Deal with pipelined CP15 ops on ARMv6+. TODO - ARMv5
; Restore interrupts
MSR CPSR_c, R1
ADRL r0, ErrorBlock_BadVFP
ADRL r0, ErrorBlock_VFPSupport_BadHW
B ReturnError_Stacked
GoodVFP
; r0 = ARM version
......@@ -290,10 +306,22 @@ InstallHandler
MSR CPSR_c, r4
EXIT
GBLA BCDVersion
BCDVersion SETBCD Module_Version*100
KillModule
LDR wp, [r12]
MOV r6, lr
; Warn our clients that we're about to die
; TODO - If ClaimProcessorVector fails, our clients will still think we're dead
ADR r0, Module_BaseAddr
MOV r1, #Service_ModulePostFinal
ADRL r2, ModuleTitle
MOV r3, #0 ; We only allow one instance
LDR r4, =BCDVersion
SWI XOS_ServiceCall
; Remove undefined instruction handler
MOV r0, #1
LDR r1, OldHandler
......@@ -361,7 +389,7 @@ SWI_CheckContext
MSRLS CPSR_f,#Z_bit ; Clear V while retaining LS state
MOVLS pc,lr
10
ADRL r0, ErrorBlock_FeatureUnavailable
ADRL r0, ErrorBlock_VFPSupport_FeatureUnavailable
B ReturnError_LR
SWI_CreateContext
......@@ -584,7 +612,7 @@ SWI_ExamineContext
CLRV
MOV pc, lr
20
ADRL r0, ErrorBlock_BadContext
ADRL r0, ErrorBlock_VFPSupport_BadContext
B ReturnError_LR
FormatDescriptorBlock_FPINST2
......@@ -633,7 +661,7 @@ FeaturesJumpTable
EndOfFeaturesJumpTable
UnknownFeature
ADRL r0, ErrorBlock_BadFeature
ADRL r0, ErrorBlock_VFPSupport_BadFeature
B ReturnError_LR
Feature_SystemRegs
......
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