public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Bret Barkelew" <bret.barkelew@microsoft.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
	"thomas.lendacky@amd.com" <thomas.lendacky@amd.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>,
	Laszlo Ersek <lersek@redhat.com>,
	Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	Liming Gao <liming.gao@intel.com>,
	Eric Dong <eric.dong@intel.com>, Ray Ni <ray.ni@intel.com>,
	Brijesh Singh <brijesh.singh@amd.com>,
	Anthony Perard <anthony.perard@citrix.com>,
	Benjamin You <benjamin.you@intel.com>,
	Guo Dong <guo.dong@intel.com>, Julien Grall <julien@xen.org>,
	Maurice Ma <maurice.ma@intel.com>, Andrew Fish <afish@apple.com>
Subject: Re: [EXTERNAL] [edk2-devel] [PATCH 4/4] UefiCpuPkg/CpuExceptionHandler: Revert binary patching in standard CpuExceptionHandlerLib
Date: Fri, 1 May 2020 20:49:23 +0000	[thread overview]
Message-ID: <CY4PR21MB07435AA07017779208AADACDEFAB0@CY4PR21MB0743.namprd21.prod.outlook.com> (raw)
In-Reply-To: <e3b2026ac6d944f9e402b3004e15371950d9be23.1588364261.git.thomas.lendacky@amd.com>

[-- Attachment #1: Type: text/plain, Size: 4258 bytes --]

Acked-by: Bret Barkelew <bret.barkelew@microsoft.com>

- Bret

________________________________
From: devel@edk2.groups.io <devel@edk2.groups.io> on behalf of Lendacky, Thomas via groups.io <thomas.lendacky=amd.com@groups.io>
Sent: Friday, May 1, 2020 1:17:41 PM
To: devel@edk2.groups.io <devel@edk2.groups.io>
Cc: Jordan Justen <jordan.l.justen@intel.com>; Laszlo Ersek <lersek@redhat.com>; Ard Biesheuvel <ard.biesheuvel@linaro.org>; Liming Gao <liming.gao@intel.com>; Eric Dong <eric.dong@intel.com>; Ray Ni <ray.ni@intel.com>; Brijesh Singh <brijesh.singh@amd.com>; Anthony Perard <anthony.perard@citrix.com>; Benjamin You <benjamin.you@intel.com>; Guo Dong <guo.dong@intel.com>; Julien Grall <julien@xen.org>; Maurice Ma <maurice.ma@intel.com>; Andrew Fish <afish@apple.com>
Subject: [EXTERNAL] [edk2-devel] [PATCH 4/4] UefiCpuPkg/CpuExceptionHandler: Revert binary patching in standard CpuExceptionHandlerLib

BZ: https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D2340&amp;data=02%7C01%7Cbret.barkelew%40microsoft.com%7Cc233bc94949a424f66bf08d7ee0cc626%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637239610952998859&amp;sdata=rm%2FpiCDgatUHtU9PEQGWTzFT70XmkpbIukV7eiHWHeo%3D&amp;reserved=0

Now that an XCODE5 specific CpuExceptionHandlerLib library is in place,
revert the changes made to the ExceptionHandlerAsm.nasm in commit
2db0ccc2d7fe ("UefiCpuPkg: Update CpuExceptionHandlerLib pass XCODE5 tool
chain") so that binary patching of flash code is not performed.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
---
 .../X64/ExceptionHandlerAsm.nasm              | 25 +++++--------------
 1 file changed, 6 insertions(+), 19 deletions(-)

diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.nasm b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.nasm
index 19198f273137..3814f9de3703 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.nasm
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.nasm
@@ -34,7 +34,7 @@ AsmIdtVectorBegin:
     db      0x6a        ; push  #VectorNum
     db      ($ - AsmIdtVectorBegin) / ((AsmIdtVectorEnd - AsmIdtVectorBegin) / 32) ; VectorNum
     push    rax
-    mov     rax, strict qword 0 ;    mov     rax, ASM_PFX(CommonInterruptEntry)
+    mov     rax, ASM_PFX(CommonInterruptEntry)
     jmp     rax
 %endrep
 AsmIdtVectorEnd:
@@ -44,8 +44,7 @@ HookAfterStubHeaderBegin:
 @VectorNum:
     db      0          ; 0 will be fixed
     push    rax
-    mov     rax, strict qword 0 ;     mov     rax, HookAfterStubHeaderEnd
-JmpAbsoluteAddress:
+    mov     rax, HookAfterStubHeaderEnd
     jmp     rax
 HookAfterStubHeaderEnd:
     mov     rax, rsp
@@ -257,7 +256,8 @@ HasErrorCode:
     ; and make sure RSP is 16-byte aligned
     ;
     sub     rsp, 4 * 8 + 8
-    call    ASM_PFX(CommonExceptionHandler)
+    mov     rax, ASM_PFX(CommonExceptionHandler)
+    call    rax
     add     rsp, 4 * 8 + 8

     cli
@@ -365,24 +365,11 @@ DoIret:
 ; comments here for definition of address map
 global ASM_PFX(AsmGetTemplateAddressMap)
 ASM_PFX(AsmGetTemplateAddressMap):
-    lea     rax, [AsmIdtVectorBegin]
+    mov     rax, AsmIdtVectorBegin
     mov     qword [rcx], rax
     mov     qword [rcx + 0x8],  (AsmIdtVectorEnd - AsmIdtVectorBegin) / 32
-    lea     rax, [HookAfterStubHeaderBegin]
+    mov     rax, HookAfterStubHeaderBegin
     mov     qword [rcx + 0x10], rax
-
-; Fix up CommonInterruptEntry address
-    lea    rax, [ASM_PFX(CommonInterruptEntry)]
-    lea    rcx, [AsmIdtVectorBegin]
-%rep  32
-    mov    qword [rcx + (JmpAbsoluteAddress - 8 - HookAfterStubHeaderBegin)], rax
-    add    rcx, (AsmIdtVectorEnd - AsmIdtVectorBegin) / 32
-%endrep
-; Fix up HookAfterStubHeaderEnd
-    lea    rax, [HookAfterStubHeaderEnd]
-    lea    rcx, [JmpAbsoluteAddress]
-    mov    qword [rcx - 8], rax
-
     ret

 ;-------------------------------------------------------------------------------------
--
2.17.1





[-- Attachment #2: Type: text/html, Size: 8304 bytes --]

  reply	other threads:[~2020-05-01 20:49 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-01 20:17 [PATCH 0/4] XCODE5 toolchain binary patching fix Lendacky, Thomas
2020-05-01 20:17 ` [PATCH 1/4] UefiCpuPkg/CpuExceptionHandler: Make XCODE5 changes toolchain specific Lendacky, Thomas
2020-05-05 21:39   ` [edk2-devel] " Laszlo Ersek
2020-05-05 22:09     ` Lendacky, Thomas
2020-05-01 20:17 ` [PATCH 2/4] UefiPayloadPkg: Use toolchain appropriate CpuExceptionHandlerLib Lendacky, Thomas
2020-05-05 22:19   ` [edk2-devel] " Laszlo Ersek
2020-05-01 20:17 ` [PATCH 3/4] OvmfPkg: " Lendacky, Thomas
2020-05-05 21:49   ` [edk2-devel] " Laszlo Ersek
2020-05-01 20:17 ` [PATCH 4/4] UefiCpuPkg/CpuExceptionHandler: Revert binary patching in standard CpuExceptionHandlerLib Lendacky, Thomas
2020-05-01 20:49   ` Bret Barkelew [this message]
2020-05-05 22:15   ` [edk2-devel] " Laszlo Ersek
2020-05-06 14:35     ` Lendacky, Thomas
2020-05-06 14:53       ` Liming Gao
2020-05-06 16:33       ` Laszlo Ersek
2020-05-06 18:07         ` [EXTERNAL] " Bret Barkelew
2020-05-06 19:51           ` Lendacky, Thomas
     [not found] ` <160B00E54624ADAA.10991@groups.io>
2020-05-05 18:50   ` [edk2-devel] [PATCH 1/4] UefiCpuPkg/CpuExceptionHandler: Make XCODE5 changes toolchain specific Lendacky, Thomas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CY4PR21MB07435AA07017779208AADACDEFAB0@CY4PR21MB0743.namprd21.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox