Commit 9c341e50 authored by Jeffrey Lee's avatar Jeffrey Lee
Browse files

Disable Wimp_ClaimFreeMemory if the free pool is a PMP

Detail:
  s/Wimp08s - If the free pool is a PMP, it's fairly safe to say there'll be no logical mapping, so don't allow Wimp_ClaimFreeMemory to succeed. Also cope with OS_Memory 10 potentially being unimplemented - swallow any error it generates, and refuse to claim the free pool.
Admin:
  Tested on Pandaboard
  Fixes crashes and subsequent OS_ChangeDynamicArea failures caused by software trying to claim the free pool (e.g. FileCore temp buffers).


Version 5.49. Tagged as 'Wimp-5_49'
parent 84a2570c
......@@ -11,13 +11,13 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "5.48"
Module_Version SETA 548
Module_MajorVersion SETS "5.49"
Module_Version SETA 549
Module_MinorVersion SETS ""
Module_Date SETS "08 Jul 2015"
Module_ApplicationDate SETS "08-Jul-15"
Module_Date SETS "01 Sep 2015"
Module_ApplicationDate SETS "01-Sep-15"
Module_ComponentName SETS "Wimp"
Module_ComponentPath SETS "castle/RiscOS/Sources/Desktop/Wimp"
Module_FullVersion SETS "5.48"
Module_HelpVersion SETS "5.48 (08 Jul 2015)"
Module_FullVersion SETS "5.49"
Module_HelpVersion SETS "5.49 (01 Sep 2015)"
END
/* (5.48)
/* (5.49)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 5.48
#define Module_MajorVersion_CMHG 5.49
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 08 Jul 2015
#define Module_Date_CMHG 01 Sep 2015
#define Module_MajorVersion "5.48"
#define Module_Version 548
#define Module_MajorVersion "5.49"
#define Module_Version 549
#define Module_MinorVersion ""
#define Module_Date "08 Jul 2015"
#define Module_Date "01 Sep 2015"
#define Module_ApplicationDate "08-Jul-15"
#define Module_ApplicationDate "01-Sep-15"
#define Module_ComponentName "Wimp"
#define Module_ComponentPath "castle/RiscOS/Sources/Desktop/Wimp"
#define Module_FullVersion "5.48"
#define Module_HelpVersion "5.48 (08 Jul 2015)"
#define Module_LibraryVersionInfo "5:48"
#define Module_FullVersion "5.49"
#define Module_HelpVersion "5.49 (01 Sep 2015)"
#define Module_LibraryVersionInfo "5:49"
......@@ -272,36 +272,51 @@ SWIWimp_ClaimFreeMemory ROUT
ORR R0,R0,#&100
MOV R1,#0
SWI XOS_Memory ; release wimp lock
CLRV ; Assume errors can be ignored (SWI not implemented in recent kernels)
]
B ExitWimp
01
; claim
ADRL R4,freepoolinuse
LDRB R0,[R4]
ADRL R10,freepoolinuse
LDRB R0,[R10]
TEQ R0,#0
MOVNE R0,#0
STRNE R0,[SP]
STRNE R0,[SP,#4]
BNE ExitWimp ; already 'claimed'
MOV R5,R1 ; preserve the amount asked for
MOV R0,#6
SWI XOS_ReadDynamicArea
MOV R9,R1 ; preserve the amount asked for
MOV R0,#2
MOV R1,#6
SWI XOS_DynamicArea
MOVVC R0,R3
MOVVC R1,R2
MOVVS R0,#0 ; Shouldn't happen
MOVVS R1,#0
TST R4,#1:SHL:20 ; Physical memory pool?
MOVNE R0,#0 ; Assume no logical mapping
MOVNE R1,#0
CMP R5,R1 ; set HI if R5 <0 or R5>R1
CMP R9,R1 ; set HI if R9 <0 or R9>R1
MOVHI R0,#0
MOVLS R2,#1
STRLSB R2,[R4] ; mark free pool in use
BHI %FT10
[ KernelLocksFreePool
Push "r0-r1"
MOV R0,#10
ORR R0,R0,#&100
MOV R1,#1
SWI XOS_Memory ; set wimp lock
Pull "r0-r1"
MOVVS R0,#0 ; just claim no memory available on error
MOVVS R1,#0
BVS %FT10
]
MOV R2,#1
STRB R2,[R10] ; mark free pool in use
10
CLRV
STR R0,[SP,#4] ; return values
STR R1,[SP]
[ KernelLocksFreePool
MOVLS R0,#10
ORRLS R0,R0,#&100
MOVLS R1,#1
SWILS XOS_Memory ; set wimp lock
]
B ExitWimp
;
......
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