From 7f22d35110e43be45a0e16a2e944feebbf51e4ed Mon Sep 17 00:00:00 2001 From: mdkinney Date: Mon, 24 Aug 2009 23:53:23 +0000 Subject: [PATCH] Fix file headers Move stack alignment check from CPU specific files into common SwitchStack() function and add VA_END() to SwitchStack(). Fix incorrect syntax for ASM_FUNCTION_REMOVE_IF_UNREFERENCED git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9193 6f19259b-4bc3-4df7-8a09-765794883524 --- MdePkg/Library/BaseLib/Arm/CpuBreakpoint.S | 2 +- MdePkg/Library/BaseLib/Arm/CpuBreakpoint.asm | 2 +- MdePkg/Library/BaseLib/Arm/CpuPause.asm | 2 +- MdePkg/Library/BaseLib/Arm/DisableInterrupts.S | 2 +- .../Library/BaseLib/Arm/DisableInterrupts.asm | 2 +- MdePkg/Library/BaseLib/Arm/EnableInterrupts.S | 2 +- MdePkg/Library/BaseLib/Arm/EnableInterrupts.asm | 2 +- MdePkg/Library/BaseLib/Arm/GccInline.c | 2 +- MdePkg/Library/BaseLib/Arm/GetInterruptsState.S | 2 +- .../Library/BaseLib/Arm/GetInterruptsState.asm | 2 +- .../Library/BaseLib/Arm/InternalSwitchStack.c | 17 +++++++++++------ MdePkg/Library/BaseLib/Arm/SetJumpLongJump.S | 4 ++-- MdePkg/Library/BaseLib/Arm/SetJumpLongJump.asm | 2 +- MdePkg/Library/BaseLib/Arm/SwitchStack.asm | 2 +- MdePkg/Library/BaseLib/Arm/Unaligned.c | 2 +- MdePkg/Library/BaseLib/BaseLib.inf | 3 ++- MdePkg/Library/BaseLib/Ebc/SwitchStack.c | 6 ------ MdePkg/Library/BaseLib/Ia32/GccInline.c | 2 +- .../Library/BaseLib/Ia32/InternalSwitchStack.c | 5 ----- .../Library/BaseLib/Ipf/InternalSwitchStack.c | 3 +-- MdePkg/Library/BaseLib/SwitchStack.c | 7 +++++++ MdePkg/Library/BaseLib/X64/GccInline.c | 2 +- 22 files changed, 38 insertions(+), 37 deletions(-) diff --git a/MdePkg/Library/BaseLib/Arm/CpuBreakpoint.S b/MdePkg/Library/BaseLib/Arm/CpuBreakpoint.S index 1041f8fb78..8c538ed9f4 100644 --- a/MdePkg/Library/BaseLib/Arm/CpuBreakpoint.S +++ b/MdePkg/Library/BaseLib/Arm/CpuBreakpoint.S @@ -3,7 +3,7 @@ # CpuBreakpoint() for ARM # # Copyright (c) 2006 - 2009, Intel Corporation
-# Portions copyright (c) 2008-2009 Apple Inc.
+# Portions copyright (c) 2008-2009 Apple Inc. All rights reserved.
# All rights reserved. This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at diff --git a/MdePkg/Library/BaseLib/Arm/CpuBreakpoint.asm b/MdePkg/Library/BaseLib/Arm/CpuBreakpoint.asm index 9cea12dbf0..487f49bd7f 100644 --- a/MdePkg/Library/BaseLib/Arm/CpuBreakpoint.asm +++ b/MdePkg/Library/BaseLib/Arm/CpuBreakpoint.asm @@ -3,7 +3,7 @@ ; CpuBreakpoint() for ARM ; ; Copyright (c) 2006 - 2009, Intel Corporation
-; Portions copyright (c) 2008-2009 Apple Inc.
+; Portions copyright (c) 2008-2009 Apple Inc. All rights reserved.
; All rights reserved. This program and the accompanying materials ; are licensed and made available under the terms and conditions of the BSD License ; which accompanies this distribution. The full text of the license may be found at diff --git a/MdePkg/Library/BaseLib/Arm/CpuPause.asm b/MdePkg/Library/BaseLib/Arm/CpuPause.asm index cad2921c0e..a8c4517541 100644 --- a/MdePkg/Library/BaseLib/Arm/CpuPause.asm +++ b/MdePkg/Library/BaseLib/Arm/CpuPause.asm @@ -3,7 +3,7 @@ ; CpuPause() for ARM ; ; Copyright (c) 2006 - 2009, Intel Corporation
-; Portions copyright (c) 2008-2009 Apple Inc.
+; Portions copyright (c) 2008-2009 Apple Inc. All rights reserved.
; All rights reserved. This program and the accompanying materials ; are licensed and made available under the terms and conditions of the BSD License ; which accompanies this distribution. The full text of the license may be found at diff --git a/MdePkg/Library/BaseLib/Arm/DisableInterrupts.S b/MdePkg/Library/BaseLib/Arm/DisableInterrupts.S index 35bf9d2603..ca9ed370da 100644 --- a/MdePkg/Library/BaseLib/Arm/DisableInterrupts.S +++ b/MdePkg/Library/BaseLib/Arm/DisableInterrupts.S @@ -3,7 +3,7 @@ # DisableInterrupts() for ARM # # Copyright (c) 2006 - 2009, Intel Corporation
-# Portions copyright (c) 2008-2009 Apple Inc.
+# Portions copyright (c) 2008-2009 Apple Inc. All rights reserved.
# All rights reserved. This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at diff --git a/MdePkg/Library/BaseLib/Arm/DisableInterrupts.asm b/MdePkg/Library/BaseLib/Arm/DisableInterrupts.asm index 859a51f4fe..d3d1036cca 100644 --- a/MdePkg/Library/BaseLib/Arm/DisableInterrupts.asm +++ b/MdePkg/Library/BaseLib/Arm/DisableInterrupts.asm @@ -3,7 +3,7 @@ ; DisableInterrupts() for ARM ; ; Copyright (c) 2006 - 2009, Intel Corporation
-; Portions copyright (c) 2008-2009 Apple Inc.
+; Portions copyright (c) 2008-2009 Apple Inc. All rights reserved.
; All rights reserved. This program and the accompanying materials ; are licensed and made available under the terms and conditions of the BSD License ; which accompanies this distribution. The full text of the license may be found at diff --git a/MdePkg/Library/BaseLib/Arm/EnableInterrupts.S b/MdePkg/Library/BaseLib/Arm/EnableInterrupts.S index a79ac55a4a..74d239cb8e 100644 --- a/MdePkg/Library/BaseLib/Arm/EnableInterrupts.S +++ b/MdePkg/Library/BaseLib/Arm/EnableInterrupts.S @@ -3,7 +3,7 @@ # EnableInterrupts() for ARM # # Copyright (c) 2006 - 2009, Intel Corporation
-# Portions copyright (c) 2008-2009 Apple Inc.
+# Portions copyright (c) 2008-2009 Apple Inc. All rights reserved.
# All rights reserved. This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at diff --git a/MdePkg/Library/BaseLib/Arm/EnableInterrupts.asm b/MdePkg/Library/BaseLib/Arm/EnableInterrupts.asm index 5c44432818..b1ca051025 100644 --- a/MdePkg/Library/BaseLib/Arm/EnableInterrupts.asm +++ b/MdePkg/Library/BaseLib/Arm/EnableInterrupts.asm @@ -3,7 +3,7 @@ ; EnableInterrupts() for ARM ; ; Copyright (c) 2006 - 2009, Intel Corporation
-; Portions copyright (c) 2008-2009 Apple Inc.
+; Portions copyright (c) 2008-2009 Apple Inc. All rights reserved.
; All rights reserved. This program and the accompanying materials ; are licensed and made available under the terms and conditions of the BSD License ; which accompanies this distribution. The full text of the license may be found at diff --git a/MdePkg/Library/BaseLib/Arm/GccInline.c b/MdePkg/Library/BaseLib/Arm/GccInline.c index f5aaf2a435..97e7d82c02 100644 --- a/MdePkg/Library/BaseLib/Arm/GccInline.c +++ b/MdePkg/Library/BaseLib/Arm/GccInline.c @@ -2,7 +2,7 @@ GCC inline implementation of BaseLib processor specific functions. Copyright (c) 2006 - 2007, Intel Corporation
- Portions copyright (c) 2008-2009 Apple Inc.
+ Portions copyright (c) 2008-2009 Apple Inc. All rights reserved.
All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at diff --git a/MdePkg/Library/BaseLib/Arm/GetInterruptsState.S b/MdePkg/Library/BaseLib/Arm/GetInterruptsState.S index 9c37e05829..1c26f749ee 100644 --- a/MdePkg/Library/BaseLib/Arm/GetInterruptsState.S +++ b/MdePkg/Library/BaseLib/Arm/GetInterruptsState.S @@ -3,7 +3,7 @@ # GetInterruptState() function for ARM # # Copyright (c) 2006 - 2009, Intel Corporation
-# Portions copyright (c) 2008-2009 Apple Inc.
+# Portions copyright (c) 2008-2009 Apple Inc. All rights reserved.
# All rights reserved. This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at diff --git a/MdePkg/Library/BaseLib/Arm/GetInterruptsState.asm b/MdePkg/Library/BaseLib/Arm/GetInterruptsState.asm index 0bf7618306..e4997c9341 100644 --- a/MdePkg/Library/BaseLib/Arm/GetInterruptsState.asm +++ b/MdePkg/Library/BaseLib/Arm/GetInterruptsState.asm @@ -3,7 +3,7 @@ ; GetInterruptState() function for ARM ; ; Copyright (c) 2006 - 2009, Intel Corporation
-; Portions copyright (c) 2008-2009 Apple Inc.
+; Portions copyright (c) 2008-2009 Apple Inc. All rights reserved.
; All rights reserved. This program and the accompanying materials ; are licensed and made available under the terms and conditions of the BSD License ; which accompanies this distribution. The full text of the license may be found at diff --git a/MdePkg/Library/BaseLib/Arm/InternalSwitchStack.c b/MdePkg/Library/BaseLib/Arm/InternalSwitchStack.c index ef337a1839..0bff206fad 100644 --- a/MdePkg/Library/BaseLib/Arm/InternalSwitchStack.c +++ b/MdePkg/Library/BaseLib/Arm/InternalSwitchStack.c @@ -2,7 +2,7 @@ SwitchStack() function for ARM. Copyright (c) 2006 - 2007, Intel Corporation
- Portions copyright (c) 2008-2009 Apple Inc.
+ Portions copyright (c) 2008-2009 Apple Inc. All rights reserved.
All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -15,6 +15,16 @@ #include "BaseLibInternals.h" +VOID +EFIAPI +InternalSwitchStackAsm ( + IN SWITCH_STACK_ENTRY_POINT EntryPoint, + IN VOID *Context1, OPTIONAL + IN VOID *Context2, OPTIONAL + IN VOID *NewStack + ); + + /** Transfers control to a function starting with a new stack. @@ -50,10 +60,5 @@ InternalSwitchStack ( ) { - // - // Stack should be aligned with CPU_STACK_ALIGNMENT - // - ASSERT (((UINTN)NewStack & (CPU_STACK_ALIGNMENT - 1)) == 0); - InternalSwitchStackAsm (EntryPoint, Context1, Context2, NewStack); } diff --git a/MdePkg/Library/BaseLib/Arm/SetJumpLongJump.S b/MdePkg/Library/BaseLib/Arm/SetJumpLongJump.S index 9c3de5e55f..96c6a652c7 100644 --- a/MdePkg/Library/BaseLib/Arm/SetJumpLongJump.S +++ b/MdePkg/Library/BaseLib/Arm/SetJumpLongJump.S @@ -1,7 +1,7 @@ #------------------------------------------------------------------------------ # # Copyright (c) 2006 - 2009, Intel Corporation
-# Portions copyright (c) 2008-2009 Apple Inc.
+# Portions copyright (c) 2008-2009 Apple Inc. All rights reserved.
# All rights reserved. This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -67,4 +67,4 @@ ASM_PFX(InternalLongJump): mov r0, r1 bx lr -ASM_FUNCTION_REMOVE_IF_UNREFERENCED() +ASM_FUNCTION_REMOVE_IF_UNREFERENCED diff --git a/MdePkg/Library/BaseLib/Arm/SetJumpLongJump.asm b/MdePkg/Library/BaseLib/Arm/SetJumpLongJump.asm index 3743291d13..5cfbedefed 100644 --- a/MdePkg/Library/BaseLib/Arm/SetJumpLongJump.asm +++ b/MdePkg/Library/BaseLib/Arm/SetJumpLongJump.asm @@ -1,7 +1,7 @@ ;------------------------------------------------------------------------------ ; ; Copyright (c) 2006 - 2009, Intel Corporation
-; Portions copyright (c) 2008-2009 Apple Inc.
+; Portions copyright (c) 2008-2009 Apple Inc. All rights reserved.
; All rights reserved. This program and the accompanying materials ; are licensed and made available under the terms and conditions of the BSD License ; which accompanies this distribution. The full text of the license may be found at diff --git a/MdePkg/Library/BaseLib/Arm/SwitchStack.asm b/MdePkg/Library/BaseLib/Arm/SwitchStack.asm index 71e8ab3d7d..be3485d02a 100644 --- a/MdePkg/Library/BaseLib/Arm/SwitchStack.asm +++ b/MdePkg/Library/BaseLib/Arm/SwitchStack.asm @@ -1,7 +1,7 @@ ;------------------------------------------------------------------------------ ; ; Copyright (c) 2006 - 2009, Intel Corporation
-; Portions copyright (c) 2008-2009 Apple Inc.
+; Portions copyright (c) 2008-2009 Apple Inc. All rights reserved.
; All rights reserved. This program and the accompanying materials ; are licensed and made available under the terms and conditions of the BSD License ; which accompanies this distribution. The full text of the license may be found at diff --git a/MdePkg/Library/BaseLib/Arm/Unaligned.c b/MdePkg/Library/BaseLib/Arm/Unaligned.c index be30c8c818..d21a83e7c6 100644 --- a/MdePkg/Library/BaseLib/Arm/Unaligned.c +++ b/MdePkg/Library/BaseLib/Arm/Unaligned.c @@ -4,7 +4,7 @@ volatile was added to work around optimization issues. Copyright (c) 2006 - 2009, Intel Corporation
- Portions Copyright (c) 2008-2009 Apple Inc.
+ Portions copyright (c) 2008-2009 Apple Inc. All rights reserved.
All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at diff --git a/MdePkg/Library/BaseLib/BaseLib.inf b/MdePkg/Library/BaseLib/BaseLib.inf index cad014dce4..849cfcb4d8 100644 --- a/MdePkg/Library/BaseLib/BaseLib.inf +++ b/MdePkg/Library/BaseLib/BaseLib.inf @@ -2,7 +2,7 @@ # Base Library implementation. # # Copyright (c) 2007 - 2009, Intel Corporation.
-# Portions Copyright (c) 2008-2009 Apple Inc.
+# Portions copyright (c) 2008-2009 Apple Inc. All rights reserved.
# # All rights reserved. This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -600,6 +600,7 @@ Arm/GccInline.c | GCC Arm/EnableInterrupts.S | GCC Arm/DisableInterrupts.S | GCC + Arm/GetInterruptsState.S | GCC Arm/SetJumpLongJump.S | GCC Arm/CpuBreakpoint.S | GCC diff --git a/MdePkg/Library/BaseLib/Ebc/SwitchStack.c b/MdePkg/Library/BaseLib/Ebc/SwitchStack.c index 8317aae325..2e77551981 100644 --- a/MdePkg/Library/BaseLib/Ebc/SwitchStack.c +++ b/MdePkg/Library/BaseLib/Ebc/SwitchStack.c @@ -54,11 +54,5 @@ InternalSwitchStack ( // This is to support compilation of CPU types that do not support assemblers // such as EBC // - - // - // Stack should be aligned with CPU_STACK_ALIGNMENT - // - ASSERT (((UINTN)NewStack & (CPU_STACK_ALIGNMENT - 1)) == 0); - EntryPoint (Context1, Context2); } diff --git a/MdePkg/Library/BaseLib/Ia32/GccInline.c b/MdePkg/Library/BaseLib/Ia32/GccInline.c index e0600e1a85..fcb0665866 100644 --- a/MdePkg/Library/BaseLib/Ia32/GccInline.c +++ b/MdePkg/Library/BaseLib/Ia32/GccInline.c @@ -2,7 +2,7 @@ GCC inline implementation of BaseLib processor specific functions. Copyright (c) 2006 - 2007, Intel Corporation
- Portions copyright (c) 2008-2009 Apple Inc.
+ Portions copyright (c) 2008-2009 Apple Inc. All rights reserved.
All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at diff --git a/MdePkg/Library/BaseLib/Ia32/InternalSwitchStack.c b/MdePkg/Library/BaseLib/Ia32/InternalSwitchStack.c index 1fe2239076..6df2434b94 100644 --- a/MdePkg/Library/BaseLib/Ia32/InternalSwitchStack.c +++ b/MdePkg/Library/BaseLib/Ia32/InternalSwitchStack.c @@ -50,11 +50,6 @@ InternalSwitchStack ( { BASE_LIBRARY_JUMP_BUFFER JumpBuffer; - // - // Stack should be aligned with CPU_STACK_ALIGNMENT - // - ASSERT (((UINTN)NewStack & (CPU_STACK_ALIGNMENT - 1)) == 0); - JumpBuffer.Eip = (UINTN)EntryPoint; JumpBuffer.Esp = (UINTN)NewStack - sizeof (VOID*); JumpBuffer.Esp -= sizeof (Context1) + sizeof (Context2); diff --git a/MdePkg/Library/BaseLib/Ipf/InternalSwitchStack.c b/MdePkg/Library/BaseLib/Ipf/InternalSwitchStack.c index 1f64de2630..ff11405b3d 100644 --- a/MdePkg/Library/BaseLib/Ipf/InternalSwitchStack.c +++ b/MdePkg/Library/BaseLib/Ipf/InternalSwitchStack.c @@ -57,9 +57,8 @@ InternalSwitchStack ( NewBsp = VA_ARG (Marker, VOID *); // - // Stack should be aligned with CPU_STACK_ALIGNMENT + // New backing store pointer should be aligned with CPU_STACK_ALIGNMENT // - ASSERT (((UINTN)NewStack & (CPU_STACK_ALIGNMENT - 1)) == 0); ASSERT (((UINTN)NewBsp & (CPU_STACK_ALIGNMENT - 1)) == 0); AsmSwitchStackAndBackingStore (EntryPoint, Context1, Context2, NewStack, NewBsp); diff --git a/MdePkg/Library/BaseLib/SwitchStack.c b/MdePkg/Library/BaseLib/SwitchStack.c index 32c64ca8d6..0c3e29d94a 100644 --- a/MdePkg/Library/BaseLib/SwitchStack.c +++ b/MdePkg/Library/BaseLib/SwitchStack.c @@ -58,10 +58,17 @@ SwitchStack ( ASSERT (EntryPoint != NULL); ASSERT (NewStack != NULL); + // + // New stack must be aligned with CPU_STACK_ALIGNMENT + // + ASSERT (((UINTN)NewStack & (CPU_STACK_ALIGNMENT - 1)) == 0); + VA_START (Marker, NewStack); InternalSwitchStack (EntryPoint, Context1, Context2, NewStack, Marker); + VA_END (Marker); + // // InternalSwitchStack () will never return // diff --git a/MdePkg/Library/BaseLib/X64/GccInline.c b/MdePkg/Library/BaseLib/X64/GccInline.c index e7fc1aa119..2473ca9fbe 100644 --- a/MdePkg/Library/BaseLib/X64/GccInline.c +++ b/MdePkg/Library/BaseLib/X64/GccInline.c @@ -2,7 +2,7 @@ GCC inline implementation of BaseLib processor specific functions. Copyright (c) 2006 - 2007, Intel Corporation
- Portions copyright (c) 2008-2009 Apple Inc.
+ Portions copyright (c) 2008-2009 Apple Inc. All rights reserved.
All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at -- 2.39.2