From owner-p4-projects@FreeBSD.ORG Thu Jan 3 21:08:17 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id C12D516A477; Thu, 3 Jan 2008 21:08:16 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6E50B16A419 for ; Thu, 3 Jan 2008 21:08:16 +0000 (UTC) (envelope-from imp@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 5BA4C13C43E for ; Thu, 3 Jan 2008 21:08:16 +0000 (UTC) (envelope-from imp@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id m03L8GDS029465 for ; Thu, 3 Jan 2008 21:08:16 GMT (envelope-from imp@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m03L8GQA029462 for perforce@freebsd.org; Thu, 3 Jan 2008 21:08:16 GMT (envelope-from imp@freebsd.org) Date: Thu, 3 Jan 2008 21:08:16 GMT Message-Id: <200801032108.m03L8GQA029462@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to imp@freebsd.org using -f From: Warner Losh To: Perforce Change Reviews Cc: Subject: PERFORCE change 132425 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jan 2008 21:08:17 -0000 http://perforce.freebsd.org/chv.cgi?CH=132425 Change 132425 by imp@imp_paco-paco on 2008/01/03 21:08:04 Trap compiles now. not 100% sure of the changes, so we should have many eyes look here... Affected files ... .. //depot/projects/mips2-jnpr/src/sys/mips/mips/trap.c#5 edit Differences ... ==== //depot/projects/mips2-jnpr/src/sys/mips/mips/trap.c#5 (text+ko) ==== @@ -311,24 +311,23 @@ unsigned ucode = 0; struct thread *td = curthread; struct proc *p = curproc; - u_quad_t sticks; vm_prot_t ftype; pt_entry_t *pte; unsigned int entry; pmap_t pmap; int quad_syscall = 0; int access_type; + ksiginfo_t ksi; char *msg = NULL; + register_t addr = 0; trapdebug_enter(trapframe, 0); type = (trapframe->cause & CR_EXC_CODE) >> CR_EXC_CODE_SHIFT; if (USERMODE(trapframe->sr)) { type |= T_USER; - sticks = td->td_sticks; usermode = 1; } else { - sticks = 0; usermode = 0; } @@ -581,6 +580,7 @@ ucode = ftype; i = ((rv == KERN_PROTECTION_FAILURE) ? SIGBUS : SIGSEGV); + addr = trapframe->pc; msg = "BAD_PAGE_FAULT"; log_bad_page_fault(msg, trapframe, type); @@ -626,6 +626,7 @@ case T_BUS_ERR_LD_ST+T_USER: /* BERR asserted to cpu */ ucode = 0; /* XXX should be VM_PROT_something */ i = SIGBUS; + addr = trapframe->pc; if (!msg) msg = "BUS_ERR"; log_bad_page_fault(msg, trapframe, type); @@ -706,7 +707,7 @@ else callp = &p->p_sysent->sv_table[code]; - nargs = callp->sy_narg & SYF_ARGMASK; + nargs = callp->sy_narg; if (nargs > nsaved) { i = copyin((caddr_t)(locr0->sp + @@ -736,14 +737,6 @@ else trp[-1].code = code; #endif - - /* - * Try to run the syscall without Giant if the syscall - * is MP safe. - */ - if ((callp->sy_narg & SYF_MPSAFE) == 0) - mtx_lock(&Giant); - STOPEVENT(p, S_SCE, nargs); PTRACESTOP_SC(p, td, S_PT_SCE); @@ -799,18 +792,12 @@ } /* - * Release Giant if we previously set it. - */ - if ((callp->sy_narg & SYF_MPSAFE) == 0) - mtx_unlock(&Giant); - - /* * The sync'ing of I & D caches for SYS_ptrace() is * done by procfs_domem() through procfs_rwmem() instead * of being done here under a special check for SYS_ptrace(). */ done: - userret(td, trapframe, sticks); + userret(td, trapframe); #ifdef KTRACE if (KTRPOINT(p, KTR_SYSRET)) @@ -824,7 +811,7 @@ STOPEVENT(p, S_SCX, code); PTRACESTOP_SC(p, td, S_PT_SCX); - +#ifdef GONE_IN_7 WITNESS_WARN(WARN_PANIC, NULL, "System call %s returning", (code >= 0 && code < SYS_MAXSYSCALL) ? syscallnames[code] : "???"); @@ -833,7 +820,7 @@ if (curthread->td_flags & (TDF_ASTPENDING|TDF_NEEDRESCHED)) { ast(trapframe); } - +#endif return (trapframe->pc); } @@ -861,6 +848,7 @@ #endif if (td->td_md.md_ss_addr != va || instr != BREAK_SSTEP) { i = SIGTRAP; + addr = trapframe->pc; break; } @@ -870,7 +858,7 @@ * call to ptrace_clear_single_step() in issignal() * when SIGTRAP is processed. */ - + addr = trapframe->pc; i = SIGTRAP; break; } @@ -885,6 +873,7 @@ va += sizeof(int); printf("watch exception @ 0x%x\n", va); i = SIGTRAP; + addr = va; break; } @@ -906,12 +895,14 @@ } else { locr0->pc += sizeof(int); } + addr = va; i = SIGEMT; /* Stuff it with something for now */ break; } case T_RES_INST+T_USER: i = SIGILL; + addr = trapframe->pc; break; case T_COP_UNUSABLE+T_USER: @@ -926,6 +917,7 @@ i = SIGILL; /* only FPU instructions allowed */ break; } + addr = trapframe->pc; MipsSwitchFPState(PCPU_GET(fpcurthread), td->td_frame); PCPU_SET(fpcurthread, td); td->td_frame->sr |= SR_COP_1_BIT; @@ -947,6 +939,7 @@ case T_OVFLOW+T_USER: i = SIGFPE; + addr = trapframe->pc; break; case T_ADDR_ERR_LD: /* misaligned access */ @@ -1023,18 +1016,23 @@ td->td_frame->pc = trapframe->pc; td->td_frame->cause = trapframe->cause; td->td_frame->badvaddr = trapframe->badvaddr; - trapsignal(td, i, ucode); + ksiginfo_init_trap(&ksi); + ksi.ksi_signo = i; + ksi.ksi_code = ucode; + ksi.ksi_addr = (void *)addr; + ksi.ksi_trapno = type; + trapsignal(td, &ksi); out: /* * Note: we should only get here if returning to user mode. */ - userret(td, trapframe, sticks); - mtx_assert(&sched_lock, MA_NOTOWNED); + userret(td, trapframe); mtx_assert(&Giant, MA_NOTOWNED); +#ifdef GONE_IN_7 if (curthread->td_flags & (TDF_ASTPENDING | TDF_NEEDRESCHED)) { ast(trapframe); } - +#endif return (trapframe->pc); } @@ -1214,7 +1212,6 @@ /* forward */ char *fn_name(unsigned addr); -void stacktrace_subr(struct trapframe *, int (*)(const char*, ...); /* * Print a stack backtrace. @@ -1226,7 +1223,7 @@ } void -stacktrace_subr(struct trapframe *regs, int (*printfn)(const char*, ...))) +stacktrace_subr(struct trapframe *regs, int (*printfn)(const char*, ...)) { InstFmt i; unsigned a0, a1, a2, a3, pc, sp, fp, ra, va, subr;