#define DTRACE_TOSTRING(s) DTRACE_STRINGIFY(s)
#if defined(KERNEL)
/*
- * For the kernel, set an explicit global label do the symbol can be located
+ * For the kernel, set an explicit global label so the symbol can be located
*/
+#ifdef __x86_64__
+#define DTRACE_LAB(p, n) \
+ "__dtrace_probe$" DTRACE_TOSTRING(%=__LINE__) DTRACE_STRINGIFY(_##p##___##n)
+
+#define DTRACE_LABEL(p, n) \
+ ".section __DATA, __data\n\t" \
+ ".globl " DTRACE_LAB(p, n) "\n\t" \
+ DTRACE_LAB(p, n) ":" ".quad 1f""\n\t" \
+ ".text" "\n\t" \
+ "1:"
+#else
#define DTRACE_LAB(p, n) \
- "__dtrace_probe$" DTRACE_TOSTRING(__LINE__) DTRACE_STRINGIFY(_##p##___##n)
+ "__dtrace_probe$" DTRACE_TOSTRING(%=__LINE__) DTRACE_STRINGIFY(_##p##___##n)
#define DTRACE_LABEL(p, n) \
".section __DATA, __data\n\t" \
DTRACE_LAB(p, n) ":" ".long 1f""\n\t" \
".text" "\n\t" \
"1:"
+#endif
#else /* !KERNEL */
#define DTRACE_LABEL(p, n) \
- "__dtrace_probe$" DTRACE_TOSTRING(__LINE__) DTRACE_STRINGIFY(_##p##___##n) ":" "\n\t"
+ "__dtrace_probe$" DTRACE_TOSTRING(%=__LINE__) DTRACE_STRINGIFY(_##p##___##n) ":" "\n\t"
#endif /* !KERNEL */
#ifdef DTRACE_CALL_TEST
#define DTRACE_NOPS \
"nop" "\n\t" \
- "leal 0(%%esi), %%esi" "\n\t"
+ "nop" "\n\t" \
+ "nop" "\n\t"
#define DTRACE_CALL_INSN(p,n) \
"call _dtracetest" DTRACE_STRINGIFY(_##p##_##n) "\n\t"
#define ARGS6_EXTENT 6
#define ARGS7_EXTENT 7
#define ARGS8_EXTENT 8
-#define ARGS9_EXTENT 10
-#define ARGS10_EXTENT 10
+#define ARGS9_EXTENT 9
+#define ARGS10_EXTENT 10
#define DTRACE_CALL0ARGS(provider, name) \
asm volatile ( \
DTRACE_CALL(provider, name) \
+ : \
+ : \
);
#define DTRACE_CALL1ARG(provider, name) \
DTRACE_CALL(provider, name) \
: \
: "r" (__dtrace_args) \
- : "memory", "rdi" \
+ : "memory", "rdi" \
);
#define DTRACE_CALL2ARGS(provider, name) \
DTRACE_CALL(provider, name) \
: \
: "r" (__dtrace_args) \
- : "memory", "rdi", "rsi" \
+ : "memory", "rdi", "rsi" \
);
#define DTRACE_CALL3ARGS(provider, name) \
DTRACE_CALL(provider, name) \
: \
: "r" (__dtrace_args) \
- : "memory", "rdi", "rsi", "rdx" \
+ : "memory", "rdi", "rsi", "rdx" \
);
#define DTRACE_CALL4ARGS(provider, name) \
DTRACE_CALL(provider, name) \
: \
: "r" (__dtrace_args) \
- : "memory", "rdi", "rsi", "rdx", "rcx" \
+ : "memory", "rdi", "rsi", "rdx", "rcx" \
);
#define DTRACE_CALL5ARGS(provider, name) \
DTRACE_CALL(provider, name) \
: \
: "r" (__dtrace_args) \
- : "memory", "rdi", "rsi", "rdx", "rcx", "r8" \
+ : "memory", "rdi", "rsi", "rdx", "rcx", "r8" \
);
#define DTRACE_CALL6ARGS(provider, name) \
DTRACE_CALL(provider, name) \
: \
: "r" (__dtrace_args) \
- : "memory", "rdi", "rsi", "rdx", "rcx", "r8", "r9" \
+ : "memory", "rdi", "rsi", "rdx", "rcx", "r8", "r9" \
);
#define DTRACE_CALL7ARGS(provider, name) \
"addq\t$0x8,%%rsp" "\n\t" \
: \
: "r" (__dtrace_args) \
- : "memory", "rdi", "rsi", "rdx", "rcx", "r8", "r9", "rax" \
- );
-
-#define DTRACE_CALL8ARGS(provider, name) \
- asm volatile ("subq\t$0x10,%%rsp" "\n\t" \
- "movq\t0x0(%0),%%rdi" "\n\t" \
- "movq\t0x8(%0),%%rsi" "\n\t" \
- "movq\t0x10(%0),%%rdx" "\n\t" \
- "movq\t0x18(%0),%%rcx" "\n\t" \
- "movq\t0x20(%0),%%r8" "\n\t" \
- "movq\t0x28(%0),%%r9" "\n\t" \
- "movdqa\t0x30(%0),%%xmm1" "\n\t" \
- "movdqa\t%%xmm1,0x0(%%rsp)" "\n\t" \
- DTRACE_CALL(provider, name) \
- "addq\t$0x10,%%rsp" "\n\t" \
- : \
- : "r" (__dtrace_args) \
- : "memory", "rdi", "rsi", "rdx", "rcx", "r8", "r9", "xmm1" \
- );
-
-#define DTRACE_CALL9ARGS(provider, name) \
- DTRACE_CALL10ARGS(provider, name)
-
-#define DTRACE_CALL10ARGS(provider, name) \
- asm volatile ("subq\t$0x20,%%rsp" "\n\t" \
- "movq\t0x0(%0),%%rdi" "\n\t" \
- "movq\t0x8(%0),%%rsi" "\n\t" \
- "movq\t0x10(%0),%%rdx" "\n\t" \
- "movq\t0x18(%0),%%rcx" "\n\t" \
- "movq\t0x20(%0),%%r8" "\n\t" \
- "movq\t0x28(%0),%%r9" "\n\t" \
- "movdqa\t0x30(%0),%%xmm1" "\n\t" \
- "movdqa\t0x40(%0),%%xmm2" "\n\t" \
- "movdqa\t%%xmm1,0x0(%%rsp)" "\n\t" \
- "movdqa\t%%xmm2,0x10(%%rsp)" "\n\t" \
- DTRACE_CALL(provider, name) \
- "addq\t$0x20,%%rsp" "\n\t" \
- : \
- : "r" (__dtrace_args) \
- : "memory", "rdi", "rsi", "rdx", "rcx", "r8", "r9", "xmm1", "xmm2" \
+ : "memory", "rdi", "rsi", "rdx", "rcx", "r8", "r9", "rax" \
);
#endif // __x86_64__
"addl\t$0x10,%%esp" \
: \
: "r" (__dtrace_args) \
- : "memory", "eax" \
+ : "memory", "eax" \
);
#define DTRACE_CALL2ARGS(provider, name) \
"addl\t$0x10,%%esp" \
: \
: "r" (__dtrace_args) \
- : "memory", "eax", "edx" \
+ : "memory", "eax", "edx" \
);
#define DTRACE_CALL3ARGS(provider, name) \
"addl\t$0x10,%%esp" \
: \
: "r" (__dtrace_args) \
- : "memory", "eax", "edx" \
+ : "memory", "eax", "edx" \
);
#define DTRACE_CALL4ARGS(provider, name) \
"addl\t$0x10,%%esp" \
: \
: "r" (__dtrace_args) \
- : "memory", "eax", "edx" \
+ : "memory", "eax", "edx" \
);
#define DTRACE_CALL5ARGS(provider, name) \
"addl\t$0x20,%%esp" \
: \
: "r" (__dtrace_args) \
- : "memory", "eax", "edx" \
+ : "memory", "eax", "edx" \
);
#define DTRACE_CALL6ARGS(provider, name) \
"addl\t$0x20,%%esp" \
: \
: "r" (__dtrace_args) \
- : "memory", "eax", "edx" \
+ : "memory", "eax", "edx" \
);
#define DTRACE_CALL7ARGS(provider, name) \
"addl\t$0x20,%%esp" \
: \
: "r" (__dtrace_args) \
- : "memory", "eax", "edx" \
+ : "memory", "eax", "edx" \
);
#define DTRACE_CALL8ARGS(provider, name) \
"addl\t$0x20,%%esp" \
: \
: "r" (__dtrace_args) \
- : "memory", "eax", "edx" \
+ : "memory", "eax", "edx" \
);
#define DTRACE_CALL9ARGS(provider, name) \
"addl\t$0x30,%%esp" \
: \
: "r" (__dtrace_args) \
- : "memory", "eax", "edx" \
+ : "memory", "eax", "edx" \
);
#define DTRACE_CALL10ARGS(provider, name) \
"addl\t$0x30,%%esp" \
: \
: "r" (__dtrace_args) \
- : "memory", "eax", "edx" \
+ : "memory", "eax", "edx" \
);
#endif // __i386__