-/* $OpenBSD: trap.c,v 1.12 1997/02/04 12:29:20 deraadt Exp $ */
+/* $OpenBSD: trap.c,v 1.13 1997/02/04 17:23:20 deraadt Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
register struct vmspace *vm = NULL;
register vm_map_t map;
int rv;
- vm_prot_t ftype;
+ vm_prot_t ftype, vftype;
extern vm_map_t kernel_map;
/* vmspace only significant if T_USER */
map = kernel_map;
else
map = &vm->vm_map;
- if (WRFAULT(code))
+ if (WRFAULT(code)) {
+ vftype = VM_PROT_WRITE;
ftype = VM_PROT_READ | VM_PROT_WRITE;
- else
+ } else
ftype = VM_PROT_READ;
va = trunc_page((vm_offset_t)v);
goto dopanic;
}
frame.f_pad = code & 0xffff;
- ucode = ftype;
+ ucode = vftype;
typ = SEGV_MAPERR;
i = SIGSEGV;
break;
register struct vmspace *vm;
register vm_offset_t va;
register int rv;
- vm_prot_t ftype;
+ vm_prot_t ftype, vftype;
int onfault;
u_quad_t sticks;
#if DEBUG
/* Now munch on protections... */
ftype = sfsr & SFSR_AT_STORE ? VM_PROT_READ|VM_PROT_WRITE:VM_PROT_READ;
+ vftype = sfsr & SFSR_AT_STORE ? VM_PROT_WRITE:VM_PROT_READ;
if (psr & PSR_PS) {
extern char Lfsbail[];
if (sfsr & SFSR_AT_TEXT || type == T_TEXTFAULT) {
tf->tf_npc = onfault + 4;
return;
}
- trapsignal(p, SIGSEGV, ftype, SEGV_MAPERR, (caddr_t)sfva);
+ trapsignal(p, SIGSEGV, vftype, SEGV_MAPERR, (caddr_t)sfva);
}
out:
if ((psr & PSR_PS) == 0) {