opnsense-src/sys/cddl/dev/dtrace
Mark Johnston f263e440d4 SDT probes can directly pass up to five arguments as arguments to
dtrace_probe(). Arguments beyond these five must be obtained in an
architecture-specific way; this can be done through the getargval provider
method, and through dtrace_getarg() if getargval isn't overridden.

This change fixes two off-by-one bugs in the way these arguments are fetched
in FreeBSD's DTrace implementation. First, the SDT provider must set the
aframes parameter to 1 when creating a probe. The aframes parameter controls
the number of frames that dtrace_getarg() will step over in order to find
the frame containing the extra arguments. On FreeBSD, dtrace_getarg() is
called in SDT probe context via

dtrace_probe()->dtrace_dif_emulate()->dtrace_dif_variable->dtrace_getarg()

so aframes must be 3 since the arguments are in dtrace_probe()'s frame; it
was previously being called with a value of 2 instead. illumos uses a
different aframes value for SDT probes, but this is because illumos SDT
probes fire by triggering the #UD fault handler rather than calling
dtrace_probe() directly.

The second bug has to do with the way arguments are grabbed out
dtrace_probe()'s frame on amd64. The code currently jumps over the first
stack argument and retrieves the rest of them using a pointer into the
stack. This works on i386 because all of dtrace_probe()'s arguments will be
on the stack and the first argument is the probe ID, which should be
ignored. However, it is incorrect to ignore the first stack argument on
amd64, so we correct the pointer used to access the arguments.

MFC after:	2 weeks
2013-06-02 01:05:36 +00:00
..
amd64 SDT probes can directly pass up to five arguments as arguments to 2013-06-02 01:05:36 +00:00
i386 Change UL to ULL since time is 32 bits. 2012-07-17 14:36:40 +00:00
mips - For o32 ABI get arguments from the stack 2012-03-26 21:47:06 +00:00
powerpc Add FBT for PowerPC DTrace. Also, clean up the DTrace assembly code, 2013-03-18 05:30:18 +00:00
dtrace_anon.c
dtrace_cddl.h Add more compatibility structure members needed by the upcoming fasttrap 2010-08-22 11:04:43 +00:00
dtrace_clone.c
dtrace_debug.c Correct a series of errors in the hand-rolled locking for drace_debug.c: 2012-12-23 15:50:37 +00:00
dtrace_hacks.c
dtrace_ioctl.c Bring back part of r249367 by adding DTrace's temporal option, which allows 2013-05-12 16:26:33 +00:00
dtrace_load.c Make the /dev/dtrace/helper node have the mode 0660. This allows 2010-09-01 12:08:32 +00:00
dtrace_modevent.c
dtrace_sysctl.c
dtrace_test.c Port the SDT test now that it's possible to create SDT probes that take 2013-06-02 00:33:36 +00:00
dtrace_unload.c Destroy the helper device when unloading. 2010-08-22 11:05:37 +00:00
dtrace_vtime.c