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)
34 struct i387_fxsave_struct {
43 u32 st_space[32]; /* 8*16 bytes for each FP-reg = 128 bytes */
44 u32 xmm_space[64]; /* 16*16 bytes for each XMM-reg = 256 bytes */
46 } __attribute__ ((aligned (16)));
49 struct i387_fxsave_struct fxsave;
52 DECLARE_PER_CPU(struct orig_ist, orig_ist);
54 #define INIT_THREAD { \
55 .sp0 = (unsigned long)&init_stack + sizeof(init_stack) \
59 .x86_tss.sp0 = (unsigned long)&init_stack + sizeof(init_stack) \
62 #define start_thread(regs,new_rip,new_rsp) do { \
63 asm volatile("movl %0,%%fs; movl %0,%%es; movl %0,%%ds": :"r" (0)); \
65 (regs)->ip = (new_rip); \
66 (regs)->sp = (new_rsp); \
67 write_pda(oldrsp, (new_rsp)); \
68 (regs)->cs = __USER_CS; \
69 (regs)->ss = __USER_DS; \
70 (regs)->flags = 0x200; \
75 * Return saved PC of a blocked thread.
76 * What is this good for? it will be always the scheduler or ret_from_fork.
78 #define thread_saved_pc(t) (*(unsigned long *)((t)->thread.sp - 8))
80 #define task_pt_regs(tsk) ((struct pt_regs *)(tsk)->thread.sp0 - 1)
81 #define KSTK_ESP(tsk) -1 /* sorry. doesn't work for syscall. */
83 #endif /* __ASM_X86_64_PROCESSOR_H */