diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2004-05-20 09:20:43 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2004-05-20 09:20:43 +0000 |
commit | fa548ed2239322fed4b99e17ca368c836285328c (patch) | |
tree | 55aab0ddc31aa2e7f0a93ce13b8a59cf28fccc84 | |
parent | bb1fe1b9b98659e5bb936357bf26eda5391543bf (diff) |
Properly flush instruction cache for ptrace(PT_WRTIE_{DI}, ...) on powerpc
and m68k.
ok drahn@, millert@
24 files changed, 106 insertions, 39 deletions
diff --git a/sys/arch/alpha/include/pmap.h b/sys/arch/alpha/include/pmap.h index b3f5b405772..ca60221e62a 100644 --- a/sys/arch/alpha/include/pmap.h +++ b/sys/arch/alpha/include/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.15 2003/10/18 20:14:42 jmc Exp $ */ +/* $OpenBSD: pmap.h,v 1.16 2004/05/20 09:20:41 kettenis Exp $ */ /* $NetBSD: pmap.h,v 1.37 2000/11/19 03:16:35 thorpej Exp $ */ /*- @@ -191,6 +191,8 @@ void pmap_tlb_shootdown_q_drain(u_long, boolean_t); #define pmap_wired_count(pmap) ((pmap)->pm_stats.wired_count) #define pmap_update(pmap) /* nothing (yet) */ +#define pmap_proc_iflush(p, va, len) /* nothing */ + extern pt_entry_t *VPT; /* Virtual Page Table */ #define PMAP_STEAL_MEMORY /* enable pmap_steal_memory() */ diff --git a/sys/arch/amd64/include/pmap.h b/sys/arch/amd64/include/pmap.h index bc21c685339..7092a4b8b70 100644 --- a/sys/arch/amd64/include/pmap.h +++ b/sys/arch/amd64/include/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.2 2004/02/23 08:32:36 mickey Exp $ */ +/* $OpenBSD: pmap.h,v 1.3 2004/05/20 09:20:41 kettenis Exp $ */ /* $NetBSD: pmap.h,v 1.1 2003/04/26 18:39:46 fvdl Exp $ */ /* @@ -420,6 +420,8 @@ extern pd_entry_t *pdes[]; #define pmap_phys_address(ppn) ptob(ppn) #define pmap_valid_entry(E) ((E) & PG_V) /* is PDE or PTE valid? */ +#define pmap_proc_iflush(p,va,len) /* nothing */ + /* * prototypes diff --git a/sys/arch/arm/include/pmap.h b/sys/arch/arm/include/pmap.h index 0261d72c332..2207858562b 100644 --- a/sys/arch/arm/include/pmap.h +++ b/sys/arch/arm/include/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.1 2004/02/01 05:09:49 drahn Exp $ */ +/* $OpenBSD: pmap.h,v 1.2 2004/05/20 09:20:41 kettenis Exp $ */ /* $NetBSD: pmap.h,v 1.76 2003/09/06 09:10:46 rearnsha Exp $ */ /* @@ -246,6 +246,8 @@ extern int pmap_debug_level; /* Only exists if PMAP_DEBUG */ #define pmap_phys_address(ppn) (arm_ptob((ppn))) +#define pmap_proc_iflush(p, va, len) /* nothing */ + /* * Functions that we need to export */ diff --git a/sys/arch/hp300/hp300/locore.s b/sys/arch/hp300/hp300/locore.s index e24ec1f81bc..6a937a1049f 100644 --- a/sys/arch/hp300/hp300/locore.s +++ b/sys/arch/hp300/hp300/locore.s @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.s,v 1.38 2004/03/09 00:08:13 xsa Exp $ */ +/* $OpenBSD: locore.s,v 1.39 2004/05/20 09:20:41 kettenis Exp $ */ /* $NetBSD: locore.s,v 1.91 1998/11/11 06:41:25 thorpej Exp $ */ /* @@ -879,8 +879,9 @@ ENTRY_NOPROFILE(trap12) movl d1,sp@- | push length movl a1,sp@- | push addr movl d0,sp@- | push command + movl _C_LABEL(curproc),sp@- | push proc pointer jbsr _C_LABEL(cachectl) | do it - lea sp@(12),sp | pop args + lea sp@(16),sp | pop args jra _ASM_LABEL(rei) | all done /* diff --git a/sys/arch/hp300/hp300/sys_machdep.c b/sys/arch/hp300/hp300/sys_machdep.c index e1384e3fb0d..37820ce9368 100644 --- a/sys/arch/hp300/hp300/sys_machdep.c +++ b/sys/arch/hp300/hp300/sys_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sys_machdep.c,v 1.12 2003/06/02 23:27:45 millert Exp $ */ +/* $OpenBSD: sys_machdep.c,v 1.13 2004/05/20 09:20:41 kettenis Exp $ */ /* $NetBSD: sys_machdep.c,v 1.17 1997/05/19 10:15:00 veego Exp $ */ /* @@ -70,7 +70,8 @@ */ /*ARGSUSED1*/ int -cachectl(req, addr, len) +cachectl(p, req, addr, len) + struct proc *p; int req; vaddr_t addr; int len; @@ -86,7 +87,7 @@ cachectl(req, addr, len) #ifdef COMPAT_HPUX extern struct emul emul_hpux; - if ((curproc->p_emul == &emul_hpux) && + if ((p->p_emul == &emul_hpux) && len != 16 && len != NBPG) doall = 1; #endif @@ -114,7 +115,7 @@ cachectl(req, addr, len) if (!doall && (pa == 0 || ((int)addr & PGOFSET) == 0)) { if (pmap_extract( - curproc->p_vmspace->vm_map.pmap, + p->p_vmspace->vm_map.pmap, addr, &pa) == FALSE) doall = 1; } diff --git a/sys/arch/hp300/include/cpu.h b/sys/arch/hp300/include/cpu.h index 4abb9721d78..b304d633999 100644 --- a/sys/arch/hp300/include/cpu.h +++ b/sys/arch/hp300/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.22 2003/06/02 23:27:45 millert Exp $ */ +/* $OpenBSD: cpu.h,v 1.23 2004/05/20 09:20:41 kettenis Exp $ */ /* $NetBSD: cpu.h,v 1.28 1998/02/13 07:41:51 scottr Exp $ */ /* @@ -180,7 +180,7 @@ int badbaddr(caddr_t); void dumpconf(void); /* sys_machdep.c functions */ -int cachectl(int, vaddr_t, int); +int cachectl(struct proc *, int, vaddr_t, int); /* vm_machdep.c functions */ void physaccess(caddr_t, caddr_t, int, int); diff --git a/sys/arch/hppa/include/pmap.h b/sys/arch/hppa/include/pmap.h index dac01466519..234b48230c4 100644 --- a/sys/arch/hppa/include/pmap.h +++ b/sys/arch/hppa/include/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.29 2004/04/21 22:14:34 mickey Exp $ */ +/* $OpenBSD: pmap.h,v 1.30 2004/05/20 09:20:42 kettenis Exp $ */ /* * Copyright (c) 2002-2004 Michael Shalayeff @@ -110,6 +110,8 @@ extern struct pdc_hwtlb pdc_hwtlb; #define pmap_is_referenced(pg) pmap_testbit(pg, PTE_PROT(TLB_REFTRAP)) #define pmap_phys_address(ppn) ((ppn) << PAGE_SHIFT) +#define pmap_proc_iflush(p,va,len) /* nothing */ + void pmap_bootstrap(vaddr_t); boolean_t pmap_changebit(struct vm_page *, u_int, u_int); boolean_t pmap_testbit(struct vm_page *, u_int); diff --git a/sys/arch/i386/include/pmap.h b/sys/arch/i386/include/pmap.h index f134b4d3914..74013d8824c 100644 --- a/sys/arch/i386/include/pmap.h +++ b/sys/arch/i386/include/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.33 2003/05/26 16:25:32 art Exp $ */ +/* $OpenBSD: pmap.h,v 1.34 2004/05/20 09:20:42 kettenis Exp $ */ /* $NetBSD: pmap.h,v 1.44 2000/04/24 17:18:18 thorpej Exp $ */ /* @@ -370,6 +370,8 @@ extern int pmap_pg_g; /* do we support PG_G? */ #define pmap_phys_address(ppn) i386_ptob(ppn) #define pmap_valid_entry(E) ((E) & PG_V) /* is PDE or PTE valid? */ +#define pmap_proc_iflush(p,va,len) /* nothing */ + /* * Prototypes diff --git a/sys/arch/luna88k/include/pmap.h b/sys/arch/luna88k/include/pmap.h index 27ba17dd1b1..d8864c577a7 100644 --- a/sys/arch/luna88k/include/pmap.h +++ b/sys/arch/luna88k/include/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.1 2004/04/21 15:23:57 aoyama Exp $ */ +/* $OpenBSD: pmap.h,v 1.2 2004/05/20 09:20:42 kettenis Exp $ */ /* * Mach Operating System * Copyright (c) 1991 Carnegie Mellon University @@ -68,6 +68,8 @@ extern caddr_t vmmap; #define pmap_clear_modify(pg) pmap_unsetbit(pg, PG_M) #define pmap_clear_reference(pg) pmap_unsetbit(pg, PG_U) +#define pmap_proc_iflush(p,va,len) do { /* nothing */ } while (0) + void pmap_bootstrap(vaddr_t, paddr_t *, paddr_t *, vaddr_t *, vaddr_t *); void pmap_cache_ctrl(pmap_t, vaddr_t, vaddr_t, u_int); boolean_t pmap_unsetbit(struct vm_page *, int); diff --git a/sys/arch/m68k/include/pmap_motorola.h b/sys/arch/m68k/include/pmap_motorola.h index b5092be61f3..b6b5c1d7ce7 100644 --- a/sys/arch/m68k/include/pmap_motorola.h +++ b/sys/arch/m68k/include/pmap_motorola.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap_motorola.h,v 1.10 2004/01/01 01:12:52 miod Exp $ */ +/* $OpenBSD: pmap_motorola.h,v 1.11 2004/05/20 09:20:42 kettenis Exp $ */ /* * Copyright (c) 1987 Carnegie-Mellon University @@ -132,6 +132,8 @@ extern struct pv_entry *pv_table; /* array of entries, one per page */ extern pt_entry_t *Sysmap; extern char *vmmap; /* map for mem, dumps, etc. */ +void pmap_proc_iflush(struct proc *, vaddr_t, vsize_t); + #ifdef M68K_MMU_HP void pmap_prefer(vaddr_t, vaddr_t *); #define PMAP_PREFER(foff, vap) pmap_prefer((foff), (vap)) diff --git a/sys/arch/m68k/m68k/pmap_motorola.c b/sys/arch/m68k/m68k/pmap_motorola.c index 5c2262639e5..94e2c6dc827 100644 --- a/sys/arch/m68k/m68k/pmap_motorola.c +++ b/sys/arch/m68k/m68k/pmap_motorola.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap_motorola.c,v 1.33 2004/01/01 01:12:54 miod Exp $ */ +/* $OpenBSD: pmap_motorola.c,v 1.34 2004/05/20 09:20:42 kettenis Exp $ */ /* * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -2696,6 +2696,15 @@ pmap_ptpage_delref(ptpva) return (rv); } +void +pmap_proc_iflush(p, va, len) + struct proc *p; + vaddr_t va; + vsize_t len; +{ + (void)cachectl(p, 0x80000004, va, len); +} + #ifdef DEBUG /* * pmap_pvdump: diff --git a/sys/arch/mac68k/include/cpu.h b/sys/arch/mac68k/include/cpu.h index a30f38fd03e..ed14fadfadf 100644 --- a/sys/arch/mac68k/include/cpu.h +++ b/sys/arch/mac68k/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.28 2003/06/02 23:27:49 millert Exp $ */ +/* $OpenBSD: cpu.h,v 1.29 2004/05/20 09:20:42 kettenis Exp $ */ /* $NetBSD: cpu.h,v 1.45 1997/02/10 22:13:40 scottr Exp $ */ /* @@ -323,6 +323,9 @@ void savectx(struct pcb *); void proc_trampoline(void); void loadustp(int); +/* sys_machdep.c */ +int cachectl(struct proc *, int, vaddr_t, int); + /* vm_machdep.c */ void physaccess(caddr_t, caddr_t, register int, register int); void physunaccess(caddr_t, register int); diff --git a/sys/arch/mac68k/mac68k/locore.s b/sys/arch/mac68k/mac68k/locore.s index a70dbeb00c6..586360c7691 100644 --- a/sys/arch/mac68k/mac68k/locore.s +++ b/sys/arch/mac68k/mac68k/locore.s @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.s,v 1.33 2004/03/08 23:48:26 xsa Exp $ */ +/* $OpenBSD: locore.s,v 1.34 2004/05/20 09:20:42 kettenis Exp $ */ /* $NetBSD: locore.s,v 1.103 1998/07/09 06:02:50 scottr Exp $ */ /* @@ -674,8 +674,9 @@ ENTRY_NOPROFILE(trap12) movl d1,sp@- | push length movl a1,sp@- | push addr movl d0,sp@- | push command + movl _C_LABEL(curproc),sp@- | push proc pointer jbsr _C_LABEL(cachectl) | do it - lea sp@(12),sp | pop args + lea sp@(16),sp | pop args jra _ASM_LABEL(rei) | all done /* diff --git a/sys/arch/mac68k/mac68k/sys_machdep.c b/sys/arch/mac68k/mac68k/sys_machdep.c index e58f7a60bd6..ca8c802c3c5 100644 --- a/sys/arch/mac68k/mac68k/sys_machdep.c +++ b/sys/arch/mac68k/mac68k/sys_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sys_machdep.c,v 1.8 2003/06/02 23:27:49 millert Exp $ */ +/* $OpenBSD: sys_machdep.c,v 1.9 2004/05/20 09:20:42 kettenis Exp $ */ /* $NetBSD: sys_machdep.c,v 1.9 1996/05/05 06:18:58 briggs Exp $ */ /* @@ -92,11 +92,10 @@ #define CC_EXTPURGE 0x80000000 /* XXX end should be */ -int cachectl(int, vaddr_t, int); - /*ARGSUSED1*/ int -cachectl(req, addr, len) +cachectl(p, req, addr, len) + struct proc *p; int req; vaddr_t addr; int len; @@ -133,7 +132,7 @@ cachectl(req, addr, len) if (!doall && (pa == 0 || ((int)addr & PGOFSET) == 0)) { if (pmap_extract( - curproc->p_vmspace->vm_map.pmap, + p->p_vmspace->vm_map.pmap, addr, &pa) == FALSE) doall = 1; } diff --git a/sys/arch/mvme68k/include/cpu.h b/sys/arch/mvme68k/include/cpu.h index 60e98ed7666..091cd1aec50 100644 --- a/sys/arch/mvme68k/include/cpu.h +++ b/sys/arch/mvme68k/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.16 2003/06/02 23:27:50 millert Exp $ */ +/* $OpenBSD: cpu.h,v 1.17 2004/05/20 09:20:42 kettenis Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -234,6 +234,7 @@ int badvaddr(vaddr_t, int); void nmihand(void *); int intr_findvec(int, int); +int cachectl(struct proc *, int, vaddr_t, int); void dma_cachectl(caddr_t, int); paddr_t kvtop(vaddr_t); void physaccess(vaddr_t, paddr_t, size_t, int); diff --git a/sys/arch/mvme68k/mvme68k/locore.s b/sys/arch/mvme68k/mvme68k/locore.s index aa2d3faebaf..ec822f97f9d 100644 --- a/sys/arch/mvme68k/mvme68k/locore.s +++ b/sys/arch/mvme68k/mvme68k/locore.s @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.s,v 1.40 2004/04/24 21:09:37 miod Exp $ */ +/* $OpenBSD: locore.s,v 1.41 2004/05/20 09:20:42 kettenis Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -954,8 +954,9 @@ ENTRY_NOPROFILE(trap12) movl d1,sp@- | push length movl a1,sp@- | push addr movl d0,sp@- | push command + movl _C_LABEL(curproc),sp@- | push proc pointer jbsr _C_LABEL(cachectl) | do it - lea sp@(12),sp | pop args + lea sp@(16),sp | pop args jra _ASM_LABEL(rei) | all done /* diff --git a/sys/arch/mvme68k/mvme68k/sys_machdep.c b/sys/arch/mvme68k/mvme68k/sys_machdep.c index 4f3773f7f98..8ce7b206d83 100644 --- a/sys/arch/mvme68k/mvme68k/sys_machdep.c +++ b/sys/arch/mvme68k/mvme68k/sys_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sys_machdep.c,v 1.14 2003/06/02 23:27:51 millert Exp $ */ +/* $OpenBSD: sys_machdep.c,v 1.15 2004/05/20 09:20:42 kettenis Exp $ */ /* * Copyright (c) 1982, 1986, 1993 @@ -57,8 +57,6 @@ #define CC_EXTPURGE 0x80000000 /* XXX end should be */ -int cachectl(int, vaddr_t, int); - /* * Note that what we do here for a 68040 is different than HP-UX. * @@ -71,7 +69,8 @@ int cachectl(int, vaddr_t, int); */ /*ARGSUSED1*/ int -cachectl(req, addr, len) +cachectl(p, req, addr, len) + struct proc *p; int req; vaddr_t addr; int len; @@ -119,7 +118,7 @@ cachectl(req, addr, len) if (!doall && (pa == 0 || ((int)addr & PGOFSET) == 0)) { if (pmap_extract( - curproc->p_vmspace->vm_map.pmap, + p->p_vmspace->vm_map.pmap, addr, &pa) == FALSE) doall = 1; } diff --git a/sys/arch/mvme88k/include/pmap.h b/sys/arch/mvme88k/include/pmap.h index 4e33c967070..6cd196398ce 100644 --- a/sys/arch/mvme88k/include/pmap.h +++ b/sys/arch/mvme88k/include/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.34 2004/04/14 13:43:47 miod Exp $ */ +/* $OpenBSD: pmap.h,v 1.35 2004/05/20 09:20:42 kettenis Exp $ */ /* * Mach Operating System * Copyright (c) 1991 Carnegie Mellon University @@ -68,6 +68,8 @@ extern caddr_t vmmap; #define pmap_clear_modify(pg) pmap_unsetbit(pg, PG_M) #define pmap_clear_reference(pg) pmap_unsetbit(pg, PG_U) +#define pmap_proc_iflush(p,va,len) do { /* nothing */ } while (0) + void pmap_bootstrap(vaddr_t); void pmap_cache_ctrl(pmap_t, vaddr_t, vaddr_t, u_int); boolean_t pmap_unsetbit(struct vm_page *, int); diff --git a/sys/arch/powerpc/include/pmap.h b/sys/arch/powerpc/include/pmap.h index eafa469005b..d68eaa69ec6 100644 --- a/sys/arch/powerpc/include/pmap.h +++ b/sys/arch/powerpc/include/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.34 2004/01/15 05:53:13 drahn Exp $ */ +/* $OpenBSD: pmap.h,v 1.35 2004/05/20 09:20:42 kettenis Exp $ */ /* $NetBSD: pmap.h,v 1.1 1996/09/30 16:34:29 ws Exp $ */ /*- @@ -133,6 +133,8 @@ void switchexit(struct proc *); int pte_spill_v(struct pmap *pm, u_int32_t va, u_int32_t dsisr, int exec_fault); #define pmap_copy(dst_pmap, src_pmap, dst_addr, len, src_addr) ; +void pmap_proc_iflush(struct proc *proc, vaddr_t va, vsize_t len); + #endif /* _KERNEL */ #endif /* _LOCORE */ #endif /* _POWERPC_PMAP_H_ */ diff --git a/sys/arch/powerpc/powerpc/pmap.c b/sys/arch/powerpc/powerpc/pmap.c index 595be03f79a..c216e298831 100644 --- a/sys/arch/powerpc/powerpc/pmap.c +++ b/sys/arch/powerpc/powerpc/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.86 2004/01/25 13:22:10 miod Exp $ */ +/* $OpenBSD: pmap.c,v 1.87 2004/05/20 09:20:42 kettenis Exp $ */ /* * Copyright (c) 2001, 2002 Dale Rahn. @@ -1943,6 +1943,26 @@ pmap_init() pmap_initialized = 1; } +void +pmap_proc_iflush(struct proc *p, vaddr_t addr, vsize_t len) +{ + paddr_t pa; + vsize_t clen; + + while (len > 0) { + clen = round_page(addr) - addr; + if (clen > len) + clen = len; + + if (pmap_extract(p->p_vmspace->vm_map.pmap, addr, &pa)) { + syncicache((void *)pa, clen); + } + + len -= clen; + addr += clen; + } +} + /* * There are two routines, pte_spill_r and pte_spill_v * the _r version only handles kernel faults which are not user diff --git a/sys/arch/sparc/include/pmap.h b/sys/arch/sparc/include/pmap.h index fcee10185f9..0fbd8b76ef8 100644 --- a/sys/arch/sparc/include/pmap.h +++ b/sys/arch/sparc/include/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.36 2003/11/14 19:05:36 miod Exp $ */ +/* $OpenBSD: pmap.h,v 1.37 2004/05/20 09:20:41 kettenis Exp $ */ /* $NetBSD: pmap.h,v 1.30 1997/08/04 20:00:47 pk Exp $ */ /* @@ -303,6 +303,8 @@ void pmap_writetext(unsigned char *, int); #define pmap_update(pm) /* nothing */ #define pmap_copy(DP,SP,D,L,S) /* nothing */ +#define pmap_proc_iflush(p,va,len) /* nothing */ + /* SUN4/SUN4C SPECIFIC DECLARATIONS */ #if defined(SUN4) || defined(SUN4C) diff --git a/sys/arch/sparc64/include/pmap.h b/sys/arch/sparc64/include/pmap.h index 81681aff364..b40e7ce2c13 100644 --- a/sys/arch/sparc64/include/pmap.h +++ b/sys/arch/sparc64/include/pmap.h @@ -163,6 +163,8 @@ int pmap_count_res(pmap_t pmap); #define pmap_phys_address(x) (x) #define pmap_update(pm) /* nothing (yet) */ +#define pmap_proc_iflush(p,va,len) /* nothing */ + void pmap_bootstrap(u_long kernelstart, u_long kernelend, u_int numctx); /* make sure all page mappings are modulo 16K to prevent d$ aliasing */ #define PMAP_PREFER(pa, va) (*(va)+=(((*(va))^(pa))&(1<<(PGSHIFT+1)))) diff --git a/sys/arch/vax/include/pmap.h b/sys/arch/vax/include/pmap.h index 512f10b6c80..77409fe25de 100644 --- a/sys/arch/vax/include/pmap.h +++ b/sys/arch/vax/include/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.20 2003/11/10 21:05:06 miod Exp $ */ +/* $OpenBSD: pmap.h,v 1.21 2004/05/20 09:20:42 kettenis Exp $ */ /* $NetBSD: pmap.h,v 1.37 1999/08/01 13:48:07 ragge Exp $ */ /* @@ -142,6 +142,8 @@ extern struct pmap kernel_pmap_store; :: "r"(__pa): "r0","r1","r2","r3","r4","r5"); \ } while (0) +#define pmap_proc_iflush(p,va,len) /* nothing */ + /* Prototypes */ void pmap_bootstrap(void); vaddr_t pmap_map(vm_offset_t, vm_offset_t, vm_offset_t, int); diff --git a/sys/miscfs/procfs/procfs_mem.c b/sys/miscfs/procfs/procfs_mem.c index 0e6cd9bede8..95d617083ea 100644 --- a/sys/miscfs/procfs/procfs_mem.c +++ b/sys/miscfs/procfs/procfs_mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: procfs_mem.c,v 1.21 2004/05/05 23:52:10 tedu Exp $ */ +/* $OpenBSD: procfs_mem.c,v 1.22 2004/05/20 09:20:41 kettenis Exp $ */ /* $NetBSD: procfs_mem.c,v 1.8 1996/02/09 22:40:50 christos Exp $ */ /* @@ -66,19 +66,27 @@ procfs_domem(curp, p, pfs, uio) struct uio *uio; { int error; + vaddr_t addr; + vsize_t len; - if (uio->uio_resid == 0) + len = uio->uio_resid; + if (len == 0) return (0); if ((error = procfs_checkioperm(curp, p)) != 0) return (error); + /* XXXCDC: how should locking work here? */ if ((p->p_flag & P_WEXIT) || (p->p_vmspace->vm_refcnt < 1)) return(EFAULT); + addr = uio->uio_offset; p->p_vmspace->vm_refcnt++; /* XXX */ error = uvm_io(&p->p_vmspace->vm_map, uio); uvmspace_free(p->p_vmspace); + if (error == 0 && uio->uio_rw == UIO_WRITE) + pmap_proc_iflush(p, addr, len); + return error; } |