On 03/16/21 04:33, Ray Ni wrote: > The change doesn't impact any functionality. > > Signed-off-by: Ray Ni <ray...@intel.com> > Cc: Eric Dong <eric.d...@intel.com> > Cc: Laszlo Ersek <ler...@redhat.com> > Cc: Rahul Kumar <rahul1.ku...@intel.com> > --- > 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.<BR> > + Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR> > 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 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#72919): https://edk2.groups.io/g/devel/message/72919 Mute This Topic: https://groups.io/mt/81368664/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-