audk/UefiCpuPkg/PiSmmCpuDxeSmm
Laszlo Ersek 9686a4678d UefiCpuPkg/PiSmmCpuDxeSmm: remove DBs from SmmRelocationSemaphoreComplete32()
(1) SmmRelocationSemaphoreComplete32() runs in 32-bit mode, so wrap it in
    a (BITS 32 ... BITS 64) bracket.

(2) SmmRelocationSemaphoreComplete32() currently compiles to:

> 000002AE  C6050000000001    mov byte [dword 0x0],0x1
> 000002B5  FF2500000000      jmp dword [dword 0x0]

    where the first instruction is patched with the contents of
    "mRebasedFlag" (so that (*mRebasedFlag) is set to 1), and the second
    instruction is patched with the address of
    "mSmmRelocationOriginalAddress" (so that we jump to
    "mSmmRelocationOriginalAddress").

    In its current form the first instruction could not be patched with
    PatchInstructionX86(), given that the operand to patch is not encoded
    in the trailing bytes of the instruction. Therefore, adopt an
    EAX-based version, inspired by both the IA32 and X64 variants of
    SmmRelocationSemaphoreComplete():

> 000002AE  50                push eax
> 000002AF  B800000000        mov eax,0x0
> 000002B4  C60001            mov byte [eax],0x1
> 000002B7  58                pop eax
> 000002B8  FF2500000000      jmp dword [dword 0x0]

    Here both instructions can be patched with PatchInstructionX86(), and
    the DBs can be replaced with native NASM syntax.

(3) Turn the "mRebasedFlagAddr32" and "mSmmRelocationOriginalAddressPtr32"
    variables into markers that suit PatchInstructionX86().

Cc: Eric Dong <eric.dong@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=866
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-04-04 16:44:25 +02:00
..
Ia32 UefiCpuPkg/PiSmmCpuDxeSmm: patch "gSmmInitStack" with PatchInstructionX86() 2018-04-04 16:44:23 +02:00
X64 UefiCpuPkg/PiSmmCpuDxeSmm: remove DBs from SmmRelocationSemaphoreComplete32() 2018-04-04 16:44:25 +02:00
CpuS3.c UefiCpuPkg/PiSmmCpuDxeSmm: patch "gSmmCr0" with PatchInstructionX86() 2018-04-04 16:44:18 +02: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/PiSmmCpuDxeSmm: Fix bitwise size issue 2017-10-16 09:03:41 +08:00
PiSmmCpuDxeSmm.c UefiCpuPkg/PiSmmCpuDxeSmm: patch "gSmmInitStack" with PatchInstructionX86() 2018-04-04 16:44:23 +02:00
PiSmmCpuDxeSmm.h UefiCpuPkg/PiSmmCpuDxeSmm: patch "gSmmInitStack" with PatchInstructionX86() 2018-04-04 16:44:23 +02:00
PiSmmCpuDxeSmm.inf UefiCpuPkg/PiSmmCpuDxeSmm: remove *.S and *.asm assembly files 2018-04-04 16:44:00 +02: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: Refine some comments about SmmMemoryAttribute 2018-04-04 10:49:07 +08:00
SmmProfile.c UefiCpuPkg/PiSmmCpuDxeSmm: patch "XdSupported" with PatchInstructionX86() 2018-04-04 16:44:08 +02:00
SmmProfile.h UefiCpuPkg/PiSmmCpu: Correct exception message. 2016-11-24 10:51:16 +08:00
SmmProfileInternal.h UefiCpuPkg/PiSmmCpuDxeSmm: patch "XdSupported" with PatchInstructionX86() 2018-04-04 16:44:08 +02: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