On Sun, Feb 21, 2010 at 02:11:40AM +0000, Darran Hunt wrote:
Module Name: src
Committed By: darran
Date: Sun Feb 21 02:11:40 UTC 2010
Modified Files:
src/sys/arch/i386/i386: trap.c vector.S
src/sys/kern: kern_lwp.c kern_proc.c kern_synch.c
src/sys/sys: lwp.h proc.h
Added Files:
src/sys/sys: dtrace_bsd.h
Log Message:
Add the DTrace hooks to the kernel (KDTRACE_HOOKS config option).
DTrace adds a pointer to the lwp and proc structures which it uses
to
manage its state. These are opaque from the kernel perspective to
keep
the kernel free of CDDL code. The state arenas are kmem_alloced
and freed
as proccesses and threads are created and destoyed.
Also add a check for trap06 (privileged/illegal instruction) so that
DTrace can check for D scripts that may have triggered the trap so
it
can clean up after them and resume normal operation.
Ok with core@.
Wow, dtrace in the kernel! This is exciting, thanks!
#ifdef makes kernel code hard to read. Will you help arrest the
accretion of conditional compilation in kern_synch.c by consolidating
the conditional compilation in a static subroutine, for example:
static void
dtrace_vtime_switch(lwp_t *newl)
{
#ifdef KDTRACE_HOOKS
/*
* If DTrace has set the active vtime enum to anything
* other than INACTIVE (0), then it should have set the
* function to call.
*/
if (dtrace_vtime_active) {
(*dtrace_vtime_switch_func)(newl);
}
#endif