Page MenuHomeFreeBSD

D62198.1796055010.diff
No OneTemporary

Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None

D62198.1796055010.diff

diff --git a/sys/i386/include/sdt_machdep.h b/sys/i386/include/sdt_machdep.h
--- a/sys/i386/include/sdt_machdep.h
+++ b/sys/i386/include/sdt_machdep.h
@@ -7,7 +7,12 @@
#ifndef _SYS_SDT_MACHDEP_H_
#define _SYS_SDT_MACHDEP_H_
-#define _SDT_ASM_PATCH_INSTR "nop; nop; nop; nop; nop"
+/*
+ * A five-byte no-op, "leal %ds:0(%esi,%eiz,1), %esi". It must be a single
+ * instruction, and must match sdt_nop in sdt_machdep.c. The multi-byte NOP
+ * (0f 1f) is not used because not every supported CPU has it.
+ */
+#define _SDT_ASM_PATCH_INSTR ".byte 0x3e, 0x8d, 0x74, 0x26, 0x00"
/*
* Work around an apparent clang bug or limitation which prevents the use of the
diff --git a/sys/x86/x86/sdt_machdep.c b/sys/x86/x86/sdt_machdep.c
--- a/sys/x86/x86/sdt_machdep.c
+++ b/sys/x86/x86/sdt_machdep.c
@@ -15,12 +15,13 @@
#define SDT_PATCH_SIZE 5
-/*
- * The instruction that _SDT_ASM_PATCH_INSTR assembles to,
- * "nopw 0(%rax,%rax,1)".
- */
+/* The instruction that _SDT_ASM_PATCH_INSTR assembles to. */
static const uint8_t sdt_nop[SDT_PATCH_SIZE] = {
- 0x66, 0x0f, 0x1f, 0x04, 0x00
+#ifdef __amd64__
+ 0x66, 0x0f, 0x1f, 0x04, 0x00 /* nopw 0(%rax,%rax,1) */
+#else
+ 0x3e, 0x8d, 0x74, 0x26, 0x00 /* leal %ds:0(%esi,%eiz,1), %esi */
+#endif
};
/*

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 30, 4:10 PM (22 h, 22 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
42108221
Default Alt Text
D62198.1796055010.diff (1 KB)

Event Timeline