[sheepdog] [PATCH v3 05/10] trace: move nop5 to trace.c

MORITA Kazutaka morita.kazutaka at gmail.com
Fri Aug 9 11:09:02 CEST 2013


From: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>

No need to write it with an assembly code.

Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
 sheep/trace/mcount.S |    4 ----
 sheep/trace/trace.c  |    3 +++
 sheep/trace/trace.h  |    1 -
 3 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/sheep/trace/mcount.S b/sheep/trace/mcount.S
index 7499ac2..4b01712 100644
--- a/sheep/trace/mcount.S
+++ b/sheep/trace/mcount.S
@@ -58,7 +58,3 @@ ENTRY(trace_return_caller)
 	movq (%rsp), %rax
 	addq $24, %rsp
 	jmp *%rdi
-
-.globl NOP5
-NOP5:
-	.byte 0x0f,0x1f,0x44,0x00,0x00 # Intel recommended one for 5 bytes nops
diff --git a/sheep/trace/trace.c b/sheep/trace/trace.c
index 32e5a81..9f9420f 100644
--- a/sheep/trace/trace.c
+++ b/sheep/trace/trace.c
@@ -15,6 +15,9 @@
 
 #include "trace.h"
 
+/* Intel recommended one for 5 bytes nops (nopl 0x0(%rax,%rax,1)) */
+static const unsigned char NOP5[INSN_SIZE] = {0x0f, 0x1f, 0x44, 0x00, 0x00};
+
 static LIST_HEAD(tracers);
 static __thread int ret_stack_index;
 static __thread struct {
diff --git a/sheep/trace/trace.h b/sheep/trace/trace.h
index d1bd8b4..48ae78e 100644
--- a/sheep/trace/trace.h
+++ b/sheep/trace/trace.h
@@ -29,7 +29,6 @@ struct tracer {
 /* mcount.S */
 void mcount(void);
 void trace_caller(void);
-extern const unsigned char NOP5[];
 void trace_return_caller(void);
 void trace_function_enter(unsigned long, unsigned long *);
 unsigned long trace_function_exit(void);
-- 
1.7.9.5




More information about the sheepdog mailing list