Changeset View
Changeset View
Standalone View
Standalone View
sys/cddl/dev/kinst/amd64/kinst_isa.c
Show First 20 Lines • Show All 506 Lines • ▼ Show 20 Lines | kinst_make_probe(linker_file_t lf, int symindx, linker_symval_t *symval, | ||||
struct kinst_probe *kp; | struct kinst_probe *kp; | ||||
dtrace_kinst_probedesc_t *pd; | dtrace_kinst_probedesc_t *pd; | ||||
const char *func; | const char *func; | ||||
int error, instrsize, n, off; | int error, instrsize, n, off; | ||||
uint8_t *instr, *limit; | uint8_t *instr, *limit; | ||||
pd = opaque; | pd = opaque; | ||||
func = symval->name; | func = symval->name; | ||||
if (strcmp(func, pd->kpd_func) != 0 || strcmp(func, "trap_check") == 0) | |||||
if (kinst_excluded(func)) | |||||
return (0); | return (0); | ||||
if (strcmp(func, pd->kpd_func) != 0) | |||||
return (0); | |||||
instr = (uint8_t *)symval->value; | instr = (uint8_t *)symval->value; | ||||
limit = (uint8_t *)symval->value + symval->size; | limit = (uint8_t *)symval->value + symval->size; | ||||
if (instr >= limit) | if (instr >= limit) | ||||
return (0); | |||||
/* | |||||
* Ignore functions not beginning with the usual function prologue. | |||||
* These might correspond to exception handlers with which we should not | |||||
* meddle. This does however exclude functions which can be safely | |||||
* traced, such as cpu_switch(). | |||||
*/ | |||||
if (*instr != KINST_PUSHL_RBP) | |||||
return (0); | return (0); | ||||
n = 0; | n = 0; | ||||
while (instr < limit) { | while (instr < limit) { | ||||
instrsize = dtrace_instr_size(instr); | instrsize = dtrace_instr_size(instr); | ||||
off = (int)(instr - (uint8_t *)symval->value); | off = (int)(instr - (uint8_t *)symval->value); | ||||
if (pd->kpd_off != -1 && off != pd->kpd_off) { | if (pd->kpd_off != -1 && off != pd->kpd_off) { | ||||
instr += instrsize; | instr += instrsize; | ||||
▲ Show 20 Lines • Show All 82 Lines • Show Last 20 Lines |