Annotation of sys/arch/hp300/hp300/trap.c, Revision 1.1
1.1 ! nbrk 1: /* $OpenBSD: trap.c,v 1.52 2007/05/15 13:46:22 martin Exp $ */
! 2: /* $NetBSD: trap.c,v 1.57 1998/02/16 20:58:31 thorpej Exp $ */
! 3:
! 4: /*
! 5: * Copyright (c) 1997 Theo de Raadt
! 6: *
! 7: * Redistribution and use in source and binary forms, with or without
! 8: * modification, are permitted provided that the following conditions
! 9: * are met:
! 10: * 1. Redistributions of source code must retain the above copyright
! 11: * notice, this list of conditions and the following disclaimer.
! 12: * 2. Redistributions in binary form must reproduce the above copyright
! 13: * notice, this list of conditions and the following disclaimer in the
! 14: * documentation and/or other materials provided with the distribution.
! 15: *
! 16: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
! 17: * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
! 18: * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
! 19: * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
! 20: * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
! 21: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
! 22: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
! 23: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
! 24: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
! 25: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
! 26: * SUCH DAMAGE.
! 27: *
! 28: * Copyright (c) 1988 University of Utah.
! 29: * Copyright (c) 1982, 1986, 1990, 1993
! 30: * The Regents of the University of California. All rights reserved.
! 31: *
! 32: * This code is derived from software contributed to Berkeley by
! 33: * the Systems Programming Group of the University of Utah Computer
! 34: * Science Department.
! 35: *
! 36: * Redistribution and use in source and binary forms, with or without
! 37: * modification, are permitted provided that the following conditions
! 38: * are met:
! 39: * 1. Redistributions of source code must retain the above copyright
! 40: * notice, this list of conditions and the following disclaimer.
! 41: * 2. Redistributions in binary form must reproduce the above copyright
! 42: * notice, this list of conditions and the following disclaimer in the
! 43: * documentation and/or other materials provided with the distribution.
! 44: * 3. Neither the name of the University nor the names of its contributors
! 45: * may be used to endorse or promote products derived from this software
! 46: * without specific prior written permission.
! 47: *
! 48: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
! 49: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
! 50: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
! 51: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
! 52: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
! 53: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
! 54: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
! 55: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
! 56: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
! 57: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
! 58: * SUCH DAMAGE.
! 59: *
! 60: * from: Utah $Hdr: trap.c 1.37 92/12/20$
! 61: *
! 62: * @(#)trap.c 8.5 (Berkeley) 1/4/94
! 63: */
! 64:
! 65: #include <sys/param.h>
! 66: #include <sys/systm.h>
! 67: #include <sys/proc.h>
! 68: #include <sys/acct.h>
! 69: #include <sys/kernel.h>
! 70: #include <sys/signalvar.h>
! 71: #include <sys/resourcevar.h>
! 72: #include <sys/syscall.h>
! 73: #include <sys/syslog.h>
! 74: #include <sys/user.h>
! 75: #ifdef KTRACE
! 76: #include <sys/ktrace.h>
! 77: #endif
! 78:
! 79: #include <m68k/frame.h>
! 80:
! 81: #include <machine/db_machdep.h>
! 82: #include <machine/psl.h>
! 83: #include <machine/trap.h>
! 84: #include <machine/cpu.h>
! 85: #include <machine/reg.h>
! 86: #include <machine/intr.h>
! 87:
! 88: #include "systrace.h"
! 89: #include <dev/systrace.h>
! 90:
! 91: #include <uvm/uvm_extern.h>
! 92: #include <uvm/uvm_pmap.h>
! 93:
! 94: #include <dev/cons.h>
! 95:
! 96: #ifdef COMPAT_HPUX
! 97: #include <compat/hpux/hpux.h>
! 98: extern struct emul emul_hpux;
! 99: #endif
! 100:
! 101: #ifdef COMPAT_SUNOS
! 102: #include <compat/sunos/sunos_syscall.h>
! 103: extern struct emul emul_sunos;
! 104: #endif
! 105:
! 106: int writeback(struct frame *);
! 107: void trap(int type, u_int code, u_int v, struct frame frame);
! 108: void syscall(register_t code, struct frame frame);
! 109: void wb_userret(struct proc *, struct frame *);
! 110:
! 111: #ifdef DEBUG
! 112: void dumpssw(u_short);
! 113: void dumpwb(int, u_short, u_int, u_int);
! 114: #endif
! 115:
! 116: int astpending;
! 117:
! 118: char *trap_type[] = {
! 119: "Bus error",
! 120: "Address error",
! 121: "Illegal instruction",
! 122: "Zero divide",
! 123: "CHK instruction",
! 124: "TRAPV instruction",
! 125: "Privilege violation",
! 126: "Trace trap",
! 127: "MMU fault",
! 128: "SSIR trap",
! 129: "Format error",
! 130: "68881 exception",
! 131: "Coprocessor violation",
! 132: "Async system trap"
! 133: };
! 134: int trap_types = sizeof trap_type / sizeof trap_type[0];
! 135:
! 136: /*
! 137: * Size of various exception stack frames (minus the standard 8 bytes)
! 138: */
! 139: short exframesize[] = {
! 140: FMT0SIZE, /* type 0 - normal (68020/030/040/060) */
! 141: FMT1SIZE, /* type 1 - throwaway (68020/030/040) */
! 142: FMT2SIZE, /* type 2 - normal 6-word (68020/030/040/060) */
! 143: FMT3SIZE, /* type 3 - FP post-instruction (68040/060) */
! 144: FMT4SIZE, /* type 4 - access error/fp disabled (68060) */
! 145: -1, -1, /* type 5-6 - undefined */
! 146: FMT7SIZE, /* type 7 - access error (68040) */
! 147: 58, /* type 8 - bus fault (68010) */
! 148: FMT9SIZE, /* type 9 - coprocessor mid-instruction (68020/030) */
! 149: FMTASIZE, /* type A - short bus fault (68020/030) */
! 150: FMTBSIZE, /* type B - long bus fault (68020/030) */
! 151: -1, -1, -1, -1 /* type C-F - undefined */
! 152: };
! 153:
! 154: #ifdef M68060
! 155: #define KDFAULT_060(c) (cputype == CPU_68060 && ((c) & FSLW_TM_SV))
! 156: #define WRFAULT_060(c) (cputype == CPU_68060 && ((c) & FSLW_RW_W))
! 157: #else
! 158: #define KDFAULT_060(c) 0
! 159: #define WRFAULT_060(c) 0
! 160: #endif
! 161:
! 162: #ifdef M68040
! 163: #define KDFAULT_040(c) (cputype == CPU_68040 && \
! 164: ((c) & SSW4_TMMASK) == SSW4_TMKD)
! 165: #define WRFAULT_040(c) (cputype == CPU_68040 && \
! 166: ((c) & SSW4_RW) == 0)
! 167: #else
! 168: #define KDFAULT_040(c) 0
! 169: #define WRFAULT_040(c) 0
! 170: #endif
! 171:
! 172: #if defined(M68030) || defined(M68020)
! 173: #define KDFAULT_OTH(c) (cputype <= CPU_68030 && \
! 174: ((c) & (SSW_DF|SSW_FCMASK)) == (SSW_DF|FC_SUPERD))
! 175: #define WRFAULT_OTH(c) (cputype <= CPU_68030 && \
! 176: ((c) & (SSW_DF|SSW_RW)) == SSW_DF)
! 177: #else
! 178: #define KDFAULT_OTH(c) 0
! 179: #define WRFAULT_OTH(c) 0
! 180: #endif
! 181:
! 182: #define KDFAULT(c) (KDFAULT_060(c) || KDFAULT_040(c) || KDFAULT_OTH(c))
! 183: #define WRFAULT(c) (WRFAULT_060(c) || WRFAULT_040(c) || WRFAULT_OTH(c))
! 184:
! 185: #ifdef DEBUG
! 186: int mmudebug = 0;
! 187: int mmupid = -1;
! 188: #define MDB_FOLLOW 1
! 189: #define MDB_WBFOLLOW 2
! 190: #define MDB_WBFAILED 4
! 191: #define MDB_ISPID(p) ((p) == mmupid)
! 192: #endif
! 193:
! 194: /*
! 195: * trap and syscall both need the following work done before returning
! 196: * to user mode.
! 197: */
! 198: void
! 199: userret(struct proc *p)
! 200: {
! 201: int sig;
! 202:
! 203: /* take pending signals */
! 204: while ((sig = CURSIG(p)) != 0)
! 205: postsig(sig);
! 206: curcpu()->ci_schedstate.spc_curpriority = p->p_priority = p->p_usrpri;
! 207: }
! 208:
! 209: #ifdef M68040
! 210: /*
! 211: * Same as above, but also handles writeback completion on 68040.
! 212: */
! 213: void
! 214: wb_userret(struct proc *p, struct frame *fp)
! 215: {
! 216: int sig;
! 217: union sigval sv;
! 218:
! 219: /* take pending signals */
! 220: while ((sig = CURSIG(p)) != 0)
! 221: postsig(sig);
! 222: p->p_priority = p->p_usrpri;
! 223:
! 224: /*
! 225: * Deal with user mode writebacks (from trap, or from sigreturn).
! 226: * If any writeback fails, go back and attempt signal delivery.
! 227: * unless we have already been here and attempted the writeback
! 228: * (e.g. bad address with user ignoring SIGSEGV). In that case
! 229: * we just return to the user without successfully completing
! 230: * the writebacks. Maybe we should just drop the sucker?
! 231: */
! 232: if (cputype == CPU_68040 && fp->f_format == FMT7) {
! 233: if ((sig = writeback(fp)) != 0) {
! 234: sv.sival_ptr = (caddr_t)fp->f_fmt7.f_fa;
! 235: trapsignal(p, sig, T_MMUFLT, SEGV_MAPERR, sv);
! 236:
! 237: while ((sig = CURSIG(p)) != 0)
! 238: postsig(sig);
! 239: p->p_priority = p->p_usrpri;
! 240: }
! 241: }
! 242: curcpu()->ci_schedstate.spc_curpriority = p->p_priority;
! 243: }
! 244: #endif
! 245:
! 246: /*
! 247: * Trap is called from locore to handle most types of processor traps,
! 248: * including events such as simulated software interrupts/AST's.
! 249: * System calls are broken out for efficiency.
! 250: */
! 251: /*ARGSUSED*/
! 252: void
! 253: trap(type, code, v, frame)
! 254: int type;
! 255: unsigned code;
! 256: unsigned v;
! 257: struct frame frame;
! 258: {
! 259: struct proc *p;
! 260: int i, s;
! 261: u_int ucode;
! 262: int typ = 0;
! 263: union sigval sv;
! 264:
! 265: uvmexp.traps++;
! 266: p = curproc;
! 267: ucode = 0;
! 268:
! 269: /* I have verified that this DOES happen! -gwr */
! 270: if (p == NULL)
! 271: p = &proc0;
! 272: #ifdef DIAGNOSTIC
! 273: if (p->p_addr == NULL)
! 274: panic("trap: no pcb");
! 275: #endif
! 276:
! 277: if (USERMODE(frame.f_sr)) {
! 278: type |= T_USER;
! 279: p->p_md.md_regs = frame.f_regs;
! 280: }
! 281: switch (type) {
! 282:
! 283: default:
! 284: dopanic:
! 285: printf("trap type %d, code = 0x%x, v = 0x%x\n", type, code, v);
! 286: printf("%s program counter = 0x%x\n",
! 287: (type & T_USER) ? "user" : "kernel", frame.f_pc);
! 288: /*
! 289: * Let the kernel debugger see the trap frame that
! 290: * caused us to panic. This is a convenience so
! 291: * one can see registers at the point of failure.
! 292: */
! 293: s = splhigh();
! 294: #ifdef KGDB
! 295: /* If connected, step or cont returns 1 */
! 296: if (kgdb_trap(type, &frame))
! 297: goto kgdb_cont;
! 298: #endif
! 299: #ifdef DDB
! 300: (void)kdb_trap(type, (db_regs_t *)&frame);
! 301: #endif
! 302: #ifdef KGDB
! 303: kgdb_cont:
! 304: #endif
! 305: splx(s);
! 306: if (panicstr) {
! 307: printf("trap during panic!\n");
! 308: #ifdef DEBUG
! 309: /* XXX should be a machine-dependent hook */
! 310: printf("(press a key)\n"); (void)cngetc();
! 311: #endif
! 312: }
! 313: regdump(&(frame.F_t), 128);
! 314: type &= ~T_USER;
! 315: if ((u_int)type < trap_types)
! 316: panic(trap_type[type]);
! 317: panic("trap");
! 318:
! 319: case T_BUSERR: /* kernel bus error */
! 320: if (p->p_addr->u_pcb.pcb_onfault == 0)
! 321: goto dopanic;
! 322: /* FALLTHROUGH */
! 323:
! 324: copyfault:
! 325: /*
! 326: * If we have arranged to catch this fault in any of the
! 327: * copy to/from user space routines, set PC to return to
! 328: * indicated location and set flag informing buserror code
! 329: * that it may need to clean up stack frame.
! 330: */
! 331: frame.f_stackadj = exframesize[frame.f_format];
! 332: frame.f_format = frame.f_vector = 0;
! 333: frame.f_pc = (int) p->p_addr->u_pcb.pcb_onfault;
! 334: return;
! 335:
! 336: case T_BUSERR|T_USER: /* bus error */
! 337: typ = BUS_OBJERR;
! 338: ucode = code & ~T_USER;
! 339: i = SIGBUS;
! 340: break;
! 341: case T_ADDRERR|T_USER: /* address error */
! 342: typ = BUS_ADRALN;
! 343: ucode = code & ~T_USER;
! 344: i = SIGBUS;
! 345: break;
! 346:
! 347: case T_COPERR: /* kernel coprocessor violation */
! 348: case T_FMTERR|T_USER: /* do all RTE errors come in as T_USER? */
! 349: case T_FMTERR: /* ...just in case... */
! 350: /*
! 351: * The user has most likely trashed the RTE or FP state info
! 352: * in the stack frame of a signal handler.
! 353: */
! 354: printf("pid %d: kernel %s exception\n", p->p_pid,
! 355: type==T_COPERR ? "coprocessor" : "format");
! 356: type |= T_USER;
! 357: p->p_sigacts->ps_sigact[SIGILL] = SIG_DFL;
! 358: i = sigmask(SIGILL);
! 359: p->p_sigignore &= ~i;
! 360: p->p_sigcatch &= ~i;
! 361: p->p_sigmask &= ~i;
! 362: i = SIGILL;
! 363: ucode = frame.f_format; /* XXX was ILL_RESAD_FAULT */
! 364: typ = ILL_COPROC;
! 365: v = frame.f_pc;
! 366: break;
! 367:
! 368: case T_COPERR|T_USER: /* user coprocessor violation */
! 369: /* What is a proper response here? */
! 370: typ = FPE_FLTINV;
! 371: ucode = 0;
! 372: i = SIGFPE;
! 373: break;
! 374:
! 375: case T_FPERR|T_USER: /* 68881 exceptions */
! 376: /*
! 377: * We pass along the 68881 status which locore stashed
! 378: * in code for us. Note that there is a possibility that the
! 379: * bit pattern of this will conflict with one of the
! 380: * FPE_* codes defined in signal.h. Fortunately for us, the
! 381: * only such codes we use are all in the range 1-7 and the low
! 382: * 3 bits of the status are defined as 0 so there is
! 383: * no clash.
! 384: */
! 385: typ = FPE_FLTRES;
! 386: ucode = code;
! 387: i = SIGFPE;
! 388: v = frame.f_pc;
! 389: break;
! 390:
! 391: #ifdef M68040
! 392: case T_FPEMULI|T_USER: /* unimplemented FP instruction */
! 393: case T_FPEMULD|T_USER: /* unimplemented FP data type */
! 394: /* XXX need to FSAVE */
! 395: printf("pid %d(%s): unimplemented FP %s at %x (EA %x)\n",
! 396: p->p_pid, p->p_comm,
! 397: frame.f_format == 2 ? "instruction" : "data type",
! 398: frame.f_pc, frame.f_fmt2.f_iaddr);
! 399: /* XXX need to FRESTORE */
! 400: typ = FPE_FLTINV;
! 401: i = SIGFPE;
! 402: v = frame.f_pc;
! 403: break;
! 404: #endif
! 405:
! 406: case T_ILLINST|T_USER: /* illegal instruction fault */
! 407: #ifdef COMPAT_HPUX
! 408: if (p->p_emul == &emul_hpux) {
! 409: typ = 0;
! 410: ucode = HPUX_ILL_ILLINST_TRAP;
! 411: i = SIGILL;
! 412: break;
! 413: }
! 414: #endif
! 415: ucode = frame.f_format; /* XXX was ILL_PRIVIN_FAULT */
! 416: typ = ILL_ILLOPC;
! 417: i = SIGILL;
! 418: v = frame.f_pc;
! 419: break;
! 420:
! 421: case T_PRIVINST|T_USER: /* privileged instruction fault */
! 422: #ifdef COMPAT_HPUX
! 423: if (p->p_emul == &emul_hpux)
! 424: ucode = HPUX_ILL_PRIV_TRAP;
! 425: else
! 426: #endif
! 427: ucode = frame.f_format; /* XXX was ILL_PRIVIN_FAULT */
! 428: typ = ILL_PRVOPC;
! 429: i = SIGILL;
! 430: v = frame.f_pc;
! 431: break;
! 432:
! 433: case T_ZERODIV|T_USER: /* Divide by zero */
! 434: #ifdef COMPAT_HPUX
! 435: if (p->p_emul == &emul_hpux)
! 436: ucode = HPUX_FPE_INTDIV_TRAP;
! 437: else
! 438: #endif
! 439: ucode = frame.f_format; /* XXX was FPE_INTDIV_TRAP */
! 440: typ = FPE_INTDIV;
! 441: i = SIGFPE;
! 442: v = frame.f_pc;
! 443: break;
! 444:
! 445: case T_CHKINST|T_USER: /* CHK instruction trap */
! 446: #ifdef COMPAT_HPUX
! 447: if (p->p_emul == &emul_hpux) {
! 448: /* handled differently under hp-ux */
! 449: i = SIGILL;
! 450: ucode = HPUX_ILL_CHK_TRAP;
! 451: break;
! 452: }
! 453: #endif
! 454: ucode = frame.f_format; /* XXX was FPE_SUBRNG_TRAP */
! 455: typ = FPE_FLTSUB;
! 456: i = SIGFPE;
! 457: v = frame.f_pc;
! 458: break;
! 459:
! 460: case T_TRAPVINST|T_USER: /* TRAPV instruction trap */
! 461: #ifdef COMPAT_HPUX
! 462: if (p->p_emul == &emul_hpux) {
! 463: /* handled differently under hp-ux */
! 464: i = SIGILL;
! 465: ucode = HPUX_ILL_TRAPV_TRAP;
! 466: break;
! 467: }
! 468: #endif
! 469: ucode = frame.f_format; /* XXX was FPE_INTOVF_TRAP */
! 470: typ = ILL_ILLTRP;
! 471: i = SIGILL;
! 472: v = frame.f_pc;
! 473: break;
! 474:
! 475: /*
! 476: * XXX: Trace traps are a nightmare.
! 477: *
! 478: * HP-UX uses trap #1 for breakpoints,
! 479: * OpenBSD/m68k uses trap #2,
! 480: * SUN 3.x uses trap #15,
! 481: * DDB and KGDB uses trap #15 (for kernel breakpoints;
! 482: * handled elsewhere).
! 483: *
! 484: * OpenBSD and HP-UX traps both get mapped by locore.s into T_TRACE.
! 485: * SUN 3.x traps get passed through as T_TRAP15 and are not really
! 486: * supported yet.
! 487: *
! 488: * XXX: We should never get kernel-mode T_TRAP15
! 489: * XXX: because locore.s now gives them special treatment.
! 490: */
! 491: case T_TRAP15: /* kernel breakpoint */
! 492: #ifdef DEBUG
! 493: printf("unexpected kernel trace trap, type = %d\n", type);
! 494: printf("program counter = 0x%x\n", frame.f_pc);
! 495: #endif
! 496: frame.f_sr &= ~PSL_T;
! 497: return;
! 498:
! 499: case T_TRACE|T_USER: /* user trace trap */
! 500: #ifdef COMPAT_SUNOS
! 501: /*
! 502: * SunOS uses Trap #2 for a "CPU cache flush".
! 503: * Just flush the on-chip caches and return.
! 504: */
! 505: if (p->p_emul == &emul_sunos) {
! 506: ICIA();
! 507: DCIU();
! 508: return;
! 509: }
! 510: #endif
! 511: /* FALLTHROUGH */
! 512: case T_TRACE: /* tracing a trap instruction */
! 513: case T_TRAP15|T_USER: /* SUN user trace trap */
! 514: frame.f_sr &= ~PSL_T;
! 515: i = SIGTRAP;
! 516: typ = TRAP_TRACE;
! 517: break;
! 518:
! 519: case T_ASTFLT: /* system async trap, cannot happen */
! 520: goto dopanic;
! 521:
! 522: case T_ASTFLT|T_USER: /* user async trap */
! 523: astpending = 0;
! 524: /*
! 525: * We check for software interrupts first. This is because
! 526: * they are at a higher level than ASTs, and on a VAX would
! 527: * interrupt the AST. We assume that if we are processing
! 528: * an AST that we must be at IPL0 so we don't bother to
! 529: * check. Note that we ensure that we are at least at SIR
! 530: * IPL while processing the SIR.
! 531: */
! 532: splsoft();
! 533: /* FALLTHROUGH */
! 534:
! 535: case T_SSIR: /* software interrupt */
! 536: case T_SSIR|T_USER:
! 537: if (ssir & SIR_NET) {
! 538: void netintr(void);
! 539: siroff(SIR_NET);
! 540: uvmexp.softs++;
! 541: netintr();
! 542: }
! 543: if (ssir & SIR_CLOCK) {
! 544: siroff(SIR_CLOCK);
! 545: uvmexp.softs++;
! 546: softclock();
! 547: }
! 548: /*
! 549: * If this was not an AST trap, we are all done.
! 550: */
! 551: if (type != (T_ASTFLT|T_USER)) {
! 552: uvmexp.traps--;
! 553: return;
! 554: }
! 555: spl0();
! 556: if (p->p_flag & P_OWEUPC) {
! 557: ADDUPROF(p);
! 558: }
! 559: if (type == (T_ASTFLT | T_USER) && want_resched) {
! 560: preempt(NULL);
! 561: }
! 562: goto out;
! 563:
! 564: case T_MMUFLT: /* kernel mode page fault */
! 565: case T_MMUFLT|T_USER: /* page fault */
! 566: {
! 567: vaddr_t va;
! 568: struct vmspace *vm = p->p_vmspace;
! 569: struct vm_map *map;
! 570: int rv;
! 571: vm_prot_t ftype, vftype;
! 572: extern struct vm_map *kernel_map;
! 573:
! 574: #ifdef DEBUG
! 575: if ((mmudebug & MDB_WBFOLLOW) || MDB_ISPID(p->p_pid))
! 576: printf("trap: T_MMUFLT pid=%d, code=%x, v=%x, pc=%x, sr=%x\n",
! 577: p->p_pid, code, v, frame.f_pc, frame.f_sr);
! 578: #endif
! 579: /*
! 580: * It is only a kernel address space fault iff:
! 581: * 1. (type & T_USER) == 0 and
! 582: * 2. pcb_onfault not set or
! 583: * 3. pcb_onfault set but supervisor space data fault
! 584: * The last can occur during an exec() copyin where the
! 585: * argument space is lazy-allocated.
! 586: */
! 587: if ((type & T_USER) == 0 &&
! 588: ((p->p_addr->u_pcb.pcb_onfault == 0) || KDFAULT(code)))
! 589: map = kernel_map;
! 590: else
! 591: map = vm ? &vm->vm_map : kernel_map;
! 592:
! 593: if (WRFAULT(code)) {
! 594: vftype = VM_PROT_WRITE;
! 595: ftype = VM_PROT_READ | VM_PROT_WRITE;
! 596: } else
! 597: vftype = ftype = VM_PROT_READ;
! 598:
! 599: va = trunc_page((vaddr_t)v);
! 600:
! 601: if (map == kernel_map && va == 0) {
! 602: printf("trap: bad kernel %s access at 0x%x\n",
! 603: (ftype & VM_PROT_WRITE) ? "read/write" :
! 604: "read", v);
! 605: goto dopanic;
! 606: }
! 607:
! 608: #ifdef COMPAT_HPUX
! 609: if (ISHPMMADDR(p, va)) {
! 610: int pmap_mapmulti(pmap_t, vaddr_t);
! 611: vaddr_t bva;
! 612:
! 613: rv = pmap_mapmulti(map->pmap, va);
! 614: if (rv) {
! 615: bva = HPMMBASEADDR(va);
! 616: rv = uvm_fault(map, bva, 0, ftype);
! 617: if (rv == 0)
! 618: (void)pmap_mapmulti(map->pmap, va);
! 619: }
! 620: } else
! 621: #endif
! 622: rv = uvm_fault(map, va, 0, ftype);
! 623: #ifdef DEBUG
! 624: if (rv && MDB_ISPID(p->p_pid))
! 625: printf("uvm_fault(%p, 0x%lx, 0, 0x%x) -> 0x%x\n",
! 626: map, va, ftype, rv);
! 627: #endif
! 628: /*
! 629: * If this was a stack access we keep track of the maximum
! 630: * accessed stack size. Also, if vm_fault gets a protection
! 631: * failure it is due to accessing the stack region outside
! 632: * the current limit and we need to reflect that as an access
! 633: * error.
! 634: */
! 635: if ((vm != NULL && (caddr_t)va >= vm->vm_maxsaddr)
! 636: && map != kernel_map) {
! 637: if (rv == 0) {
! 638: uvm_grow(p, va);
! 639: } else if (rv == EACCES)
! 640: rv = EFAULT;
! 641: }
! 642: if (rv == 0) {
! 643: if (type == T_MMUFLT) {
! 644: #ifdef M68040
! 645: if (cputype == CPU_68040)
! 646: (void)writeback(&frame);
! 647: #endif
! 648: return;
! 649: }
! 650: goto out;
! 651: }
! 652: if (type == T_MMUFLT) {
! 653: if (p->p_addr->u_pcb.pcb_onfault)
! 654: goto copyfault;
! 655: printf("uvm_fault(%p, 0x%lx, 0, 0x%x) -> 0x%x\n",
! 656: map, va, ftype, rv);
! 657: printf(" type %x, code [mmu,,ssw]: %x\n",
! 658: type, code);
! 659: goto dopanic;
! 660: }
! 661: frame.f_pad = code & 0xffff;
! 662: ucode = vftype;
! 663: typ = SEGV_MAPERR;
! 664: i = SIGSEGV;
! 665: break;
! 666: }
! 667: }
! 668: sv.sival_ptr = (caddr_t)v;
! 669: trapsignal(p, i, ucode, typ, sv);
! 670: out:
! 671: if ((type & T_USER) == 0)
! 672: return;
! 673: #ifdef M68040
! 674: wb_userret(p, &frame);
! 675: #else
! 676: userret(p);
! 677: #endif
! 678: }
! 679:
! 680: #ifdef M68040
! 681: #ifdef DEBUG
! 682: struct writebackstats {
! 683: int calls;
! 684: int cpushes;
! 685: int move16s;
! 686: int wb1s, wb2s, wb3s;
! 687: int wbsize[4];
! 688: } wbstats;
! 689:
! 690: char *f7sz[] = { "longword", "byte", "word", "line" };
! 691: char *f7tt[] = { "normal", "MOVE16", "AFC", "ACK" };
! 692: char *f7tm[] = { "d-push", "u-data", "u-code", "M-data",
! 693: "M-code", "k-data", "k-code", "RES" };
! 694: char wberrstr[] =
! 695: "WARNING: pid %d(%s) writeback [%s] failed, pc=%x fa=%x wba=%x wbd=%x\n";
! 696: #endif
! 697:
! 698: int
! 699: writeback(struct frame *fp)
! 700: {
! 701: struct fmt7 *f = &fp->f_fmt7;
! 702: struct proc *p = curproc;
! 703: int err = 0;
! 704: u_int fa;
! 705: paddr_t pa;
! 706: caddr_t oonfault = p->p_addr->u_pcb.pcb_onfault;
! 707:
! 708: #ifdef DEBUG
! 709: if ((mmudebug & MDB_WBFOLLOW) || MDB_ISPID(p->p_pid)) {
! 710: printf(" pid=%d, fa=%x,", p->p_pid, f->f_fa);
! 711: dumpssw(f->f_ssw);
! 712: }
! 713: wbstats.calls++;
! 714: #endif
! 715: /*
! 716: * Deal with special cases first.
! 717: */
! 718: if ((f->f_ssw & SSW4_TMMASK) == SSW4_TMDCP) {
! 719: /*
! 720: * Dcache push fault.
! 721: * Line-align the address and write out the push data to
! 722: * the indicated physical address.
! 723: */
! 724: #ifdef DEBUG
! 725: if ((mmudebug & MDB_WBFOLLOW) || MDB_ISPID(p->p_pid)) {
! 726: printf(" pushing %s to PA %x, data %x",
! 727: f7sz[(f->f_ssw & SSW4_SZMASK) >> 5],
! 728: f->f_fa, f->f_pd0);
! 729: if ((f->f_ssw & SSW4_SZMASK) == SSW4_SZLN)
! 730: printf("/%x/%x/%x",
! 731: f->f_pd1, f->f_pd2, f->f_pd3);
! 732: printf("\n");
! 733: }
! 734: if (f->f_wb1s & SSW4_WBSV)
! 735: panic("writeback: cache push with WB1S valid");
! 736: wbstats.cpushes++;
! 737: #endif
! 738: /*
! 739: * XXX there are security problems if we attempt to do a
! 740: * cache push after a signal handler has been called.
! 741: */
! 742: pmap_kenter_pa((vaddr_t)vmmap,
! 743: trunc_page((vaddr_t)f->f_fa), VM_PROT_WRITE);
! 744: pmap_update(pmap_kernel());
! 745: fa = (u_int)&vmmap[(f->f_fa & PGOFSET) & ~0x000f];
! 746: bcopy((caddr_t)&f->f_pd0, (caddr_t)fa, 16);
! 747: pmap_extract(pmap_kernel(), (vaddr_t)fa, &pa);
! 748: DCFL(pa);
! 749: pmap_kremove((vaddr_t)vmmap, PAGE_SIZE);
! 750: pmap_update(pmap_kernel());
! 751: } else if ((f->f_ssw & (SSW4_RW|SSW4_TTMASK)) == SSW4_TTM16) {
! 752: /*
! 753: * MOVE16 fault.
! 754: * Line-align the address and write out the push data to
! 755: * the indicated virtual address.
! 756: */
! 757: #ifdef DEBUG
! 758: if ((mmudebug & MDB_WBFOLLOW) || MDB_ISPID(p->p_pid))
! 759: printf(" MOVE16 to VA %x(%x), data %x/%x/%x/%x\n",
! 760: f->f_fa, f->f_fa & ~0xF, f->f_pd0, f->f_pd1,
! 761: f->f_pd2, f->f_pd3);
! 762: if (f->f_wb1s & SSW4_WBSV)
! 763: panic("writeback: MOVE16 with WB1S valid");
! 764: wbstats.move16s++;
! 765: #endif
! 766: if (KDFAULT(f->f_wb1s))
! 767: bcopy((caddr_t)&f->f_pd0, (caddr_t)(f->f_fa & ~0xF), 16);
! 768: else
! 769: err = suline((caddr_t)(f->f_fa & ~0xF), (caddr_t)&f->f_pd0);
! 770: if (err) {
! 771: fa = f->f_fa & ~0xF;
! 772: #ifdef DEBUG
! 773: if (mmudebug & MDB_WBFAILED)
! 774: printf(wberrstr, p->p_pid, p->p_comm,
! 775: "MOVE16", fp->f_pc, f->f_fa,
! 776: f->f_fa & ~0xF, f->f_pd0);
! 777: #endif
! 778: }
! 779: } else if (f->f_wb1s & SSW4_WBSV) {
! 780: /*
! 781: * Writeback #1.
! 782: * Position the "memory-aligned" data and write it out.
! 783: */
! 784: u_int wb1d = f->f_wb1d;
! 785: int off;
! 786:
! 787: #ifdef DEBUG
! 788: if ((mmudebug & MDB_WBFOLLOW) || MDB_ISPID(p->p_pid))
! 789: dumpwb(1, f->f_wb1s, f->f_wb1a, f->f_wb1d);
! 790: wbstats.wb1s++;
! 791: wbstats.wbsize[(f->f_wb2s&SSW4_SZMASK)>>5]++;
! 792: #endif
! 793: off = (f->f_wb1a & 3) * 8;
! 794: switch (f->f_wb1s & SSW4_SZMASK) {
! 795: case SSW4_SZLW:
! 796: if (off)
! 797: wb1d = (wb1d >> (32 - off)) | (wb1d << off);
! 798: if (KDFAULT(f->f_wb1s))
! 799: *(long *)f->f_wb1a = wb1d;
! 800: else
! 801: err = copyout(&wb1d, (caddr_t)f->f_wb1a,
! 802: sizeof(int));
! 803: break;
! 804: case SSW4_SZB:
! 805: off = 24 - off;
! 806: if (off)
! 807: wb1d >>= off;
! 808: if (KDFAULT(f->f_wb1s))
! 809: *(char *)f->f_wb1a = wb1d;
! 810: else {
! 811: char tmp = wb1d;
! 812:
! 813: err = copyout(&tmp, (caddr_t)f->f_wb1a,
! 814: sizeof(char));
! 815: }
! 816: break;
! 817: case SSW4_SZW:
! 818: off = (off + 16) % 32;
! 819: if (off)
! 820: wb1d = (wb1d >> (32 - off)) | (wb1d << off);
! 821: if (KDFAULT(f->f_wb1s))
! 822: *(short *)f->f_wb1a = wb1d;
! 823: else {
! 824: short tmp = wb1d;
! 825:
! 826: err = copyout(&tmp, (caddr_t)f->f_wb1a,
! 827: sizeof(short));
! 828: }
! 829: break;
! 830: }
! 831: if (err) {
! 832: fa = f->f_wb1a;
! 833: #ifdef DEBUG
! 834: if (mmudebug & MDB_WBFAILED)
! 835: printf(wberrstr, p->p_pid, p->p_comm,
! 836: "#1", fp->f_pc, f->f_fa,
! 837: f->f_wb1a, f->f_wb1d);
! 838: #endif
! 839: }
! 840: }
! 841: /*
! 842: * Deal with the "normal" writebacks.
! 843: *
! 844: * XXX writeback2 is known to reflect a LINE size writeback after
! 845: * a MOVE16 was already dealt with above. Ignore it.
! 846: */
! 847: if (err == 0 && (f->f_wb2s & SSW4_WBSV) &&
! 848: (f->f_wb2s & SSW4_SZMASK) != SSW4_SZLN) {
! 849: #ifdef DEBUG
! 850: if ((mmudebug & MDB_WBFOLLOW) || MDB_ISPID(p->p_pid))
! 851: dumpwb(2, f->f_wb2s, f->f_wb2a, f->f_wb2d);
! 852: wbstats.wb2s++;
! 853: wbstats.wbsize[(f->f_wb2s&SSW4_SZMASK)>>5]++;
! 854: #endif
! 855: switch (f->f_wb2s & SSW4_SZMASK) {
! 856: case SSW4_SZLW:
! 857: if (KDFAULT(f->f_wb2s))
! 858: *(long *)f->f_wb2a = f->f_wb2d;
! 859: else
! 860: err = copyout(&f->f_wb2d, (caddr_t)f->f_wb2a,
! 861: sizeof(int));
! 862: break;
! 863: case SSW4_SZB:
! 864: if (KDFAULT(f->f_wb2s))
! 865: *(char *)f->f_wb2a = f->f_wb2d;
! 866: else {
! 867: char tmp = f->f_wb2d;
! 868:
! 869: err = copyout(&tmp, (caddr_t)f->f_wb2a,
! 870: sizeof(char));
! 871: }
! 872: break;
! 873: case SSW4_SZW:
! 874: if (KDFAULT(f->f_wb2s))
! 875: *(short *)f->f_wb2a = f->f_wb2d;
! 876: else {
! 877: short tmp = f->f_wb2d;
! 878:
! 879: err = copyout(&tmp, (caddr_t)f->f_wb2a,
! 880: sizeof(short));
! 881: }
! 882: break;
! 883: }
! 884: if (err) {
! 885: fa = f->f_wb2a;
! 886: #ifdef DEBUG
! 887: if (mmudebug & MDB_WBFAILED) {
! 888: printf(wberrstr, p->p_pid, p->p_comm,
! 889: "#2", fp->f_pc, f->f_fa,
! 890: f->f_wb2a, f->f_wb2d);
! 891: dumpssw(f->f_ssw);
! 892: dumpwb(2, f->f_wb2s, f->f_wb2a, f->f_wb2d);
! 893: }
! 894: #endif
! 895: }
! 896: }
! 897: if (err == 0 && (f->f_wb3s & SSW4_WBSV)) {
! 898: #ifdef DEBUG
! 899: if ((mmudebug & MDB_WBFOLLOW) || MDB_ISPID(p->p_pid))
! 900: dumpwb(3, f->f_wb3s, f->f_wb3a, f->f_wb3d);
! 901: wbstats.wb3s++;
! 902: wbstats.wbsize[(f->f_wb3s&SSW4_SZMASK)>>5]++;
! 903: #endif
! 904: switch (f->f_wb3s & SSW4_SZMASK) {
! 905: case SSW4_SZLW:
! 906: if (KDFAULT(f->f_wb3s))
! 907: *(long *)f->f_wb3a = f->f_wb3d;
! 908: else
! 909: err = copyout(&f->f_wb3d, (caddr_t)f->f_wb3a,
! 910: sizeof(int));
! 911: break;
! 912: case SSW4_SZB:
! 913: if (KDFAULT(f->f_wb3s))
! 914: *(char *)f->f_wb3a = f->f_wb3d;
! 915: else {
! 916: char tmp = f->f_wb3d;
! 917:
! 918: err = copyout(&tmp, (caddr_t)f->f_wb3a,
! 919: sizeof(char));
! 920: }
! 921: break;
! 922: case SSW4_SZW:
! 923: if (KDFAULT(f->f_wb3s))
! 924: *(short *)f->f_wb3a = f->f_wb3d;
! 925: else {
! 926: short tmp = f->f_wb3d;
! 927:
! 928: err = copyout(&tmp, (caddr_t)f->f_wb3a,
! 929: sizeof(short));
! 930: }
! 931: break;
! 932: #ifdef DEBUG
! 933: case SSW4_SZLN:
! 934: panic("writeback: wb3s indicates LINE write");
! 935: #endif
! 936: }
! 937: if (err) {
! 938: fa = f->f_wb3a;
! 939: #ifdef DEBUG
! 940: if (mmudebug & MDB_WBFAILED)
! 941: printf(wberrstr, p->p_pid, p->p_comm,
! 942: "#3", fp->f_pc, f->f_fa,
! 943: f->f_wb3a, f->f_wb3d);
! 944: #endif
! 945: }
! 946: }
! 947: p->p_addr->u_pcb.pcb_onfault = oonfault;
! 948: /*
! 949: * Any problems are SIGSEGV's
! 950: */
! 951: if (err)
! 952: err = SIGSEGV;
! 953: return(err);
! 954: }
! 955:
! 956: #ifdef DEBUG
! 957: void
! 958: dumpssw(ssw)
! 959: u_short ssw;
! 960: {
! 961: printf(" SSW: %x: ", ssw);
! 962: if (ssw & SSW4_CP)
! 963: printf("CP,");
! 964: if (ssw & SSW4_CU)
! 965: printf("CU,");
! 966: if (ssw & SSW4_CT)
! 967: printf("CT,");
! 968: if (ssw & SSW4_CM)
! 969: printf("CM,");
! 970: if (ssw & SSW4_MA)
! 971: printf("MA,");
! 972: if (ssw & SSW4_ATC)
! 973: printf("ATC,");
! 974: if (ssw & SSW4_LK)
! 975: printf("LK,");
! 976: if (ssw & SSW4_RW)
! 977: printf("RW,");
! 978: printf(" SZ=%s, TT=%s, TM=%s\n",
! 979: f7sz[(ssw & SSW4_SZMASK) >> 5],
! 980: f7tt[(ssw & SSW4_TTMASK) >> 3],
! 981: f7tm[ssw & SSW4_TMMASK]);
! 982: }
! 983:
! 984: void
! 985: dumpwb(num, s, a, d)
! 986: int num;
! 987: u_short s;
! 988: u_int a, d;
! 989: {
! 990: struct proc *p = curproc;
! 991: paddr_t pa;
! 992: int tmp;
! 993:
! 994: printf(" writeback #%d: VA %x, data %x, SZ=%s, TT=%s, TM=%s\n",
! 995: num, a, d, f7sz[(s & SSW4_SZMASK) >> 5],
! 996: f7tt[(s & SSW4_TTMASK) >> 3], f7tm[s & SSW4_TMMASK]);
! 997: printf(" PA ");
! 998: if (pmap_extract(p->p_vmspace->vm_map.pmap, (vaddr_t)a, &pa) == FALSE)
! 999: printf("<invalid address>");
! 1000: else {
! 1001: if (copyin((caddr_t)a, &tmp, sizeof(int)) == 0)
! 1002: printf("%lx, current value %lx", pa, tmp);
! 1003: else
! 1004: printf("%lx, current value inaccessible", pa);
! 1005: }
! 1006: printf("\n");
! 1007: }
! 1008: #endif
! 1009: #endif
! 1010:
! 1011: /*
! 1012: * Process a system call.
! 1013: */
! 1014: void
! 1015: syscall(code, frame)
! 1016: register_t code;
! 1017: struct frame frame;
! 1018: {
! 1019: caddr_t params;
! 1020: struct sysent *callp;
! 1021: struct proc *p;
! 1022: int error, opc, nsys;
! 1023: size_t argsize;
! 1024: register_t args[8], rval[2];
! 1025:
! 1026: uvmexp.syscalls++;
! 1027: if (!USERMODE(frame.f_sr))
! 1028: panic("syscall");
! 1029: p = curproc;
! 1030: p->p_md.md_regs = frame.f_regs;
! 1031: opc = frame.f_pc;
! 1032:
! 1033: nsys = p->p_emul->e_nsysent;
! 1034: callp = p->p_emul->e_sysent;
! 1035:
! 1036: #ifdef COMPAT_SUNOS
! 1037: if (p->p_emul == &emul_sunos) {
! 1038: /*
! 1039: * SunOS passes the syscall-number on the stack, whereas
! 1040: * BSD passes it in D0. So, we have to get the real "code"
! 1041: * from the stack, and clean up the stack, as SunOS glue
! 1042: * code assumes the kernel pops the syscall argument the
! 1043: * glue pushed on the stack. Sigh...
! 1044: */
! 1045: if (copyin((caddr_t)frame.f_regs[SP], &code,
! 1046: sizeof(register_t)) != 0)
! 1047: code = -1;
! 1048:
! 1049: /*
! 1050: * XXX
! 1051: * Don't do this for sunos_sigreturn, as there's no stored pc
! 1052: * on the stack to skip, the argument follows the syscall
! 1053: * number without a gap.
! 1054: */
! 1055: if (code != SUNOS_SYS_sigreturn) {
! 1056: frame.f_regs[SP] += sizeof (int);
! 1057: /*
! 1058: * remember that we adjusted the SP,
! 1059: * might have to undo this if the system call
! 1060: * returns ERESTART.
! 1061: */
! 1062: p->p_md.md_flags |= MDP_STACKADJ;
! 1063: } else
! 1064: p->p_md.md_flags &= ~MDP_STACKADJ;
! 1065: }
! 1066: #endif
! 1067:
! 1068: params = (caddr_t)frame.f_regs[SP] + sizeof(int);
! 1069:
! 1070: switch (code) {
! 1071: case SYS_syscall:
! 1072: /*
! 1073: * Code is first argument, followed by actual args.
! 1074: */
! 1075: if (copyin(params, &code, sizeof(register_t)) != 0)
! 1076: code = -1;
! 1077: params += sizeof(int);
! 1078: /*
! 1079: * XXX sigreturn requires special stack manipulation
! 1080: * that is only done if entered via the sigreturn
! 1081: * trap. Cannot allow it here so make sure we fail.
! 1082: */
! 1083: if (code == SYS_sigreturn)
! 1084: code = nsys;
! 1085: break;
! 1086: case SYS___syscall:
! 1087: /*
! 1088: * Like syscall, but code is a quad, so as to maintain
! 1089: * quad alignment for the rest of the arguments.
! 1090: */
! 1091: if (callp != sysent)
! 1092: break;
! 1093: if (copyin(params + _QUAD_LOWWORD * sizeof(int), &code,
! 1094: sizeof(register_t)) != 0)
! 1095: code = -1;
! 1096: params += sizeof(quad_t);
! 1097: break;
! 1098: default:
! 1099: break;
! 1100: }
! 1101: if (code < 0 || code >= nsys)
! 1102: callp += p->p_emul->e_nosys; /* illegal */
! 1103: else
! 1104: callp += code;
! 1105: argsize = callp->sy_argsize;
! 1106: if (argsize)
! 1107: error = copyin(params, (caddr_t)args, argsize);
! 1108: else
! 1109: error = 0;
! 1110: #ifdef SYSCALL_DEBUG
! 1111: scdebug_call(p, code, args);
! 1112: #endif
! 1113: #ifdef KTRACE
! 1114: if (KTRPOINT(p, KTR_SYSCALL))
! 1115: ktrsyscall(p, code, argsize, args);
! 1116: #endif
! 1117: if (error)
! 1118: goto bad;
! 1119: rval[0] = 0;
! 1120: rval[1] = frame.f_regs[D1];
! 1121: #if NSYSTRACE > 0
! 1122: if (ISSET(p->p_flag, P_SYSTRACE))
! 1123: error = systrace_redirect(code, p, args, rval);
! 1124: else
! 1125: #endif
! 1126: error = (*callp->sy_call)(p, args, rval);
! 1127: switch (error) {
! 1128: case 0:
! 1129: frame.f_regs[D0] = rval[0];
! 1130: frame.f_regs[D1] = rval[1];
! 1131: frame.f_sr &= ~PSL_C; /* carry bit */
! 1132: break;
! 1133: case ERESTART:
! 1134: /*
! 1135: * We always enter through a `trap' instruction, which is 2
! 1136: * bytes, so adjust the pc by that amount.
! 1137: */
! 1138: frame.f_pc = opc - 2;
! 1139: break;
! 1140: case EJUSTRETURN:
! 1141: /* nothing to do */
! 1142: break;
! 1143: default:
! 1144: bad:
! 1145: if (p->p_emul->e_errno)
! 1146: error = p->p_emul->e_errno[error];
! 1147: frame.f_regs[D0] = error;
! 1148: frame.f_sr |= PSL_C; /* carry bit */
! 1149: break;
! 1150: }
! 1151:
! 1152: #ifdef SYSCALL_DEBUG
! 1153: scdebug_ret(p, code, error, rval);
! 1154: #endif
! 1155: #ifdef COMPAT_SUNOS
! 1156: /* need new p-value for this */
! 1157: if (error == ERESTART && (p->p_md.md_flags & MDP_STACKADJ))
! 1158: frame.f_regs[SP] -= sizeof (int);
! 1159: #endif
! 1160: userret(p);
! 1161: #ifdef KTRACE
! 1162: if (KTRPOINT(p, KTR_SYSRET))
! 1163: ktrsysret(p, code, error, rval[0]);
! 1164: #endif
! 1165: }
CVSweb