Changeset View
Changeset View
Standalone View
Standalone View
sys/cddl/dev/dtrace/arm/dtrace_isa.c
Show First 20 Lines • Show All 83 Lines • ▼ Show 20 Lines | dtrace_getpcstack(pc_t *pcstack, int pcstack_limit, int aframes, | ||||
state.registers[FP] = (uint32_t)__builtin_frame_address(0); | state.registers[FP] = (uint32_t)__builtin_frame_address(0); | ||||
state.registers[SP] = sp; | state.registers[SP] = sp; | ||||
state.registers[LR] = (uint32_t)__builtin_return_address(0); | state.registers[LR] = (uint32_t)__builtin_return_address(0); | ||||
state.registers[PC] = (uint32_t)dtrace_getpcstack; | state.registers[PC] = (uint32_t)dtrace_getpcstack; | ||||
while (depth < pcstack_limit) { | while (depth < pcstack_limit) { | ||||
int done; | int done; | ||||
done = unwind_stack_one(&state, 1); | done = unwind_stack_one(&state); | ||||
/* | /* | ||||
* NB: Unlike some other architectures, we don't need to | * NB: Unlike some other architectures, we don't need to | ||||
* explicitly insert cpu_dtrace_caller as it appears in the | * explicitly insert cpu_dtrace_caller as it appears in the | ||||
* normal kernel stack trace rather than a special trap frame. | * normal kernel stack trace rather than a special trap frame. | ||||
*/ | */ | ||||
if (aframes > 0) { | if (aframes > 0) { | ||||
aframes--; | aframes--; | ||||
▲ Show 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | dtrace_getstackdepth(int aframes) | ||||
__asm __volatile("mov %0, sp" : "=&r" (sp)); | __asm __volatile("mov %0, sp" : "=&r" (sp)); | ||||
state.registers[FP] = (uint32_t)__builtin_frame_address(0); | state.registers[FP] = (uint32_t)__builtin_frame_address(0); | ||||
state.registers[SP] = sp; | state.registers[SP] = sp; | ||||
state.registers[LR] = (uint32_t)__builtin_return_address(0); | state.registers[LR] = (uint32_t)__builtin_return_address(0); | ||||
state.registers[PC] = (uint32_t)dtrace_getstackdepth; | state.registers[PC] = (uint32_t)dtrace_getstackdepth; | ||||
do { | do { | ||||
done = unwind_stack_one(&state, 1); | done = unwind_stack_one(&state); | ||||
depth++; | depth++; | ||||
} while (!done); | } while (!done); | ||||
if (depth < aframes) | if (depth < aframes) | ||||
return 0; | return 0; | ||||
else | else | ||||
return depth - aframes; | return depth - aframes; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 97 Lines • Show Last 20 Lines |