2 * Copyright (C) 1994 Linus Torvalds
5 #ifndef __ASM_X86_64_PROCESSOR_H
6 #define __ASM_X86_64_PROCESSOR_H
8 #include <asm/segment.h>
10 #include <asm/types.h>
11 #include <asm/sigcontext.h>
12 #include <asm/cpufeature.h>
13 #include <linux/threads.h>
15 #include <asm/current.h>
16 #include <asm/system.h>
17 #include <linux/personality.h>
18 #include <asm/desc_defs.h>
21 * User space process size. 47bits minus one guard page.
23 #define TASK_SIZE64 (0x800000000000UL - 4096)
25 /* This decides where the kernel will search for a free chunk of vm
26 * space during mmap's.
28 #define IA32_PAGE_OFFSET ((current->personality & ADDR_LIMIT_3GB) ? 0xc0000000 : 0xFFFFe000)
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)
35 DECLARE_PER_CPU(struct orig_ist, orig_ist);
37 #define INIT_THREAD { \
38 .sp0 = (unsigned long)&init_stack + sizeof(init_stack) \
42 .x86_tss.sp0 = (unsigned long)&init_stack + sizeof(init_stack) \
45 #define start_thread(regs,new_rip,new_rsp) do { \
46 asm volatile("movl %0,%%fs; movl %0,%%es; movl %0,%%ds": :"r" (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; \
58 * Return saved PC of a blocked thread.
59 * What is this good for? it will be always the scheduler or ret_from_fork.
61 #define thread_saved_pc(t) (*(unsigned long *)((t)->thread.sp - 8))
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. */
66 #endif /* __ASM_X86_64_PROCESSOR_H */