ia64/xen-unstable

view xen/include/asm-x86/x86_64/asm_defns.h @ 11859:025e19453f1a

Define REX64_PREFIX to account for assembler syntax differences on SVR4 targets.

Signed-off-by: John Levon <john.levon@sun.com>
author kfraser@localhost.localdomain
date Tue Oct 17 18:50:08 2006 +0100 (2006-10-17)
parents 07a892f12609
children 96f167771979
line source
1 #ifndef __X86_64_ASM_DEFNS_H__
2 #define __X86_64_ASM_DEFNS_H__
4 #ifndef NDEBUG
5 /* Indicate special exception stack frame by inverting the frame pointer. */
6 #define SETUP_EXCEPTION_FRAME_POINTER \
7 movq %rsp,%rbp; \
8 notq %rbp
9 #else
10 #define SETUP_EXCEPTION_FRAME_POINTER
11 #endif
13 #define SAVE_ALL \
14 cld; \
15 pushq %rdi; \
16 pushq %rsi; \
17 pushq %rdx; \
18 pushq %rcx; \
19 pushq %rax; \
20 pushq %r8; \
21 pushq %r9; \
22 pushq %r10; \
23 pushq %r11; \
24 pushq %rbx; \
25 pushq %rbp; \
26 SETUP_EXCEPTION_FRAME_POINTER; \
27 pushq %r12; \
28 pushq %r13; \
29 pushq %r14; \
30 pushq %r15;
32 #define RESTORE_ALL \
33 popq %r15; \
34 popq %r14; \
35 popq %r13; \
36 popq %r12; \
37 popq %rbp; \
38 popq %rbx; \
39 popq %r11; \
40 popq %r10; \
41 popq %r9; \
42 popq %r8; \
43 popq %rax; \
44 popq %rcx; \
45 popq %rdx; \
46 popq %rsi; \
47 popq %rdi;
49 #ifdef PERF_COUNTERS
50 #define PERFC_INCR(_name,_idx) \
51 pushq %rdx; \
52 leaq perfcounters+_name(%rip),%rdx; \
53 lock incl (%rdx,_idx,4); \
54 popq %rdx;
55 #else
56 #define PERFC_INCR(_name,_idx)
57 #endif
59 /* Work around AMD erratum #88 */
60 #define safe_swapgs \
61 "mfence; swapgs;"
63 #ifdef __sun__
64 #define REX64_PREFIX "rex64\\"
65 #else
66 #define REX64_PREFIX "rex64/"
67 #endif
69 #define BUILD_SMP_INTERRUPT(x,v) XBUILD_SMP_INTERRUPT(x,v)
70 #define XBUILD_SMP_INTERRUPT(x,v) \
71 asmlinkage void x(void); \
72 __asm__( \
73 "\n"__ALIGN_STR"\n" \
74 ".globl " STR(x) "\n\t" \
75 STR(x) ":\n\t" \
76 "pushq $0\n\t" \
77 "movl $"#v",4(%rsp)\n\t" \
78 STR(SAVE_ALL) \
79 "movq %rsp,%rdi\n\t" \
80 "callq "STR(smp_##x)"\n\t" \
81 "jmp ret_from_intr\n");
83 #define BUILD_COMMON_IRQ() \
84 __asm__( \
85 "\n" __ALIGN_STR"\n" \
86 "common_interrupt:\n\t" \
87 STR(SAVE_ALL) \
88 "movq %rsp,%rdi\n\t" \
89 "callq " STR(do_IRQ) "\n\t" \
90 "jmp ret_from_intr\n");
92 #define IRQ_NAME2(nr) nr##_interrupt(void)
93 #define IRQ_NAME(nr) IRQ_NAME2(IRQ##nr)
95 #define BUILD_IRQ(nr) \
96 asmlinkage void IRQ_NAME(nr); \
97 __asm__( \
98 "\n"__ALIGN_STR"\n" \
99 STR(IRQ) #nr "_interrupt:\n\t" \
100 "pushq $0\n\t" \
101 "movl $"#nr",4(%rsp)\n\t" \
102 "jmp common_interrupt");
104 #endif /* __X86_64_ASM_DEFNS_H__ */