Date: Fri, 26 Oct 2001 04:33:35 -0700 (PDT) From: John Baldwin <jhb@FreeBSD.org> To: ppc@FreeBSD.org, gehicks@pacbell.net Subject: trap() and friends Message-ID: <XFMail.011026043335.jhb@FreeBSD.org>
index | next in thread | raw e-mail
[-- Attachment #1 --] I was bored last night, so I cleaned up the powerpc trap() function. I don't have anything setup to test it, but I think it should compile and handle most kernel and user faults ok. (I haven't looked at the ALI faults yet, so they always fail right now.) (This is assuming the pmap code is done, it's just the necessary changes for trap() itself.) I also think that syscalls might work now, assuming that the NetBSD code this was cribbed from worked. Since my Note that some of the assembly stuff in locore.s still needs some work. Specifically, on return from interrupts and exceptions, we need to call the ast() function instead of doing an EXC_AST fake trap. I've got some comments to that effect in the patch. There are no guarantees that this compiles, but it should be a lot closer now to the final version. http://www.FreeBSD.org/~jhb/patches/ppc.patch -- John Baldwin <jhb@FreeBSD.org> -- http://www.FreeBSD.org/~jhb/ PGP Key: http://www.baldwin.cx/~john/pgpkey.asc "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ [-- Attachment #2 --] Index: include/cpu.h =================================================================== RCS file: /usr/cvs/src/sys/powerpc/include/cpu.h,v retrieving revision 1.6 diff -u -r1.6 cpu.h --- include/cpu.h 15 Oct 2001 12:23:06 -0000 1.6 +++ include/cpu.h 19 Oct 2001 20:41:19 -0000 @@ -53,9 +53,6 @@ void delay(int); #define DELAY(n) delay(n) -extern int want_resched; -extern int astpending; - extern char bootpath[]; #if defined(_KERNEL) || defined(_STANDALONE) Index: include/trap.h =================================================================== RCS file: /usr/cvs/src/sys/powerpc/include/trap.h,v retrieving revision 1.1 diff -u -r1.1 trap.h --- include/trap.h 10 Jun 2001 02:39:28 -0000 1.1 +++ include/trap.h 26 Oct 2001 11:00:26 -0000 @@ -52,7 +52,7 @@ /* The following are only available on 604: */ #define EXC_PERF 0x0f00 /* Performance Monitoring */ #define EXC_BPT 0x1300 /* Instruction Breakpoint */ -#define EXC_SMI 0x1400 /* System Managment Interrupt */ +#define EXC_SMI 0x1400 /* System Management Interrupt */ /* And these are only on the 603: */ #define EXC_IMISS 0x1000 /* Instruction translation miss */ @@ -61,8 +61,6 @@ #define EXC_LAST 0x2f00 /* Last possible exception vector */ -#define EXC_AST 0x3000 /* Fake AST vector */ - /* Trap was in user mode */ #define EXC_USER 0x10000 @@ -87,6 +85,7 @@ #ifndef LOCORE void trap(struct trapframe *); +void syscall(struct trapframe *); #endif /* !LOCORE */ Index: powerpc/locore.s =================================================================== RCS file: /usr/cvs/src/sys/powerpc/powerpc/locore.s,v retrieving revision 1.4 diff -u -r1.4 locore.s --- powerpc/locore.s 20 Sep 2001 00:47:13 -0000 1.4 +++ powerpc/locore.s 24 Sep 2001 21:17:52 -0000 @@ -943,15 +943,11 @@ lwz 5,FRAME_SRR1+8(1) mtcr 5 bc 4,17,1f /* branch if PSL_PR is false */ - lis 3,astpending@ha - lwz 4,astpending@l(3) - andi. 4,4,1 - beq 1f #if 0 /* XXX */ li 6,EXC_AST #endif stw 6,FRAME_EXC+8(1) - b trapagain + b trapagain /* XXX: should call ast(frame ptr) */ 1: #if 0 FRAME_LEAVE(tempsave) @@ -1129,10 +1125,6 @@ lwz 3,GD_CURPCB(3) /* get curpcb from globaldata */ lwz 3,PCB_PMR(3) /* get pmap real address from curpcb */ mtsr KERNEL_SR,3 - lis 3,astpending@ha /* Test AST pending */ - lwz 4,astpending@l(3) - andi. 4,4,1 - beq 1f /* Setup for entry to realtrap: */ lwz 3,0(1) /* get saved SP */ mtsprg 1,3 @@ -1152,7 +1144,7 @@ lwz 31,intr_depth@l(30) addi 31,31,-1 stw 31,intr_depth@l(30) - b realtrap + b realtrap /* XXX: should call ast(frame ptr) */ 1: /* Here is the normal exit of extintr: */ lwz 5,36(1) Index: powerpc/trap.c =================================================================== RCS file: /usr/cvs/src/sys/powerpc/powerpc/trap.c,v retrieving revision 1.4 diff -u -r1.4 trap.c --- powerpc/trap.c 24 Sep 2001 02:58:49 -0000 1.4 +++ powerpc/trap.c 26 Oct 2001 11:24:29 -0000 @@ -63,306 +63,478 @@ #define NARGREG 8 /* 8 args are in registers */ #define MOREARGS(sp) ((caddr_t)((int)(sp) + 8)) /* more args go here */ -volatile int astpending; -volatile int want_resched; +#ifdef WITNESS +extern char *syscallnames[]; +#endif #if 0 /* XXX: not used yet */ static int fix_unaligned __P((struct proc *p, struct trapframe *frame)); #endif +static void trap_fatal __P((struct trapframe *framep)); +static void printtrap __P((int vector, struct trapframe *framep, int isfatal, + int user, vm_offset_t eva)); +static int trap_pfault __P((struct trapframe *frame, int user); +static int handle_onfault __P((struct trapframe *frame)); + +static const char *ppc_exception_names[] = { + "Reserved 0", /* 0 */ + "Reset", /* 1 */ + "Machine Check", /* 2 */ + "Data Storage Interrupt", /* 3 */ + "Instruction Storage Interrupt", /* 4 */ + "External Interrupt", /* 5 */ + "Alignment Interrupt", /* 6 */ + "Program Interrupt", /* 7 */ + "Floating Point Unavailable", /* 8 */ + "Decrementer Interrupt", /* 9 */ + "Reserved", /* 10 */ + "Reserved", /* 11 */ + "System Call", /* 12 */ + "Trace", /* 13 */ + "Floating Point Assist", /* 14 */ + "Performance Monitoring", /* 15 */ + "Instruction TLB Miss", /* 16 */ + "Data Load TLB Miss", /* 17 */ + "Data Store TLB Miss", /* 18 */ + "Instruction Breakpoint", /* 19 */ + "System Management Interrupt", /* 20 */ + "Reserved 21", /* 21 */ + "Reserved 22", /* 22 */ + "Reserved 23", /* 23 */ + "Reserved 24", /* 24 */ + "Reserved 25", /* 25 */ + "Reserved 26", /* 26 */ + "Reserved 27", /* 27 */ + "Reserved 28", /* 28 */ + "Reserved 29", /* 29 */ + "Reserved 30", /* 30 */ + "Reserved 31", /* 31 */ + "Reserved 32", /* 32 */ + "Reserved 33", /* 33 */ + "Reserved 34", /* 34 */ + "Reserved 35", /* 35 */ + "Reserved 36", /* 36 */ + "Reserved 37", /* 37 */ + "Reserved 38", /* 38 */ + "Reserved 39", /* 39 */ + "Reserved 40", /* 40 */ + "Reserved 41", /* 41 */ + "Reserved 42", /* 42 */ + "Reserved 43", /* 43 */ + "Reserved 44", /* 44 */ + "Reserved 45", /* 45 */ + "Reserved 46", /* 46 */ + "Reserved 47", /* 47 */ +}; + +static void +printtrap(int vector, struct trapframe *framep, int isfatal, int user, int eva) +{ + + printf("\n"); + printf("%s %s trap:\n", isfatal ? "fatal" : "handled", + user ? "user" : "kernel"); + printf("\n"); + printf(" exception = 0x%x (%s)\n", type, + ppc_exception_names[vector >> 8]); + switch (vector) { + case EXC_DSI: + printf(" virtual address = 0x%x\n", framep->dar); + break; + case EXC_ISI: + printf(" virtual address = 0x%x\n", framep->srr0); + break; + } + printf(" srr0 = 0x%x", frame->srr0); + printf(" curthread = %p\n", curthread); + if (curthread != NULL) + printf(" pid = %d, comm = %s\n", + curthread->td_proc->p_pid, curthread->td_proc->p_comm); + printf("\n"); +} + +static void +trap_fatal(struct trapframe *framep) +{ + + printtrap(frame->exc, frame, 1, (frame->ssr1 & PSL_PR)); +#ifdef DDB + if ((debugger_on_panic || db_active) && kdb_trap(frame->exc, 0, frame)) + return; +#endif + panic("%s Trap", ppc_exception_names[frame->exc >> 8]); +} + +/* + * Handles a fatal fault when we have onfault state to recover. Returns + * non-zero if there was onfault recovery state available. + */ +static void +handle_onfault __P((struct trapframe *frame) +{ + struct thread *td; + faultbuf *fb; + + td = curthread; + fb = td->td_pcb.pcb_onfault; + if (fb != NULL) { + frame->srr0 = (*fb)[0]; + frame->fixreg[1] = (*fb)[1]; + frame->fixreg[2] = (*fb)[2]; + frame->cr = (*fb)[3]; + bcopy(&(*fb)[4], &frame->fixreg[13], + 19 * sizeof(register_t)); + return (1); + } + return (0); +} void trap(struct trapframe *frame) { -#if 0 /* XXX: This code hasn't been reworked yet. */ + struct thread *td; struct proc *p; - int type; - u_int sticks; + int sig, type, user; + u_int sticks, ucode; - p = curproc; - type = frame->exc; + atomic_add_int(&cnt.v_trap, 1); - if (frame->srr1 & PSL_PR) { - type |= EXC_USER; - sticks = p->p_sticks; - } + td = curthread; + p = td->td_proc; + + type = frame->exc; + ucode = type; + sig = 0; + user = (frame->ssr1 & PSL_PR); + sticks = 0; + + CTR3(KTR_TRAP, "trap: %s type=%s (%s)", p->p_comm, + ppc_exception_names[type >> 8], + user ? "user" : "kernel"); + + if (user) { + sticks = td->td_kse->ke_sticks; + td->td_frame = frame; + KASSERT(td->td_ucred == NULL, ("already have a ucred")); + PROC_LOCK(p); + td->td_ucred = crhold(p->p_ucred); + PROC_UNLOCK(p); + + /* User Mode Traps */ + switch (type) { + case EXC_TRC: + frame->srr1 &= ~PSL_SE; + sig = SIGTRAP; + break; + case EXC_DSI: + case EXC_ISI: + sig = trap_pfault(frame, 1); + break; + case EXC_SC: + syscall(frame); + break; + case EXC_FPU: + if (fpuproc) + save_fpu(fpuproc); + fpuproc = p; + enable_fpu(p); + break; - switch (type) { - case EXC_TRC|EXC_USER: - frame->srr1 &= ~PSL_SE; - trapsignal(p, SIGTRAP, EXC_TRC); + case EXC_ALI: +#if 0 + if (fix_unaligned(p, frame) != 0) +#endif + sig = SIGBUS; +#if 0 + else + frame->srr0 += 4; +#endif break; - case EXC_DSI: - { - vm_map_t map; - vaddr_t va; - int ftype; - faultbuf *fb; - - map = kernel_map; - va = frame->dar; - if ((va >> ADDR_SR_SHFT) == USER_SR) { - sr_t user_sr; - - __asm ("mfsr %0, %1" - : "=r"(user_sr) : "K"(USER_SR)); - va &= ADDR_PIDX | ADDR_POFF; - va |= user_sr << ADDR_SR_SHFT; - map = &p->p_vmspace->vm_map; - } - if (frame->dsisr & DSISR_STORE) - ftype = VM_PROT_READ | VM_PROT_WRITE; + + case EXC_PGM: + /* XXX temporarily */ + /* XXX: Magic Number? */ + if (frame->srr1 & 0x0002000) + sig = SIGTRAP; else - ftype = VM_PROT_READ; - if (uvm_fault(map, trunc_page(va), 0, ftype) - == KERN_SUCCESS) + sig = SIGILL; + break; + + default: + trap_fatal(frame); + } + } else { + /* Kernel Mode Traps */ + + KASSERT(cold || td->td_ucred != NULL, + ("kernel trap doesn't have ucred")); + switch (type) { + case EXC_DSI: + if (trap_pfault(frame, 0) == 0) return; - if (fb = p->p_addr->u_pcb.pcb_onfault) { - frame->srr0 = (*fb)[0]; - frame->fixreg[1] = (*fb)[1]; - frame->fixreg[2] = (*fb)[2]; - frame->cr = (*fb)[3]; - bcopy(&(*fb)[4], &frame->fixreg[13], - 19 * sizeof(register_t)); + break; + case EXC_MCHK: + if (handle_onfault(frame)) return; - } - map = kernel_map; - } - goto brain_damage; - case EXC_DSI|EXC_USER: - { - int ftype, rv; - - if (frame->dsisr & DSISR_STORE) - ftype = VM_PROT_READ | VM_PROT_WRITE; - else - ftype = VM_PROT_READ; - if ((rv = uvm_fault(&p->p_vmspace->vm_map, - trunc_page(frame->dar), 0, ftype)) - == KERN_SUCCESS) - break; - if (rv == KERN_RESOURCE_SHORTAGE) { - printf("UVM: pid %d (%s), uid %d killed: " - "out of swap\n", - p->p_pid, p->p_comm, - p->p_cred && p->p_ucred ? - p->p_ucred->cr_uid : -1); - trapsignal(p, SIGKILL, EXC_DSI); - } else { - trapsignal(p, SIGSEGV, EXC_DSI); - } - } - break; - case EXC_ISI|EXC_USER: - { - int ftype; - - ftype = VM_PROT_READ | VM_PROT_EXECUTE; - if (uvm_fault(&p->p_vmspace->vm_map, - trunc_page(frame->srr0), 0, ftype) - == KERN_SUCCESS) - break; + break; + default: + trap_fatal(frame); } - trapsignal(p, SIGSEGV, EXC_ISI); - break; - case EXC_SC|EXC_USER: - { - struct sysent *callp; - size_t argsize; - register_t code, error; - register_t *params, rval[2]; - int nsys, n; - register_t args[10]; - - uvmexp.syscalls++; - - nsys = p->p_emul->e_nsysent; - callp = p->p_emul->e_sysent; + } + if (sig != 0) { + if (p->p_sysent->sv_transtrap != NULL) + sig = (p->p_sysent->sv_transtrap)(sig, type); + trapsignal(p, sig, ucode); + } + userret(p, frame, sticks); + mtx_assert(&Giant, MA_NOTOWNED); + mtx_lock(&Giant); + crfree(td->td_ucred); + mtx_unlock(&Giant); + td->td_ucred = NULL; +#ifdef NOTYET + /* + * XXX: this needs to be handled somewhere else? + * + * If someone stole the fpu while we were away, disable it + */ + if (p != fpuproc) + frame->srr1 &= ~PSL_FP; + curcpu()->ci_schedstate.spc_curpriority = p->p_priority; +#endif +} + +void +syscall(struct trapframe *frame) +{ + caddr_t params; + struct sysent *callp; + struct thread *td; + struct proc *p; + int error; + size_t narg; + register_t args[10]; + u_int code; + + td = curthread; + p = td->td_proc; + + atomic_add_int(&cnt.v_syscall, 1); - code = frame->fixreg[0]; - params = frame->fixreg + FIRSTARG; + code = frame->fixreg[0]; + params = frame->fixreg + FIRSTARG; - switch (code) { - case SYS_syscall: - /* - * code is first argument, - * followed by actual args. - */ - code = *params++; - break; - case SYS___syscall: - /* - * Like syscall, but code is a quad, - * so as to maintain quad alignment - * for the rest of the args. - */ - if (callp != sysent) - break; - params++; - code = *params++; - break; - default: - break; - } - if (code < 0 || code >= nsys) - callp += p->p_emul->e_nosys; - else - callp += code; - argsize = callp->sy_argsize; - n = NARGREG - (params - (frame->fixreg + FIRSTARG)); - if (argsize > n * sizeof(register_t)) { - bcopy(params, args, n * sizeof(register_t)); - if (error = copyin(MOREARGS(frame->fixreg[1]), - args + n, - argsize - n * sizeof(register_t))) { -#ifdef KTRACE - /* Can't get all the arguments! */ - if (KTRPOINT(p, KTR_SYSCALL)) - ktrsyscall(p, code, argsize, - args); -#endif - goto syscall_bad; - } - params = args; - } + if (p->p_sysent->sv_prepsyscall) + /* + * The prep code is MP aware. + */ + (*p->p_sysent->sv_prepsyscall)(&frame, args, &code, ¶ms); + else if (code == SYS_syscall) + /* + * code is first argument, + * followed by actual args. + */ + code = *params++; + else if (code == SYS___syscall) { + /* + * Like syscall, but code is a quad, + * so as to maintain quad alignment + * for the rest of the args. + */ + params++; + code = *params++; + } + + if (p->p_sysent->sv_mask) + code &= p->p_sysent->sv_mask; + + if (code >= p->p_sysent->sv_size) + callp = &p->p_sysent->sv_table[0]; + else + callp = &p->p_sysent->sv_table[code]; + + narg = callp->sy_narg & SYF_ARGMASK; + + n = NARGREG - (params - (frame->fixreg + FIRSTARG)); + if (argsize > n * sizeof(register_t)) { + bcopy(params, args, n * sizeof(register_t)); + if (error = copyin(MOREARGS(frame->fixreg[1]), args + n, + argsize - n * sizeof(register_t))) { #ifdef KTRACE + /* Can't get all the arguments! */ if (KTRPOINT(p, KTR_SYSCALL)) - ktrsyscall(p, code, argsize, params); + ktrsyscall(p->p_tracep, code, narg, args); #endif - rval[0] = 0; - rval[1] = frame->fixreg[FIRSTARG + 1]; - - switch (error = (*callp->sy_call)(p, params, rval)) { - case 0: - frame->fixreg[FIRSTARG] = rval[0]; - frame->fixreg[FIRSTARG + 1] = rval[1]; - frame->cr &= ~0x10000000; - break; - case ERESTART: - /* - * Set user's pc back to redo the system call. - */ - frame->srr0 -= 4; - break; - case EJUSTRETURN: - /* nothing to do */ - break; - default: -syscall_bad: - if (p->p_emul->e_errno) - error = p->p_emul->e_errno[error]; - frame->fixreg[FIRSTARG] = error; - frame->cr |= 0x10000000; - break; - } + goto bad; + } + params = args; + } + + /* + * Try to run the syscall without Giant if the syscall is MP safe. + */ + if ((callp->sy_narg & SYF_MPSAFE) == 0) + mtx_lock(&Giant); + #ifdef KTRACE - if (KTRPOINT(p, KTR_SYSRET)) - ktrsysret(p, code, error, rval[0]); + if (KTRPOINT(p, KTR_SYSCALL)) + ktrsyscall(p->p_tracep, code, narg, params); #endif - } - break; + td->td_retval[0] = 0; + td->td_retval[1] = frame->fixreg[FIRSTARG + 1]; - case EXC_FPU|EXC_USER: - if (fpuproc) - save_fpu(fpuproc); - fpuproc = p; - enable_fpu(p); - break; + STOPEVENT(p, S_SCE, narg); - case EXC_AST|EXC_USER: - /* This is just here that we trap */ + error = (*callp->sy_call)(td, args); + switch (error) { + case 0: + frame->fixreg[FIRSTARG] = td->td_retval[0]; + frame->fixreg[FIRSTARG + 1] = td->td_retval[1]; + /* XXX: Magic number */ + frame->cr &= ~0x10000000; break; - - case EXC_ALI|EXC_USER: - if (fix_unaligned(p, frame) != 0) - trapsignal(p, SIGBUS, EXC_ALI); - else - frame->srr0 += 4; + case ERESTART: + /* + * Set user's pc back to redo the system call. + */ + frame->srr0 -= 4; break; - - case EXC_PGM|EXC_USER: -/* XXX temporarily */ - if (frame->srr1 & 0x0002000) - trapsignal(p, SIGTRAP, EXC_PGM); - else - trapsignal(p, SIGILL, EXC_PGM); + case EJUSTRETURN: + /* nothing to do */ break; - - case EXC_MCHK: - { - faultbuf *fb; - - if (fb = p->p_addr->u_pcb.pcb_onfault) { - frame->srr0 = (*fb)[0]; - frame->fixreg[1] = (*fb)[1]; - frame->fixreg[2] = (*fb)[2]; - frame->cr = (*fb)[3]; - bcopy(&(*fb)[4], &frame->fixreg[13], - 19 * sizeof(register_t)); - return; - } + default: +bad: + if (p->p_sysent->sv_errsize) { + if (error >= p->p_sysent->sv_errsize) + error = -1; /* XXX */ + else + error = p->p_sysent->sv_errtbl[error]; } - goto brain_damage; + frame->fixreg[FIRSTARG] = error; + /* XXX: Magic number: Carry Flag Equivalent? */ + frame->cr |= 0x10000000; + break; + } - default: -brain_damage: - printf("trap type %x at %x\n", type, frame->srr0); -#ifdef DDB - Debugger(); /* XXX temporarily */ -#endif -#ifdef TRAP_PANICWAIT - printf("Press a key to panic.\n"); - cngetc(); + +#ifdef KTRACE + if (KTRPOINT(p, KTR_SYSRET)) + ktrsysret(p->p_tracep, code, error, td->td_retval[0]); #endif - panic("trap"); - } - astpending = 0; /* we are about to do it */ + if ((callp->sys_narg & SYF_MPSAFE) == 0) + mtx_unlock(&Giant); - uvmexp.softs++; + /* + * Does the comment in the i386 code about errno apply here? + */ + STOPEVENT(p, S_SCX, code); + +#ifdef WITNESS + if (witness_list(td)) { + panic("system call %s returning with mutex(s) held\n", + syscallnames[code]); + } +#endif + mtx_assert(&sched_lock, MA_NOTOWNED); + mtx_assert(&Giant, MA_NOTOWNED); +} - if (p->p_flag & P_OWEUPC) { - p->p_flag &= ~P_OWEUPC; - ADDUPROF(p); +static int +trap_pfault(struct trapframe *frame, int user) +{ + vm_offset_t eva, va; + struct thread *td; + struct proc *p; + vm_map_t map; + vm_prot_t ftype; + int rv; + + td = curthread; + p = td->td_proc; + if (frame->exc == EXC_ISI) { + eva = frame->srr0; + ftype = VM_PROT_READ | VM_PROT_EXECUTE; + } else { + eva = frame->dar; + if (frame->dsisr & DSISR_STORE) + ftype = VM_PROT_READ | VM_PROT_WRITE; + else + ftype = VM_PROT_READ; } - /* take pending signals */ - { - int sig; + if ((eva >> ADDR_SR_SHFT) != USER_SR) { + if (user) + return (SIGSEGV); + map = kernel_map; + } else { + sr_t user_sr; - while (sig = CURSIG(p)) - postsig(sig); + if (p->p_vmspace == NULL) + return (SIGSEGV); + + __asm ("mfsr %0, %1" + : "=r"(user_sr) + : "K"(USER_SR)); + eva &= ADDR_PIDX | ADDR_POFF; + eva |= user_sr << ADDR_SR_SHFT; + map = &p->p_vmspace->vm_map; } + va = trunc_page(eva); + + mtx_lock(&Giant); + if (map != kernel_map) { + /* + * Keep swapout from messing with us during this + * critical time. + */ + PROC_LOCK(p); + ++p->p_lock; + PROC_UNLOCK(p); - p->p_priority = p->p_usrpri; - if (want_resched) { - int sig; /* - * We are being preempted. + * Grow the stack if necessary + */ + /* grow_stack returns false only if va falls into + * a growable stack region and the stack growth + * fails. It returns true if va was not within + * a growable stack region, or if the stack + * growth succeeded. + */ + if (!grow_stack (p, va)) + rv = KERN_FAILURE; + else + /* Fault in the user page: */ + rv = vm_fault(map, va, ftype, + (ftype & VM_PROT_WRITE) ? VM_FAULT_DIRTY + : VM_FAULT_NORMAL); + + PROC_LOCK(p); + --p->p_lock; + PROC_UNLOCK(p); + } else { + /* + * Don't have to worry about process locking or stacks in the + * kernel. */ - preempt(NULL); - while (sig = CURSIG(p)) - postsig(sig); + rv = vm_fault(map, va, ftype, VM_FAULT_NORMAL); } + mtx_unlock(&Giant); - /* - * If profiling, charge recent system time to the trapped pc. - */ - if (p->p_flag & P_PROFIL) { - extern int psratio; + if (rv == KERN_SUCCESS) + return (0); - addupc_task(p, frame->srr0, - (int)(p->p_sticks - sticks) * psratio); - } - /* - * If someone stole the fpu while we were away, disable it - */ - if (p != fpuproc) - frame->srr1 &= ~PSL_FP; - curcpu()->ci_schedstate.spc_curpriority = p->p_priority; -#endif + if (!user && handle_onfault(frame)) + return (0); + + return (SIGSEGV); } #if 0 /* XXX: child_return not used */ +/* + * XXX: the trapframe return values should be setup in vm_machdep.c in + * cpu_fork(). + */ void child_return(void *arg) {home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.011026043335.jhb>
