x86: finish processor.h integration
[sfrench/cifs-2.6.git] / include / asm-x86 / processor_64.h
1 /*
2  * Copyright (C) 1994 Linus Torvalds
3  */
4
5 #ifndef __ASM_X86_64_PROCESSOR_H
6 #define __ASM_X86_64_PROCESSOR_H
7
8 #include <asm/segment.h>
9 #include <asm/page.h>
10 #include <asm/types.h>
11 #include <asm/sigcontext.h>
12 #include <asm/cpufeature.h>
13 #include <linux/threads.h>
14 #include <asm/msr.h>
15 #include <asm/current.h>
16 #include <asm/system.h>
17 #include <linux/personality.h>
18 #include <asm/desc_defs.h>
19
20 /*
21  * User space process size. 47bits minus one guard page.
22  */
23 #define TASK_SIZE64     (0x800000000000UL - 4096)
24
25 /* This decides where the kernel will search for a free chunk of vm
26  * space during mmap's.
27  */
28 #define IA32_PAGE_OFFSET ((current->personality & ADDR_LIMIT_3GB) ? 0xc0000000 : 0xFFFFe000)
29
30 #define TASK_SIZE               (test_thread_flag(TIF_IA32) ? IA32_PAGE_OFFSET : TASK_SIZE64)
31 #define TASK_SIZE_OF(child)     ((test_tsk_thread_flag(child, TIF_IA32)) ? IA32_PAGE_OFFSET : TASK_SIZE64)
32
33
34
35 DECLARE_PER_CPU(struct orig_ist, orig_ist);
36
37 #define INIT_THREAD  { \
38         .sp0 = (unsigned long)&init_stack + sizeof(init_stack) \
39 }
40
41 #define INIT_TSS  { \
42         .x86_tss.sp0 = (unsigned long)&init_stack + sizeof(init_stack) \
43 }
44
45 #define start_thread(regs,new_rip,new_rsp) do { \
46         asm volatile("movl %0,%%fs; movl %0,%%es; movl %0,%%ds": :"r" (0));      \
47         load_gs_index(0);                                                       \
48         (regs)->ip = (new_rip);                                          \
49         (regs)->sp = (new_rsp);                                          \
50         write_pda(oldrsp, (new_rsp));                                            \
51         (regs)->cs = __USER_CS;                                                  \
52         (regs)->ss = __USER_DS;                                                  \
53         (regs)->flags = 0x200;                                                   \
54         set_fs(USER_DS);                                                         \
55 } while(0) 
56
57 /*
58  * Return saved PC of a blocked thread.
59  * What is this good for? it will be always the scheduler or ret_from_fork.
60  */
61 #define thread_saved_pc(t) (*(unsigned long *)((t)->thread.sp - 8))
62
63 #define task_pt_regs(tsk) ((struct pt_regs *)(tsk)->thread.sp0 - 1)
64 #define KSTK_ESP(tsk) -1 /* sorry. doesn't work for syscall. */
65
66 #endif /* __ASM_X86_64_PROCESSOR_H */