Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-9]: src/sys/arch/aarch64/aarch64 Pull up following revision(s) (r...
details: https://anonhg.NetBSD.org/src/rev/78e59c9ed704
branches: netbsd-9
changeset: 1002118:78e59c9ed704
user: martin <martin%NetBSD.org@localhost>
date: Fri Jan 01 12:54:07 2021 +0000
description:
Pull up following revision(s) (requested by rin in ticket #1171):
sys/arch/aarch64/aarch64/pmap.c: revision 1.82
sys/arch/aarch64/aarch64/pmap.c: revision 1.83
pmap_procwr(): sync icache even if p != curproc. This fixes applications
like GDB for arm32, that rewrite text of other process.
Thanks to ryo@ for discussion.
Use tlen for temporary length variable instead of l, which is usually
used for struct lwp *.
No binary changes.
diffstat:
sys/arch/aarch64/aarch64/pmap.c | 26 ++++++++++++++++++++------
1 files changed, 20 insertions(+), 6 deletions(-)
diffs (49 lines):
diff -r 40ed11029b5a -r 78e59c9ed704 sys/arch/aarch64/aarch64/pmap.c
--- a/sys/arch/aarch64/aarch64/pmap.c Fri Jan 01 12:38:49 2021 +0000
+++ b/sys/arch/aarch64/aarch64/pmap.c Fri Jan 01 12:54:07 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.41.2.7 2021/01/01 12:38:49 martin Exp $ */
+/* $NetBSD: pmap.c,v 1.41.2.8 2021/01/01 12:54:07 martin 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.41.2.7 2021/01/01 12:38:49 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.41.2.8 2021/01/01 12:54:07 martin Exp $");
#include "opt_arm_debug.h"
#include "opt_ddb.h"
@@ -879,12 +879,26 @@
*
*/
void
-pmap_procwr(struct proc *p, vaddr_t va, int len)
+pmap_procwr(struct proc *p, vaddr_t sva, int len)
{
- /* We only need to do anything if it is the current process. */
- if (p == curproc)
- cpu_icache_sync_range(va, len);
+ if (__predict_true(p == curproc))
+ cpu_icache_sync_range(sva, len);
+ else {
+ struct pmap *pm = p->p_vmspace->vm_map.pmap;
+ paddr_t pa;
+ vaddr_t va, eva;
+ int tlen;
+
+ for (va = sva; len > 0; va = eva, len -= tlen) {
+ eva = uimin(va + len, trunc_page(va + PAGE_SIZE));
+ tlen = eva - va;
+ if (!pmap_extract(pm, va, &pa))
+ continue;
+ va = AARCH64_PA_TO_KVA(pa);
+ cpu_icache_sync_range(va, tlen);
+ }
+ }
}
static pt_entry_t
Home |
Main Index |
Thread Index |
Old Index