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.1825.1615912257589984520 for ; Tue, 16 Mar 2021 09:30:57 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UOEDWs/J; 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=1615912256; 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=8+dHAd1RrIYMJ1TMd9M6cXtGygHJfeAoZ64jdkJkBSo=; b=UOEDWs/J5ifAT7ghnO213GKnlQ0Co16qFmHPX+EQ2Pd5HfS46dCadNFi+qK6NllwOoEj3F Zkx8iQrGkDwp2+jAmKai2ZNV3WQOdPWzUALudPEzjX91/kvSYdNWGBBTvHGvJCx2pdgMgH XEtOuZwm7yoWDi5orx/xV9gXR8nFq5o= 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-265-kGKWxe63O4S6M-J5Zm4H6Q-1; Tue, 16 Mar 2021 12:30:50 -0400 X-MC-Unique: kGKWxe63O4S6M-J5Zm4H6Q-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A9ECC800FF0; Tue, 16 Mar 2021 16:30:49 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-114-138.ams2.redhat.com [10.36.114.138]) by smtp.corp.redhat.com (Postfix) with ESMTP id AAEC219CAD; Tue, 16 Mar 2021 16:30:48 +0000 (UTC) Subject: Re: [PATCH 1/2] UefiCpuPkg/CpuDxe: Rename variables to follow EDKII coding standard To: Ray Ni , devel@edk2.groups.io Cc: Eric Dong , Rahul Kumar References: <20210316033350.2026-1-ray.ni@intel.com> <20210316033350.2026-2-ray.ni@intel.com> From: "Laszlo Ersek" Message-ID: <3cecbb33-6838-a0d8-e81d-ed81d33ec4f1@redhat.com> Date: Tue, 16 Mar 2021 17:30:47 +0100 MIME-Version: 1.0 In-Reply-To: <20210316033350.2026-2-ray.ni@intel.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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 03/16/21 04:33, Ray Ni wrote: > The change doesn't impact any functionality. > > Signed-off-by: Ray Ni > Cc: Eric Dong > Cc: Laszlo Ersek > Cc: Rahul Kumar > --- > UefiCpuPkg/CpuDxe/CpuGdt.c | 27 +++++++++++++-------------- > 1 file changed, 13 insertions(+), 14 deletions(-) > > diff --git a/UefiCpuPkg/CpuDxe/CpuGdt.c b/UefiCpuPkg/CpuDxe/CpuGdt.c > index a1ab543f2d..322ce87142 100644 > --- a/UefiCpuPkg/CpuDxe/CpuGdt.c > +++ b/UefiCpuPkg/CpuDxe/CpuGdt.c > @@ -2,7 +2,7 @@ > C based implementation of IA32 interrupt handling only > requiring a minimal assembly interrupt entry point. > > - Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
> + Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.
> SPDX-License-Identifier: BSD-2-Clause-Patent > > **/ > @@ -13,7 +13,7 @@ > // > // Global descriptor table (GDT) Template > // > -STATIC GDT_ENTRIES GdtTemplate = { > +STATIC GDT_ENTRIES gGdtTemplate = { > // > // NULL_SEL > // > @@ -124,32 +124,31 @@ InitGlobalDescriptorTable ( > VOID > ) > { > - GDT_ENTRIES *gdt; > - IA32_DESCRIPTOR gdtPtr; > + GDT_ENTRIES *Gdt; > + IA32_DESCRIPTOR Gdtr; > > // > // Allocate Runtime Data for the GDT > // > - gdt = AllocateRuntimePool (sizeof (GdtTemplate) + 8); > - ASSERT (gdt != NULL); > - gdt = ALIGN_POINTER (gdt, 8); > + Gdt = AllocateRuntimePool (sizeof (gGdtTemplate) + 8); > + ASSERT (Gdt != NULL); > + Gdt = ALIGN_POINTER (Gdt, 8); > > // > // Initialize all GDT entries > // > - CopyMem (gdt, &GdtTemplate, sizeof (GdtTemplate)); > + CopyMem (Gdt, &gGdtTemplate, sizeof (gGdtTemplate)); > > // > // Write GDT register > // > - gdtPtr.Base = (UINT32)(UINTN)(VOID*) gdt; > - gdtPtr.Limit = (UINT16) (sizeof (GdtTemplate) - 1); > - AsmWriteGdtr (&gdtPtr); > + Gdtr.Base = (UINT32) (UINTN) Gdt; > + Gdtr.Limit = (UINT16) (sizeof (gGdtTemplate) - 1); > + AsmWriteGdtr (&Gdtr); > > // > // Update selector (segment) registers base on new GDT > // > - SetCodeSelector ((UINT16)CPU_CODE_SEL); > - SetDataSelectors ((UINT16)CPU_DATA_SEL); > + SetCodeSelector ((UINT16) CPU_CODE_SEL); > + SetDataSelectors ((UINT16) CPU_DATA_SEL); > } > - > (1) I think "mGdtTemplate" would be a better name than "gGdtTemplate". I think the "g" prefix is used when an object is identical for all firmware modules (such as named GUIDs, for example). (2) I think the last hunk does not belong in this patch -- more precisely, I *disagree* with the last hunk. Inserting a space in the middle of a typecast, after the parenthesized typename, is a bad practice in edk2; it is error prone and suggests that typecasts have low binding power (when in reality they have almost the strongest binding). Thanks Laszlo