From nobody Wed Jul 24 21:24:55 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 4WTn9442C8z5R0mW; Wed, 24 Jul 2024 21:24:56 +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 4WTn940Tn5z4lRX; Wed, 24 Jul 2024 21:24:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1721856296; 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=4h/bHMSBisdSQ088eNxopmM3m4uiGa0lIxZpwByY5dY=; b=Rn/JegLkDv5Q/UP+IQJKDSES2KgGb5nXW8mA09wcAapNf/7ASidYGcqiqfIm3HOe6Ckdiz wIBbaomYayYhYo6hnxACUpxzllmbbyNoihgB1b/XQJgXl3OVAnHtaZZSfXhoP1yEJClVwt eE+5fhWNtJCcSBoPqXyJ4P60HsfU6KYaUgseCXh3x56oqUxIx0C5k8D2vicf/BluRh6hxD eaDJ9MGGKRiswCdWpil9VzSXtJnNKtPeuiv1hML/hn/1R5bWWOUBVlsvrdDATgDTYN0Qwp qgsI490sy0i2VygI7bpD3vNShiy6VyNILoDj1Q8Ht6f8Yk71ddqQOCo5PZQxTw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1721856296; a=rsa-sha256; cv=none; b=UddtDkeR5LFn0oM7ltkpC/uF0iAWD5q7RS/OnQe3oyHxOEyDRm4UhxRSGrOzut12SdQh4t oy/WJQPqm6/n8iO6iSPIVbQhReZBWFMF4bOO5xC//hfjuTXa9AWgV4370E1plmAggLKo1L x2V/SPbLTA6wyscBEWydDq3S6uJ78LGe/vqijWwmrUfD7qAs+cxna4riQhatxKoLWs507g 283XY+9M7xunT8WYxVtDsSGEHnYLy62+10kVF4zt3irAxW9VaOE55p7vkFxv0j5sQ+GXB7 w7JcfOAxoEc+kyPcssC6RSkeBub2kcrb7lF5J/3+mdT4cnKFfcl4JPtzmWSC3Q== 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=1721856296; 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=4h/bHMSBisdSQ088eNxopmM3m4uiGa0lIxZpwByY5dY=; b=Q6e1fBTsuHVVfU5WOZ/aK6TJNx1bJbjW+GNyir5KRPaBPysD+QcPbzVAS7j91YFRHRa8Hx HUSYWA+qkQ/nrtztkroq/gwGN+8/Bsd72Wb0xv4QzTaWX/hTbMXHy6om6EeY5Xc+PyIHHQ xEp3EC3PYtcE6aybJvjK4gqJkokhRSj2REXfnXndb4jl2GgnFulvjNtAfn1alg0uRgYc3z 20kAmcFCv3+dJDmxE5P+dAZZEpjnKKxrNHb3NOVVSj3wl29hp2gZEQFcE2CHrQfCM9IqGv PX6SFV7f37pmhIovgwv6qsnprGAjiA36vbEfowFOY4SfQaxCbPKk5MYM1nSLDg== 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 4WTn94065JzS23; Wed, 24 Jul 2024 21:24:56 +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 46OLOtj8083414; Wed, 24 Jul 2024 21:24:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46OLOtQs083411; Wed, 24 Jul 2024 21:24:55 GMT (envelope-from git) Date: Wed, 24 Jul 2024 21:24:55 GMT Message-Id: <202407242124.46OLOtQs083411@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: 82283cad12a4 - main - dtrace: Avoid including dtrace_isa.c directly into dtrace.c 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: 82283cad12a417abfb1469d899b2d7cfb1d38f77 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=82283cad12a417abfb1469d899b2d7cfb1d38f77 commit 82283cad12a417abfb1469d899b2d7cfb1d38f77 Author: Mark Johnston AuthorDate: 2024-07-24 20:10:33 +0000 Commit: Mark Johnston CommitDate: 2024-07-24 21:24:46 +0000 dtrace: Avoid including dtrace_isa.c directly into dtrace.c This was done in the original DTrace import, presumably because that made it a bit easier to handle includes. However, this can cause dtrace_getpcstack() to be inlined into dtrace_probe(), resulting in a missing frame in stack traces since dtrace_getpcstack() takes care to bump "aframes" to account for its own stack frame. To avoid this, compile dtrace_isa.c separately on all platforms. Add requisite includes. MFC after: 2 weeks Sponsored by: Innovate UK --- sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c | 1 - sys/cddl/dev/dtrace/aarch64/dtrace_isa.c | 3 +++ sys/cddl/dev/dtrace/amd64/dtrace_isa.c | 3 ++- sys/cddl/dev/dtrace/arm/dtrace_isa.c | 1 + sys/cddl/dev/dtrace/i386/dtrace_isa.c | 3 ++- sys/cddl/dev/dtrace/powerpc/dtrace_isa.c | 2 ++ sys/cddl/dev/dtrace/riscv/dtrace_isa.c | 1 + sys/cddl/dev/fbt/x86/fbt_isa.c | 2 +- sys/conf/files.arm | 1 + sys/conf/files.riscv | 1 + sys/modules/dtrace/dtrace/Makefile | 1 + 11 files changed, 15 insertions(+), 4 deletions(-) diff --git a/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c b/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c index ce02676e0dc1..d3e40e96e897 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c +++ b/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c @@ -18446,7 +18446,6 @@ static struct cdevsw helper_cdevsw = { #include #include #include -#include SYSINIT(dtrace_load, SI_SUB_DTRACE, SI_ORDER_FIRST, dtrace_load, NULL); SYSUNINIT(dtrace_unload, SI_SUB_DTRACE, SI_ORDER_FIRST, dtrace_unload, NULL); diff --git a/sys/cddl/dev/dtrace/aarch64/dtrace_isa.c b/sys/cddl/dev/dtrace/aarch64/dtrace_isa.c index 72944e8a5ae2..ff0e068006bd 100644 --- a/sys/cddl/dev/dtrace/aarch64/dtrace_isa.c +++ b/sys/cddl/dev/dtrace/aarch64/dtrace_isa.c @@ -27,6 +27,7 @@ #include #include +#include #include #include #include @@ -46,6 +47,8 @@ #include #include +#include + #include "regset.h" #define MAX_USTACK_DEPTH 2048 diff --git a/sys/cddl/dev/dtrace/amd64/dtrace_isa.c b/sys/cddl/dev/dtrace/amd64/dtrace_isa.c index 0b7162998536..9db5a16190db 100644 --- a/sys/cddl/dev/dtrace/amd64/dtrace_isa.c +++ b/sys/cddl/dev/dtrace/amd64/dtrace_isa.c @@ -27,6 +27,7 @@ #include #include +#include #include #include #include @@ -368,7 +369,7 @@ dtrace_getarg(int arg, int aframes) for (i = 1; i <= aframes; i++) { fp = fp->f_frame; - if (P2ROUNDUP(fp->f_retaddr, 16) == + if (roundup2(fp->f_retaddr, 16) == (long)dtrace_invop_callsite) { /* * In the case of amd64, we will use the pointer to the diff --git a/sys/cddl/dev/dtrace/arm/dtrace_isa.c b/sys/cddl/dev/dtrace/arm/dtrace_isa.c index c3783b77c2d4..ed03e5ca0006 100644 --- a/sys/cddl/dev/dtrace/arm/dtrace_isa.c +++ b/sys/cddl/dev/dtrace/arm/dtrace_isa.c @@ -27,6 +27,7 @@ #include #include +#include #include #include #include diff --git a/sys/cddl/dev/dtrace/i386/dtrace_isa.c b/sys/cddl/dev/dtrace/i386/dtrace_isa.c index 64c8de2a8d3a..7a30587120ba 100644 --- a/sys/cddl/dev/dtrace/i386/dtrace_isa.c +++ b/sys/cddl/dev/dtrace/i386/dtrace_isa.c @@ -27,6 +27,7 @@ #include #include +#include #include #include #include @@ -428,7 +429,7 @@ dtrace_getarg(int arg, int aframes) for (i = 1; i <= aframes; i++) { fp = fp->f_frame; - if (P2ROUNDUP(fp->f_retaddr, 4) == + if (roundup2(fp->f_retaddr, 4) == (long)dtrace_invop_callsite) { /* * If we pass through the invalid op handler, we will diff --git a/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c b/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c index 7185a01c125d..acde4f0aeab2 100644 --- a/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c +++ b/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c @@ -29,6 +29,7 @@ #include #include +#include #include #include #include @@ -37,6 +38,7 @@ #include #include #include +#include #include #include diff --git a/sys/cddl/dev/dtrace/riscv/dtrace_isa.c b/sys/cddl/dev/dtrace/riscv/dtrace_isa.c index 87f52b809dfa..7a66d93d4ba9 100644 --- a/sys/cddl/dev/dtrace/riscv/dtrace_isa.c +++ b/sys/cddl/dev/dtrace/riscv/dtrace_isa.c @@ -29,6 +29,7 @@ #include #include +#include #include #include #include diff --git a/sys/cddl/dev/fbt/x86/fbt_isa.c b/sys/cddl/dev/fbt/x86/fbt_isa.c index 387a3f1582c3..ee05d37b383e 100644 --- a/sys/cddl/dev/fbt/x86/fbt_isa.c +++ b/sys/cddl/dev/fbt/x86/fbt_isa.c @@ -54,7 +54,7 @@ #define FBT_PATCHVAL 0xf0 #endif -#define FBT_AFRAMES 2 +#define FBT_AFRAMES 3 int fbt_invop(uintptr_t addr, struct trapframe *frame, uintptr_t scratch __unused) diff --git a/sys/conf/files.arm b/sys/conf/files.arm index 825680b73165..5ada97ccad30 100644 --- a/sys/conf/files.arm +++ b/sys/conf/files.arm @@ -76,6 +76,7 @@ arm/arm/unwind.c optional ddb | kdtrace_hooks | stack arm/arm/vm_machdep.c standard arm/arm/vfp.c optional vfp cddl/dev/dtrace/arm/dtrace_asm.S optional dtrace compile-with "${DTRACE_S}" +cddl/dev/dtrace/arm/dtrace_isa.c optional dtrace compile-with "${DTRACE_C}" cddl/dev/dtrace/arm/dtrace_subr.c optional dtrace compile-with "${DTRACE_C}" cddl/dev/fbt/arm/fbt_isa.c optional dtrace_fbt | dtraceall compile-with "${FBT_C}" diff --git a/sys/conf/files.riscv b/sys/conf/files.riscv index 5b94eb327f93..89fb6f3cbe5a 100644 --- a/sys/conf/files.riscv +++ b/sys/conf/files.riscv @@ -1,4 +1,5 @@ cddl/dev/dtrace/riscv/dtrace_asm.S optional dtrace compile-with "${DTRACE_S}" +cddl/dev/dtrace/riscv/dtrace_isa.c optional dtrace compile-with "${DTRACE_C}" cddl/dev/dtrace/riscv/dtrace_subr.c optional dtrace compile-with "${DTRACE_C}" cddl/dev/dtrace/riscv/instr_size.c optional dtrace compile-with "${DTRACE_C}" cddl/dev/fbt/riscv/fbt_isa.c optional dtrace_fbt | dtraceall compile-with "${FBT_C}" diff --git a/sys/modules/dtrace/dtrace/Makefile b/sys/modules/dtrace/dtrace/Makefile index 765a8477f3f2..472de0ff944b 100644 --- a/sys/modules/dtrace/dtrace/Makefile +++ b/sys/modules/dtrace/dtrace/Makefile @@ -12,6 +12,7 @@ KMOD= dtrace SRCS= dtrace.c \ dtrace_xoroshiro128_plus.c \ dtrace_asm.S \ + dtrace_isa.c \ dtrace_subr.c .if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"