Page MenuHomeFreeBSD

D39504.id120149.diff
No OneTemporary

D39504.id120149.diff

diff --git a/sys/cddl/dev/kinst/amd64/kinst_isa.h b/sys/cddl/dev/kinst/amd64/kinst_isa.h
--- a/sys/cddl/dev/kinst/amd64/kinst_isa.h
+++ b/sys/cddl/dev/kinst/amd64/kinst_isa.h
@@ -20,12 +20,6 @@
#define KINST_TRAMP_SIZE 32
#define KINST_TRAMPCHUNK_SIZE PAGE_SIZE
-/*
- * Fill the trampolines with breakpoint instructions so that the kernel will
- * crash cleanly if things somehow go wrong.
- */
-#define KINST_TRAMP_INIT(t, s) memset((t), KINST_PATCHVAL, (s))
-
typedef uint8_t kinst_patchval_t;
struct kinst_probe_md {
diff --git a/sys/cddl/dev/kinst/trampoline.c b/sys/cddl/dev/kinst/trampoline.c
--- a/sys/cddl/dev/kinst/trampoline.c
+++ b/sys/cddl/dev/kinst/trampoline.c
@@ -28,6 +28,18 @@
#include "kinst.h"
#include "kinst_isa.h"
+/*
+ * Fill the trampolines with breakpoint instructions so that the kernel will
+ * crash cleanly if things somehow go wrong.
+ */
+#define KINST_TRAMP_INIT(t, s) do { \
+ int _i, _v; \
+ \
+ _v = KINST_PATCHVAL; \
+ for (_i = 0; _i < (s); _i += sizeof(kinst_patchval_t)) \
+ memcpy(&((uint8_t *)(t))[_i], &_v, sizeof(kinst_patchval_t)); \
+} while (0)
+
/*
* We can have 4KB/32B = 128 trampolines per chunk.
*/

File Metadata

Mime Type
text/plain
Expires
Fri, May 22, 3:07 PM (13 h, 26 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33423661
Default Alt Text
D39504.id120149.diff (1 KB)

Event Timeline