Changeset View
Changeset View
Standalone View
Standalone View
sys/cddl/dev/fbt/x86/fbt_isa.c
Show First 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | |||||
#define FBT_LEAVE 0xc9 | #define FBT_LEAVE 0xc9 | ||||
#ifdef __amd64__ | #ifdef __amd64__ | ||||
#define FBT_PATCHVAL 0xcc | #define FBT_PATCHVAL 0xcc | ||||
#else | #else | ||||
#define FBT_PATCHVAL 0xf0 | #define FBT_PATCHVAL 0xf0 | ||||
#endif | #endif | ||||
#define FBT_AFRAMES 2 | |||||
int | int | ||||
fbt_invop(uintptr_t addr, struct trapframe *frame, uintptr_t scratch __unused) | fbt_invop(uintptr_t addr, struct trapframe *frame, uintptr_t scratch __unused) | ||||
{ | { | ||||
solaris_cpu_t *cpu; | solaris_cpu_t *cpu; | ||||
uintptr_t *stack; | uintptr_t *stack; | ||||
uintptr_t arg0, arg1, arg2, arg3, arg4, rval; | uintptr_t arg0, arg1, arg2, arg3, arg4, rval; | ||||
fbt_probe_t *fbt; | fbt_probe_t *fbt; | ||||
int8_t fbtrval; | int8_t fbtrval; | ||||
▲ Show 20 Lines • Show All 161 Lines • ▼ Show 20 Lines | if (!(instr[1] == FBT_MOVL_ESP_EBP0_V0 && | ||||
!(instr[1] == FBT_MOVL_ESP_EBP0_V1 && | !(instr[1] == FBT_MOVL_ESP_EBP0_V1 && | ||||
instr[2] == FBT_MOVL_ESP_EBP1_V1)) | instr[2] == FBT_MOVL_ESP_EBP1_V1)) | ||||
return (0); | return (0); | ||||
#endif | #endif | ||||
fbt = malloc(sizeof (fbt_probe_t), M_FBT, M_WAITOK | M_ZERO); | fbt = malloc(sizeof (fbt_probe_t), M_FBT, M_WAITOK | M_ZERO); | ||||
fbt->fbtp_name = name; | fbt->fbtp_name = name; | ||||
fbt->fbtp_id = dtrace_probe_create(fbt_id, modname, | fbt->fbtp_id = dtrace_probe_create(fbt_id, modname, | ||||
name, FBT_ENTRY, 3, fbt); | name, FBT_ENTRY, FBT_AFRAMES, fbt); | ||||
fbt->fbtp_patchpoint = instr; | fbt->fbtp_patchpoint = instr; | ||||
fbt->fbtp_ctl = lf; | fbt->fbtp_ctl = lf; | ||||
fbt->fbtp_loadcnt = lf->loadcnt; | fbt->fbtp_loadcnt = lf->loadcnt; | ||||
fbt->fbtp_rval = DTRACE_INVOP_PUSHL_EBP; | fbt->fbtp_rval = DTRACE_INVOP_PUSHL_EBP; | ||||
fbt->fbtp_savedval = *instr; | fbt->fbtp_savedval = *instr; | ||||
fbt->fbtp_patchval = FBT_PATCHVAL; | fbt->fbtp_patchval = FBT_PATCHVAL; | ||||
fbt->fbtp_symindx = symindx; | fbt->fbtp_symindx = symindx; | ||||
▲ Show 20 Lines • Show All 77 Lines • ▼ Show 20 Lines | #endif | ||||
/* | /* | ||||
* We have a winner! | * We have a winner! | ||||
*/ | */ | ||||
fbt = malloc(sizeof (fbt_probe_t), M_FBT, M_WAITOK | M_ZERO); | fbt = malloc(sizeof (fbt_probe_t), M_FBT, M_WAITOK | M_ZERO); | ||||
fbt->fbtp_name = name; | fbt->fbtp_name = name; | ||||
if (retfbt == NULL) { | if (retfbt == NULL) { | ||||
fbt->fbtp_id = dtrace_probe_create(fbt_id, modname, | fbt->fbtp_id = dtrace_probe_create(fbt_id, modname, | ||||
name, FBT_RETURN, 3, fbt); | name, FBT_RETURN, FBT_AFRAMES, fbt); | ||||
} else { | } else { | ||||
retfbt->fbtp_probenext = fbt; | retfbt->fbtp_probenext = fbt; | ||||
fbt->fbtp_id = retfbt->fbtp_id; | fbt->fbtp_id = retfbt->fbtp_id; | ||||
} | } | ||||
retfbt = fbt; | retfbt = fbt; | ||||
fbt->fbtp_patchpoint = instr; | fbt->fbtp_patchpoint = instr; | ||||
fbt->fbtp_ctl = lf; | fbt->fbtp_ctl = lf; | ||||
Show All 30 Lines |