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

Fix *WimpMode/Wimp_SetMode to return an error when given a bad mode selector...

Fix *WimpMode/Wimp_SetMode to return an error when given a bad mode selector block. Re-read configured mode on Sevice_Reset.

Detail:
  s/Wimp01 - Reinitialise currentmode on Service_Reset in order to get the correct mode in the case of a GraphicsV driver overriding it (driver may not have been initialised at the time of the first call in module init). Add a bit more mode debugging and ensure ValidateAddress code completely removed under Medusa.
  s/Wimp02 - Issue OS_CheckModeValid in validatemode so we can detect cases where a valid looking mode selector block doesn't actually map to a mode definition. Add more mode debugging code.
Admin:
  Tested on Raspberry Pi
  Fixes issue where "F12 -> *BASIC -> MODE 0 -> QUIT -> return" wouldn't restore screen mode correctly if currentmode had been set to a bad mode selector (e.g. after a CMOS reset nukes the LoadModeFile command), due to WimpMode's lack of error checking
  Note that this merely prevents currentmode being set to a bad mode at the time of *WimpMode/Wimp_SetMode - if a mode which is valid suddenly becomes invalid (e.g. due to loading a new MDF but not reselecting a valid wimp mode) then the Wimp will still fail to set a sensible mode on return to the desktop.


Version 5.40. Tagged as 'Wimp-5_40'
parent 6911d7cc
......@@ -11,13 +11,13 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "5.39"
Module_Version SETA 539
Module_MajorVersion SETS "5.40"
Module_Version SETA 540
Module_MinorVersion SETS ""
Module_Date SETS "13 Apr 2014"
Module_ApplicationDate SETS "13-Apr-14"
Module_Date SETS "18 Apr 2014"
Module_ApplicationDate SETS "18-Apr-14"
Module_ComponentName SETS "Wimp"
Module_ComponentPath SETS "castle/RiscOS/Sources/Desktop/Wimp"
Module_FullVersion SETS "5.39"
Module_HelpVersion SETS "5.39 (13 Apr 2014)"
Module_FullVersion SETS "5.40"
Module_HelpVersion SETS "5.40 (18 Apr 2014)"
END
/* (5.39)
/* (5.40)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 5.39
#define Module_MajorVersion_CMHG 5.40
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 13 Apr 2014
#define Module_Date_CMHG 18 Apr 2014
#define Module_MajorVersion "5.39"
#define Module_Version 539
#define Module_MajorVersion "5.40"
#define Module_Version 540
#define Module_MinorVersion ""
#define Module_Date "13 Apr 2014"
#define Module_Date "18 Apr 2014"
#define Module_ApplicationDate "13-Apr-14"
#define Module_ApplicationDate "18-Apr-14"
#define Module_ComponentName "Wimp"
#define Module_ComponentPath "castle/RiscOS/Sources/Desktop/Wimp"
#define Module_FullVersion "5.39"
#define Module_HelpVersion "5.39 (13 Apr 2014)"
#define Module_LibraryVersionInfo "5:39"
#define Module_FullVersion "5.40"
#define Module_HelpVersion "5.40 (18 Apr 2014)"
#define Module_LibraryVersionInfo "5:40"
......@@ -3423,12 +3423,14 @@ gotwork
|
MOV R0,#1 ; Read configured mode
SWI XOS_ReadSysInfo
Debug mode,"gotwork trying mode",R0
BLVC validatemode ; error if non-graphics mode
MOVVS R0,#27
[ Medusa
BL copy_mode_specifier ; just in case configured mode
; is new style.
]
Debug mode,"setting currentmode",R0
STR R0,currentmode ; altered by Wimp_SetMode
]
;
......@@ -4142,7 +4144,26 @@ Service2
TEQ R1,#Service_Reset
MOVNE PC,LR
[ Medusa :LAND: :LNOT: DontCheckModeOnInit
; Reset currentmode on Service_Reset
; This allows us to get the correct mode in the case of a GraphicsV
; driver overriding the result of OS_ReadSysInfo 1 (as the driver
; probably wasn't initialised at the time we first read the mode)
Push "R0-R2,LR"
MOV R0,#1 ; Read configured mode
SWI XOS_ReadSysInfo
Debug mode,"Service_Reset trying mode",R0
BLVC validatemode ; error if non-graphics mode
MOVVS R0,#27
[ Medusa
BL copy_mode_specifier ; just in case configured mode
; is new style.
]
Debug mode,"setting currentmode",R0
STR R0,currentmode ; altered by Wimp_SetMode
Pull "R0-R2,LR"
; Fall through...
]
initptrs_deallocating ; called on Service_Reset
Push "LR"
......@@ -4151,19 +4172,8 @@ initptrs_deallocating ; called on Service_Reset
BL defaultfilters ; re-register the filter routines
Pull "PC"
[ :LNOT: Medusa
ValidateAddress
[ Medusa
; [ true
; Push "R0-R2,lr"
; MOV R0,#6
; SWI XOS_ReadDynamicArea ; is there a kernel free pool
; Pull "R0-R2,lr"
; MOVVC PC,lr
; CLRV
; |
; MOV PC,lr
; ]
|
Debug valid,"Validate address ",r2,r3
Push "LR"
LDRB r14,memoryOK ; BUGFIX: NRaine 6-Aug-96 (should be unconditional)
......
......@@ -232,11 +232,13 @@ initfirsttask
MOV R0,#1 ; Read configured mode
SWI XOS_ReadSysInfo
Debug mode,"initfirsttask trying mode",R0
BLVC validatemode ; error if non-graphics mode
MOVVS R0,#27
[ Medusa
BL copy_mode_specifier
]
Debug mode,"setting currentmode",R0
STR R0,currentmode ; altered by Wimp_SetMode
05
BL recalcmodevars ; before any SWIs are called!
......@@ -1761,6 +1763,7 @@ printsyntax
SWIWimp_SetMode
MyEntry "SetMode"
Debug mode,"SWIWimp_SetMode trying mode",R0
BL validatemode
BVS ExitWimp
LDR R2,taskcount
......@@ -1769,6 +1772,7 @@ SWIWimp_SetMode
[ Medusa
BL copy_mode_specifier
]
Debug mode,"setting currentmode",R0
STR R0,currentmode ; just alter value for next time
01 LDR R1,commandflag ; you can change mode without penalty
ORR R14,R1,#cf_suspended ; since the desktop is intact
......@@ -1784,13 +1788,22 @@ SWIWimp_SetMode
validatemode
Push "R0-R3,LR"
Debug mode,"validatemode",R0
;
SWI XOS_CheckModeValid ; check any mode selector block describes a valid mode
CMPCS R1,#-3 ; only give up if no substitute
DebugIf HI,mode,"-> CheckModeValid failed"
BHI %FT01 ; Also NE for the MyXError below
LDR R0,[SP] ; assume OS_ReadModeVariable checks below will still be valid when given original mode
;
MOV R1,#VduExt_ModeFlags
SWI XOS_ReadModeVariable
MOVCSS r0,#1 ; For the NE on MyXError below ! Carry preserved
DebugIf CS,mode,"-> couldn't get mode flags"
BCS %FT01
;
TST R2,#ModeFlag_NonGraphic ; NE => this is a non-graphic mode
DebugIf NE,mode,"-> non-graphics mode"
BNE %FT01
;
MOV R1,#VduExt_Log2BPP
......@@ -1799,6 +1812,7 @@ validatemode
MOV R1,#VduExt_Log2BPC
SWI XOS_ReadModeVariable
TEQ R2,R3 ; NE => this is a double-pixel mode
DebugIf NE,mode,"-> double-pixel mode"
01
MyXError WimpBadMode,NE
;
......@@ -1895,6 +1909,7 @@ int_setmode ROUT
LDR R0,[sp,#8] ; skip OS_Word block to get mode number
Debug mode,"int_setmode setting",R0
[ Medusa
CMP R0,#256
BLO %FT20
......
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