From: Pierre-Marc Fournier Date: Tue, 27 Oct 2009 23:18:36 +0000 (-0400) Subject: move processor.h to include/ust dir X-Git-Tag: v1.9.1~845 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=2782fc4bdcc62e3448c59f30dbb07d88d901a597;p=lttng-ust.git move processor.h to include/ust dir --- diff --git a/include/ust/marker.h b/include/ust/marker.h index 5c7d1b36..0c32586a 100644 --- a/include/ust/marker.h +++ b/include/ust/marker.h @@ -30,7 +30,7 @@ //ust// #include #include #include -#include "processor.h" +#include //ust// struct module; //ust// struct task_struct; diff --git a/include/ust/processor.h b/include/ust/processor.h new file mode 100644 index 00000000..1eb58436 --- /dev/null +++ b/include/ust/processor.h @@ -0,0 +1,107 @@ +#ifndef UST_PROCESSOR_H +#define UST_PROCESSOR_H + +#include + +#ifdef X86_32 + +struct registers { + long eax; + long ebx; + long ecx; + long edx; + long ebp; + long esp; + long esi; + long edi; + int xds; + int xes; + int xfs; + int xgs; + long eip; + int xcs; + long eflags; + int xss; +}; + +static inline save_registers(struct registers *regs) +{ +} + +#define RELATIVE_ADDRESS(__rel_label__) __rel_label__ + +#define _ASM_PTR ".long " + +#else + +struct registers { + unsigned long rax; + unsigned long rbx; + unsigned long rcx; + unsigned long rdx; + unsigned long rbp; + unsigned long rsp; + unsigned long rsi; + unsigned long rdi; + unsigned long r8; + unsigned long r9; + unsigned long r10; + unsigned long r11; + unsigned long r12; + unsigned long r13; + unsigned long r14; + unsigned long r15; + int cs; + int ss; +}; + +#define save_registers(regsptr) \ + asm ("movq %%rax,%c[rax_off](%[regs])\n\t" \ + "movq %%rbx,%c[rbx_off](%[regs])\n\t" \ + "movq %%rcx,%c[rcx_off](%[regs])\n\t" \ + "movq %%rdx,%c[rdx_off](%[regs])\n\t" \ + "movq %%rbp,%c[rbp_off](%[regs])\n\t" \ + "movq %%rsp,%c[rsp_off](%[regs])\n\t" \ + "movq %%rsi,%c[rsi_off](%[regs])\n\t" \ + "movq %%rdi,%c[rdi_off](%[regs])\n\t" \ + "movq %%r8,%c[r8_off](%[regs])\n\t" \ + "movq %%r9,%c[r9_off](%[regs])\n\t" \ + "movq %%r10,%c[r10_off](%[regs])\n\t" \ + "movq %%r11,%c[r11_off](%[regs])\n\t" \ + "movq %%r12,%c[r12_off](%[regs])\n\t" \ + "movq %%r13,%c[r13_off](%[regs])\n\t" \ + "movq %%r14,%c[r14_off](%[regs])\n\t" \ + "movq %%r15,%c[r15_off](%[regs])\n\t" \ + "movw %%cs,%c[cs_off](%[regs])\n\t" \ + "movw %%ss,%c[ss_off](%[regs])\n\t" \ + : \ + : [regs] "r" (regsptr), \ + [rax_off] "i" (offsetof(struct registers, rax)), \ + [rbx_off] "i" (offsetof(struct registers, rbx)), \ + [rcx_off] "i" (offsetof(struct registers, rcx)), \ + [rdx_off] "i" (offsetof(struct registers, rdx)), \ + [rbp_off] "i" (offsetof(struct registers, rbp)), \ + [rsp_off] "i" (offsetof(struct registers, rsp)), \ + [rsi_off] "i" (offsetof(struct registers, rsi)), \ + [rdi_off] "i" (offsetof(struct registers, rdi)), \ + [r8_off] "i" (offsetof(struct registers, r8)), \ + [r9_off] "i" (offsetof(struct registers, r9)), \ + [r10_off] "i" (offsetof(struct registers, r10)), \ + [r11_off] "i" (offsetof(struct registers, r11)), \ + [r12_off] "i" (offsetof(struct registers, r12)), \ + [r13_off] "i" (offsetof(struct registers, r13)), \ + [r14_off] "i" (offsetof(struct registers, r14)), \ + [r15_off] "i" (offsetof(struct registers, r15)), \ + [cs_off] "i" (offsetof(struct registers, cs)), \ + [ss_off] "i" (offsetof(struct registers, ss)) \ + ); + +/* Macro to insert the address of a relative jump in an assembly stub, + * in a relocatable way. On x86-64, this uses a special (%rip) notation. */ +#define RELATIVE_ADDRESS(__rel_label__) __rel_label__(%%rip) + +#define _ASM_PTR ".quad " + +#endif + +#endif /* UST_PROCESSOR_H */ diff --git a/libust/processor.h b/libust/processor.h deleted file mode 100644 index 1eb58436..00000000 --- a/libust/processor.h +++ /dev/null @@ -1,107 +0,0 @@ -#ifndef UST_PROCESSOR_H -#define UST_PROCESSOR_H - -#include - -#ifdef X86_32 - -struct registers { - long eax; - long ebx; - long ecx; - long edx; - long ebp; - long esp; - long esi; - long edi; - int xds; - int xes; - int xfs; - int xgs; - long eip; - int xcs; - long eflags; - int xss; -}; - -static inline save_registers(struct registers *regs) -{ -} - -#define RELATIVE_ADDRESS(__rel_label__) __rel_label__ - -#define _ASM_PTR ".long " - -#else - -struct registers { - unsigned long rax; - unsigned long rbx; - unsigned long rcx; - unsigned long rdx; - unsigned long rbp; - unsigned long rsp; - unsigned long rsi; - unsigned long rdi; - unsigned long r8; - unsigned long r9; - unsigned long r10; - unsigned long r11; - unsigned long r12; - unsigned long r13; - unsigned long r14; - unsigned long r15; - int cs; - int ss; -}; - -#define save_registers(regsptr) \ - asm ("movq %%rax,%c[rax_off](%[regs])\n\t" \ - "movq %%rbx,%c[rbx_off](%[regs])\n\t" \ - "movq %%rcx,%c[rcx_off](%[regs])\n\t" \ - "movq %%rdx,%c[rdx_off](%[regs])\n\t" \ - "movq %%rbp,%c[rbp_off](%[regs])\n\t" \ - "movq %%rsp,%c[rsp_off](%[regs])\n\t" \ - "movq %%rsi,%c[rsi_off](%[regs])\n\t" \ - "movq %%rdi,%c[rdi_off](%[regs])\n\t" \ - "movq %%r8,%c[r8_off](%[regs])\n\t" \ - "movq %%r9,%c[r9_off](%[regs])\n\t" \ - "movq %%r10,%c[r10_off](%[regs])\n\t" \ - "movq %%r11,%c[r11_off](%[regs])\n\t" \ - "movq %%r12,%c[r12_off](%[regs])\n\t" \ - "movq %%r13,%c[r13_off](%[regs])\n\t" \ - "movq %%r14,%c[r14_off](%[regs])\n\t" \ - "movq %%r15,%c[r15_off](%[regs])\n\t" \ - "movw %%cs,%c[cs_off](%[regs])\n\t" \ - "movw %%ss,%c[ss_off](%[regs])\n\t" \ - : \ - : [regs] "r" (regsptr), \ - [rax_off] "i" (offsetof(struct registers, rax)), \ - [rbx_off] "i" (offsetof(struct registers, rbx)), \ - [rcx_off] "i" (offsetof(struct registers, rcx)), \ - [rdx_off] "i" (offsetof(struct registers, rdx)), \ - [rbp_off] "i" (offsetof(struct registers, rbp)), \ - [rsp_off] "i" (offsetof(struct registers, rsp)), \ - [rsi_off] "i" (offsetof(struct registers, rsi)), \ - [rdi_off] "i" (offsetof(struct registers, rdi)), \ - [r8_off] "i" (offsetof(struct registers, r8)), \ - [r9_off] "i" (offsetof(struct registers, r9)), \ - [r10_off] "i" (offsetof(struct registers, r10)), \ - [r11_off] "i" (offsetof(struct registers, r11)), \ - [r12_off] "i" (offsetof(struct registers, r12)), \ - [r13_off] "i" (offsetof(struct registers, r13)), \ - [r14_off] "i" (offsetof(struct registers, r14)), \ - [r15_off] "i" (offsetof(struct registers, r15)), \ - [cs_off] "i" (offsetof(struct registers, cs)), \ - [ss_off] "i" (offsetof(struct registers, ss)) \ - ); - -/* Macro to insert the address of a relative jump in an assembly stub, - * in a relocatable way. On x86-64, this uses a special (%rip) notation. */ -#define RELATIVE_ADDRESS(__rel_label__) __rel_label__(%%rip) - -#define _ASM_PTR ".quad " - -#endif - -#endif /* UST_PROCESSOR_H */