From a2c9ab80a94d9ad6e506d2f89b2191a45706245a Mon Sep 17 00:00:00 2001 From: Andrea Bastoni Date: Mon, 1 Feb 2010 23:07:54 -0500 Subject: Add Feather-Trace x86_64 architecture dependent code --- arch/x86/include/asm/feather_trace.h | 3 +- arch/x86/include/asm/feather_trace_64.h | 69 +++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+), 2 deletions(-) create mode 100644 arch/x86/include/asm/feather_trace_64.h (limited to 'arch/x86/include') diff --git a/arch/x86/include/asm/feather_trace.h b/arch/x86/include/asm/feather_trace.h index 86a4303fce7a..4fd31633405d 100644 --- a/arch/x86/include/asm/feather_trace.h +++ b/arch/x86/include/asm/feather_trace.h @@ -11,8 +11,7 @@ static inline unsigned long long ft_timestamp(void) #ifdef CONFIG_X86_32 #include "feather_trace_32.h" #else -/* not ready for integration yet */ -//#include "feather_trace_64.h" +#include "feather_trace_64.h" #endif #endif diff --git a/arch/x86/include/asm/feather_trace_64.h b/arch/x86/include/asm/feather_trace_64.h new file mode 100644 index 000000000000..030622daa809 --- /dev/null +++ b/arch/x86/include/asm/feather_trace_64.h @@ -0,0 +1,69 @@ +/* Do not directly include this file. Include feather_trace.h instead */ + +/* regparm is the default on x86_64 */ +#define feather_callback + +# define _EVENT_TABLE(id,from,to) \ + ".section __event_table, \"aw\"\n\t" \ + ".balign 8\n\t" \ + ".quad " #id ", 0, " #from ", " #to " \n\t" \ + ".previous \n\t" + +/* + * x86_64 callee only owns rbp, rbx, r12 -> r15 + * the called can freely modify the others + */ +#define CLOBBER_LIST "memory", "cc", "rdi", "rsi", "rdx", "rcx", \ + "r8", "r9", "r10", "r11" + +#define ft_event(id, callback) \ + __asm__ __volatile__( \ + "1: jmp 2f \n\t" \ + " call " #callback " \n\t" \ + _EVENT_TABLE(id,1b,2f) \ + "2: \n\t" \ + : : : CLOBBER_LIST) + +#define ft_event0(id, callback) \ + __asm__ __volatile__( \ + "1: jmp 2f \n\t" \ + " movq $" #id ", %%rdi \n\t" \ + " call " #callback " \n\t" \ + _EVENT_TABLE(id,1b,2f) \ + "2: \n\t" \ + : : : CLOBBER_LIST) + +#define ft_event1(id, callback, param) \ + __asm__ __volatile__( \ + "1: jmp 2f \n\t" \ + " movq %0, %%rsi \n\t" \ + " movq $" #id ", %%rdi \n\t" \ + " call " #callback " \n\t" \ + _EVENT_TABLE(id,1b,2f) \ + "2: \n\t" \ + : : "r" (param) : CLOBBER_LIST) + +#define ft_event2(id, callback, param, param2) \ + __asm__ __volatile__( \ + "1: jmp 2f \n\t" \ + " movq %1, %%rdx \n\t" \ + " movq %0, %%rsi \n\t" \ + " movq $" #id ", %%rdi \n\t" \ + " call " #callback " \n\t" \ + _EVENT_TABLE(id,1b,2f) \ + "2: \n\t" \ + : : "r" (param), "r" (param2) : CLOBBER_LIST) + +#define ft_event3(id, callback, p, p2, p3) \ + __asm__ __volatile__( \ + "1: jmp 2f \n\t" \ + " movq %2, %%rcx \n\t" \ + " movq %1, %%rdx \n\t" \ + " movq %0, %%rsi \n\t" \ + " movq $" #id ", %%rdi \n\t" \ + " call " #callback " \n\t" \ + _EVENT_TABLE(id,1b,2f) \ + "2: \n\t" \ + : : "r" (p), "r" (p2), "r" (p3) : CLOBBER_LIST) + +#define __ARCH_HAS_FEATHER_TRACE -- cgit v1.2.2