diff options
author | Glauber de Oliveira Costa <gcosta@redhat.com> | 2008-01-30 07:31:08 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-01-30 07:31:08 -0500 |
commit | 0a3b4d151a8e57f50ce5a12c7ea5ec9965cf0b5a (patch) | |
tree | d052ba5e4b35484a78d613d3af42e4026b2fc192 /include/asm-x86/system_64.h | |
parent | 833d8469b102365f427f7791e79ec1843ff5f164 (diff) |
x86: move switch_to macro to system.h
This patch moves the switch_to() macro to system.h
As those macros are fundamentally different between i386 and x86_64,
they are enclosed around an ifdef.
Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'include/asm-x86/system_64.h')
-rw-r--r-- | include/asm-x86/system_64.h | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/include/asm-x86/system_64.h b/include/asm-x86/system_64.h index 9def35eb75e3..97fa251ccb2b 100644 --- a/include/asm-x86/system_64.h +++ b/include/asm-x86/system_64.h | |||
@@ -4,49 +4,6 @@ | |||
4 | #include <asm/segment.h> | 4 | #include <asm/segment.h> |
5 | #include <asm/cmpxchg.h> | 5 | #include <asm/cmpxchg.h> |
6 | 6 | ||
7 | #ifdef __KERNEL__ | ||
8 | |||
9 | /* entries in ARCH_DLINFO: */ | ||
10 | #ifdef CONFIG_IA32_EMULATION | ||
11 | # define AT_VECTOR_SIZE_ARCH 2 | ||
12 | #else | ||
13 | # define AT_VECTOR_SIZE_ARCH 1 | ||
14 | #endif | ||
15 | |||
16 | #define __SAVE(reg,offset) "movq %%" #reg ",(14-" #offset ")*8(%%rsp)\n\t" | ||
17 | #define __RESTORE(reg,offset) "movq (14-" #offset ")*8(%%rsp),%%" #reg "\n\t" | ||
18 | |||
19 | /* frame pointer must be last for get_wchan */ | ||
20 | #define SAVE_CONTEXT "pushf ; pushq %%rbp ; movq %%rsi,%%rbp\n\t" | ||
21 | #define RESTORE_CONTEXT "movq %%rbp,%%rsi ; popq %%rbp ; popf\t" | ||
22 | |||
23 | #define __EXTRA_CLOBBER \ | ||
24 | ,"rcx","rbx","rdx","r8","r9","r10","r11","r12","r13","r14","r15" | ||
25 | |||
26 | /* Save restore flags to clear handle leaking NT */ | ||
27 | #define switch_to(prev,next,last) \ | ||
28 | asm volatile(SAVE_CONTEXT \ | ||
29 | "movq %%rsp,%P[threadrsp](%[prev])\n\t" /* save RSP */ \ | ||
30 | "movq %P[threadrsp](%[next]),%%rsp\n\t" /* restore RSP */ \ | ||
31 | "call __switch_to\n\t" \ | ||
32 | ".globl thread_return\n" \ | ||
33 | "thread_return:\n\t" \ | ||
34 | "movq %%gs:%P[pda_pcurrent],%%rsi\n\t" \ | ||
35 | "movq %P[thread_info](%%rsi),%%r8\n\t" \ | ||
36 | LOCK_PREFIX "btr %[tif_fork],%P[ti_flags](%%r8)\n\t" \ | ||
37 | "movq %%rax,%%rdi\n\t" \ | ||
38 | "jc ret_from_fork\n\t" \ | ||
39 | RESTORE_CONTEXT \ | ||
40 | : "=a" (last) \ | ||
41 | : [next] "S" (next), [prev] "D" (prev), \ | ||
42 | [threadrsp] "i" (offsetof(struct task_struct, thread.sp)), \ | ||
43 | [ti_flags] "i" (offsetof(struct thread_info, flags)),\ | ||
44 | [tif_fork] "i" (TIF_FORK), \ | ||
45 | [thread_info] "i" (offsetof(struct task_struct, stack)), \ | ||
46 | [pda_pcurrent] "i" (offsetof(struct x8664_pda, pcurrent)) \ | ||
47 | : "memory", "cc" __EXTRA_CLOBBER) | ||
48 | |||
49 | #endif /* __KERNEL__ */ | ||
50 | 7 | ||
51 | static inline unsigned long read_cr8(void) | 8 | static inline unsigned long read_cr8(void) |
52 | { | 9 | { |