aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHesham Almatary <Hesham.Almatary@cl.cam.ac.uk>2025-11-13 14:57:54 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2025-11-13 14:57:54 +0000
commit587490dabc649b58f0c7966e749aa80a0f16796b (patch)
tree1a4f6f11ddaf764138f174e1a9f3f60323e4b40c
parentb19e61f223a1982cce103b9716568391a071892a (diff)
arm64: Fix calculating kernel size for preload metadata
Cast &end to vm_offset_t before subtracting VM_MIN_KERNEL_ADDRESS to ensure the resulting size is correct for PRELOAD_PUSH_VALUE. Previously the correct size was effectively divided by sizeof(void *). Reviewed by: andrew Obtained from: CheriBSD Differential Revision: https://reviews.freebsd.org/D53699
-rw-r--r--sys/arm64/arm64/machdep_boot.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/arm64/arm64/machdep_boot.c b/sys/arm64/arm64/machdep_boot.c
index 83bd74ea7317..1c5e8189e436 100644
--- a/sys/arm64/arm64/machdep_boot.c
+++ b/sys/arm64/arm64/machdep_boot.c
@@ -106,7 +106,8 @@ fake_preload_metadata(void *dtb_ptr, size_t dtb_size)
PRELOAD_PUSH_VALUE(uint32_t, MODINFO_SIZE);
PRELOAD_PUSH_VALUE(uint32_t, sizeof(size_t));
- PRELOAD_PUSH_VALUE(uint64_t, (size_t)(&end - VM_MIN_KERNEL_ADDRESS));
+ PRELOAD_PUSH_VALUE(uint64_t,
+ (size_t)((vm_offset_t)&end - VM_MIN_KERNEL_ADDRESS));
if (dtb_ptr != NULL) {
/* Copy DTB to KVA space and insert it into module chain. */