Commit 3a26f20e authored by Jeffrey Lee's avatar Jeffrey Lee Committed by ROOL

Fix stack imbalance in DA release

In OS_DynamicArea 2, a stack imbalance would occur if an error is
encountered while releasing the physical pages of a PMP (R1-R8 pushed,
but only R1-R7 pulled). Fix it, but also don't bother storing R1, since
it's never modified.
parent a4ab6171
......@@ -1332,7 +1332,7 @@ DAR_notsparse
; This is a bit of a simplistic approach - request for everything to
; be unmapped and leave it to PMP_LogOp to detect which pages are and
; aren't there
Push "r1-r8"
Push "r2-r8"
LDR r6, [r10, #DANode_Base]
MOV r3, #0
LDR r4, [r10, #DANode_SparseHWM] ; Assume HWM valid
......@@ -1353,7 +1353,7 @@ DAR_PMP_logunmap
MOV r2, sp
SWI XOS_DynamicArea
MOV sp, r8
Pull "r1-r8", VS
Pull "r2-r8", VS
EXIT VS
CMP r4, #0
MOV r3, #0
......@@ -1376,13 +1376,13 @@ DAR_PMP_physunmap
MOV r2, sp
SWI XOS_DynamicArea
MOV sp, r8
Pull "r1-r7", VS
Pull "r2-r8", VS
EXIT VS
CMP r4, #0
MOV r3, #0
BGT DAR_PMP_physloop
; All pages released, safe to free area
Pull "r1-r8"
Pull "r2-r8"
MOV r0, #DAReason_Remove
B DAR_delink
DAR_notPMP
......
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