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

MORITA Kazutaka morita.kazutaka at gmail.com
Wed Aug 7 17:49:04 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 54b1c97..36fedb6 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 014741c..0ae5a8a 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)) */
+const unsigned char NOP5[INSN_SIZE] = {0x0f, 0x1f, 0x44, 0x00, 0x00};
+
 static struct caller *callers;
 static size_t nr_callers;
 
diff --git a/sheep/trace/trace.h b/sheep/trace/trace.h
index c4229e6..a6e7fc8 100644
--- a/sheep/trace/trace.h
+++ b/sheep/trace/trace.h
@@ -38,7 +38,6 @@ extern struct tracer graph_tracer;
 void mcount(void);
 void trace_caller(void);
 void trace_call(unsigned long, unsigned long *);
-extern const unsigned char NOP5[];
 void trace_return_caller(void);
 unsigned long trace_return_call(void);
 
-- 
1.7.9.5




More information about the sheepdog mailing list