Module Name:    src
Committed By:   jmcneill
Date:           Sun Dec  1 20:27:26 UTC 2019

Modified Files:
        src/sys/arch/aarch64/aarch64: kobj_machdep.c

Log Message:
Flush insn / data caches after loading modules


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/aarch64/aarch64/kobj_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/aarch64/aarch64/kobj_machdep.c
diff -u src/sys/arch/aarch64/aarch64/kobj_machdep.c:1.2 src/sys/arch/aarch64/aarch64/kobj_machdep.c:1.3
--- src/sys/arch/aarch64/aarch64/kobj_machdep.c:1.2	Sun Aug 19 20:02:22 2018
+++ src/sys/arch/aarch64/aarch64/kobj_machdep.c	Sun Dec  1 20:27:26 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kobj_machdep.c,v 1.2 2018/08/19 20:02:22 ryo Exp $	*/
+/*	$NetBSD: kobj_machdep.c,v 1.3 2019/12/01 20:27:26 jmcneill Exp $	*/
 
 /*
  * Copyright (c) 2018 Ryo Shimizu <r...@nerv.org>
@@ -27,19 +27,21 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kobj_machdep.c,v 1.2 2018/08/19 20:02:22 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kobj_machdep.c,v 1.3 2019/12/01 20:27:26 jmcneill Exp $");
 
 #define ELFSIZE		ARCH_ELFSIZE
 
 #include "opt_ddb.h"
 
 #include <sys/param.h>
+#include <sys/kernel.h>
 #include <sys/kobj.h>
 #include <sys/exec.h>
 #include <sys/exec_elf.h>
 #include <sys/errno.h>
 #include <sys/queue.h>
 #include <sys/tree.h>
+#include <sys/xcall.h>
 
 #include <aarch64/cpufunc.h>
 
@@ -357,8 +359,26 @@ kobj_reloc(kobj_t ko, uintptr_t relocbas
 	return 0;
 }
 
+static void
+kobj_idcache_wbinv_all(void)
+{
+	cpu_idcache_wbinv_all();
+}
+
 int
 kobj_machdep(kobj_t ko, void *base, size_t size, bool load)
 {
+	uint64_t where;
+
+	if (load) {
+		if (cold) {
+			kobj_idcache_wbinv_all();
+		} else {
+			where = xc_broadcast(0,
+			    (xcfunc_t)kobj_idcache_wbinv_all, NULL, NULL);
+			xc_wait(where);
+		}
+	}
+
 	return 0;
 }

Reply via email to