Author: jhb Date: Tue Dec 1 18:22:34 2020 New Revision: 368245 URL: https://svnweb.freebsd.org/changeset/base/368245
Log: 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 Modified: head/sys/arm64/arm64/db_trace.c head/sys/arm64/arm64/stack_machdep.c head/sys/arm64/arm64/unwind.c head/sys/arm64/include/csan.h head/sys/arm64/include/stack.h head/sys/cddl/dev/dtrace/aarch64/dtrace_isa.c Modified: head/sys/arm64/arm64/db_trace.c ============================================================================== --- head/sys/arm64/arm64/db_trace.c Tue Dec 1 18:13:57 2020 (r368244) +++ head/sys/arm64/arm64/db_trace.c Tue Dec 1 18:22:34 2020 (r368245) @@ -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); } Modified: head/sys/arm64/arm64/stack_machdep.c ============================================================================== --- head/sys/arm64/arm64/stack_machdep.c Tue Dec 1 18:13:57 2020 (r368244) +++ head/sys/arm64/arm64/stack_machdep.c Tue Dec 1 18:22:34 2020 (r368245) @@ -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); } Modified: head/sys/arm64/arm64/unwind.c ============================================================================== --- head/sys/arm64/arm64/unwind.c Tue Dec 1 18:13:57 2020 (r368244) +++ head/sys/arm64/arm64/unwind.c Tue Dec 1 18:22:34 2020 (r368245) @@ -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); } Modified: head/sys/arm64/include/csan.h ============================================================================== --- head/sys/arm64/include/csan.h Tue Dec 1 18:13:57 2020 (r368244) +++ head/sys/arm64/include/csan.h Tue Dec 1 18:22:34 2020 (r368245) @@ -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) { Modified: head/sys/arm64/include/stack.h ============================================================================== --- head/sys/arm64/include/stack.h Tue Dec 1 18:13:57 2020 (r368244) +++ head/sys/arm64/include/stack.h Tue Dec 1 18:22:34 2020 (r368245) @@ -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 *); Modified: head/sys/cddl/dev/dtrace/aarch64/dtrace_isa.c ============================================================================== --- head/sys/cddl/dev/dtrace/aarch64/dtrace_isa.c Tue Dec 1 18:13:57 2020 (r368244) +++ head/sys/cddl/dev/dtrace/aarch64/dtrace_isa.c Tue Dec 1 18:22:34 2020 (r368245) @@ -83,9 +83,9 @@ dtrace_getpcstack(pc_t *pcstack, int pcstack_limit, in __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); _______________________________________________ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"