2 * Copyright (C) 1994 Linus Torvalds
5 #ifndef __ASM_I386_PROCESSOR_H
6 #define __ASM_I386_PROCESSOR_H
9 #include <asm/math_emu.h>
10 #include <asm/segment.h>
12 #include <asm/types.h>
13 #include <asm/sigcontext.h>
14 #include <asm/cpufeature.h>
16 #include <asm/system.h>
17 #include <linux/threads.h>
18 #include <linux/init.h>
19 #include <asm/desc_defs.h>
22 * the following now lives in the per cpu area:
23 * extern int cpu_llc_id[NR_CPUS];
25 DECLARE_PER_CPU(u8, cpu_llc_id);
28 * User space process size: 3GB (default).
30 #define TASK_SIZE (PAGE_OFFSET)
32 #define INIT_THREAD { \
33 .sp0 = sizeof(init_stack) + (long)&init_stack, \
35 .sysenter_cs = __KERNEL_CS, \
36 .io_bitmap_ptr = NULL, \
37 .fs = __KERNEL_PERCPU, \
41 * Note that the .io_bitmap member must be extra-big. This is because
42 * the CPU will access an additional byte beyond the end of the IO
43 * permission bitmap. The extra byte must be all 1 bits, and must
44 * be within the limit.
48 .sp0 = sizeof(init_stack) + (long)&init_stack, \
51 .io_bitmap_base = INVALID_IO_BITMAP_OFFSET, \
53 .io_bitmap = { [ 0 ... IO_BITMAP_LONGS] = ~0 }, \
56 #define start_thread(regs, new_eip, new_esp) do { \
57 __asm__("movl %0,%%gs": :"r" (0)); \
60 regs->ds = __USER_DS; \
61 regs->es = __USER_DS; \
62 regs->ss = __USER_DS; \
63 regs->cs = __USER_CS; \
69 extern unsigned long thread_saved_pc(struct task_struct *tsk);
71 #define THREAD_SIZE_LONGS (THREAD_SIZE/sizeof(unsigned long))
72 #define KSTK_TOP(info) \
74 unsigned long *__ptr = (unsigned long *)(info); \
75 (unsigned long)(&__ptr[THREAD_SIZE_LONGS]); \
79 * The below -8 is to reserve 8 bytes on top of the ring0 stack.
80 * This is necessary to guarantee that the entire "struct pt_regs"
81 * is accessable even if the CPU haven't stored the SS/ESP registers
82 * on the stack (interrupt gate does not save these registers
83 * when switching to the same priv ring).
84 * Therefore beware: accessing the ss/esp fields of the
85 * "struct pt_regs" is possible, but they may contain the
86 * completely wrong values.
88 #define task_pt_regs(task) \
90 struct pt_regs *__regs__; \
91 __regs__ = (struct pt_regs *)(KSTK_TOP(task_stack_page(task))-8); \
95 #define KSTK_ESP(task) (task_pt_regs(task)->sp)
97 #endif /* __ASM_I386_PROCESSOR_H */