]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFsp2Pkg/Library/BaseFspSwitchStackLib/FspSwitchStackLib.c
Add IntelFsp2Pkg and IntelFsp2WrapperPkg.
[mirror_edk2.git] / IntelFsp2Pkg / Library / BaseFspSwitchStackLib / FspSwitchStackLib.c
diff --git a/IntelFsp2Pkg/Library/BaseFspSwitchStackLib/FspSwitchStackLib.c b/IntelFsp2Pkg/Library/BaseFspSwitchStackLib/FspSwitchStackLib.c
new file mode 100644 (file)
index 0000000..42a57a2
--- /dev/null
@@ -0,0 +1,42 @@
+/** @file\r
+\r
+  Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>\r
+  This program and the accompanying materials\r
+  are licensed and made available under the terms and conditions of the BSD License\r
+  which accompanies this distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php.\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#include <Base.h>\r
+#include <Library/BaseLib.h>\r
+#include <Library/FspCommonLib.h>\r
+\r
+/**\r
+\r
+  Switch the current stack to the previous saved stack.\r
+\r
+  @param[in]  NewStack         The new stack to be switched.\r
+\r
+  @return OldStack         After switching to the saved stack,\r
+                           this value will be saved in eax before returning.\r
+\r
+\r
+**/\r
+UINT32\r
+SwapStack (\r
+  IN  UINT32 NewStack\r
+  )\r
+{\r
+  FSP_GLOBAL_DATA  *FspData;\r
+  UINT32         OldStack;\r
+\r
+  FspData  = GetFspGlobalDataPointer ();\r
+  OldStack = FspData->CoreStack;\r
+  FspData->CoreStack = NewStack;\r
+  return OldStack;\r
+}\r
+\r