X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=UefiCpuPkg%2FPiSmmCpuDxeSmm%2FX64%2FSmiEntry.nasm;fp=UefiCpuPkg%2FPiSmmCpuDxeSmm%2FX64%2FSmiEntry.nasm;h=414b5ab5fa9e014a5aaa9534c10c3c6588323733;hp=315d0f8670757f6cdb93e5a5d0ace0c03971cb10;hb=a364928195e911c2650fcae6bd34cfd501df1f57;hpb=60eb6c6d2e01e8d44d29740b006df1fc7e74ab21 diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.nasm b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.nasm index 315d0f8670..414b5ab5fa 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.nasm +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.nasm @@ -173,9 +173,6 @@ SmiHandlerIdtrAbsAddr: mov gs, eax mov ax, [rbx + DSC_SS] mov ss, eax - mov rax, strict qword 0 ; mov rax, _SmiHandler -_SmiHandlerAbsAddr: - jmp rax _SmiHandler: mov rbx, [rsp + 0x8] ; rcx <- CpuIndex @@ -189,13 +186,19 @@ _SmiHandler: add rsp, -0x20 mov rcx, rbx - call ASM_PFX(CpuSmmDebugEntry) + mov rax, strict qword 0 ; call ASM_PFX(CpuSmmDebugEntry) +CpuSmmDebugEntryAbsAddr: + call rax mov rcx, rbx - call ASM_PFX(SmiRendezvous) + mov rax, strict qword 0 ; call ASM_PFX(SmiRendezvous) +SmiRendezvousAbsAddr: + call rax mov rcx, rbx - call ASM_PFX(CpuSmmDebugExit) + mov rax, strict qword 0 ; call ASM_PFX(CpuSmmDebugExit) +CpuSmmDebugExitAbsAddr: + call rax add rsp, 0x20 @@ -206,7 +209,8 @@ _SmiHandler: add rsp, 0x200 - lea rax, [ASM_PFX(mXdSupported)] + mov rax, strict qword 0 ; lea rax, [ASM_PFX(mXdSupported)] +mXdSupportedAbsAddr: mov al, [rax] cmp al, 0 jz .1 @@ -224,13 +228,33 @@ _SmiHandler: ASM_PFX(gcSmiHandlerSize) DW $ - _SmiEntryPoint +; +; Retrieve the address and fill it into mov opcode. +; +; It is called in the driver entry point first. +; It is used to fix up the real address in mov opcode. +; Then, after the code logic is copied to the different location, +; the code can also run. +; global ASM_PFX(PiSmmCpuSmiEntryFixupAddress) ASM_PFX(PiSmmCpuSmiEntryFixupAddress): lea rax, [ASM_PFX(gSmiHandlerIdtr)] lea rcx, [SmiHandlerIdtrAbsAddr] mov qword [rcx - 8], rax - lea rax, [_SmiHandler] - lea rcx, [_SmiHandlerAbsAddr] + lea rax, [ASM_PFX(CpuSmmDebugEntry)] + lea rcx, [CpuSmmDebugEntryAbsAddr] + mov qword [rcx - 8], rax + + lea rax, [ASM_PFX(SmiRendezvous)] + lea rcx, [SmiRendezvousAbsAddr] + mov qword [rcx - 8], rax + + lea rax, [ASM_PFX(CpuSmmDebugExit)] + lea rcx, [CpuSmmDebugExitAbsAddr] + mov qword [rcx - 8], rax + + lea rax, [ASM_PFX(mXdSupported)] + lea rcx, [mXdSupportedAbsAddr] mov qword [rcx - 8], rax ret