summaryrefslogtreecommitdiff
path: root/ArmPlatformPkg/Sec/Helper.asm
diff options
context:
space:
mode:
Diffstat (limited to 'ArmPlatformPkg/Sec/Helper.asm')
-rw-r--r--ArmPlatformPkg/Sec/Helper.asm8
1 files changed, 5 insertions, 3 deletions
diff --git a/ArmPlatformPkg/Sec/Helper.asm b/ArmPlatformPkg/Sec/Helper.asm
index 15b8f47522..a03a90626e 100644
--- a/ArmPlatformPkg/Sec/Helper.asm
+++ b/ArmPlatformPkg/Sec/Helper.asm
@@ -22,13 +22,15 @@
// r1: MpId
// r2: Secure Monitor mode stack
enter_monitor_mode
- mrs r4, cpsr // Save current mode (SVC) in r1
+ cmp r2, #0 // If a Secure Monitor stack base has not been defined then use the Secure stack
+ moveq r2, sp
+
+ mrs r4, cpsr // Save current mode (SVC) in r4
bic r3, r4, #0x1f // Clear all mode bits
orr r3, r3, #0x16 // Set bits for Monitor mode
msr cpsr_cxsf, r3 // We are now in Monitor Mode
- cmp r2, #0 // If a Secure Monitor stack base has been passed, used it
- movne sp, r2 // Use the passed sp
+ mov sp, r2 // Set the stack of the Monitor Mode
mov lr, r0 // Use the pass entrypoint as lr