IntelFsp2Pkg/FspSecCore: Make FSP functions position independent
authorMaurice Ma <maurice.ma@intel.com>
Thu, 13 Oct 2016 01:00:44 +0000 (18:00 -0700)
committerMaurice Ma <maurice.ma@intel.com>
Thu, 13 Oct 2016 03:57:45 +0000 (20:57 -0700)
The current AsmGetFspInfoHeader function in FspHeader.nasm is
position dependent code since it uses absolute address. Change
to use relative address instead to make it position independent.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Maurice Ma <maurice.ma@intel.com>
Reviewed-by: Giri P Mudusuru <giri.p.mudusuru@intel.com>
IntelFsp2Pkg/FspSecCore/Ia32/FspHelper.nasm

index a848dcb..ad63194 100644 (file)
@@ -31,7 +31,7 @@ ASM_PFX(NextInstruction):
    pop   eax\r
    sub   eax, ASM_PFX(NextInstruction)\r
    add   eax, ASM_PFX(AsmGetFspInfoHeader)\r
-   sub   eax, dword [ASM_PFX(FspInfoHeaderRelativeOff)]\r
+   sub   eax, dword [eax - ASM_PFX(AsmGetFspInfoHeader) + ASM_PFX(FspInfoHeaderRelativeOff)]\r
    ret\r
 \r
 global ASM_PFX(AsmGetFspInfoHeaderNoStack)\r