Include fasttrap handling for DATAMODEL_ILP32 when compiling for amd64.
MFC after: 1 month
This commit is contained in:
parent
907b59d769
commit
6d1ffb50fc
@ -64,6 +64,7 @@
|
||||
#include <sys/dtrace_bsd.h>
|
||||
#include <sys/eventhandler.h>
|
||||
#include <sys/rmlock.h>
|
||||
#include <sys/sysent.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/u8_textprep.h>
|
||||
#include <sys/user.h>
|
||||
@ -930,6 +931,13 @@ fasttrap_tracepoint_enable(proc_t *p, fasttrap_probe_t *probe, uint_t index)
|
||||
ASSERT(0);
|
||||
}
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
if (SV_PROC_FLAG(p, SV_LP64))
|
||||
p->p_model = DATAMODEL_LP64;
|
||||
else
|
||||
p->p_model = DATAMODEL_ILP32;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* If the ISA-dependent initialization goes to plan, go back to the
|
||||
* beginning and try to install this freshly made tracepoint.
|
||||
|
@ -43,11 +43,11 @@
|
||||
#include <sys/segments.h>
|
||||
#include <sys/x86_archext.h>
|
||||
#else
|
||||
#include <cddl/dev/dtrace/dtrace_cddl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/dtrace_bsd.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/rmlock.h>
|
||||
#include <sys/dtrace_bsd.h>
|
||||
#include <cddl/dev/dtrace/dtrace_cddl.h>
|
||||
#include <cddl/dev/dtrace/x86/regset.h>
|
||||
#include <machine/segments.h>
|
||||
#include <machine/reg.h>
|
||||
@ -283,12 +283,10 @@ fasttrap_anarg(struct reg *rp, int function_entry, int argno)
|
||||
DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT | CPU_DTRACE_BADADDR);
|
||||
} else {
|
||||
#endif
|
||||
#ifdef __i386
|
||||
uint32_t *stack = (uint32_t *)rp->r_esp;
|
||||
uint32_t *stack = (uint32_t *)rp->r_rsp;
|
||||
DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT);
|
||||
value = dtrace_fuword32(&stack[argno + shift]);
|
||||
DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT | CPU_DTRACE_BADADDR);
|
||||
#endif
|
||||
#ifdef __amd64
|
||||
}
|
||||
#endif
|
||||
@ -716,7 +714,6 @@ fasttrap_fulword_noerr(const void *uaddr)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __i386__
|
||||
static uint32_t
|
||||
fasttrap_fuword32_noerr(const void *uaddr)
|
||||
{
|
||||
@ -727,7 +724,6 @@ fasttrap_fuword32_noerr(const void *uaddr)
|
||||
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
fasttrap_return_common(struct reg *rp, uintptr_t pc, pid_t pid,
|
||||
@ -842,7 +838,6 @@ fasttrap_usdt_args64(fasttrap_probe_t *probe, struct reg *rp, int argc,
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __i386__
|
||||
static void
|
||||
fasttrap_usdt_args32(fasttrap_probe_t *probe, struct reg *rp, int argc,
|
||||
uint32_t *argv)
|
||||
@ -860,7 +855,6 @@ fasttrap_usdt_args32(fasttrap_probe_t *probe, struct reg *rp, int argc,
|
||||
argv[i] = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static int
|
||||
fasttrap_do_seg(fasttrap_tracepoint_t *tp, struct reg *rp, uintptr_t *addr)
|
||||
@ -1094,7 +1088,6 @@ fasttrap_pid_probe(struct reg *rp)
|
||||
if (tp->ftt_ids != NULL) {
|
||||
fasttrap_id_t *id;
|
||||
|
||||
#ifdef __amd64
|
||||
if (p->p_model == DATAMODEL_LP64) {
|
||||
for (id = tp->ftt_ids; id != NULL; id = id->fti_next) {
|
||||
fasttrap_probe_t *probe = id->fti_probe;
|
||||
@ -1136,9 +1129,8 @@ fasttrap_pid_probe(struct reg *rp)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
#else /* __amd64 */
|
||||
uintptr_t s0, s1, s2, s3, s4, s5;
|
||||
uint32_t *stack = (uint32_t *)rp->r_esp;
|
||||
uint32_t *stack = (uint32_t *)rp->r_rsp;
|
||||
|
||||
/*
|
||||
* In 32-bit mode, all arguments are passed on the
|
||||
@ -1191,10 +1183,7 @@ fasttrap_pid_probe(struct reg *rp)
|
||||
t[2], t[3], t[4]);
|
||||
}
|
||||
}
|
||||
#endif /* __amd64 */
|
||||
#ifdef __amd64
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1259,12 +1248,10 @@ fasttrap_pid_probe(struct reg *rp)
|
||||
addr = rp->r_rsp + sizeof (uintptr_t);
|
||||
} else {
|
||||
#endif
|
||||
#ifdef __i386__
|
||||
uint32_t dst32;
|
||||
ret = dst32 = fasttrap_fuword32((void *)rp->r_esp);
|
||||
ret = dst32 = fasttrap_fuword32((void *)rp->r_rsp);
|
||||
dst = dst32;
|
||||
addr = rp->r_esp + sizeof (uint32_t);
|
||||
#endif
|
||||
addr = rp->r_rsp + sizeof (uint32_t);
|
||||
#ifdef __amd64
|
||||
}
|
||||
#endif
|
||||
@ -1409,10 +1396,8 @@ fasttrap_pid_probe(struct reg *rp)
|
||||
ret = fasttrap_sulword((void *)rp->r_rsp, rp->r_rbp);
|
||||
} else {
|
||||
#endif
|
||||
#ifdef __i386__
|
||||
rp->r_rsp -= sizeof (uint32_t);
|
||||
ret = fasttrap_suword32((void *)rp->r_rsp, rp->r_rbp);
|
||||
#endif
|
||||
#ifdef __amd64
|
||||
}
|
||||
#endif
|
||||
@ -1732,7 +1717,6 @@ fasttrap_pid_probe(struct reg *rp)
|
||||
i += sizeof (uint64_t);
|
||||
} else {
|
||||
#endif
|
||||
#ifdef __i386__
|
||||
/*
|
||||
* Set up the jmp to the next instruction; note that
|
||||
* the size of the traced instruction cancels out.
|
||||
@ -1741,7 +1725,6 @@ fasttrap_pid_probe(struct reg *rp)
|
||||
/* LINTED - alignment */
|
||||
*(uint32_t *)&scratch[i] = pc - addr - 5;
|
||||
i += sizeof (uint32_t);
|
||||
#endif
|
||||
#ifdef __amd64
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user