From: Pierre-Marc Fournier Date: Tue, 27 Oct 2009 22:32:52 +0000 (-0400) Subject: rename registers.h -> processor.h X-Git-Tag: v0.1~73 X-Git-Url: http://git.liburcu.org/?p=ust.git;a=commitdiff_plain;h=5af57e629ac975403111807ed849f906e993b4a1 rename registers.h -> processor.h --- diff --git a/libust/marker.h b/libust/marker.h index 06f2b93..4c6a703 100644 --- a/libust/marker.h +++ b/libust/marker.h @@ -31,7 +31,7 @@ #include "kernelcompat.h" #include #include "localerr.h" -#include "registers.h" +#include "processor.h" //ust// struct module; //ust// struct task_struct; diff --git a/libust/processor.h b/libust/processor.h new file mode 100644 index 0000000..1eb5843 --- /dev/null +++ b/libust/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/registers.h b/libust/registers.h deleted file mode 100644 index ab12c4e..0000000 --- a/libust/registers.h +++ /dev/null @@ -1,107 +0,0 @@ -#ifndef UST_REGISTERS_H -#define UST_REGISTERS_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_REGISTERS_H */