Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/aarch64 Define PMAP_NEED_PROCWR, providing strategi...



details:   https://anonhg.NetBSD.org/src/rev/0969399e1c94
branches:  trunk
changeset: 1004466:0969399e1c94
user:      maya <maya%NetBSD.org@localhost>
date:      Tue Oct 29 20:01:22 2019 +0000

description:
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

diffstat:

 sys/arch/aarch64/aarch64/pmap.c |  20 ++++++++++++++++++--
 sys/arch/aarch64/include/pmap.h |   4 +++-
 2 files changed, 21 insertions(+), 3 deletions(-)

diffs (66 lines):

diff -r 645f105532e8 -r 0969399e1c94 sys/arch/aarch64/aarch64/pmap.c
--- a/sys/arch/aarch64/aarch64/pmap.c   Tue Oct 29 16:32:44 2019 +0000
+++ b/sys/arch/aarch64/aarch64/pmap.c   Tue Oct 29 20:01:22 2019 +0000
@@ -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@localhost>
@@ -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 @@
        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)
diff -r 645f105532e8 -r 0969399e1c94 sys/arch/aarch64/include/pmap.h
--- a/sys/arch/aarch64/include/pmap.h   Tue Oct 29 16:32:44 2019 +0000
+++ b/sys/arch/aarch64/include/pmap.h   Tue Oct 29 20:01:22 2019 +0000
@@ -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 @@
 #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);
 



Home | Main Index | Thread Index | Old Index