IntelFsp2Pkg/FspSecCore: Reserve 32B when calling C function in 64bit

After bootloader calls FSP API mode, I found the RDI register is
changed in some cases.
Below is the first line of function FspApiCallingCheck in assembly dump
  mov qword ptr [rsp+0x8],rbx
We can see compiler will use rsp+0x8 for some purpose, while rsp+0x8
is used to save RDI by FSP in code before.

According to the x86-64 calling convention, caller is responsible for
allocating 32 bytes of "shadow space" on the stack right before calling
the function (regardless of the actual number of parameters used).
However FSP code doesn't reserve 32 bytes before calling
FspApiCallingCheck C function in 64bit.

The patch fixes it by reserving the 32 bytes before calling C routine.
Also, make sure the stack is 16-byte alignment, sub 0x28 to RSP.

Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
1 file changed