git: 38720107324b - main - dtrace: Fix RISC-V user stack unwinder
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 06 Feb 2023 19:28:08 UTC
The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=38720107324b3903f342bcb0306c72c4e4235053 commit 38720107324b3903f342bcb0306c72c4e4235053 Author: Jessica Clarke <jrtc27@FreeBSD.org> AuthorDate: 2023-02-06 18:30:57 +0000 Commit: Mitchell Horne <mhorne@FreeBSD.org> CommitDate: 2023-02-06 19:26:53 +0000 dtrace: Fix RISC-V user stack unwinder The unwind logic was copied from AArch64 which follows the peculiar AACPS (where, unlike typical RISC architectures, its frame pointer follows an x86/stack machine-like convention where the frame pointer points at the bottom of the frame record, not the top). Delete the pointless riscv_frame struct and fix this. Reviewed by: mhorne MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D28054 --- sys/cddl/dev/dtrace/riscv/dtrace_isa.c | 5 ++--- sys/riscv/include/frame.h | 5 ----- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/sys/cddl/dev/dtrace/riscv/dtrace_isa.c b/sys/cddl/dev/dtrace/riscv/dtrace_isa.c index bc8426a752df..6d44a0cee9ee 100644 --- a/sys/cddl/dev/dtrace/riscv/dtrace_isa.c +++ b/sys/cddl/dev/dtrace/riscv/dtrace_isa.c @@ -150,9 +150,8 @@ dtrace_getustack_common(uint64_t *pcstack, int pcstack_limit, uintptr_t pc, if (fp == 0) break; - pc = dtrace_fuword64((void *)(fp + - offsetof(struct riscv_frame, f_retaddr))); - fp = dtrace_fuword64((void *)fp); + pc = dtrace_fuword64((void *)(fp - 1 * sizeof(uint64_t))); + fp = dtrace_fuword64((void *)(fp - 2 * sizeof(uint64_t))); if (fp == oldfp) { *flags |= CPU_DTRACE_BADSTACK; diff --git a/sys/riscv/include/frame.h b/sys/riscv/include/frame.h index 3917aebfac76..a822a285996c 100644 --- a/sys/riscv/include/frame.h +++ b/sys/riscv/include/frame.h @@ -59,11 +59,6 @@ struct trapframe { uint64_t tf_scause; }; -struct riscv_frame { - struct riscv_frame *f_frame; - u_long f_retaddr; -}; - /* * Signal frame. Pushed onto user stack before calling sigcode. */