git: 700a2c08dcea - main - stand/efi: Use EFI_PAGE_SIZE here, it's more appropriate

From: Warner Losh <imp_at_FreeBSD.org>
Date: Fri, 30 May 2025 15:57:21 UTC
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=700a2c08dceab4dc41859e5c1501ec3b186f6cbd

commit 700a2c08dceab4dc41859e5c1501ec3b186f6cbd
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2025-05-30 14:14:15 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2025-05-30 15:56:50 +0000

    stand/efi: Use EFI_PAGE_SIZE here, it's more appropriate
    
    No functional change: We're allocating a page from EFI, which is always
    4k on amd64. So, this should always be 4k. PAGE_SIZE usually is this,
    but might not be in some cases. For the end of the stack pointer in the
    ist1, it should point the architecture's physical page past where we've
    allocated. EFI_PAGE_SIZE more faithfully reflects that here since
    PAGE_SIZE might not be exactly that in the future (if we had a larger
    logical page than physical page). Since the AllocPage interface is in
    EFI_PAGE_SIZE pages always, this seems safer. No functional change since
    they are both 2096 today.
    
    Sponsored by:           Netflix
    Reviewed by:    tsoome
    Differential Revision:  https://reviews.freebsd.org/D50584
---
 stand/efi/loader/arch/amd64/trap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/stand/efi/loader/arch/amd64/trap.c b/stand/efi/loader/arch/amd64/trap.c
index 95a42a18f719..61feb76e2dca 100644
--- a/stand/efi/loader/arch/amd64/trap.c
+++ b/stand/efi/loader/arch/amd64/trap.c
@@ -356,7 +356,7 @@ efi_redirect_exceptions(void)
 	PREPARE_EXCEPTION(19);
 	PREPARE_EXCEPTION(20);
 
-	exc_rsp = exc_stack_pa + PAGE_SIZE -
+	exc_rsp = exc_stack_pa + EFI_PAGE_SIZE -
 	    (6 /* hw exception frame */ + 3 /* scratch regs */) * 8;
 
 	/* Find free IST and use it */
@@ -376,7 +376,7 @@ efi_redirect_exceptions(void)
 		if (intercepted[i])
 			loader_idt_e->gd_ist = ist;
 	}
-	(&(tss->tss_ist1))[ist - 1] = exc_stack_pa + PAGE_SIZE;
+	(&(tss->tss_ist1))[ist - 1] = exc_stack_pa + EFI_PAGE_SIZE;
 
 	/* Switch to new IDT */
 	rfl = intr_disable();