git: cef256558752 - main - dtrace: export dtrace_dis_get_byte()

From: Christos Margiolis <christos_at_FreeBSD.org>
Date: Mon, 22 May 2023 20:22:15 UTC
The branch main has been updated by christos:

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

commit cef256558752afa1f25afd7823bb01fde8bd63bd
Author:     Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2023-05-22 20:21:25 +0000
Commit:     Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2023-05-22 20:21:25 +0000

    dtrace: export dtrace_dis_get_byte()
    
    kinst uses this function as well, but because it is not exported, it
    implements its own copy of it. The patch also exposes the function to
    userland, so programs that need to use dtrace_disx86() can use this
    function instead of rolling their own copies.
    
    Reviewed by:    markj
    Approved by:    markj (mentor)
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D39871
---
 sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h | 4 ++++
 sys/cddl/dev/dtrace/x86/instr_size.c                 | 3 ++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h b/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h
index 7b8da08e9ae9..6b09a1761af9 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h
+++ b/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h
@@ -2431,6 +2431,10 @@ extern void dtrace_helpers_destroy(proc_t *);
 extern int dtrace_instr_size(uint8_t *instr);
 #endif
 
+#if defined(__i386) || defined(__amd64)
+extern int dtrace_dis_get_byte(void *p);
+#endif
+
 #endif	/* _ASM */
 
 #if defined(__i386) || defined(__amd64)
diff --git a/sys/cddl/dev/dtrace/x86/instr_size.c b/sys/cddl/dev/dtrace/x86/instr_size.c
index a2a9b9342566..878bcf7cf09e 100644
--- a/sys/cddl/dev/dtrace/x86/instr_size.c
+++ b/sys/cddl/dev/dtrace/x86/instr_size.c
@@ -49,6 +49,7 @@
 
 typedef	u_int			model_t;
 #define	DATAMODEL_NATIVE	0
+int dtrace_dis_get_byte(void *);
 int dtrace_instr_size(uint8_t *);
 int dtrace_instr_size_isa(uint8_t *, model_t, int *);
 #endif
@@ -79,7 +80,7 @@ typedef enum dis_isize {
 /*
  * get a byte from instruction stream
  */
-static int
+int
 dtrace_dis_get_byte(void *p)
 {
 	int ret;