From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=17.171.2.60; helo=ma1-aaemail-dr-lapp01.apple.com; envelope-from=afish@apple.com; receiver=edk2-devel@lists.01.org Received: from ma1-aaemail-dr-lapp01.apple.com (ma1-aaemail-dr-lapp01.apple.com [17.171.2.60]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id BED32211CD9B5 for ; Thu, 7 Mar 2019 14:38:05 -0800 (PST) Received: from pps.filterd (ma1-aaemail-dr-lapp01.apple.com [127.0.0.1]) by ma1-aaemail-dr-lapp01.apple.com (8.16.0.27/8.16.0.27) with SMTP id x27Mb5xn027700 for ; Thu, 7 Mar 2019 14:38:04 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=apple.com; h=mime-version : content-type : sender : from : subject : message-id : date : to; s=20180706; bh=kfLOG6V9axJt+VGZoHTCTxWthdvDhfgxdfJ/IqB5Iow=; b=UzPk9R9HLH/UMos/5LNMYKiGmMXRmQR7xULfbX88sldwPO6AIJehVBRruW7Hw2x5v8l+ JwkUpYhOHksTTHncw0vvgzMeiu4qOrCU0c11ZDFP97skOIP6gsn+6uPy5gOoFAxblMOK KVufeAl+t8V8ZWfd7xdAZytITUWysfRsZXNU6dHzgVrWkHj9NKOC26gZGSqCPWblZ9lg TuZ2b8wAcao0P5Mb6C7d01i6Gzv2tsD2j1thK+Z3LuEpWfwLrqK8t7HcY7IKZIrNT2QO w2lBqe4bvhKwP2m76cvqZ8ucof2lQNMWbtCV1Wl/Ifbmr+v0GSnSLI9CZhcK7IUG/7qA Ng== Received: from ma1-mtap-s02.corp.apple.com (ma1-mtap-s02.corp.apple.com [17.40.76.6]) by ma1-aaemail-dr-lapp01.apple.com with ESMTP id 2qyscd3k9v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO) for ; Thu, 07 Mar 2019 14:38:04 -0800 MIME-version: 1.0 Received: from ma1-mmpp-sz09.apple.com (ma1-mmpp-sz09.apple.com [17.171.128.183]) by ma1-mtap-s02.corp.apple.com (Oracle Communications Messaging Server 8.0.2.3.20181024 64bit (built Oct 24 2018)) with ESMTPS id <0PO000H5KPJEAF20@ma1-mtap-s02.corp.apple.com> for edk2-devel@lists.01.org; Thu, 07 Mar 2019 14:38:02 -0800 (PST) Received: from process_milters-daemon.ma1-mmpp-sz09.apple.com by ma1-mmpp-sz09.apple.com (Oracle Communications Messaging Server 8.0.2.3.20181024 64bit (built Oct 24 2018)) id <0PO000100OTO4700@ma1-mmpp-sz09.apple.com> for edk2-devel@lists.01.org; Thu, 07 Mar 2019 14:38:02 -0800 (PST) X-Va-A: X-Va-T-CD: 3b266a2f6a8b2663ff6662a8ca2180b2 X-Va-E-CD: 5a7273e0a347291708c1ed8c821711c5 X-Va-R-CD: 92cecc56118bfb5a398a107f5931c130 X-Va-CD: 0 X-Va-ID: 355a6bea-f55f-4592-bba6-db669dd32cdc X-V-A: X-V-T-CD: 3b266a2f6a8b2663ff6662a8ca2180b2 X-V-E-CD: 5a7273e0a347291708c1ed8c821711c5 X-V-R-CD: 92cecc56118bfb5a398a107f5931c130 X-V-CD: 0 X-V-ID: ebd51366-bdab-42bf-b09c-3ebbf5b858e4 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-03-07_13:,, signatures=0 Received: from [17.234.199.80] (unknown [17.234.199.80]) by ma1-mmpp-sz09.apple.com (Oracle Communications Messaging Server 8.0.2.3.20181024 64bit (built Oct 24 2018)) with ESMTPSA id <0PO000ET0PJCE600@ma1-mmpp-sz09.apple.com> for edk2-devel@lists.01.org; Thu, 07 Mar 2019 14:38:02 -0800 (PST) Sender: afish@apple.com From: Andrew Fish Message-id: <96DCE1C9-B02B-4520-A483-F72BBAAAB3B8@apple.com> Date: Thu, 07 Mar 2019 14:37:57 -0800 To: edk2-devel X-Mailer: Apple Mail (2.3445.6.18) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-03-07_13:, , signatures=0 X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: UefiCpuPkg CpuDxe GDT init question? X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2019 22:38:06 -0000 Content-Type: text/plain; CHARSET=US-ASCII Content-Transfer-Encoding: 7BIT I'm trying to understand why gdtPtr.Base is casting to (UINT32)? 1) gdtPtr.Base is a a UINTN 2) It is legal for AllocateRuntimePool() to return an address > 4GB It seems like the code should just cast to (UINTN)? https://github.com/tianocore/edk2/blob/master/UefiCpuPkg/CpuDxe/CpuGdt.c#L151 VOID InitGlobalDescriptorTable ( VOID ) { GDT_ENTRIES *gdt; IA32_DESCRIPTOR gdtPtr; // // Allocate Runtime Data for the GDT // gdt = AllocateRuntimePool (sizeof (GdtTemplate) + 8); ASSERT (gdt != NULL); gdt = ALIGN_POINTER (gdt, 8); // // Initialize all GDT entries // CopyMem (gdt, &GdtTemplate, sizeof (GdtTemplate)); // // Write GDT register // gdtPtr.Base = (UINT32)(UINTN)(VOID*) gdt; gdtPtr.Limit = (UINT16) (sizeof (GdtTemplate) - 1); AsmWriteGdtr (&gdtPtr); Thanks, Andrew Fish