Commit 0634b535 authored by Jeffrey Lee's avatar Jeffrey Lee Committed by ROOL
Browse files

Add missing AMBControl appspace shrink check

Fix GrowFreePoolFromAppSpace (i.e. appspace shrink operation) to issue
UpCall_MemoryMoving / Service_Memory when attempting to shrink PMP-based
appspace (i.e. AMBControl nodes). This fixes (e.g.) BASIC getting stuck
in an abort loop if you try and use OS_ChangeDynamicArea to grow the
free pool.

Version 6.40. Tagged as 'Kernel-6_40'
parent 5014117d
...@@ -9,12 +9,12 @@ ...@@ -9,12 +9,12 @@
GBLS Module_ApplicationDate GBLS Module_ApplicationDate
GBLS Module_HelpVersion GBLS Module_HelpVersion
GBLS Module_ComponentName GBLS Module_ComponentName
Module_MajorVersion SETS "6.39" Module_MajorVersion SETS "6.40"
Module_Version SETA 639 Module_Version SETA 640
Module_MinorVersion SETS "" Module_MinorVersion SETS ""
Module_Date SETS "22 Jun 2020" Module_Date SETS "01 Jul 2020"
Module_ApplicationDate SETS "22-Jun-20" Module_ApplicationDate SETS "01-Jul-20"
Module_ComponentName SETS "Kernel" Module_ComponentName SETS "Kernel"
Module_FullVersion SETS "6.39" Module_FullVersion SETS "6.40"
Module_HelpVersion SETS "6.39 (22 Jun 2020)" Module_HelpVersion SETS "6.40 (01 Jul 2020)"
END END
/* (6.39) /* (6.40)
* *
* This file is automatically maintained by srccommit, do not edit manually. * This file is automatically maintained by srccommit, do not edit manually.
* *
*/ */
#define Module_MajorVersion_CMHG 6.39 #define Module_MajorVersion_CMHG 6.40
#define Module_MinorVersion_CMHG #define Module_MinorVersion_CMHG
#define Module_Date_CMHG 22 Jun 2020 #define Module_Date_CMHG 01 Jul 2020
#define Module_MajorVersion "6.39" #define Module_MajorVersion "6.40"
#define Module_Version 639 #define Module_Version 640
#define Module_MinorVersion "" #define Module_MinorVersion ""
#define Module_Date "22 Jun 2020" #define Module_Date "01 Jul 2020"
#define Module_ApplicationDate "22-Jun-20" #define Module_ApplicationDate "01-Jul-20"
#define Module_ComponentName "Kernel" #define Module_ComponentName "Kernel"
#define Module_FullVersion "6.39" #define Module_FullVersion "6.40"
#define Module_HelpVersion "6.39 (22 Jun 2020)" #define Module_HelpVersion "6.40 (01 Jul 2020)"
#define Module_LibraryVersionInfo "6:39" #define Module_LibraryVersionInfo "6:40"
...@@ -5229,7 +5229,14 @@ GrowFreePoolFromAppSpace ROUT ...@@ -5229,7 +5229,14 @@ GrowFreePoolFromAppSpace ROUT
RSB r1, r1, #0 ; (AreaShrink assumes negative size on entry) RSB r1, r1, #0 ; (AreaShrink assumes negative size on entry)
MOVEQ r0, #ChangeDyn_AplSpace MOVEQ r0, #ChangeDyn_AplSpace
BEQ AreaShrink BEQ AreaShrink
; Shrink of PMP appspace - go via CDA_PMP ; Shrink of PMP appspace
; Check that the app is happy (normally handled by AreaShrink)
Push "r10"
MOV r10, r1
BL CheckAppSpace
Pull "r10"
BVS ChangeDynError
; Call through to CDA_PMP to call the (AMBControl) DA handler
B CDA_PMP B CDA_PMP
ShrinkFreePoolToAppSpace ROUT ShrinkFreePoolToAppSpace ROUT
...@@ -5570,12 +5577,21 @@ CDA_PMP ROUT ...@@ -5570,12 +5577,21 @@ CDA_PMP ROUT
LDR r11, [r10, #DANode_PMPSize] ; Remember current size LDR r11, [r10, #DANode_PMPSize] ; Remember current size
MOV r0, #DAHandler_ResizePMP MOV r0, #DAHandler_ResizePMP
MOV r1, r1, ASR #12 MOV r1, r1, ASR #12
[ DebugCDA2
DREG r2, "CDA_PMP calling ResizePMP for DA ", cc
DREG r1, ", page count ", cc
DREG r10, ", DANode "
]
MOV lr, pc MOV lr, pc
LDMIA r12, {r12, pc} ; Call handler LDMIA r12, {r12, pc} ; Call handler
; Exit without issuing service call - PhysOp should have triggered it for us ; Exit without issuing service call - PhysOp should have triggered it for us
MOVVC r0, r2 ; r0 = DA number if no error MOVVC r0, r2 ; r0 = DA number if no error
MRS r2, CPSR MRS r2, CPSR
LDR r10, [r10, #DANode_PMPSize] LDR r10, [r10, #DANode_PMPSize]
[ DebugCDA2
DREG r10, "new size: ", cc
DREG r11, " old size: "
]
SUBS r1, r10, r11 SUBS r1, r10, r11
RSBLT r1, r1, #0 ; get unsigned change for OS_ChangeDynamicArea return RSBLT r1, r1, #0 ; get unsigned change for OS_ChangeDynamicArea return
CMP r1, #DynArea_PMP_BigPageCount ; even though unsigned, use same +2GB clamp CMP r1, #DynArea_PMP_BigPageCount ; even though unsigned, use same +2GB clamp
......
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