audk/UefiCpuPkg/PiSmmCpuDxeSmm
Liming Gao a364928195 UefiCpuPkg PiSmmCpuDxeSmm: Update SmiEntry function run the same position
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1191

Before commit e21e355e2c, jmp _SmiHandler
is commented. And below code, ASM_PFX(CpuSmmDebugEntry) is moved into rax,
then call it. But, this code doesn't work in XCODE5 tool chain. Because XCODE5
doesn't generated the absolute address in the EFI image. So, rax stores the
relative address. Once this logic is moved to another place, it will not work.
;   jmp     _SmiHandler                 ; instruction is not needed
...
    mov     rax, ASM_PFX(CpuSmmDebugEntry)
    call    rax

Commit e21e355e2c is to support XCODE5.
One tricky way is selected to fix it. Although SmiEntry logic is copied to
another place and run, but here jmp _SmiHandler is enabled to jmp the original
code place, then call ASM_PFX(CpuSmmDebugEntry) with the relative address.
    mov     rax, strict qword 0         ;   mov     rax, _SmiHandler
_SmiHandlerAbsAddr:
    jmp     rax
...
    call    ASM_PFX(CpuSmmDebugEntry)

Now, BZ 1191 raises the issue that SmiHandler should run in the copied address,
can't run in the common address. So, jmp _SmiHandler is required to be removed,
the code is kept to run in copied address. And, the relative address is
requried to be fixed up to the absolute address. The necessary changes should
not affect the behavior of platforms that already consume PiSmmCpuDxeSmm.
OVMF SMM boot to shell with VS2017, GCC5 and XCODE5 tool chain has been verified.
...
    mov     rax, strict qword 0         ;   call    ASM_PFX(CpuSmmDebugEntry)
CpuSmmDebugEntryAbsAddr:
    call    rax

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2018-09-25 08:25:41 +08:00
..
Ia32 UefiCpuPkg/PiSmmCpuDxeSmm: implement non-stop mode for SMM 2018-08-30 07:22:30 +08:00
X64 UefiCpuPkg PiSmmCpuDxeSmm: Update SmiEntry function run the same position 2018-09-25 08:25:41 +08:00
CpuS3.c UefiCpuPkg/PiSmmCpuDxeSmm: move InitSmmS3Cr3() into else block 2018-09-17 10:45:53 +08:00
CpuService.c UefiCpuPkg/LocalApicLib: Rename GetProcessorLocation() 2016-11-02 09:16:21 +08:00
CpuService.h UefiCpuPkg: Add PiSmmCpuDxeSmm module no IA32/X64 files 2015-10-19 19:12:53 +00:00
MpService.c UefiCpuPkg: Clean up source files 2018-06-28 11:19:53 +08:00
PiSmmCpuDxeSmm.c UefiCpuPkg/PiSmmCpuDxeSmm: clear exec file mode bits on "PiSmmCpuDxeSmm.c" 2018-08-22 10:33:49 +02:00
PiSmmCpuDxeSmm.h UefiCpuPkg: Remove redundant library classes, Ppis and GUIDs 2018-09-21 14:42:53 +08:00
PiSmmCpuDxeSmm.inf UefiCpuPkg: Remove redundant library classes, Ppis and GUIDs 2018-09-21 14:42:53 +08:00
PiSmmCpuDxeSmm.uni UefiCpuPkg: Convert all .uni files to utf-8 2015-12-15 04:59:14 +00:00
PiSmmCpuDxeSmmExtra.uni UefiCpuPkg: Convert all .uni files to utf-8 2015-12-15 04:59:14 +00:00
SmmCpuMemoryManagement.c UefiCpuPkg/PiSmmCpuDxeSmm: Avoid possible NULL ptr dereference 2018-07-31 13:07:47 +08:00
SmmProfile.c UefiCpuPkg/PiSmmCpuDxeSmm: implement non-stop mode for SMM 2018-08-30 07:22:30 +08:00
SmmProfile.h UefiCpuPkg/PiSmmCpuDxeSmm: implement non-stop mode for SMM 2018-08-30 07:22:30 +08:00
SmmProfileInternal.h UefiCpuPkg: Remove redundant library classes, Ppis and GUIDs 2018-09-21 14:42:53 +08:00
SmramSaveState.c UefiCpuPkg/PiSmmCpuDxeSmm: patch "gSmiCr3" with PatchInstructionX86() 2018-04-04 16:44:06 +02:00
SyncTimer.c UefiCpuPkg: Add PiSmmCpuDxeSmm module no IA32/X64 files 2015-10-19 19:12:53 +00:00