summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2020-10-22 15:54:11 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2020-10-22 15:54:11 +0000
commitc720b5d2e4279c73cfd01f3e745788acb0fee9ae (patch)
treed31f2da4668d4de70976e5e17ab48665f1ff8aab
parent7ef2eb8c932d0ca12083143b729c293afae8746d (diff)
Use the DBZ instruction to zero memory a cache line at a time.
This is what we already do on powerpc and seems to be what everybody does for 64-bit POWER systems. ok deraadt@, patrick@
-rw-r--r--sys/arch/powerpc64/powerpc64/pmap.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/arch/powerpc64/powerpc64/pmap.c b/sys/arch/powerpc64/powerpc64/pmap.c
index 4c54bb5dd89..ab479cdfcd1 100644
--- a/sys/arch/powerpc64/powerpc64/pmap.c
+++ b/sys/arch/powerpc64/powerpc64/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.51 2020/10/18 14:51:09 kettenis Exp $ */
+/* $OpenBSD: pmap.c,v 1.52 2020/10/22 15:54:10 kettenis Exp $ */
/*
* Copyright (c) 2015 Martin Pieuchot
@@ -1432,9 +1432,11 @@ pmap_zero_page(struct vm_page *pg)
{
paddr_t pa = VM_PAGE_TO_PHYS(pg);
paddr_t va = zero_page + cpu_number() * PAGE_SIZE;
+ int offset;
pmap_kenter_pa(va, pa, PROT_READ | PROT_WRITE);
- memset((void *)va, 0, PAGE_SIZE);
+ for (offset = 0; offset < PAGE_SIZE; offset += cacheline_size)
+ __asm volatile ("dcbz 0, %0" :: "r"(va + offset));
pmap_kremove(va, PAGE_SIZE);
}