Index: FspSecCore/Ia32/FspApiEntry.asm
===================================================================
--- FspSecCore/Ia32/FspApiEntry.asm	(revision 17200)
+++ FspSecCore/Ia32/FspApiEntry.asm	(working copy)
@@ -38,8 +38,9 @@
 ; Following functions will be provided in PlatformSecLib
 ;
 EXTERN   GetFspBaseAddress:PROC
+EXTERN   GetFspInfoHdr:PROC
 EXTERN   GetBootFirmwareVolumeOffset:PROC
-EXTERN   Pei2LoaderSwitchStack:PROC
+EXTERN   Loader2PeiSwitchStack:PROC
 EXTERN   LoadMicrocode(LoadMicrocodeDefault):PROC
 EXTERN   SecPlatformInit(SecPlatformInitDefault):PROC
 EXTERN   SecCarInit:PROC
@@ -505,8 +506,10 @@
   jz     @F
   cmp    eax, 3   ; FspMemoryInit API
   jz     @F
-  jmp    Pei2LoaderSwitchStack
 
+  call   GetFspInfoHdr
+  jmp    Loader2PeiSwitchStack
+
 @@:
   ;
   ; FspInit and FspMemoryInit APIs, setup the initial stack frame
@@ -515,8 +518,13 @@
   ;
   ; Store the address in FSP which will return control to the BL
   ;
-  push   offset exit
+  push   eax
 
+  push   eax
+  call   GetFspInfoHdr
+  mov    [esp + 4], eax
+  pop    eax
+
   ;
   ; Create a Task Frame in the stack for the Boot Loader
   ;
@@ -584,6 +592,7 @@
   call    SecStartup
 
 exit:
+  add     esp, 4
   ret
 
 FspApiCommon   ENDP
Index: FspSecCore/Ia32/FspApiEntry.s
===================================================================
--- FspSecCore/Ia32/FspApiEntry.s	(revision 17200)
+++ FspSecCore/Ia32/FspApiEntry.s	(working copy)
@@ -215,8 +215,10 @@
 #
 # Following functions will be provided in PlatformSecLib
 #
+ASM_GLOBAL    ASM_PFX(GetFspBaseAddress)
+ASM_GLOBAL    ASM_PFX(GetFspInfoHdr)
 ASM_GLOBAL    ASM_PFX(GetBootFirmwareVolumeOffset)
-ASM_GLOBAL    ASM_PFX(Pei2LoaderSwitchStack)
+ASM_GLOBAL    ASM_PFX(Loader2PeiSwitchStack)
 
 
 #
@@ -717,7 +719,8 @@
   jz      FspApiCommonL2
   cmpl    $0x03, %eax                        # FspMemoryInit API
   jz      FspApiCommonL2
-  jmp     Pei2LoaderSwitchStack
+  call    ASM_PFX(GetFspInfoHdr)
+  jmp     Loader2PeiSwitchStack
 
 FspApiCommonL2:
   #
@@ -727,8 +730,13 @@
   #
   # Store the address in FSP which will return control to the BL
   #
-  pushl   $FspApiCommonExit
+  pushl  %eax
 
+  pushl  %eax
+  call   ASM_PFX(GetFspInfoHdr)
+  movl   %eax, 4(%esp)
+  popl   %eax
+
   #
   # Create a Task Frame in the stack for the Boot Loader
   #
@@ -798,5 +806,6 @@
   call    ASM_PFX(SecStartup)
 
 FspApiCommonExit:
+  addl    $4, %esp
   ret
 
Index: FspSecCore/Ia32/FspHelper.asm
===================================================================
--- FspSecCore/Ia32/FspHelper.asm	(revision 17200)
+++ FspSecCore/Ia32/FspHelper.asm	(working copy)
@@ -15,7 +15,7 @@
     .model  flat,C
     .code
 
-FspInfoHeaderRelativeOff    PROC      NEAR    PRIVATE
+FspInfoHeaderRelativeOff    PROC      NEAR    PUBLIC
    ;
    ; This value will be pached by the build script
    ;
@@ -30,4 +30,10 @@
    ret
 GetFspBaseAddress           ENDP
 
+GetFspInfoHdr               PROC      NEAR    PUBLIC
+   mov   eax, GetFspBaseAddress
+   sub   eax, dword ptr [FspInfoHeaderRelativeOff]   
+   ret
+GetFspInfoHdr               ENDP
+
      END
\ No newline at end of file
Index: FspSecCore/Ia32/FspHelper.s
===================================================================
--- FspSecCore/Ia32/FspHelper.s	(revision 17200)
+++ FspSecCore/Ia32/FspHelper.s	(working copy)
@@ -31,3 +31,8 @@
    mov    (%eax), %eax
    ret
 
+ASM_GLOBAL ASM_PFX(GetFspInfoHdr)
+ASM_PFX(GetFspInfoHdr):
+   mov    $GetFspBaseAddress, %eax
+   sub    $FspInfoHeaderRelativeOff, %eax
+   ret
Index: Include/Library/FspCommonLib.h
===================================================================
--- Include/Library/FspCommonLib.h	(revision 17200)
+++ Include/Library/FspCommonLib.h	(working copy)
@@ -182,6 +182,17 @@
   );
 
 /**
+  This function gets the FSP info header pointer from the API context.
+
+  @retval FspInfoHeader   FSP info header pointer
+**/
+FSP_INFO_HEADER *
+EFIAPI
+GetFspInfoHeaderFromApiContext (
+  VOID
+  );
+
+/**
   This function gets the VPD data pointer.
 
   @return VpdDataRgnPtr   VPD data pointer.
Index: Library/BaseFspCommonLib/FspCommonLib.c
===================================================================
--- Library/BaseFspCommonLib/FspCommonLib.c	(revision 17200)
+++ Library/BaseFspCommonLib/FspCommonLib.c	(working copy)
@@ -27,7 +27,7 @@
 //   API Parameter                +0x34
 //   API return address           +0x30
 //
-//   push    offset exit          +0x2C
+//   push    FspInfoHeader        +0x2C
 //   pushfd                       +0x28
 //   cli
 //   pushad                       +0x24
@@ -47,7 +47,7 @@
   UINT32    Ecx;
   UINT32    Eax;
   UINT16    Flags[2];
-  UINT32    ExitOff;
+  UINT32    FspHdr;
   UINT32    ApiRet;
   UINT32    ApiParam;
 } CONTEXT_STACK;
@@ -332,6 +332,23 @@
 }
 
 /**
+  This function gets the FSP info header pointer.
+
+  @retval FspInfoHeader   FSP info header pointer
+**/
+FSP_INFO_HEADER *
+EFIAPI
+GetFspInfoHeaderFromApiContext (
+  VOID
+  )
+{
+  FSP_GLOBAL_DATA  *FspData;
+
+  FspData  = GetFspGlobalDataPointer ();
+  return  (FSP_INFO_HEADER *)(*(UINT32 *)(UINTN)(FspData->CoreStack + CONTEXT_STACK_OFFSET(FspHdr)));  
+}
+
+/**
   This function gets the VPD data pointer.
 
   @return VpdDataRgnPtr   VPD data pointer.
Index: Library/BaseFspSwitchStackLib/Ia32/Stack.asm
===================================================================
--- Library/BaseFspSwitchStackLib/Ia32/Stack.asm	(revision 17200)
+++ Library/BaseFspSwitchStackLib/Ia32/Stack.asm	(working copy)
@@ -1,6 +1,6 @@
 ;------------------------------------------------------------------------------
 ;
-; Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
+; Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR>
 ; 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
@@ -28,7 +28,8 @@
 ;------------------------------------------------------------------------------
 EXTERNDEF  C   MeasurePoint:PROC
 Pei2LoaderSwitchStack   PROC C PUBLIC
-    jmp     Loader2PeiSwitchStack
+    xor     eax, eax
+    jmp     FspSwitchStack
 Pei2LoaderSwitchStack   ENDP
 
 ;------------------------------------------------------------------------------
@@ -38,10 +39,21 @@
 ;   VOID
 ;   )
 ;------------------------------------------------------------------------------
+Loader2PeiSwitchStack   PROC C PUBLIC    
+    jmp     FspSwitchStack
+Loader2PeiSwitchStack   ENDP
+
+;------------------------------------------------------------------------------
+; UINT32
+; EFIAPI
+; FspSwitchStack (
+;   VOID
+;   )
+;------------------------------------------------------------------------------
 EXTERNDEF  C   SwapStack:PROC
-Loader2PeiSwitchStack   PROC C PUBLIC
+FspSwitchStack   PROC C PUBLIC
     ; Save current contexts
-    push    offset exit
+    push    eax
     pushfd
     cli
     pushad
@@ -59,7 +71,8 @@
     popad
     popfd
 exit:
+    add     esp, 4
     ret
-Loader2PeiSwitchStack   ENDP
+FspSwitchStack   ENDP
 
     END
Index: Library/BaseFspSwitchStackLib/Ia32/Stack.s
===================================================================
--- Library/BaseFspSwitchStackLib/Ia32/Stack.s	(revision 17200)
+++ Library/BaseFspSwitchStackLib/Ia32/Stack.s	(working copy)
@@ -25,20 +25,33 @@
 #------------------------------------------------------------------------------
 ASM_GLOBAL ASM_PFX(Pei2LoaderSwitchStack)
 ASM_PFX(Pei2LoaderSwitchStack):
-    jmp     ASM_PFX(Loader2PeiSwitchStack)
+    xorl    %eax, %eax
+    jmp     ASM_PFX(FspSwitchStack)
 
 #------------------------------------------------------------------------------
 # UINT32
 # EFIAPI
 # Loader2PeiSwitchStack (
+#   VOID
 #   )
 #------------------------------------------------------------------------------
 ASM_GLOBAL ASM_PFX(Loader2PeiSwitchStack)
 ASM_PFX(Loader2PeiSwitchStack):
+    jmp     ASM_PFX(FspSwitchStack)
+
+#------------------------------------------------------------------------------
+# UINT32
+# EFIAPI
+# FspSwitchStack (
+#   VOID
+#   )
+#------------------------------------------------------------------------------
+ASM_GLOBAL ASM_PFX(FspSwitchStack)
+ASM_PFX(FspSwitchStack):
     #
     #Save current contexts
     #
-    push    $exit
+    push    %eax
     pushf
     cli
     pusha
@@ -60,6 +73,7 @@
     popa
     popf
 exit:
+    add     $0x04,%esp
     ret
 
 
