diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2005-11-12 23:14:04 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2005-11-12 23:14:04 +0000 |
commit | a786586c49b390f86241e8b55611e860e5d89ef1 (patch) | |
tree | 497ca96a1f0d623b920810346729fc5086bf00c3 /sys | |
parent | 02bc7df7d946553a2773b99fb357702a59265d8c (diff) |
Pass a struct proc * to ISHPMMADDR instead of abusing curproc in it.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/hp300/hp300/trap.c | 6 | ||||
-rw-r--r-- | sys/arch/m68k/include/param.h | 6 | ||||
-rw-r--r-- | sys/arch/mvme68k/mvme68k/trap.c | 178 |
3 files changed, 95 insertions, 95 deletions
diff --git a/sys/arch/hp300/hp300/trap.c b/sys/arch/hp300/hp300/trap.c index b73a1ef71b8..3808d7f44f6 100644 --- a/sys/arch/hp300/hp300/trap.c +++ b/sys/arch/hp300/hp300/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.47 2005/05/01 09:55:47 miod Exp $ */ +/* $OpenBSD: trap.c,v 1.48 2005/11/12 23:14:00 miod Exp $ */ /* $NetBSD: trap.c,v 1.57 1998/02/16 20:58:31 thorpej Exp $ */ /* @@ -624,7 +624,7 @@ dopanic: } #ifdef COMPAT_HPUX - if (ISHPMMADDR(va)) { + if (ISHPMMADDR(p, va)) { int pmap_mapmulti(pmap_t, vaddr_t); vaddr_t bva; @@ -633,7 +633,7 @@ dopanic: bva = HPMMBASEADDR(va); rv = uvm_fault(map, bva, 0, ftype); if (rv == 0) - (void) pmap_mapmulti(map->pmap, va); + (void)pmap_mapmulti(map->pmap, va); } } else #endif diff --git a/sys/arch/m68k/include/param.h b/sys/arch/m68k/include/param.h index 93fe1d93dbf..30ab5eea064 100644 --- a/sys/arch/m68k/include/param.h +++ b/sys/arch/m68k/include/param.h @@ -1,4 +1,4 @@ -/* $OpenBSD: param.h,v 1.15 2005/10/23 19:00:25 martin Exp $ */ +/* $OpenBSD: param.h,v 1.16 2005/11/12 23:14:03 miod Exp $ */ /* $NetBSD: param.h,v 1.2 1997/06/10 18:21:23 veego Exp $ */ /* @@ -148,8 +148,8 @@ * Pages in the first 256Mb are mapped in at every 256Mb segment. */ #define HPMMMASK 0xF0000000 -#define ISHPMMADDR(v) \ - ((curproc->p_md.md_flags & MDP_HPUXMMAP) && \ +#define ISHPMMADDR(p, v) \ + (((p)->p_md.md_flags & MDP_HPUXMMAP) && \ ((unsigned)(v) & HPMMMASK) && \ ((unsigned)(v) & HPMMMASK) != HPMMMASK) #define HPMMBASEADDR(v) \ diff --git a/sys/arch/mvme68k/mvme68k/trap.c b/sys/arch/mvme68k/mvme68k/trap.c index c804974adad..6304314b5e4 100644 --- a/sys/arch/mvme68k/mvme68k/trap.c +++ b/sys/arch/mvme68k/mvme68k/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.59 2005/07/31 15:38:12 miod Exp $ */ +/* $OpenBSD: trap.c,v 1.60 2005/11/12 23:14:03 miod Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -526,105 +526,105 @@ copyfault: case T_MMUFLT: /* kernel mode page fault */ case T_MMUFLT|T_USER: /* page fault */ - { - vm_offset_t va; - struct vmspace *vm = NULL; - struct vm_map *map; - int rv; - vm_prot_t ftype, vftype; - extern struct vm_map *kernel_map; - - /* vmspace only significant if T_USER */ - if (p) - vm = p->p_vmspace; + { + vm_offset_t va; + struct vmspace *vm = NULL; + struct vm_map *map; + int rv; + vm_prot_t ftype, vftype; + extern struct vm_map *kernel_map; + + /* vmspace only significant if T_USER */ + if (p) + vm = p->p_vmspace; #ifdef DEBUG - if ((mmudebug & MDB_WBFOLLOW) || MDB_ISPID(p->p_pid)) - printf("trap: T_MMUFLT pid=%d, code=%x, v=%x, pc=%x, sr=%x\n", - p->p_pid, code, v, frame.f_pc, frame.f_sr); + if ((mmudebug & MDB_WBFOLLOW) || MDB_ISPID(p->p_pid)) + printf("trap: T_MMUFLT pid=%d, code=%x, v=%x, pc=%x, sr=%x\n", + p->p_pid, code, v, frame.f_pc, frame.f_sr); #endif - /* - * It is only a kernel address space fault iff: - * 1. (type & T_USER) == 0 and - * 2. pcb_onfault not set or - * 3. pcb_onfault set but supervisor space data fault - * The last can occur during an exec() copyin where the - * argument space is lazy-allocated. - */ - if (type == T_MMUFLT && - ((p && !p->p_addr->u_pcb.pcb_onfault) || KDFAULT(code))) - map = kernel_map; - else - map = vm ? &vm->vm_map : kernel_map; - if (WRFAULT(code)) { - vftype = VM_PROT_WRITE; - ftype = VM_PROT_READ | VM_PROT_WRITE; - } else - vftype = ftype = VM_PROT_READ; - va = trunc_page((vm_offset_t)v); - - if (map == kernel_map && va == 0) { - printf("trap: bad kernel access at %x\n", v); - goto dopanic; - } + /* + * It is only a kernel address space fault iff: + * 1. (type & T_USER) == 0 and + * 2. pcb_onfault not set or + * 3. pcb_onfault set but supervisor space data fault + * The last can occur during an exec() copyin where the + * argument space is lazy-allocated. + */ + if (type == T_MMUFLT && + ((p && !p->p_addr->u_pcb.pcb_onfault) || KDFAULT(code))) + map = kernel_map; + else + map = vm ? &vm->vm_map : kernel_map; + if (WRFAULT(code)) { + vftype = VM_PROT_WRITE; + ftype = VM_PROT_READ | VM_PROT_WRITE; + } else + vftype = ftype = VM_PROT_READ; + va = trunc_page((vm_offset_t)v); + + if (map == kernel_map && va == 0) { + printf("trap: bad kernel access at %x\n", v); + goto dopanic; + } #ifdef COMPAT_HPUX - if (ISHPMMADDR(va)) { - vm_offset_t bva; - - rv = pmap_mapmulti(map->pmap, va); - if (rv) { - bva = HPMMBASEADDR(va); - rv = uvm_fault(map, bva, 0, ftype); - if (rv == 0) - (void) pmap_mapmulti(map->pmap, va); - } - } else + if (ISHPMMADDR(p, va)) { + vm_offset_t bva; + + rv = pmap_mapmulti(map->pmap, va); + if (rv) { + bva = HPMMBASEADDR(va); + rv = uvm_fault(map, bva, 0, ftype); + if (rv == 0) + (void)pmap_mapmulti(map->pmap, va); + } + } else #endif - rv = uvm_fault(map, va, 0, ftype); + rv = uvm_fault(map, va, 0, ftype); #ifdef DEBUG - if (rv && MDB_ISPID(p->p_pid)) - printf("uvm_fault(%x, %x, 0, %x) -> %x\n", - map, va, ftype, rv); + if (rv && MDB_ISPID(p->p_pid)) + printf("uvm_fault(%x, %x, 0, %x) -> %x\n", + map, va, ftype, rv); #endif - /* - * If this was a stack access we keep track of the maximum - * accessed stack size. Also, if vm_fault gets a protection - * failure it is due to accessing the stack region outside - * the current limit and we need to reflect that as an access - * error. - */ - if ((vm != NULL && (caddr_t)va >= vm->vm_maxsaddr) - && map != kernel_map) { - if (rv == 0) - uvm_grow(p, va); - else if (rv == EACCES) - rv = EFAULT; - } - if (rv == 0) { - if (type == T_MMUFLT) { + /* + * If this was a stack access we keep track of the maximum + * accessed stack size. Also, if vm_fault gets a protection + * failure it is due to accessing the stack region outside + * the current limit and we need to reflect that as an access + * error. + */ + if ((vm != NULL && (caddr_t)va >= vm->vm_maxsaddr) + && map != kernel_map) { + if (rv == 0) + uvm_grow(p, va); + else if (rv == EACCES) + rv = EFAULT; + } + if (rv == 0) { + if (type == T_MMUFLT) { #if defined(M68040) - if (mmutype == MMU_68040) - (void) writeback(&frame, 1); + if (mmutype == MMU_68040) + (void) writeback(&frame, 1); #endif - return; - } - goto out; - } - if (type == T_MMUFLT) { - if (p && p->p_addr->u_pcb.pcb_onfault) - goto copyfault; - printf("uvm_fault(%p, %lx, 0, %x) -> %x\n", - map, va, ftype, rv); - printf(" type %x, code [mmu,,ssw]: %x\n", - type, code); - goto dopanic; + return; } - frame.f_pad = code & 0xffff; - ucode = vftype; - typ = SEGV_MAPERR; - i = SIGSEGV; - break; + goto out; } + if (type == T_MMUFLT) { + if (p && p->p_addr->u_pcb.pcb_onfault) + goto copyfault; + printf("uvm_fault(%p, %lx, 0, %x) -> %x\n", + map, va, ftype, rv); + printf(" type %x, code [mmu,,ssw]: %x\n", + type, code); + goto dopanic; + } + frame.f_pad = code & 0xffff; + ucode = vftype; + typ = SEGV_MAPERR; + i = SIGSEGV; + } + break; } sv.sival_int = v; trapsignal(p, i, ucode, typ, sv); |