subr_trap.c (a0ad3760a2235cb0d4625d83db092df5ea0f3db9) | subr_trap.c (960173b9b283675c49eee318c6ca8c12ecb5d188) |
---|---|
1/*- 2 * Copyright (c) 1990 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * the University of Utah, and William Jolitz. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 19 unchanged lines hidden (view full) --- 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 * | 1/*- 2 * Copyright (c) 1990 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * the University of Utah, and William Jolitz. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 19 unchanged lines hidden (view full) --- 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 * |
36 * @(#)trap.c 7.4 (Berkeley) 5/13/91 37 * 38 * PATCHES MAGIC LEVEL PATCH THAT GOT US HERE 39 * -------------------- ----- ---------------------- 40 * CURRENT PATCH LEVEL: 1 00137 41 * -------------------- ----- ---------------------- 42 * 43 * 08 Apr 93 Bruce Evans Several VM system fixes 44 * Paul Kranenburg Add counter for vmstat | 36 * from: @(#)trap.c 7.4 (Berkeley) 5/13/91 37 * $Id$ |
45 */ | 38 */ |
46static char rcsid[] = "$Header: /a/cvs/386BSD/src/sys/i386/i386/trap.c,v 1.2 1993/07/27 10:52:20 davidg Exp $"; | |
47 48/* 49 * 386 Trap and System call handleing 50 */ 51 | 39 40/* 41 * 386 Trap and System call handleing 42 */ 43 |
44#include "npx.h" |
|
52#include "machine/cpu.h" 53#include "machine/psl.h" 54#include "machine/reg.h" 55 56#include "param.h" 57#include "systm.h" 58#include "proc.h" 59#include "user.h" --- 141 unchanged lines hidden (view full) --- 201 cnt.v_soft++; 202 if ((p->p_flag & SOWEUPC) && p->p_stats->p_prof.pr_scale) { 203 addupc(frame.tf_eip, &p->p_stats->p_prof, 1); 204 p->p_flag &= ~SOWEUPC; 205 } 206 goto out; 207 208 case T_DNA|T_USER: | 45#include "machine/cpu.h" 46#include "machine/psl.h" 47#include "machine/reg.h" 48 49#include "param.h" 50#include "systm.h" 51#include "proc.h" 52#include "user.h" --- 141 unchanged lines hidden (view full) --- 194 cnt.v_soft++; 195 if ((p->p_flag & SOWEUPC) && p->p_stats->p_prof.pr_scale) { 196 addupc(frame.tf_eip, &p->p_stats->p_prof, 1); 197 p->p_flag &= ~SOWEUPC; 198 } 199 goto out; 200 201 case T_DNA|T_USER: |
209#ifdef NPX | 202#if NNPX > 0 |
210 /* if a transparent fault (due to context switch "late") */ 211 if (npxdna()) return; | 203 /* if a transparent fault (due to context switch "late") */ 204 if (npxdna()) return; |
212#endif | 205#endif /* NNPX > 0 */ |
213#ifdef MATH_EMULATE 214 i = math_emulate(&frame); 215 if (i == 0) return; 216#else /* MATH_EMULTATE */ 217 panic("trap: math emulation necessary!"); 218#endif /* MATH_EMULTATE */ 219 ucode = FPE_FPU_NP_TRAP; 220 break; --- 32 unchanged lines hidden (view full) --- 253 register vm_map_t map; 254 int rv; 255 vm_prot_t ftype; 256 extern vm_map_t kernel_map; 257 unsigned nss,v; 258 259 va = trunc_page((vm_offset_t)eva); 260 /* | 206#ifdef MATH_EMULATE 207 i = math_emulate(&frame); 208 if (i == 0) return; 209#else /* MATH_EMULTATE */ 210 panic("trap: math emulation necessary!"); 211#endif /* MATH_EMULTATE */ 212 ucode = FPE_FPU_NP_TRAP; 213 break; --- 32 unchanged lines hidden (view full) --- 246 register vm_map_t map; 247 int rv; 248 vm_prot_t ftype; 249 extern vm_map_t kernel_map; 250 unsigned nss,v; 251 252 va = trunc_page((vm_offset_t)eva); 253 /* |
261 * Avoid even looking at pde_v(va) for high va's. va's 262 * above VM_MAX_KERNEL_ADDRESS don't correspond to normal 263 * PDE's (half of them correspond to APDEpde and half to 264 * an unmapped kernel PDE). va's betweeen 0xFEC00000 and 265 * VM_MAX_KERNEL_ADDRESS correspond to unmapped kernel PDE's 266 * (XXX - why are only 3 initialized when 6 are required to 267 * reach VM_MAX_KERNEL_ADDRESS?). Faulting in an unmapped 268 * kernel page table would give inconsistent PTD's. 269 * 270 * XXX - faulting in unmapped page tables wastes a page if 271 * va turns out to be invalid. 272 * 273 * XXX - should "kernel address space" cover the kernel page 274 * tables? Might have same problem with PDEpde as with 275 * APDEpde (or there may be no problem with APDEpde). 276 */ 277 if (va > 0xFEBFF000) { 278 rv = KERN_FAILURE; /* becomes SIGBUS */ 279 goto nogo; 280 } 281 /* | |
282 * It is only a kernel address space fault iff: 283 * 1. (type & T_USER) == 0 and 284 * 2. pcb_onfault not set or 285 * 3. pcb_onfault set but supervisor space fault 286 * The last can occur during an exec() copyin where the 287 * argument space is lazy-allocated. 288 */ 289 if (type == T_PAGEFLT && va >= KERNBASE) --- 324 unchanged lines hidden --- | 254 * It is only a kernel address space fault iff: 255 * 1. (type & T_USER) == 0 and 256 * 2. pcb_onfault not set or 257 * 3. pcb_onfault set but supervisor space fault 258 * The last can occur during an exec() copyin where the 259 * argument space is lazy-allocated. 260 */ 261 if (type == T_PAGEFLT && va >= KERNBASE) --- 324 unchanged lines hidden --- |