Define PMAP_NEED_PROCWR, providing strategically placed i-cache

synchronization where just-changed memory is about to be executed.

Fixes SIGILLs seen when running Mono 6 on QEMU Cortex-A57.

ok ryo
This commit is contained in:
maya 2019-10-29 20:01:22 +00:00
parent b48beaffb7
commit 7e6130baeb
2 changed files with 21 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.47 2019/09/22 13:57:55 jmcneill Exp $ */
/* $NetBSD: pmap.c,v 1.48 2019/10/29 20:01:22 maya Exp $ */
/*
* Copyright (c) 2017 Ryo Shimizu <ryo@nerv.org>
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.47 2019/09/22 13:57:55 jmcneill Exp $");
__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.48 2019/10/29 20:01:22 maya Exp $");
#include "opt_arm_debug.h"
#include "opt_ddb.h"
@ -877,6 +877,22 @@ pmap_icache_sync_range(pmap_t pm, vaddr_t sva, vaddr_t eva)
pm_unlock(pm);
}
/*
* Routine: pmap_procwr
*
* Function:
* Synchronize caches corresponding to [addr, addr+len) in p.
*
*/
void
pmap_procwr(struct proc *p, vaddr_t va, int len)
{
/* We only need to do anything if it is the current process. */
if (p == curproc)
cpu_icache_sync_range(va, len);
}
static pt_entry_t
_pmap_pte_adjust_prot(pt_entry_t pte, vm_prot_t prot, vm_prot_t protmask,
bool user)

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.h,v 1.25 2019/08/12 10:28:04 skrll Exp $ */
/* $NetBSD: pmap.h,v 1.26 2019/10/29 20:01:22 maya Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@ -46,6 +46,7 @@
#include <aarch64/pte.h>
#define PMAP_NEED_PROCWR
#define PMAP_GROWKERNEL
#define PMAP_STEAL_MEMORY
@ -272,6 +273,7 @@ aarch64_mmap_flags(paddr_t mdpgno)
#define pmap_wired_count(pmap) ((pmap)->pm_stats.wired_count)
#define pmap_resident_count(pmap) ((pmap)->pm_stats.resident_count)
void pmap_procwr(struct proc *, vaddr_t, int);
bool pmap_extract_coherency(pmap_t, vaddr_t, paddr_t *, bool *);
void pmap_icache_sync_range(pmap_t, vaddr_t, vaddr_t);