From c720b5d2e4279c73cfd01f3e745788acb0fee9ae Mon Sep 17 00:00:00 2001 From: Mark Kettenis Date: Thu, 22 Oct 2020 15:54:11 +0000 Subject: 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@ --- sys/arch/powerpc64/powerpc64/pmap.c | 6 ++++-- 1 file 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); } -- cgit v1.2.3