From nobody Sun Jul 14 16:43:17 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WMWNj5mHsz5QyP6; Sun, 14 Jul 2024 16:43:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WMWNj5CYdz4MFN; Sun, 14 Jul 2024 16:43:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720975397; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vxEWuu7ECqywDP8tr8b6+5kjwNCFmBrRtYbP+S9fkBo=; b=LnWs5cZfZqBgKEShtoHK2FPUu+9D8GJU8Cv9tUFw497V01I596Hhu340DqQ+IVxD3Nawt4 nuVKU6tP3Kt268kpenG2GHSUbCI2iZRV1sXMDO87mwo5CkSD7IRjYE4n4oAW5yrXbaLAUE WLX+vhTX8h8C7EQfCXAS/zHdJqBGQQTrV22MThnGba7WaPjxdI8d3Nvd4ukhHuj6M1PY2a LRjQVoemkEg6xc+wlev0lQwIcpB66ipSnMfSPB+DTfwi0N91O21uBg1xDZbz71PsrH+RDn IRmOKIMsxQJryFEhDyXqWnEoAtlcrkwuz4eMI3DgUEZzrLUUa4rhrybQru97+g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720975397; a=rsa-sha256; cv=none; b=mX4ZMfEgHKNnHeJrVkMF/hUFQqwbBXD6Xung5lVyLUG745DPRI95F5X5yHquyTr3MLDHfr dn6exJP/h20BJg9BW5rASJKaR8vgCzKeDvW032X8yxsuUiN7DAClwLFZomk4E2mAMgn1tv B2uG4cU2SiEJ3u0Ti8oTYjDKyUUComQdR6BNGfq1WOeh8aguRhvd0WupydstssHq0eSslR sSDiy4KWEMnXstTXEjKBpKxYtU5cRBhbh677pfcQfsxYYjPETDxKKxKkTlz25bPZvNT/ol SXEbogzqmkSj6aLKQXlG6RzXrG+fREamUOQSVKWuZB/F3YUPW/oP9EyG8hA3pg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720975397; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vxEWuu7ECqywDP8tr8b6+5kjwNCFmBrRtYbP+S9fkBo=; b=Z6YcPsXCvDazDfbxCqbsLdJ4NNtt3zNfAlMZSRr8BWdlp5xidHG6eil36B7UtnTkDpBjSB nmjqM2S1l3Drd64aTrKjlYjnPe2xVrFr7BmUE4IiksTzc2FcNXhwqDY7P8pbfb59oznUIR WR5VXO53dEGnA/M41dHu/8Rbzwoh0/XjtZ/xE0RcA/DPY91or3YWPrK53eDtRLP/waIaof t5V56iiCwSXydcsYn8+xqxvhhvnzHZ0cGFUhnEsYDzxmaTEM1vSw6OlRLtPHkayuVA57fn vHEf2uO5887d62d4MtLwQkxBWnkZIlKXmtWKkV8aiMB01oECUvri78QqB4i8Fg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4WMWNj4qSkzHDL; Sun, 14 Jul 2024 16:43:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 46EGhHdk039517; Sun, 14 Jul 2024 16:43:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46EGhHAF039514; Sun, 14 Jul 2024 16:43:17 GMT (envelope-from git) Date: Sun, 14 Jul 2024 16:43:17 GMT Message-Id: <202407141643.46EGhHAF039514@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 9ab7f84be600 - stable/14 - dtrace: Add a partial implementation of dtrace_getarg() on arm64 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 9ab7f84be600572534bf77b54cb566d92e6ce197 Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=9ab7f84be600572534bf77b54cb566d92e6ce197 commit 9ab7f84be600572534bf77b54cb566d92e6ce197 Author: Mark Johnston AuthorDate: 2024-06-20 16:41:01 +0000 Commit: Mark Johnston CommitDate: 2024-07-14 16:16: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 (cherry picked from commit bae00433f013c1c960ab13b9d81edef5a9dbf84d) --- 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