Page MenuHomeFreeBSD

D39504.id120510.diff
No OneTemporary

D39504.id120510.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
@@ -19,12 +19,7 @@
*/
#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))
+#define KINST_TRAMP_FILL KINST_PATCHVAL
typedef uint8_t kinst_patchval_t;
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
@@ -29,8 +29,17 @@
#include "kinst_isa.h"
/*
- * We can have 4KB/32B = 128 trampolines per chunk.
+ * Fill the trampolines with KINST_TRAMP_FILL so that the kernel will crash
+ * cleanly if things somehow go wrong.
*/
+#define KINST_TRAMP_INIT(t, s) do { \
+ int _i, _v; \
+ \
+ _v = KINST_TRAMP_FILL; \
+ for (_i = 0; _i < (s); _i += sizeof(kinst_patchval_t)) \
+ memcpy(&((uint8_t *)(t))[_i], &_v, sizeof(kinst_patchval_t)); \
+} while (0)
+
#define KINST_TRAMPS_PER_CHUNK (KINST_TRAMPCHUNK_SIZE / KINST_TRAMP_SIZE)
struct trampchunk {

File Metadata

Mime Type
text/plain
Expires
Thu, Nov 13, 12:00 AM (7 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
25236931
Default Alt Text
D39504.id120510.diff (1 KB)

Event Timeline