]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPkg: Replace single dead loop.
authorOlivier Martin <olivier.martin@arm.com>
Sat, 1 Mar 2014 10:57:55 +0000 (10:57 +0000)
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Sat, 1 Mar 2014 10:57:55 +0000 (10:57 +0000)
Several assembler macros use a loop at the label "dead" to trap an error.
This is difficult to debug as there is no indication of how one arrived at the loop.
This change replaces dead with distinct loops locally in the macro,
which means the cause of the hang is detectable to the debugger.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15273 6f19259b-4bc3-4df7-8a09-765794883524

ArmPkg/Include/AsmMacroIoLibV8.h
ArmPkg/Library/ArmLib/AArch64/AArch64Support.S
ArmPkg/Library/ArmLib/Common/AArch64/ArmLibSupport.S
ArmPlatformPkg/PrePeiCore/AArch64/Exception.S
ArmPlatformPkg/PrePeiCore/AArch64/PrePeiCoreEntryPoint.S

index 78a033cb4fdf97051bc3aa5608960da8c3428ecb..5ab1b5723eb866fa6c796391a4c44a481edbf33b 100644 (file)
@@ -106,24 +106,24 @@ _InitializePrimaryStackEnd:
 // Provide the Macro with a safe temp xreg to use.\r
 #define EL1_OR_EL2(SAFE_XREG)        \\r
         mrs    SAFE_XREG, CurrentEL ;\\r
-        cmp    SAFE_XREG, #0x4     ;\\r
-        b.eq   1f                  ;\\r
-        cmp    SAFE_XREG, #0x8     ;\\r
-        b.eq   2f                  ;\\r
-        b      dead                ;// We should never get here.\r
+        cmp    SAFE_XREG, #0x     ;\\r
+        b.eq   2f                   ;\\r
+        cmp    SAFE_XREG, #0x     ;\\r
+        b.ne   .                    ;// We should never get here\r
+// EL1 code starts here\r
 \r
 // CurrentEL : 0xC = EL3; 8 = EL2; 4 = EL1\r
 // This only selects between EL1 and EL2 and EL3, else we die.\r
 // Provide the Macro with a safe temp xreg to use.\r
-#define EL1_OR_EL2_OR_EL3(SAFE_XREG)        \\r
+#define EL1_OR_EL2_OR_EL3(SAFE_XREG) \\r
         mrs    SAFE_XREG, CurrentEL ;\\r
+        cmp    SAFE_XREG, #0xC      ;\\r
+        b.eq   3f                   ;\\r
+        cmp    SAFE_XREG, #0x8      ;\\r
+        b.eq   2f                   ;\\r
         cmp    SAFE_XREG, #0x4      ;\\r
-        b.eq   1f           ;\\r
-        cmp    SAFE_XREG, #0x8     ;\\r
-        b.eq   2f                  ;\\r
-        cmp    SAFE_XREG, #0xC     ;\\r
-        b.eq   3f                  ;\\r
-        b      dead                ;// We should never get here.\r
+        b.ne   .                    ;// We should never get here\r
+// EL1 code starts here\r
 \r
 #else\r
 \r
index 5901ffacd4405cc682be5855a34f2412461adaca..66c310bb3194820a704c0466b6c500f8757b165a 100644 (file)
@@ -503,7 +503,4 @@ ASM_PFX(ArmReadCurrentEL):
   mrs   x0, CurrentEL\r
   ret\r
 \r
-dead:\r
-  b     dead\r
-\r
 ASM_FUNCTION_REMOVE_IF_UNREFERENCED\r
index cf2ec76be92dd86fa0c4646bfc2495dfccb6561e..5dd3fca5e958de10dd33e71ff94c676310040359 100644 (file)
@@ -1,7 +1,7 @@
 #------------------------------------------------------------------------------\r
 #\r
 # Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
-# Copyright (c) 2011 - 2013, ARM Limited. All rights reserved.\r
+# Copyright (c) 2011 - 2014, ARM Limited. All rights reserved.\r
 #\r
 # This program and the accompanying materials\r
 # are licensed and made available under the terms and conditions of the BSD License\r
@@ -196,7 +196,5 @@ ASM_PFX(ArmCallSEV):
   sev\r
   ret\r
 \r
-dead:\r
-  b       dead\r
 \r
 ASM_FUNCTION_REMOVE_IF_UNREFERENCED\r
index 9ca422b2f5d79e121061d44667314a440082499b..1fc39e68a160f3a8aeaaa45d35d107f58f323975 100644 (file)
@@ -1,5 +1,5 @@
 #\r
-#  Copyright (c) 2011-2013, ARM Limited. All rights reserved.\r
+#  Copyright (c) 2011-2014, ARM Limited. All rights reserved.\r
 #\r
 #  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
@@ -79,6 +79,3 @@ _DefaultFiq_h:
 _DefaultSError_h:\r
   mov  x0, #EXCEPT_AARCH64_SERROR\r
   TO_HANDLER\r
-\r
-dead:\r
-   b   dead\r
index 5bdbe4585ffece243b32c2b42ce03b7c42e46551..05a823ba21a559c701e2d5fc96225ad6c055e787 100644 (file)
@@ -1,5 +1,5 @@
 //\r
-//  Copyright (c) 2011-2013, ARM Limited. All rights reserved.\r
+//  Copyright (c) 2011-2014, ARM Limited. All rights reserved.\r
 //\r
 //  This program and the accompanying materials\r
 //  are licensed and made available under the terms and conditions of the BSD License\r
@@ -43,13 +43,12 @@ ASM_PFX(_ModuleEntryPoint):
 // changes.\r
 \r
 // Which EL are we running at? Every EL needs some level of setup...\r
-  EL1_OR_EL2_OR_EL3(x0)\r
+// We should not run this code in EL3\r
+  EL1_OR_EL2(x0)\r
 1:bl    ASM_PFX(SetupExceptionLevel1)\r
   b     ASM_PFX(MainEntryPoint)\r
 2:bl    ASM_PFX(SetupExceptionLevel2)\r
   b     ASM_PFX(MainEntryPoint)\r
-3:// If we are at EL3 we die.\r
-  b     dead\r
 \r
 ASM_PFX(MainEntryPoint):\r
   // Identify CPU ID\r
@@ -109,6 +108,3 @@ _SetupPrimaryCoreStack:
   // 128-bit variable on the stack\r
   SetPrimaryStack (x1, x2, x3, x4)\r
   b     _PrepareArguments\r
-\r
-dead:\r
-  b     dead\r