Changeset View
Changeset View
Standalone View
Standalone View
sys/cddl/dev/dtrace/i386/dtrace_subr.c
Show All 27 Lines | |||||
*/ | */ | ||||
/* | /* | ||||
* Copyright (c) 2011, Joyent, Inc. All rights reserved. | * Copyright (c) 2011, Joyent, Inc. All rights reserved. | ||||
*/ | */ | ||||
#include <sys/param.h> | #include <sys/param.h> | ||||
#include <sys/systm.h> | #include <sys/systm.h> | ||||
#include <sys/types.h> | |||||
#include <sys/cpuset.h> | #include <sys/cpuset.h> | ||||
#include <sys/kernel.h> | #include <sys/kernel.h> | ||||
#include <sys/malloc.h> | #include <sys/malloc.h> | ||||
#include <sys/kmem.h> | #include <sys/kmem.h> | ||||
#include <sys/proc.h> | |||||
#include <sys/smp.h> | #include <sys/smp.h> | ||||
#include <sys/dtrace_impl.h> | #include <sys/dtrace_impl.h> | ||||
#include <sys/dtrace_bsd.h> | #include <sys/dtrace_bsd.h> | ||||
#include <cddl/dev/dtrace/dtrace_cddl.h> | |||||
#include <machine/clock.h> | #include <machine/clock.h> | ||||
#include <machine/cpufunc.h> | #include <machine/cpufunc.h> | ||||
#include <machine/frame.h> | #include <machine/frame.h> | ||||
#include <machine/psl.h> | #include <machine/psl.h> | ||||
#include <machine/trap.h> | #include <machine/trap.h> | ||||
#include <vm/pmap.h> | #include <vm/pmap.h> | ||||
extern uintptr_t kernelbase; | extern uintptr_t kernelbase; | ||||
Show All 11 Lines | typedef struct dtrace_invop_hdlr { | ||||
struct dtrace_invop_hdlr *dtih_next; | struct dtrace_invop_hdlr *dtih_next; | ||||
} dtrace_invop_hdlr_t; | } dtrace_invop_hdlr_t; | ||||
dtrace_invop_hdlr_t *dtrace_invop_hdlr; | dtrace_invop_hdlr_t *dtrace_invop_hdlr; | ||||
int | int | ||||
dtrace_invop(uintptr_t addr, struct trapframe *frame, uintptr_t eax) | dtrace_invop(uintptr_t addr, struct trapframe *frame, uintptr_t eax) | ||||
{ | { | ||||
struct thread *td; | |||||
dtrace_invop_hdlr_t *hdlr; | dtrace_invop_hdlr_t *hdlr; | ||||
int rval; | int rval; | ||||
rval = 0; | |||||
td = curthread; | |||||
td->t_dtrace_trapframe = frame; | |||||
for (hdlr = dtrace_invop_hdlr; hdlr != NULL; hdlr = hdlr->dtih_next) | for (hdlr = dtrace_invop_hdlr; hdlr != NULL; hdlr = hdlr->dtih_next) | ||||
if ((rval = hdlr->dtih_func(addr, frame, eax)) != 0) | if ((rval = hdlr->dtih_func(addr, frame, eax)) != 0) | ||||
break; | |||||
td->t_dtrace_trapframe = NULL; | |||||
return (rval); | return (rval); | ||||
return (0); | |||||
} | } | ||||
void | void | ||||
dtrace_invop_add(int (*func)(uintptr_t, struct trapframe *, uintptr_t)) | dtrace_invop_add(int (*func)(uintptr_t, struct trapframe *, uintptr_t)) | ||||
{ | { | ||||
dtrace_invop_hdlr_t *hdlr; | dtrace_invop_hdlr_t *hdlr; | ||||
hdlr = kmem_alloc(sizeof (dtrace_invop_hdlr_t), KM_SLEEP); | hdlr = kmem_alloc(sizeof (dtrace_invop_hdlr_t), KM_SLEEP); | ||||
▲ Show 20 Lines • Show All 383 Lines • Show Last 20 Lines |