From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.groups.io with SMTP id smtpd.web11.8238.1606990904967721891 for ; Thu, 03 Dec 2020 02:21:45 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Ggkp5LX5; spf=pass (domain: redhat.com, ip: 216.205.24.124, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606990904; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DB/0/z/SOASe6Mgh0mw+l7awBsvEOSWQczh2owLeLTs=; b=Ggkp5LX5Ssoqe2D/OwUpqh8xTNtVFtu1EDHlUjXYK1CXIumuF31aKERh7zCrr6S/e2c6R5 XkfYxi1DTNEo6nU85wLlGyBw2xb6mg7RpJjfGNh2SLsdcsn5KAu3f91PkMXPO82R+goqxI pyejbcQdrNcqSxhAYTQVhFBB4nJyjsI= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-521-5dJTeDpxM-Kdc3VvEnHD1w-1; Thu, 03 Dec 2020 05:21:40 -0500 X-MC-Unique: 5dJTeDpxM-Kdc3VvEnHD1w-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BD6B71936B61; Thu, 3 Dec 2020 10:21:38 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-113-182.ams2.redhat.com [10.36.113.182]) by smtp.corp.redhat.com (Postfix) with ESMTP id 837B910013C0; Thu, 3 Dec 2020 10:21:37 +0000 (UTC) Subject: Re: [edk2-devel] [PATCH] UefiCpuPkg/CpuDxe: Fix boot error To: devel@edk2.groups.io, guo.dong@intel.com Cc: eric.dong@intel.com, ray.ni@intel.com, rahul1.kumar@intel.com References: <20201202213833.23316-1-guo.dong@intel.com> From: "Laszlo Ersek" Message-ID: <8196c235-b0dd-e774-3775-1ee5323aaf75@redhat.com> Date: Thu, 3 Dec 2020 11:21:36 +0100 MIME-Version: 1.0 In-Reply-To: <20201202213833.23316-1-guo.dong@intel.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=lersek@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 12/02/20 22:38, Guo Dong wrote: > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3084 > > When DXE drivers are dispatched above 4GB memory and > the system is already in 64bit mode, the address > setCodeSelectorLongJump in stack will be override > by parameter. so change to use 64bit address and > jump to qword address. > > Signed-off-by: Guo Dong > --- > UefiCpuPkg/CpuDxe/X64/CpuAsm.nasm | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/UefiCpuPkg/CpuDxe/X64/CpuAsm.nasm b/UefiCpuPkg/CpuDxe/X64/CpuAsm.nasm > index c3489bcc3e..6ad32b49f4 100644 > --- a/UefiCpuPkg/CpuDxe/X64/CpuAsm.nasm > +++ b/UefiCpuPkg/CpuDxe/X64/CpuAsm.nasm > @@ -23,8 +23,8 @@ ASM_PFX(SetCodeSelector): > sub rsp, 0x10 > lea rax, [setCodeSelectorLongJump] > mov [rsp], rax I'll let Ray and Eric review this patch, just one question for my understanding: for clarity, shouldn't the above MOV have referred to "eax" in the first place? Because (before this patch) it seems to store 8 bytes (from rax), and then to overwrite the high-address DWORD of those 8 bytes, with the next operation (which stores 2 bytes from CX). IMO, for clarity's sake, the original code should have used EAX. Why write 8 bytes when only the low-address 4 bytes matter anyway? Anyhow, this is no longer relevant, because of the present patch; I just wanted to ask about it so I understand better. Thanks Laszlo > - mov [rsp+4], cx > - jmp dword far [rsp] > + mov [rsp+8], cx > + jmp qword far [rsp] > setCodeSelectorLongJump: > add rsp, 0x10 > ret >