diff options
author | oliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524> | 2012-03-26 10:49:58 +0000 |
---|---|---|
committer | oliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524> | 2012-03-26 10:49:58 +0000 |
commit | 59a2b365ea8797007f8aab0f9e89e2c040a83ae6 (patch) | |
tree | de9673da63ab7419a4d68d7e89dfc9f1630bbd35 /ArmPlatformPkg/Sec | |
parent | 7defe7b354bb21322f25c73284bc740cf161c653 (diff) | |
download | edk2-platforms-59a2b365ea8797007f8aab0f9e89e2c040a83ae6.tar.xz |
ArmPlatformPkg/Sec: Fixed monitor stack setup
The Secure Monitor stack was not when a stack base was not provided by the Secure SVC world.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13126 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ArmPlatformPkg/Sec')
-rw-r--r-- | ArmPlatformPkg/Sec/Helper.S | 8 | ||||
-rw-r--r-- | ArmPlatformPkg/Sec/Helper.asm | 8 |
2 files changed, 10 insertions, 6 deletions
diff --git a/ArmPlatformPkg/Sec/Helper.S b/ArmPlatformPkg/Sec/Helper.S index 9e3b13b38f..8bdb66ab87 100644 --- a/ArmPlatformPkg/Sec/Helper.S +++ b/ArmPlatformPkg/Sec/Helper.S @@ -24,13 +24,15 @@ GCC_ASM_EXPORT(set_non_secure_mode) # r1: MpId
# r2: Secure Monitor mode stack
ASM_PFX(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
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
|