mirror of
https://github.com/opnsense/src.git
synced 2026-02-16 00:58:21 -05:00
Use uintptr_t instead of uint64_t for pointers in stack frames.
Reviewed by: andrew Obtained from: CheriBSD Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D27361
This commit is contained in:
parent
fdd947e4ce
commit
4d16f94191
6 changed files with 24 additions and 24 deletions
|
|
@ -73,7 +73,7 @@ db_stack_trace_cmd(struct unwind_state *frame)
|
|||
db_expr_t offset;
|
||||
|
||||
while (1) {
|
||||
uint64_t pc = frame->pc;
|
||||
uintptr_t pc = frame->pc;
|
||||
int ret;
|
||||
|
||||
ret = unwind_frame(frame);
|
||||
|
|
@ -109,9 +109,9 @@ db_trace_thread(struct thread *thr, int count)
|
|||
if (thr != curthread) {
|
||||
ctx = kdb_thr_ctx(thr);
|
||||
|
||||
frame.sp = (uint64_t)ctx->pcb_sp;
|
||||
frame.fp = (uint64_t)ctx->pcb_x[29];
|
||||
frame.pc = (uint64_t)ctx->pcb_x[30];
|
||||
frame.sp = (uintptr_t)ctx->pcb_sp;
|
||||
frame.fp = (uintptr_t)ctx->pcb_x[29];
|
||||
frame.pc = (uintptr_t)ctx->pcb_x[30];
|
||||
db_stack_trace_cmd(&frame);
|
||||
} else
|
||||
db_trace_self();
|
||||
|
|
@ -122,12 +122,12 @@ void
|
|||
db_trace_self(void)
|
||||
{
|
||||
struct unwind_state frame;
|
||||
uint64_t sp;
|
||||
uintptr_t sp;
|
||||
|
||||
__asm __volatile("mov %0, sp" : "=&r" (sp));
|
||||
|
||||
frame.sp = sp;
|
||||
frame.fp = (uint64_t)__builtin_frame_address(0);
|
||||
frame.pc = (uint64_t)db_trace_self;
|
||||
frame.fp = (uintptr_t)__builtin_frame_address(0);
|
||||
frame.pc = (uintptr_t)db_trace_self;
|
||||
db_stack_trace_cmd(&frame);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,13 +81,13 @@ void
|
|||
stack_save(struct stack *st)
|
||||
{
|
||||
struct unwind_state frame;
|
||||
uint64_t sp;
|
||||
uintptr_t sp;
|
||||
|
||||
__asm __volatile("mov %0, sp" : "=&r" (sp));
|
||||
|
||||
frame.sp = sp;
|
||||
frame.fp = (uint64_t)__builtin_frame_address(0);
|
||||
frame.pc = (uint64_t)stack_save;
|
||||
frame.fp = (uintptr_t)__builtin_frame_address(0);
|
||||
frame.pc = (uintptr_t)stack_save;
|
||||
|
||||
stack_capture(st, &frame);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,17 +37,17 @@ __FBSDID("$FreeBSD$");
|
|||
int
|
||||
unwind_frame(struct unwind_state *frame)
|
||||
{
|
||||
uint64_t fp;
|
||||
uintptr_t fp;
|
||||
|
||||
fp = frame->fp;
|
||||
if (!INKERNEL(fp))
|
||||
return (-1);
|
||||
|
||||
frame->sp = fp + 0x10;
|
||||
frame->sp = fp + sizeof(uintptr_t) * 2;
|
||||
/* FP to previous frame (X29) */
|
||||
frame->fp = *(uint64_t *)(fp);
|
||||
frame->fp = ((uintptr_t *)fp)[0];
|
||||
/* LR (X30) */
|
||||
frame->pc = *(uint64_t *)(fp + 8) - 4;
|
||||
frame->pc = ((uintptr_t *)fp)[1] - 4;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,14 +76,14 @@ kcsan_md_unwind(void)
|
|||
const char *symname;
|
||||
#endif
|
||||
struct unwind_state frame;
|
||||
uint64_t sp;
|
||||
uintptr_t sp;
|
||||
int nsym;
|
||||
|
||||
__asm __volatile("mov %0, sp" : "=&r" (sp));
|
||||
|
||||
frame.sp = sp;
|
||||
frame.fp = (uint64_t)__builtin_frame_address(0);
|
||||
frame.pc = (uint64_t)kcsan_md_unwind;
|
||||
frame.fp = (uintptr_t)__builtin_frame_address(0);
|
||||
frame.pc = (uintptr_t)kcsan_md_unwind;
|
||||
nsym = 0;
|
||||
|
||||
while (1) {
|
||||
|
|
|
|||
|
|
@ -33,9 +33,9 @@
|
|||
((va) >= VM_MIN_KERNEL_ADDRESS && (va) <= VM_MAX_KERNEL_ADDRESS)
|
||||
|
||||
struct unwind_state {
|
||||
uint64_t fp;
|
||||
uint64_t sp;
|
||||
uint64_t pc;
|
||||
uintptr_t fp;
|
||||
uintptr_t sp;
|
||||
uintptr_t pc;
|
||||
};
|
||||
|
||||
int unwind_frame(struct unwind_state *);
|
||||
|
|
|
|||
|
|
@ -83,9 +83,9 @@ dtrace_getpcstack(pc_t *pcstack, int pcstack_limit, int aframes,
|
|||
|
||||
__asm __volatile("mov %0, sp" : "=&r" (sp));
|
||||
|
||||
state.fp = (uint64_t)__builtin_frame_address(0);
|
||||
state.fp = (uintptr_t)__builtin_frame_address(0);
|
||||
state.sp = sp;
|
||||
state.pc = (uint64_t)dtrace_getpcstack;
|
||||
state.pc = (uintptr_t)dtrace_getpcstack;
|
||||
|
||||
while (depth < pcstack_limit) {
|
||||
if (!INKERNEL(state.pc) || !INKERNEL(state.fp))
|
||||
|
|
@ -281,9 +281,9 @@ dtrace_getstackdepth(int aframes)
|
|||
|
||||
__asm __volatile("mov %0, sp" : "=&r" (sp));
|
||||
|
||||
state.fp = (uint64_t)__builtin_frame_address(0);
|
||||
state.fp = (uintptr_t)__builtin_frame_address(0);
|
||||
state.sp = sp;
|
||||
state.pc = (uint64_t)dtrace_getstackdepth;
|
||||
state.pc = (uintptr_t)dtrace_getstackdepth;
|
||||
|
||||
do {
|
||||
done = unwind_frame(&state);
|
||||
|
|
|
|||
Loading…
Reference in a new issue