From 6130a34587a3ba4c6bb20fe0d9c685972cd8c6f4 Mon Sep 17 00:00:00 2001 From: Aiken Harris Date: Mon, 28 Jul 2025 17:57:16 +0200 Subject: [PATCH] Align stack as required by the ABI --- xtoskrnl/ke/krnlinit.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xtoskrnl/ke/krnlinit.c b/xtoskrnl/ke/krnlinit.c index c2c0c4b..1138589 100644 --- a/xtoskrnl/ke/krnlinit.c +++ b/xtoskrnl/ke/krnlinit.c @@ -60,6 +60,6 @@ KeStartXtSystem(IN PKERNEL_INITIALIZATION_BLOCK Parameters) /* Raise to HIGH runlevel */ KeRaiseRunLevel(HIGH_LEVEL); - /* Switch the boot stack, setting the pointer to the top of the buffer and aligning it to a 4-byte boundary */ - KepSwitchBootStack(((ULONG_PTR)&ArKernelBootStack + KERNEL_STACK_SIZE) & ~0x3); + /* Switch the boot stack, setting the pointer to the top of the buffer and aligning it as required by the ABI */ + KepSwitchBootStack(((ULONG_PTR)&ArKernelBootStack + KERNEL_STACK_SIZE) & ~(STACK_ALIGNMENT - 1)); }