subr_syscall.c (1307) | subr_syscall.c (1321) |
---|---|
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 --- 20 unchanged lines hidden (view full) --- 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 * from: @(#)trap.c 7.4 (Berkeley) 5/13/91 | 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 --- 20 unchanged lines hidden (view full) --- 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 * from: @(#)trap.c 7.4 (Berkeley) 5/13/91 |
37 * $Id: trap.c,v 1.19 1994/03/14 21:54:03 davidg Exp $ | 37 * $Id: trap.c,v 1.20 1994/03/24 23:12:34 davidg Exp $ |
38 */ 39 40/* 41 * 386 Trap and System call handleing 42 */ 43 44#include "isa.h" 45#include "npx.h" --- 37 unchanged lines hidden (view full) --- 83void write_gs __P((/* promoted u_short */ int gs)); 84 85#endif /* __GNUC__ */ 86 87extern int grow(struct proc *,int); 88 89struct sysent sysent[]; 90int nsysent; | 38 */ 39 40/* 41 * 386 Trap and System call handleing 42 */ 43 44#include "isa.h" 45#include "npx.h" --- 37 unchanged lines hidden (view full) --- 83void write_gs __P((/* promoted u_short */ int gs)); 84 85#endif /* __GNUC__ */ 86 87extern int grow(struct proc *,int); 88 89struct sysent sysent[]; 90int nsysent; |
91extern unsigned cpl; 92extern unsigned netmask, ttymask, biomask; | |
93 94#define MAX_TRAP_MSG 27 95char *trap_msg[] = { 96 "reserved addressing fault", /* 0 T_RESADFLT */ 97 "privileged instruction fault", /* 1 T_PRIVINFLT */ 98 "reserved operand fault", /* 2 T_RESOPFLT */ 99 "breakpoint instruction fault", /* 3 T_BPTFLT */ 100 "", /* 4 unused */ --- 120 unchanged lines hidden (view full) --- 221 case T_DNA|T_USER: 222#if NNPX > 0 223 /* if a transparent fault (due to context switch "late") */ 224 if (npxdna()) return; 225#endif /* NNPX > 0 */ 226#ifdef MATH_EMULATE 227 i = math_emulate(&frame); 228 if (i == 0) return; | 91 92#define MAX_TRAP_MSG 27 93char *trap_msg[] = { 94 "reserved addressing fault", /* 0 T_RESADFLT */ 95 "privileged instruction fault", /* 1 T_PRIVINFLT */ 96 "reserved operand fault", /* 2 T_RESOPFLT */ 97 "breakpoint instruction fault", /* 3 T_BPTFLT */ 98 "", /* 4 unused */ --- 120 unchanged lines hidden (view full) --- 219 case T_DNA|T_USER: 220#if NNPX > 0 221 /* if a transparent fault (due to context switch "late") */ 222 if (npxdna()) return; 223#endif /* NNPX > 0 */ 224#ifdef MATH_EMULATE 225 i = math_emulate(&frame); 226 if (i == 0) return; |
229#else /* MATH_EMULTATE */ | 227#else /* MATH_EMULATE */ |
230 panic("trap: math emulation necessary!"); | 228 panic("trap: math emulation necessary!"); |
231#endif /* MATH_EMULTATE */ | 229#endif /* MATH_EMULATE */ |
232 ucode = FPE_FPU_NP_TRAP; 233 break; 234 235 case T_BOUND|T_USER: 236 ucode = FPE_SUBRNG_TRAP; 237 i = SIGFPE; 238 break; 239 --- 16 unchanged lines hidden (view full) --- 256 case T_PAGEFLT: /* allow page faults in kernel mode */ 257 case T_PAGEFLT|T_USER: /* page fault */ 258 { 259 vm_offset_t va; 260 struct vmspace *vm; 261 vm_map_t map = 0; 262 int rv = 0, oldflags; 263 vm_prot_t ftype; | 230 ucode = FPE_FPU_NP_TRAP; 231 break; 232 233 case T_BOUND|T_USER: 234 ucode = FPE_SUBRNG_TRAP; 235 i = SIGFPE; 236 break; 237 --- 16 unchanged lines hidden (view full) --- 254 case T_PAGEFLT: /* allow page faults in kernel mode */ 255 case T_PAGEFLT|T_USER: /* page fault */ 256 { 257 vm_offset_t va; 258 struct vmspace *vm; 259 vm_map_t map = 0; 260 int rv = 0, oldflags; 261 vm_prot_t ftype; |
264 unsigned nss, v; | 262 unsigned v; |
265 extern vm_map_t kernel_map; 266 267 va = trunc_page((vm_offset_t)eva); 268 269 /* 270 * Don't allow user-mode faults in kernel address space 271 */ 272 if ((type == (T_PAGEFLT|T_USER)) && (va >= KERNBASE)) { --- 157 unchanged lines hidden (view full) --- 430 if (curproc) { 431 printf("%d (%s)\n", 432 curproc->p_pid, curproc->p_comm ? 433 curproc->p_comm : ""); 434 } else { 435 printf("Idle\n"); 436 } 437 printf("interrupt mask = "); | 263 extern vm_map_t kernel_map; 264 265 va = trunc_page((vm_offset_t)eva); 266 267 /* 268 * Don't allow user-mode faults in kernel address space 269 */ 270 if ((type == (T_PAGEFLT|T_USER)) && (va >= KERNBASE)) { --- 157 unchanged lines hidden (view full) --- 428 if (curproc) { 429 printf("%d (%s)\n", 430 curproc->p_pid, curproc->p_comm ? 431 curproc->p_comm : ""); 432 } else { 433 printf("Idle\n"); 434 } 435 printf("interrupt mask = "); |
438 if ((cpl & netmask) == netmask) | 436 if ((cpl & net_imask) == net_imask) |
439 printf("net "); | 437 printf("net "); |
440 if ((cpl & ttymask) == ttymask) | 438 if ((cpl & tty_imask) == tty_imask) |
441 printf("tty "); | 439 printf("tty "); |
442 if ((cpl & biomask) == biomask) | 440 if ((cpl & bio_imask) == bio_imask) |
443 printf("bio "); 444 if (cpl == 0) 445 printf("none"); 446 printf("\n"); 447 448#ifdef KDB 449 if (kdb_trap(&psl)) 450 return; --- 58 unchanged lines hidden (view full) --- 509 * Compensate for 386 brain damage (missing URKR). 510 * This is a little simpler than the pagefault handler in trap() because 511 * it the page tables have already been faulted in and high addresses 512 * are thrown out early for other reasons. 513 */ 514int trapwrite(addr) 515 unsigned addr; 516{ | 441 printf("bio "); 442 if (cpl == 0) 443 printf("none"); 444 printf("\n"); 445 446#ifdef KDB 447 if (kdb_trap(&psl)) 448 return; --- 58 unchanged lines hidden (view full) --- 507 * Compensate for 386 brain damage (missing URKR). 508 * This is a little simpler than the pagefault handler in trap() because 509 * it the page tables have already been faulted in and high addresses 510 * are thrown out early for other reasons. 511 */ 512int trapwrite(addr) 513 unsigned addr; 514{ |
517 unsigned nss; | |
518 struct proc *p; 519 vm_offset_t va, v; 520 struct vmspace *vm; 521 int oldflags; 522 int rv; 523 524 va = trunc_page((vm_offset_t)addr); 525 /* --- 188 unchanged lines hidden --- | 515 struct proc *p; 516 vm_offset_t va, v; 517 struct vmspace *vm; 518 int oldflags; 519 int rv; 520 521 va = trunc_page((vm_offset_t)addr); 522 /* --- 188 unchanged lines hidden --- |