Date: Thu, 20 Jun 2024 16:45:44 GMT From: Mark Johnston <markj@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: bae00433f013 - main - dtrace: Add a partial implementation of dtrace_getarg() on arm64 Message-ID: <202406201645.45KGjiZR048138@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=bae00433f013c1c960ab13b9d81edef5a9dbf84d commit bae00433f013c1c960ab13b9d81edef5a9dbf84d Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2024-06-20 16:41:01 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2024-06-20 16:41:01 +0000 dtrace: Add a partial implementation of dtrace_getarg() on arm64 For invop providers (i.e., fbt and kinst) we can simply reach into the invop trapframe to fetch argument registers for arguments 0-7; for argument 8 and beyond we have to read the value off of the stack. Reviewed by: Domagoj Stolfa, avg MFC after: 2 weeks Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D45649 --- sys/cddl/dev/dtrace/aarch64/dtrace_isa.c | 33 +++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/sys/cddl/dev/dtrace/aarch64/dtrace_isa.c b/sys/cddl/dev/dtrace/aarch64/dtrace_isa.c index 34e225f32e81..72944e8a5ae2 100644 --- a/sys/cddl/dev/dtrace/aarch64/dtrace_isa.c +++ b/sys/cddl/dev/dtrace/aarch64/dtrace_isa.c @@ -238,14 +238,37 @@ dtrace_getufpstack(uint64_t *pcstack, uint64_t *fpstack, int pcstack_limit) printf("IMPLEMENT ME: %s\n", __func__); } -/*ARGSUSED*/ uint64_t -dtrace_getarg(int arg, int aframes) +dtrace_getarg(int arg, int aframes __unused) { + struct trapframe *tf; - printf("IMPLEMENT ME: %s\n", __func__); - - return (0); + /* + * We only handle invop providers here. + */ + if ((tf = curthread->t_dtrace_trapframe) == NULL) { + DTRACE_CPUFLAG_SET(CPU_DTRACE_ILLOP); + return (0); + } else if (arg < 8) { + return (tf->tf_x[arg]); + } else { + uintptr_t p; + uint64_t val; + + p = (tf->tf_sp + (arg - 8) * sizeof(uint64_t)); + if ((p & 7) != 0) { + DTRACE_CPUFLAG_SET(CPU_DTRACE_BADALIGN); + cpu_core[curcpu].cpuc_dtrace_illval = p; + return (0); + } + if (!kstack_contains(curthread, p, sizeof(uint64_t))) { + DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR); + cpu_core[curcpu].cpuc_dtrace_illval = p; + return (0); + } + memcpy(&val, (void *)p, sizeof(uint64_t)); + return (val); + } } int
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202406201645.45KGjiZR048138>