git: db05f9fbfb1a - main - dtrace: implement dtrace_instr_size() for arm64

From: Christos Margiolis <christos_at_FreeBSD.org>
Date: Tue, 23 May 2023 14:19:50 UTC
The branch main has been updated by christos:

URL: https://cgit.FreeBSD.org/src/commit/?id=db05f9fbfb1a92caccaf37154666a99373028588

commit db05f9fbfb1a92caccaf37154666a99373028588
Author:     Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2023-05-23 14:19:15 +0000
Commit:     Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2023-05-23 14:19:15 +0000

    dtrace: implement dtrace_instr_size() for arm64
    
    Reviewed by:    markj
    Approved by;    markj (mentor)
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D39955
---
 cddl/lib/libdtrace/Makefile              |  4 ++++
 sys/cddl/dev/dtrace/aarch64/instr_size.c | 14 ++++++++++++++
 sys/modules/dtrace/dtrace/Makefile       |  2 +-
 3 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/cddl/lib/libdtrace/Makefile b/cddl/lib/libdtrace/Makefile
index 468603633658..5232293e0be5 100644
--- a/cddl/lib/libdtrace/Makefile
+++ b/cddl/lib/libdtrace/Makefile
@@ -131,6 +131,10 @@ SRCS+=		instr_size.c
 DSRCS+=		regs_riscv.d
 .endif
 
+.if ${MACHINE_CPUARCH} == "aarch64"
+SRCS+=		instr_size.c
+.endif
+
 YFLAGS+=-d
 
 LIBADD=	ctf elf proc pthread rtld_db
diff --git a/sys/cddl/dev/dtrace/aarch64/instr_size.c b/sys/cddl/dev/dtrace/aarch64/instr_size.c
new file mode 100644
index 000000000000..35964c0f0f78
--- /dev/null
+++ b/sys/cddl/dev/dtrace/aarch64/instr_size.c
@@ -0,0 +1,14 @@
+/*
+ * SPDX-License-Identifier: CDDL 1.0
+ *
+ * Copyright 2023 Christos Margiolis <christos@FreeBSD.org>
+ */
+
+#include <sys/types.h>
+#include <sys/dtrace.h>
+
+int
+dtrace_instr_size(uint8_t *instr __unused)
+{
+	return (INSN_SIZE);
+}
diff --git a/sys/modules/dtrace/dtrace/Makefile b/sys/modules/dtrace/dtrace/Makefile
index 1513418281ad..04829bd1d2c4 100644
--- a/sys/modules/dtrace/dtrace/Makefile
+++ b/sys/modules/dtrace/dtrace/Makefile
@@ -24,7 +24,7 @@ CFLAGS+=       -I${SYSDIR}/cddl/contrib/opensolaris/uts/intel \
                -I${SYSDIR}/cddl/dev/dtrace/x86
 .endif
 
-.if ${MACHINE_CPUARCH} == "riscv"
+.if ${MACHINE_CPUARCH} == "riscv" || ${MACHINE_CPUARCH} == "aarch64"
 SRCS+=		instr_size.c
 .endif