Use uintptr_t instead of uint64_t for pointers in stack frames.
Reviewed by: mhorne Obtained from: CheriBSD Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D25995
This commit is contained in:
parent
97dc595da2
commit
367de39efa
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=364180
@ -41,9 +41,9 @@
|
||||
(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 *);
|
||||
|
@ -108,9 +108,9 @@ db_stack_trace_cmd(struct unwind_state *frame)
|
||||
db_printf("--- exception %ld, tval = %#lx\n",
|
||||
tf->tf_scause & EXCP_MASK,
|
||||
tf->tf_stval);
|
||||
frame->sp = (uint64_t)tf->tf_sp;
|
||||
frame->fp = (uint64_t)tf->tf_s[0];
|
||||
frame->pc = (uint64_t)tf->tf_sepc;
|
||||
frame->sp = tf->tf_sp;
|
||||
frame->fp = tf->tf_s[0];
|
||||
frame->pc = tf->tf_sepc;
|
||||
if (!INKERNEL(frame->fp))
|
||||
break;
|
||||
continue;
|
||||
@ -132,9 +132,9 @@ db_trace_thread(struct thread *thr, int count)
|
||||
|
||||
ctx = kdb_thr_ctx(thr);
|
||||
|
||||
frame.sp = (uint64_t)ctx->pcb_sp;
|
||||
frame.fp = (uint64_t)ctx->pcb_s[0];
|
||||
frame.pc = (uint64_t)ctx->pcb_ra;
|
||||
frame.sp = ctx->pcb_sp;
|
||||
frame.fp = ctx->pcb_s[0];
|
||||
frame.pc = ctx->pcb_ra;
|
||||
db_stack_trace_cmd(&frame);
|
||||
return (0);
|
||||
}
|
||||
@ -143,12 +143,12 @@ void
|
||||
db_trace_self(void)
|
||||
{
|
||||
struct unwind_state frame;
|
||||
uint64_t sp;
|
||||
uintptr_t sp;
|
||||
|
||||
__asm __volatile("mv %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);
|
||||
}
|
||||
|
@ -86,13 +86,13 @@ void
|
||||
stack_save(struct stack *st)
|
||||
{
|
||||
struct unwind_state frame;
|
||||
uint64_t sp;
|
||||
uintptr_t sp;
|
||||
|
||||
__asm __volatile("mv %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);
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ __FBSDID("$FreeBSD$");
|
||||
int
|
||||
unwind_frame(struct unwind_state *frame)
|
||||
{
|
||||
uint64_t fp;
|
||||
uintptr_t fp;
|
||||
|
||||
fp = frame->fp;
|
||||
|
||||
@ -50,8 +50,8 @@ unwind_frame(struct unwind_state *frame)
|
||||
return (-1);
|
||||
|
||||
frame->sp = fp;
|
||||
frame->fp = *(uint64_t *)(fp - 16);
|
||||
frame->pc = *(uint64_t *)(fp - 8) - 4;
|
||||
frame->fp = ((uintptr_t *)fp)[-2];
|
||||
frame->pc = ((uintptr_t *)fp)[-1] - 4;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user