From nobody Thu Jun 20 16:45:44 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 4W4mZc5bdzz5P5ys; Thu, 20 Jun 2024 16:45:44 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4W4mZc4v97z4qJr; Thu, 20 Jun 2024 16:45:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1718901944; 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=O6R/pzT3UKy2ZcrCRetF2Np79L1B81aIhmcaf5OKRkM=; b=UjYlbsqoem+GkhY0XEEmJm7lJqUs5tA7ccpgWKQN5PUdyZ/TmWkXcUQFCuSzLvSdanwHTM bviQ+XbZXB3JEuIYZKysF4umhq+bYQNPl43m3PI3Qn3sTlwqyB94kVGQ3gJ2PrUYDqCqeV xPqUV5Ufv+TKvsMFxywmuIPnMtEkD2MD5KTVluTZzqfXYQd/erLW+PuK/ZRBucux0TGjpC SpI2AeJ/AaQ3QOcDeAIRHNYZ+pxmPHxNJjdU1uw9bySJRfUXxC7IJLRTUeQ05LPAO6grOQ 7iQCOhsETJ+uca1Xxig0APUR+DvZuFIsCkZ1G8plRxGMz0FsqQxImivyXCH2Kw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1718901944; a=rsa-sha256; cv=none; b=d2Vys6Ewoy31NTbWVh7iIVq6AkmVZFJMx2GoZyDvTtWX2JyKP7r6vP3NpkFGJy2MAkLrBw Quqtfe3XSvGVNJ3MNvdlCM7YaM8GWEbhK5KZUy7AUf314VZl6a7uK1cHJVVWJXQrU1pSaC UFLYCwKIZ1JDMVR9wE9V9dA+4Dnn9YIl6tt8fXPvM/83i1xUXzTdNkQemz7oEQXfOh3mJ8 3Az8KtKTPX/VAXtMEQcnb35mGSGTBFvLGpFzyn5XvxPOQybJixk/XQfLHraAMtXHhFnedL wSBdHhJg18G5P0HnsmfsOQcClfraGxZ3w9ZkKfarFBCyGVicfNop7fLcpKFlgw== 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=1718901944; 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=O6R/pzT3UKy2ZcrCRetF2Np79L1B81aIhmcaf5OKRkM=; b=RxbblqloMp6RmgChzjmDyBApa2w/T8GnYu8utID/u4MC70BC/nr/A74f9kqeiYowmNz5o6 E2fLYpvM3P/Q4zRI9/ZgjeY5VRQE/UXvHOBPQOcwrlD+/AIo6GqVkjnUiVgin3pVDDP4Sd ONbRPLThkr8ZKSaQBakI2NAP/Dx0cGdJck4m3MQZtUlX7BFWW5STGcFDNEOQEHDHK+KIx/ 3KQFE3rQSjI/gL7NmVXGQoOMkv24d7/458jTROlREA29BoxDBotuma78XpYydqhaOfgK9O o2vmzgo+IdlVpu4aw2q4IXhGIAvNss/juvboiK+igDjK9D0wZes0Y0deZtl5Fw== 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 4W4mZc4SkmzYWs; Thu, 20 Jun 2024 16:45:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 45KGji09048141; Thu, 20 Jun 2024 16:45:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 45KGjiZR048138; Thu, 20 Jun 2024 16:45:44 GMT (envelope-from git) Date: Thu, 20 Jun 2024 16:45:44 GMT Message-Id: <202406201645.45KGjiZR048138@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: bae00433f013 - main - 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/main X-Git-Reftype: branch X-Git-Commit: bae00433f013c1c960ab13b9d81edef5a9dbf84d Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=bae00433f013c1c960ab13b9d81edef5a9dbf84d commit bae00433f013c1c960ab13b9d81edef5a9dbf84d Author: Mark Johnston AuthorDate: 2024-06-20 16:41:01 +0000 Commit: Mark Johnston 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