From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.byosoft.com.cn (mail.byosoft.com.cn [58.240.74.242]) by mx.groups.io with SMTP id smtpd.web10.7007.1604019789627068523 for ; Thu, 29 Oct 2020 18:03:10 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=none, err=permanent DNS error (domain: byosoft.com.cn, ip: 58.240.74.242, mailfrom: gaoliming@byosoft.com.cn) Received: from DESKTOPS6D0PVI ([58.246.60.130]) (envelope-sender ) by 192.168.6.13 with ESMTP for ; Fri, 30 Oct 2020 09:02:56 +0800 X-WM-Sender: gaoliming@byosoft.com.cn X-WM-AuthFlag: YES X-WM-AuthUser: gaoliming@byosoft.com.cn From: "gaoliming" To: "'Tom Lendacky'" , Cc: "'Brijesh Singh'" , "'Michael D Kinney'" , "'Zhiguang Liu'" References: <11164899a8f43cfb79beb98e113141c14f0c2240.1603981082.git.thomas.lendacky@amd.com> In-Reply-To: <11164899a8f43cfb79beb98e113141c14f0c2240.1603981082.git.thomas.lendacky@amd.com> Subject: =?UTF-8?B?5Zue5aSNOiBbUEFUQ0ggdjMgMDEvMTFdIE1kZVBrZzogQ2xlYW4gdXAgR0hDQiBmaWVsZCBvZmZzZXRzIGFuZCBzYXZlIGFyZWE=?= Date: Fri, 30 Oct 2020 09:03:04 +0800 Message-ID: <004401d6ae58$6bc95500$435bff00$@byosoft.com.cn> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQJNR69V5RMBaF29mW5dsAWZ05/ANQEjepw6qLkFobA= Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: quoted-printable Content-Language: zh-cn Reviewed-by: Liming Gao > -----=D3=CA=BC=FE=D4=AD=BC=FE----- > =B7=A2=BC=FE=C8=CB: Tom Lendacky > =B7=A2=CB=CD=CA=B1=BC=E4: 2020=C4=EA10=D4=C229=C8=D5 22:18 > =CA=D5=BC=FE=C8=CB: devel@edk2.groups.io > =B3=AD=CB=CD: Brijesh Singh ; Michael D Kinney > ; Liming Gao ; > Zhiguang Liu > =D6=F7=CC=E2: [PATCH v3 01/11] MdePkg: Clean up GHCB field offsets and = save area >=20 > From: Tom Lendacky >=20 > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3008 >=20 > Use OFFSET_OF () and sizeof () to calculate the GHCB register field > offsets instead of hardcoding the values in the GHCB_REGISTER enum. > Define only fields that are used per the GHCB specification, which = will > result in removing some fields and adding others. >=20 > Also, remove the DR7 field from the GHCB_SAVE_AREA structure since it = is > not used/defined in the GHCB specification and then rename the = reserved > fields as appropriate. >=20 > Cc: Michael D Kinney > Cc: Liming Gao > Cc: Zhiguang Liu > Signed-off-by: Tom Lendacky > --- > MdePkg/Include/Register/Amd/Ghcb.h | 40 +++++++------------- > 1 file changed, 14 insertions(+), 26 deletions(-) >=20 > diff --git a/MdePkg/Include/Register/Amd/Ghcb.h > b/MdePkg/Include/Register/Amd/Ghcb.h > index 54a80da0f6d7..1fce64d5b7cd 100644 > --- a/MdePkg/Include/Register/Amd/Ghcb.h > +++ b/MdePkg/Include/Register/Amd/Ghcb.h > @@ -82,35 +82,10 @@ > #define IOIO_SEG_DS (BIT11 | BIT10) >=20 >=20 > -typedef enum { > - GhcbCpl =3D 25, > - GhcbRflags =3D 46, > - GhcbRip, > - GhcbRsp =3D 59, > - GhcbRax =3D 63, > - GhcbRcx =3D 97, > - GhcbRdx, > - GhcbRbx, > - GhcbRbp =3D 101, > - GhcbRsi, > - GhcbRdi, > - GhcbR8, > - GhcbR9, > - GhcbR10, > - GhcbR11, > - GhcbR12, > - GhcbR13, > - GhcbR14, > - GhcbR15, > - GhcbXCr0 =3D 125, > -} GHCB_REGISTER; > - > typedef PACKED struct { > UINT8 Reserved1[203]; > UINT8 Cpl; > - UINT8 Reserved2[148]; > - UINT64 Dr7; > - UINT8 Reserved3[144]; > + UINT8 Reserved8[300]; > UINT64 Rax; > UINT8 Reserved4[264]; > UINT64 Rcx; > @@ -136,6 +111,19 @@ typedef PACKED struct { > UINT32 GhcbUsage; > } GHCB; >=20 > +typedef enum { > + GhcbCpl =3D OFFSET_OF (GHCB, SaveArea.Cpl) / sizeof = (UINT64), > + GhcbRax =3D OFFSET_OF (GHCB, SaveArea.Rax) / sizeof > (UINT64), > + GhcbRbx =3D OFFSET_OF (GHCB, SaveArea.Rbx) / sizeof > (UINT64), > + GhcbRcx =3D OFFSET_OF (GHCB, SaveArea.Rcx) / sizeof > (UINT64), > + GhcbRdx =3D OFFSET_OF (GHCB, SaveArea.Rdx) / sizeof > (UINT64), > + GhcbXCr0 =3D OFFSET_OF (GHCB, SaveArea.XCr0) / sizeof > (UINT64), > + GhcbSwExitCode =3D OFFSET_OF (GHCB, SaveArea.SwExitCode) / sizeof > (UINT64), > + GhcbSwExitInfo1 =3D OFFSET_OF (GHCB, SaveArea.SwExitInfo1) / = sizeof > (UINT64), > + GhcbSwExitInfo2 =3D OFFSET_OF (GHCB, SaveArea.SwExitInfo2) / = sizeof > (UINT64), > + GhcbSwScratch =3D OFFSET_OF (GHCB, SaveArea.SwScratch) / sizeof > (UINT64), > +} GHCB_REGISTER; > + > typedef union { > struct { > UINT32 Lower32Bits; > -- > 2.28.0