aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Turner <andrew@FreeBSD.org>2023-11-13 16:34:56 +0000
committerAndrew Turner <andrew@FreeBSD.org>2023-11-15 18:05:08 +0000
commit5fae53589eacbf65855419922c881b3a25a68e03 (patch)
tree0873b631cbcfc272c36bf324702110df90725d33
parent7eb26be9c8080686f64fdc0a28e5ae7839bbc82d (diff)
downloadsrc-5fae53589eacbf65855419922c881b3a25a68e03.tar.gz
src-5fae53589eacbf65855419922c881b3a25a68e03.zip
arm64: Use pmap_early_vtophys in pmap_bootstrap_san
Use pmap_early_vtophys to find the physical address of the kernel base rather than using the calculated offset as it will be removed in a latter commit. Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D42566
-rw-r--r--sys/arm64/arm64/machdep.c2
-rw-r--r--sys/arm64/arm64/pmap.c5
-rw-r--r--sys/arm64/include/pmap.h2
3 files changed, 6 insertions, 3 deletions
diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c
index bb7689c19101..7aa20357acf4 100644
--- a/sys/arm64/arm64/machdep.c
+++ b/sys/arm64/arm64/machdep.c
@@ -973,7 +973,7 @@ initarm(struct arm64_bootparams *abp)
* segments also get excluded from phys_avail.
*/
#if defined(KASAN)
- pmap_bootstrap_san(KERNBASE - abp->kern_delta);
+ pmap_bootstrap_san();
#endif
physmem_init_kernel_globals();
diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c
index 8c2c6f9d7b81..3dc74626f01b 100644
--- a/sys/arm64/arm64/pmap.c
+++ b/sys/arm64/arm64/pmap.c
@@ -1365,11 +1365,14 @@ pmap_bootstrap(vm_paddr_t kernstart, vm_size_t kernlen)
* - Map that entire range using L2 superpages.
*/
void
-pmap_bootstrap_san(vm_paddr_t kernstart)
+pmap_bootstrap_san(void)
{
vm_offset_t va;
+ vm_paddr_t kernstart;
int i, shadow_npages, nkasan_l2;
+ kernstart = pmap_early_vtophys(KERNBASE);
+
/*
* Rebuild physmap one more time, we may have excluded more regions from
* allocation since pmap_bootstrap().
diff --git a/sys/arm64/include/pmap.h b/sys/arm64/include/pmap.h
index 1789588210c3..ad9aa409815a 100644
--- a/sys/arm64/include/pmap.h
+++ b/sys/arm64/include/pmap.h
@@ -192,7 +192,7 @@ pmap_vmspace_copy(pmap_t dst_pmap __unused, pmap_t src_pmap __unused)
#if defined(KASAN) || defined(KMSAN)
struct arm64_bootparams;
-void pmap_bootstrap_san(vm_paddr_t);
+void pmap_bootstrap_san(void);
void pmap_san_enter(vm_offset_t);
void pmap_san_bootstrap(struct arm64_bootparams *);
#endif