From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 92FF17803CE for ; Tue, 30 Jan 2024 12:32:24 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=qYvQz4QFTQgTaKdsf6A3vSbdRZBOxF3H+vTgNO2m3/k=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding:Content-Type; s=20140610; t=1706617943; v=1; b=bM9KIeB2lqYoF2tZtE+EtYfz1WvJhXrvWJZbNkJqYJg9GdERMVugqcWQ1PaTVyv+o+vcnJIp WqQtc05EkeZjlLNBY8EXyCqWfVXA4BGZD6w4x5NQWOy/W/7WHL53BE4+L5EWT50MlgD47pXaC2l WIwsKlMsiCYREtELzcExM7Pc= X-Received: by 127.0.0.2 with SMTP id 7U8tYY7687511xH5YBhaFErI; Tue, 30 Jan 2024 04:32:23 -0800 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.groups.io with SMTP id smtpd.web10.17190.1706617937564586638 for ; Tue, 30 Jan 2024 04:32:17 -0800 X-Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-479-hUPofF0JPgqfVJG495xmrA-1; Tue, 30 Jan 2024 07:32:10 -0500 X-MC-Unique: hUPofF0JPgqfVJG495xmrA-1 X-Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2B33F8630C6; Tue, 30 Jan 2024 12:32:10 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.192.180]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EC69E492BC6; Tue, 30 Jan 2024 12:32:09 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 906801800D67; Tue, 30 Jan 2024 13:32:04 +0100 (CET) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Erdem Aktas , Oliver Steffen , Jiewen Yao , Ard Biesheuvel , Min Xu , Tom Lendacky , Gerd Hoffmann , Michael Roth , Liming Gao , Laszlo Ersek Subject: [edk2-devel] [PATCH v2 3/5] OvmfPkg/ResetVector: improve page table flag names Date: Tue, 30 Jan 2024 13:32:02 +0100 Message-ID: <20240130123204.764453-4-kraxel@redhat.com> In-Reply-To: <20240130123204.764453-1-kraxel@redhat.com> References: <20240130123204.764453-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,kraxel@redhat.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: FPUl0iLw4eo4YobMhMnOqHrnx7686176AA= Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=bM9KIeB2; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=redhat.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io Add comments, rename some of the PAGE_* flags and combined attributes. Specifically use "LARGEPAGE" instead of "2M" because that bit is used for both 2M and 1G large pages. Signed-off-by: Gerd Hoffmann --- OvmfPkg/ResetVector/Ia32/PageTables64.asm | 39 +++++++++++++---------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/OvmfPkg/ResetVector/Ia32/PageTables64.asm b/OvmfPkg/ResetVector/Ia32/PageTables64.asm index 317cad430f29..6fec6f2beeea 100644 --- a/OvmfPkg/ResetVector/Ia32/PageTables64.asm +++ b/OvmfPkg/ResetVector/Ia32/PageTables64.asm @@ -10,6 +10,7 @@ BITS 32 +; common for all levels %define PAGE_PRESENT 0x01 %define PAGE_READ_WRITE 0x02 %define PAGE_USER_SUPERVISOR 0x04 @@ -17,25 +18,29 @@ BITS 32 %define PAGE_CACHE_DISABLE 0x010 %define PAGE_ACCESSED 0x020 %define PAGE_DIRTY 0x040 -%define PAGE_PAT 0x080 %define PAGE_GLOBAL 0x0100 -%define PAGE_2M_MBO 0x080 -%define PAGE_2M_PAT 0x01000 + +; page table entries (level 1) +%define PAGE_PTE_PAT 0x080 + +; page directory entries (level 2+) +%define PAGE_PDE_LARGEPAGE 0x080 +%define PAGE_PDE_PAT 0x01000 %define PAGE_4K_PDE_ATTR (PAGE_ACCESSED + \ PAGE_DIRTY + \ PAGE_READ_WRITE + \ PAGE_PRESENT) -%define PAGE_2M_PDE_ATTR (PAGE_2M_MBO + \ - PAGE_ACCESSED + \ - PAGE_DIRTY + \ - PAGE_READ_WRITE + \ - PAGE_PRESENT) +%define PAGE_PDE_LARGEPAGE_ATTR (PAGE_PDE_LARGEPAGE + \ + PAGE_ACCESSED + \ + PAGE_DIRTY + \ + PAGE_READ_WRITE + \ + PAGE_PRESENT) -%define PAGE_PDP_ATTR (PAGE_ACCESSED + \ - PAGE_READ_WRITE + \ - PAGE_PRESENT) +%define PAGE_PDE_DIRECTORY_ATTR (PAGE_ACCESSED + \ + PAGE_READ_WRITE + \ + PAGE_PRESENT) %define TDX_BSP 1 %define TDX_AP 2 @@ -84,19 +89,19 @@ clearPageTablesMemoryLoop: ; ; Top level Page Directory Pointers (1 * 512GB entry) ; - mov dword[PT_ADDR (0)], PT_ADDR (0x1000) + PAGE_PDP_ATTR + mov dword[PT_ADDR (0)], PT_ADDR (0x1000) + PAGE_PDE_DIRECTORY_ATTR mov dword[PT_ADDR (4)], edx ; ; Next level Page Directory Pointers (4 * 1GB entries => 4GB) ; - mov dword[PT_ADDR (0x1000)], PT_ADDR (0x2000) + PAGE_PDP_ATTR + mov dword[PT_ADDR (0x1000)], PT_ADDR (0x2000) + PAGE_PDE_DIRECTORY_ATTR mov dword[PT_ADDR (0x1004)], edx - mov dword[PT_ADDR (0x1008)], PT_ADDR (0x3000) + PAGE_PDP_ATTR + mov dword[PT_ADDR (0x1008)], PT_ADDR (0x3000) + PAGE_PDE_DIRECTORY_ATTR mov dword[PT_ADDR (0x100C)], edx - mov dword[PT_ADDR (0x1010)], PT_ADDR (0x4000) + PAGE_PDP_ATTR + mov dword[PT_ADDR (0x1010)], PT_ADDR (0x4000) + PAGE_PDE_DIRECTORY_ATTR mov dword[PT_ADDR (0x1014)], edx - mov dword[PT_ADDR (0x1018)], PT_ADDR (0x5000) + PAGE_PDP_ATTR + mov dword[PT_ADDR (0x1018)], PT_ADDR (0x5000) + PAGE_PDE_DIRECTORY_ATTR mov dword[PT_ADDR (0x101C)], edx ; @@ -107,7 +112,7 @@ pageTableEntriesLoop: mov eax, ecx dec eax shl eax, 21 - add eax, PAGE_2M_PDE_ATTR + add eax, PAGE_PDE_LARGEPAGE_ATTR mov [ecx * 8 + PT_ADDR (0x2000 - 8)], eax mov [(ecx * 8 + PT_ADDR (0x2000 - 8)) + 4], edx loop pageTableEntriesLoop -- 2.43.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#114778): https://edk2.groups.io/g/devel/message/114778 Mute This Topic: https://groups.io/mt/104052210/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-