| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: trap.c,v 1.142 2024/01/20 00:15:30 thorpej Exp $ */ | | 1 | /* $NetBSD: trap.c,v 1.143 2024/05/04 13:45:10 mlelstv Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 1988 University of Utah. | | 4 | * Copyright (c) 1988 University of Utah. |
5 | * Copyright (c) 1982, 1986, 1990 The Regents of the University of California. | | 5 | * Copyright (c) 1982, 1986, 1990 The Regents of the University of California. |
6 | * All rights reserved. | | 6 | * All rights reserved. |
7 | * | | 7 | * |
8 | * This code is derived from software contributed to Berkeley by | | 8 | * This code is derived from software contributed to Berkeley by |
9 | * the Systems Programming Group of the University of Utah Computer | | 9 | * the Systems Programming Group of the University of Utah Computer |
10 | * Science Department. | | 10 | * Science Department. |
11 | * | | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | | 12 | * Redistribution and use in source and binary forms, with or without |
13 | * modification, are permitted provided that the following conditions | | 13 | * modification, are permitted provided that the following conditions |
14 | * are met: | | 14 | * are met: |
| @@ -35,27 +35,27 @@ | | | @@ -35,27 +35,27 @@ |
35 | * | | 35 | * |
36 | * from: Utah $Hdr: trap.c 1.32 91/04/06$ | | 36 | * from: Utah $Hdr: trap.c 1.32 91/04/06$ |
37 | * | | 37 | * |
38 | * @(#)trap.c 7.15 (Berkeley) 8/2/91 | | 38 | * @(#)trap.c 7.15 (Berkeley) 8/2/91 |
39 | */ | | 39 | */ |
40 | | | 40 | |
41 | #include "opt_ddb.h" | | 41 | #include "opt_ddb.h" |
42 | #include "opt_execfmt.h" | | 42 | #include "opt_execfmt.h" |
43 | #include "opt_compat_sunos.h" | | 43 | #include "opt_compat_sunos.h" |
44 | #include "opt_fpu_emulate.h" | | 44 | #include "opt_fpu_emulate.h" |
45 | #include "opt_m68k_arch.h" | | 45 | #include "opt_m68k_arch.h" |
46 | | | 46 | |
47 | #include <sys/cdefs.h> | | 47 | #include <sys/cdefs.h> |
48 | __KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.142 2024/01/20 00:15:30 thorpej Exp $"); | | 48 | __KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.143 2024/05/04 13:45:10 mlelstv Exp $"); |
49 | | | 49 | |
50 | #include <sys/param.h> | | 50 | #include <sys/param.h> |
51 | #include <sys/systm.h> | | 51 | #include <sys/systm.h> |
52 | #include <sys/proc.h> | | 52 | #include <sys/proc.h> |
53 | #include <sys/acct.h> | | 53 | #include <sys/acct.h> |
54 | #include <sys/kernel.h> | | 54 | #include <sys/kernel.h> |
55 | #include <sys/signalvar.h> | | 55 | #include <sys/signalvar.h> |
56 | #include <sys/resourcevar.h> | | 56 | #include <sys/resourcevar.h> |
57 | #include <sys/syslog.h> | | 57 | #include <sys/syslog.h> |
58 | #include <sys/syscall.h> | | 58 | #include <sys/syscall.h> |
59 | #include <sys/userret.h> | | 59 | #include <sys/userret.h> |
60 | #include <sys/kauth.h> | | 60 | #include <sys/kauth.h> |
61 | | | 61 | |
| @@ -354,27 +354,27 @@ trapmmufault(int type, u_int code, u_int | | | @@ -354,27 +354,27 @@ trapmmufault(int type, u_int code, u_int |
354 | | | 354 | |
355 | if ( | | 355 | if ( |
356 | #ifdef M68060 | | 356 | #ifdef M68060 |
357 | machineid & AMIGA_68060 ? code & FSLW_RW_W : | | 357 | machineid & AMIGA_68060 ? code & FSLW_RW_W : |
358 | #endif | | 358 | #endif |
359 | mmutype == MMU_68040 ? (code & (SSW_LK|SSW_RW040)) != SSW_RW040 : | | 359 | mmutype == MMU_68040 ? (code & (SSW_LK|SSW_RW040)) != SSW_RW040 : |
360 | ((code & SSW_DF) != 0 && | | 360 | ((code & SSW_DF) != 0 && |
361 | ((code & SSW_RW) == 0 || (code & SSW_RM) != 0))) | | 361 | ((code & SSW_RW) == 0 || (code & SSW_RM) != 0))) |
362 | ftype = VM_PROT_WRITE; | | 362 | ftype = VM_PROT_WRITE; |
363 | else | | 363 | else |
364 | ftype = VM_PROT_READ; | | 364 | ftype = VM_PROT_READ; |
365 | va = trunc_page((vaddr_t)v); | | 365 | va = trunc_page((vaddr_t)v); |
366 | #ifdef DEBUG | | 366 | #ifdef DEBUG |
367 | if (map == kernel_map && va == 0) { | | 367 | if (map == kernel_map && va == 0 && onfault == 0) { |
368 | printf("trap: bad kernel access at %x pc %x\n", v, fp->f_pc); | | 368 | printf("trap: bad kernel access at %x pc %x\n", v, fp->f_pc); |
369 | panictrap(type, code, v, fp); | | 369 | panictrap(type, code, v, fp); |
370 | } | | 370 | } |
371 | | | 371 | |
372 | if (mmudebug) | | 372 | if (mmudebug) |
373 | printf("vm_fault(%p,%lx,%d)\n", map, va, ftype); | | 373 | printf("vm_fault(%p,%lx,%d)\n", map, va, ftype); |
374 | #endif | | 374 | #endif |
375 | | | 375 | |
376 | pcb->pcb_onfault = NULL; | | 376 | pcb->pcb_onfault = NULL; |
377 | rv = uvm_fault(map, va, ftype); | | 377 | rv = uvm_fault(map, va, ftype); |
378 | pcb->pcb_onfault = onfault; | | 378 | pcb->pcb_onfault = onfault; |
379 | | | 379 | |
380 | #ifdef DEBUG | | 380 | #ifdef DEBUG |