diff options
author | markj <markj@FreeBSD.org> | 2014-08-04 21:41:00 +0000 |
---|---|---|
committer | markj <markj@FreeBSD.org> | 2014-08-04 21:41:00 +0000 |
commit | a14261c0897b808f7557a5960fb3c6432f216d36 (patch) | |
tree | 66bcf79d723c80a39adae837328093ade8296f2d /sys/cddl/dev | |
parent | 2fd28e23736da641dbe3990391f997fb55353b17 (diff) | |
download | FreeBSD-src-a14261c0897b808f7557a5960fb3c6432f216d36.zip FreeBSD-src-a14261c0897b808f7557a5960fb3c6432f216d36.tar.gz |
MFC r256822:
When fetching function arguments out of a frame on amd64, explicitly select
the register based on the argument index rather than relying on the fields
in struct reg to be in the right order. This assumption is incorrect on
FreeBSD and generally led to bogus argument values for the sixth argument
of PID and USDT probes; the first five are passed directly to dtrace_probe()
via the fasttrap trap handler and so were correctly handled.
Diffstat (limited to 'sys/cddl/dev')
-rw-r--r-- | sys/cddl/dev/dtrace/amd64/dtrace_isa.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/sys/cddl/dev/dtrace/amd64/dtrace_isa.c b/sys/cddl/dev/dtrace/amd64/dtrace_isa.c index 34d6f33..3d3c43c 100644 --- a/sys/cddl/dev/dtrace/amd64/dtrace_isa.c +++ b/sys/cddl/dev/dtrace/amd64/dtrace_isa.c @@ -367,7 +367,27 @@ dtrace_getarg(int arg, int aframes) sizeof (uintptr_t)); if (arg <= inreg) { - stack = (uintptr_t *)&rp->r_rdi; + switch (arg) { + case 0: + stack = (uintptr_t *)&rp->r_rdi; + break; + case 1: + stack = (uintptr_t *)&rp->r_rsi; + break; + case 2: + stack = (uintptr_t *)&rp->r_rdx; + break; + case 3: + stack = (uintptr_t *)&rp->r_rcx; + break; + case 4: + stack = (uintptr_t *)&rp->r_r8; + break; + case 5: + stack = (uintptr_t *)&rp->r_r9; + break; + } + arg = 0; } else { stack = (uintptr_t *)(rp->r_rsp); arg -= inreg; |