--- src/sys/platform/vkernel/i386/trap.c 2008/05/06 18:43:02 1.32 +++ src/sys/platform/vkernel/i386/trap.c 2008/05/19 10:28:06 1.33 @@ -66,6 +66,7 @@ #ifdef KTRACE #include #endif +#include #include #include #include @@ -353,6 +354,22 @@ userexit(struct lwp *lp) lwkt_switch(); } + +#if !defined(KTR_KERNENTRY) +#define KTR_KERNENTRY KTR_ALL +#endif +KTR_INFO_MASTER(kernentry); +KTR_INFO(KTR_KERNENTRY, kernentry, trap, 0, "pid=%d, tid=%d, trapno=%d, eva=%p", + sizeof(int) + sizeof(int) + sizeof(int) + sizeof(vm_offset_t)); +KTR_INFO(KTR_KERNENTRY, kernentry, trap_ret, 0, "pid=%d, tid=%d", + sizeof(int) + sizeof(int)); +KTR_INFO(KTR_KERNENTRY, kernentry, syscall, 0, "pid=%d, tid=%d, call=%d", + sizeof(int) + sizeof(int) + sizeof(int)); +KTR_INFO(KTR_KERNENTRY, kernentry, syscall_ret, 0, "pid=%d, tid=%d, err=%d", + sizeof(int) + sizeof(int) + sizeof(int)); +KTR_INFO(KTR_KERNENTRY, kernentry, fork_ret, 0, "pid=%d, tid=%d", + sizeof(int) + sizeof(int)); + /* * Exception, fault, and trap interface to the kernel. * This common code is called from assembly language IDT gate entry @@ -415,6 +432,9 @@ user_trap(struct trapframe *frame) return; } + KTR_LOG(kernentry_trap, lp->lwp_proc->p_pid, lp->lwp_tid, + frame->tf_trapno, eva); + #ifdef DDB if (db_active) { eva = (frame->tf_trapno == T_PAGEFLT ? rcr2() : 0); @@ -642,6 +662,7 @@ out2: ; if (have_mplock) rel_mplock(); #endif + KTR_LOG(kernentry_trap_ret, lp->lwp_proc->p_pid, lp->lwp_tid); #ifdef INVARIANTS KASSERT(crit_count == (td->td_pri & ~TDPRI_MASK), ("syscall: critical section count mismatch! %d/%d", @@ -1144,6 +1165,9 @@ syscall2(struct trapframe *frame) u_int code; union sysunion args; + KTR_LOG(kernentry_syscall, lp->lwp_proc->p_pid, lp->lwp_tid, + frame->tf_eax); + #ifdef SMP KASSERT(td->td_mpcount == 0, ("badmpcount syscall2 from %p", (void *)frame->tf_eip)); if (syscall_mpsafe == 0) @@ -1348,6 +1372,7 @@ bad: if (have_mplock) rel_mplock(); #endif + KTR_LOG(kernentry_syscall_ret, lp->lwp_proc->p_pid, lp->lwp_tid, error); #ifdef INVARIANTS KASSERT(crit_count == (td->td_pri & ~TDPRI_MASK), ("syscall: critical section count mismatch! %d/%d", @@ -1363,6 +1388,7 @@ fork_return(struct lwp *lp, struct trapf frame->tf_edx = 1; generic_lwp_return(lp, frame); + KTR_LOG(kernentry_fork_ret, lp->lwp_proc->p_pid, lp->lwp_tid); } /*