aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristos Margiolis <christos@FreeBSD.org>2023-05-22 20:21:25 +0000
committerChristos Margiolis <christos@FreeBSD.org>2023-05-22 20:21:25 +0000
commitcef256558752afa1f25afd7823bb01fde8bd63bd (patch)
tree076c1ffba1d5f166e4640ee8ce3e05bc25b61aed
parent3c6fb586b956798fbff8e9c50e7e3a7f204ba5f3 (diff)
downloadsrc-cef256558752afa1f25afd7823bb01fde8bd63bd.tar.gz
src-cef256558752afa1f25afd7823bb01fde8bd63bd.zip
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
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h4
-rw-r--r--sys/cddl/dev/dtrace/x86/instr_size.c3
2 files changed, 6 insertions, 1 deletions
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;