From 944f7f4eeb83f5f7503acf61c28797c7bf666095 Mon Sep 17 00:00:00 2001 From: kettenis Date: Wed, 27 Dec 2017 14:13:05 +0000 Subject: [PATCH] Initialize memhook such that /dev/mem access doesn't attempt to map pages at address zero. Spotted by Artturi Alm. ok patrick@ --- sys/arch/arm64/arm64/pmap.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/sys/arch/arm64/arm64/pmap.c b/sys/arch/arm64/arm64/pmap.c index 4dd2df4a2e2..2e7b0db7976 100644 --- a/sys/arch/arm64/arm64/pmap.c +++ b/sys/arch/arm64/arm64/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.39 2017/12/23 15:04:46 kettenis Exp $ */ +/* $OpenBSD: pmap.c,v 1.40 2017/12/27 14:13:05 kettenis Exp $ */ /* * Copyright (c) 2008-2009,2014-2016 Dale Rahn * @@ -133,6 +133,10 @@ vaddr_t pmap_map_stolen(vaddr_t); void pmap_physload_avail(void); extern caddr_t msgbufaddr; +char *memhook; +vaddr_t zero_page; +vaddr_t copy_src_page; +vaddr_t copy_dst_page; /* XXX - panic on pool get failures? */ struct pool pmap_pmap_pool; @@ -1201,6 +1205,9 @@ pmap_bootstrap(long kvo, paddr_t lpt1, long kernelstart, long kernelend, printf("all mapped\n"); + memhook = (char *)vstart; + vstart += PAGE_SIZE; + return vstart; } @@ -1650,11 +1657,6 @@ pmap_update(pmap_t pm) { } -char *memhook; -vaddr_t zero_page; -vaddr_t copy_src_page; -vaddr_t copy_dst_page; - int pmap_is_referenced(struct vm_page *pg) { -- 2.20.1