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
This commit is contained in:
Jessica Clarke 2023-02-06 14:30:57 -04:00 committed by Mitchell Horne
parent 06faad1de2
commit 3872010732
2 changed files with 2 additions and 8 deletions

View File

@ -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;

View File

@ -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.
*/