blob: d590da88c0dfb7fd44cba63cd66c584ce8f5bc83 [file] [log] [blame]
Glauber de Oliveira Costac758ecf2008-01-30 13:31:03 +01001#ifndef __ASM_X86_PROCESSOR_H
2#define __ASM_X86_PROCESSOR_H
3
Glauber de Oliveira Costa053de042008-01-30 13:31:27 +01004#include <asm/processor-flags.h>
5
Ingo Molnar58f6f6e2008-01-30 13:32:54 +01006/* migration helpers, for KVM - will be removed in 2.6.25: */
7#include <asm/vm86.h>
8#define Xgt_desc_struct desc_ptr
9
Glauber de Oliveira Costa683e0252008-01-30 13:31:27 +010010/* Forward declaration, a strange C thing */
11struct task_struct;
12struct mm_struct;
13
Glauber de Oliveira Costa2f66dcc2008-01-30 13:31:57 +010014#include <asm/vm86.h>
15#include <asm/math_emu.h>
16#include <asm/segment.h>
Glauber de Oliveira Costa2f66dcc2008-01-30 13:31:57 +010017#include <asm/types.h>
18#include <asm/sigcontext.h>
19#include <asm/current.h>
20#include <asm/cpufeature.h>
21#include <asm/system.h>
Glauber de Oliveira Costac72dcf82008-01-30 13:31:27 +010022#include <asm/page.h>
Glauber de Oliveira Costaca241c72008-01-30 13:31:31 +010023#include <asm/percpu.h>
Glauber de Oliveira Costa2f66dcc2008-01-30 13:31:57 +010024#include <asm/msr.h>
25#include <asm/desc_defs.h>
Andi Kleenbd616432008-01-30 13:32:38 +010026#include <asm/nops.h>
Ingo Molnar4d46a892008-02-21 04:24:40 +010027
Glauber de Oliveira Costa2f66dcc2008-01-30 13:31:57 +010028#include <linux/personality.h>
Glauber de Oliveira Costa5300db82008-01-30 13:31:33 +010029#include <linux/cpumask.h>
30#include <linux/cache.h>
Glauber de Oliveira Costa2f66dcc2008-01-30 13:31:57 +010031#include <linux/threads.h>
32#include <linux/init.h>
Glauber de Oliveira Costac72dcf82008-01-30 13:31:27 +010033
Glauber de Oliveira Costa0ccb8ac2008-01-30 13:31:27 +010034/*
35 * Default implementation of macro that returns current
36 * instruction pointer ("program counter").
37 */
38static inline void *current_text_addr(void)
39{
40 void *pc;
Ingo Molnar4d46a892008-02-21 04:24:40 +010041
42 asm volatile("mov $1f, %0; 1:":"=r" (pc));
43
Glauber de Oliveira Costa0ccb8ac2008-01-30 13:31:27 +010044 return pc;
45}
46
Glauber de Oliveira Costadbcb4662008-01-30 13:31:31 +010047#ifdef CONFIG_X86_VSMP
Ingo Molnar4d46a892008-02-21 04:24:40 +010048# define ARCH_MIN_TASKALIGN (1 << INTERNODE_CACHE_SHIFT)
49# define ARCH_MIN_MMSTRUCT_ALIGN (1 << INTERNODE_CACHE_SHIFT)
Glauber de Oliveira Costadbcb4662008-01-30 13:31:31 +010050#else
Ingo Molnar4d46a892008-02-21 04:24:40 +010051# define ARCH_MIN_TASKALIGN 16
52# define ARCH_MIN_MMSTRUCT_ALIGN 0
Glauber de Oliveira Costadbcb4662008-01-30 13:31:31 +010053#endif
54
Glauber de Oliveira Costa5300db82008-01-30 13:31:33 +010055/*
56 * CPU type and hardware bug flags. Kept separately for each CPU.
57 * Members of this structure are referenced in head.S, so think twice
58 * before touching them. [mj]
59 */
60
61struct cpuinfo_x86 {
Ingo Molnar4d46a892008-02-21 04:24:40 +010062 __u8 x86; /* CPU family */
63 __u8 x86_vendor; /* CPU vendor */
64 __u8 x86_model;
65 __u8 x86_mask;
Glauber de Oliveira Costa5300db82008-01-30 13:31:33 +010066#ifdef CONFIG_X86_32
Ingo Molnar4d46a892008-02-21 04:24:40 +010067 char wp_works_ok; /* It doesn't on 386's */
68
69 /* Problems on some 486Dx4's and old 386's: */
70 char hlt_works_ok;
71 char hard_math;
72 char rfu;
73 char fdiv_bug;
74 char f00f_bug;
75 char coma_bug;
76 char pad0;
Glauber de Oliveira Costa5300db82008-01-30 13:31:33 +010077#else
Ingo Molnar4d46a892008-02-21 04:24:40 +010078 /* Number of 4K pages in DTLB/ITLB combined(in pages): */
79 int x86_tlbsize;
80 __u8 x86_virt_bits;
81 __u8 x86_phys_bits;
82 /* CPUID returned core id bits: */
83 __u8 x86_coreid_bits;
84 /* Max extended CPUID function supported: */
85 __u32 extended_cpuid_level;
Glauber de Oliveira Costa5300db82008-01-30 13:31:33 +010086#endif
Ingo Molnar4d46a892008-02-21 04:24:40 +010087 /* Maximum supported CPUID level, -1=no CPUID: */
88 int cpuid_level;
89 __u32 x86_capability[NCAPINTS];
90 char x86_vendor_id[16];
91 char x86_model_id[64];
92 /* in KB - valid for CPUS which support this call: */
93 int x86_cache_size;
94 int x86_cache_alignment; /* In bytes */
95 int x86_power;
96 unsigned long loops_per_jiffy;
Glauber de Oliveira Costa5300db82008-01-30 13:31:33 +010097#ifdef CONFIG_SMP
Ingo Molnar4d46a892008-02-21 04:24:40 +010098 /* cpus sharing the last level cache: */
99 cpumask_t llc_shared_map;
Glauber de Oliveira Costa5300db82008-01-30 13:31:33 +0100100#endif
Ingo Molnar4d46a892008-02-21 04:24:40 +0100101 /* cpuid returned max cores value: */
102 u16 x86_max_cores;
103 u16 apicid;
Yinghai Lu01aaea12008-03-06 13:46:39 -0800104 u16 initial_apicid;
Ingo Molnar4d46a892008-02-21 04:24:40 +0100105 u16 x86_clflush_size;
Glauber de Oliveira Costa5300db82008-01-30 13:31:33 +0100106#ifdef CONFIG_SMP
Ingo Molnar4d46a892008-02-21 04:24:40 +0100107 /* number of cores as seen by the OS: */
108 u16 booted_cores;
109 /* Physical processor id: */
110 u16 phys_proc_id;
111 /* Core id: */
112 u16 cpu_core_id;
113 /* Index into per_cpu list: */
114 u16 cpu_index;
Glauber de Oliveira Costa5300db82008-01-30 13:31:33 +0100115#endif
116} __attribute__((__aligned__(SMP_CACHE_BYTES)));
117
Ingo Molnar4d46a892008-02-21 04:24:40 +0100118#define X86_VENDOR_INTEL 0
119#define X86_VENDOR_CYRIX 1
120#define X86_VENDOR_AMD 2
121#define X86_VENDOR_UMC 3
122#define X86_VENDOR_NEXGEN 4
123#define X86_VENDOR_CENTAUR 5
124#define X86_VENDOR_TRANSMETA 7
125#define X86_VENDOR_NSC 8
126#define X86_VENDOR_NUM 9
127
128#define X86_VENDOR_UNKNOWN 0xff
Glauber de Oliveira Costa5300db82008-01-30 13:31:33 +0100129
Glauber de Oliveira Costa1a539052008-01-30 13:31:39 +0100130/*
131 * capabilities of CPUs
132 */
Ingo Molnar4d46a892008-02-21 04:24:40 +0100133extern struct cpuinfo_x86 boot_cpu_data;
134extern struct cpuinfo_x86 new_cpu_data;
135
136extern struct tss_struct doublefault_tss;
137extern __u32 cleared_cpu_caps[NCAPINTS];
Glauber de Oliveira Costa5300db82008-01-30 13:31:33 +0100138
139#ifdef CONFIG_SMP
140DECLARE_PER_CPU(struct cpuinfo_x86, cpu_info);
141#define cpu_data(cpu) per_cpu(cpu_info, cpu)
142#define current_cpu_data cpu_data(smp_processor_id())
143#else
144#define cpu_data(cpu) boot_cpu_data
145#define current_cpu_data boot_cpu_data
146#endif
147
Glauber Costa3d3f4872008-03-03 14:12:48 -0300148static inline int hlt_works(int cpu)
149{
150#ifdef CONFIG_X86_32
151 return cpu_data(cpu).hlt_works_ok;
152#else
153 return 1;
154#endif
155}
156
Ingo Molnar4d46a892008-02-21 04:24:40 +0100157#define cache_line_size() (boot_cpu_data.x86_cache_alignment)
158
159extern void cpu_detect(struct cpuinfo_x86 *c);
Glauber de Oliveira Costa1a539052008-01-30 13:31:39 +0100160
161extern void identify_cpu(struct cpuinfo_x86 *);
162extern void identify_boot_cpu(void);
163extern void identify_secondary_cpu(struct cpuinfo_x86 *);
Glauber de Oliveira Costa5300db82008-01-30 13:31:33 +0100164extern void print_cpu_info(struct cpuinfo_x86 *);
165extern void init_scattered_cpuid_features(struct cpuinfo_x86 *c);
166extern unsigned int init_intel_cacheinfo(struct cpuinfo_x86 *c);
167extern unsigned short num_cache_leaves;
168
Glauber de Oliveira Costa1a539052008-01-30 13:31:39 +0100169#if defined(CONFIG_X86_HT) || defined(CONFIG_X86_64)
170extern void detect_ht(struct cpuinfo_x86 *c);
171#else
172static inline void detect_ht(struct cpuinfo_x86 *c) {}
173#endif
174
Glauber de Oliveira Costac758ecf2008-01-30 13:31:03 +0100175static inline void native_cpuid(unsigned int *eax, unsigned int *ebx,
Ingo Molnar4d46a892008-02-21 04:24:40 +0100176 unsigned int *ecx, unsigned int *edx)
Glauber de Oliveira Costac758ecf2008-01-30 13:31:03 +0100177{
178 /* ecx is often an input as well as an output. */
179 __asm__("cpuid"
180 : "=a" (*eax),
181 "=b" (*ebx),
182 "=c" (*ecx),
183 "=d" (*edx)
184 : "0" (*eax), "2" (*ecx));
185}
186
Glauber de Oliveira Costac72dcf82008-01-30 13:31:27 +0100187static inline void load_cr3(pgd_t *pgdir)
188{
189 write_cr3(__pa(pgdir));
190}
Glauber de Oliveira Costac758ecf2008-01-30 13:31:03 +0100191
Thomas Gleixner96a388d2007-10-11 11:20:03 +0200192#ifdef CONFIG_X86_32
Glauber de Oliveira Costaca241c72008-01-30 13:31:31 +0100193/* This is the TSS defined by the hardware. */
194struct x86_hw_tss {
Ingo Molnar4d46a892008-02-21 04:24:40 +0100195 unsigned short back_link, __blh;
196 unsigned long sp0;
197 unsigned short ss0, __ss0h;
198 unsigned long sp1;
199 /* ss1 caches MSR_IA32_SYSENTER_CS: */
200 unsigned short ss1, __ss1h;
201 unsigned long sp2;
202 unsigned short ss2, __ss2h;
203 unsigned long __cr3;
204 unsigned long ip;
205 unsigned long flags;
206 unsigned long ax;
207 unsigned long cx;
208 unsigned long dx;
209 unsigned long bx;
210 unsigned long sp;
211 unsigned long bp;
212 unsigned long si;
213 unsigned long di;
214 unsigned short es, __esh;
215 unsigned short cs, __csh;
216 unsigned short ss, __ssh;
217 unsigned short ds, __dsh;
218 unsigned short fs, __fsh;
219 unsigned short gs, __gsh;
220 unsigned short ldt, __ldth;
221 unsigned short trace;
222 unsigned short io_bitmap_base;
223
Glauber de Oliveira Costaca241c72008-01-30 13:31:31 +0100224} __attribute__((packed));
225#else
226struct x86_hw_tss {
Ingo Molnar4d46a892008-02-21 04:24:40 +0100227 u32 reserved1;
228 u64 sp0;
229 u64 sp1;
230 u64 sp2;
231 u64 reserved2;
232 u64 ist[7];
233 u32 reserved3;
234 u32 reserved4;
235 u16 reserved5;
236 u16 io_bitmap_base;
237
Glauber de Oliveira Costaca241c72008-01-30 13:31:31 +0100238} __attribute__((packed)) ____cacheline_aligned;
239#endif
240
241/*
Ingo Molnar4d46a892008-02-21 04:24:40 +0100242 * IO-bitmap sizes:
Glauber de Oliveira Costaca241c72008-01-30 13:31:31 +0100243 */
Ingo Molnar4d46a892008-02-21 04:24:40 +0100244#define IO_BITMAP_BITS 65536
245#define IO_BITMAP_BYTES (IO_BITMAP_BITS/8)
246#define IO_BITMAP_LONGS (IO_BITMAP_BYTES/sizeof(long))
247#define IO_BITMAP_OFFSET offsetof(struct tss_struct, io_bitmap)
248#define INVALID_IO_BITMAP_OFFSET 0x8000
249#define INVALID_IO_BITMAP_OFFSET_LAZY 0x9000
Glauber de Oliveira Costaca241c72008-01-30 13:31:31 +0100250
251struct tss_struct {
Ingo Molnar4d46a892008-02-21 04:24:40 +0100252 /*
253 * The hardware state:
254 */
255 struct x86_hw_tss x86_tss;
Glauber de Oliveira Costaca241c72008-01-30 13:31:31 +0100256
257 /*
258 * The extra 1 is there because the CPU will access an
259 * additional byte beyond the end of the IO permission
260 * bitmap. The extra byte must be all 1 bits, and must
261 * be within the limit.
262 */
Ingo Molnar4d46a892008-02-21 04:24:40 +0100263 unsigned long io_bitmap[IO_BITMAP_LONGS + 1];
Glauber de Oliveira Costaca241c72008-01-30 13:31:31 +0100264 /*
265 * Cache the current maximum and the last task that used the bitmap:
266 */
Ingo Molnar4d46a892008-02-21 04:24:40 +0100267 unsigned long io_bitmap_max;
268 struct thread_struct *io_bitmap_owner;
269
Glauber de Oliveira Costaca241c72008-01-30 13:31:31 +0100270 /*
Ingo Molnar4d46a892008-02-21 04:24:40 +0100271 * Pad the TSS to be cacheline-aligned (size is 0x100):
Glauber de Oliveira Costaca241c72008-01-30 13:31:31 +0100272 */
Ingo Molnar4d46a892008-02-21 04:24:40 +0100273 unsigned long __cacheline_filler[35];
Glauber de Oliveira Costaca241c72008-01-30 13:31:31 +0100274 /*
Ingo Molnar4d46a892008-02-21 04:24:40 +0100275 * .. and then another 0x100 bytes for the emergency kernel stack:
Glauber de Oliveira Costaca241c72008-01-30 13:31:31 +0100276 */
Ingo Molnar4d46a892008-02-21 04:24:40 +0100277 unsigned long stack[64];
278
Glauber de Oliveira Costaca241c72008-01-30 13:31:31 +0100279} __attribute__((packed));
280
281DECLARE_PER_CPU(struct tss_struct, init_tss);
282
Ingo Molnar4d46a892008-02-21 04:24:40 +0100283/*
284 * Save the original ist values for checking stack pointers during debugging
285 */
Glauber de Oliveira Costa1a539052008-01-30 13:31:39 +0100286struct orig_ist {
Ingo Molnar4d46a892008-02-21 04:24:40 +0100287 unsigned long ist[7];
Glauber de Oliveira Costa1a539052008-01-30 13:31:39 +0100288};
289
Roland McGrath99f8ecd2008-01-30 13:31:48 +0100290#define MXCSR_DEFAULT 0x1f80
291
Glauber de Oliveira Costa46265df2008-01-30 13:31:41 +0100292struct i387_fsave_struct {
Ingo Molnarca9cda22008-03-05 15:15:42 +0100293 u32 cwd; /* FPU Control Word */
294 u32 swd; /* FPU Status Word */
295 u32 twd; /* FPU Tag Word */
296 u32 fip; /* FPU IP Offset */
297 u32 fcs; /* FPU IP Selector */
298 u32 foo; /* FPU Operand Pointer Offset */
299 u32 fos; /* FPU Operand Pointer Selector */
300
301 /* 8*10 bytes for each FP-reg = 80 bytes: */
Ingo Molnar4d46a892008-02-21 04:24:40 +0100302 u32 st_space[20];
Ingo Molnarca9cda22008-03-05 15:15:42 +0100303
304 /* Software status information [not touched by FSAVE ]: */
Ingo Molnar4d46a892008-02-21 04:24:40 +0100305 u32 status;
Glauber de Oliveira Costa46265df2008-01-30 13:31:41 +0100306};
307
308struct i387_fxsave_struct {
Ingo Molnarca9cda22008-03-05 15:15:42 +0100309 u16 cwd; /* Control Word */
310 u16 swd; /* Status Word */
311 u16 twd; /* Tag Word */
312 u16 fop; /* Last Instruction Opcode */
Roland McGrath99f8ecd2008-01-30 13:31:48 +0100313 union {
314 struct {
Ingo Molnarca9cda22008-03-05 15:15:42 +0100315 u64 rip; /* Instruction Pointer */
316 u64 rdp; /* Data Pointer */
Roland McGrath99f8ecd2008-01-30 13:31:48 +0100317 };
318 struct {
Ingo Molnarca9cda22008-03-05 15:15:42 +0100319 u32 fip; /* FPU IP Offset */
320 u32 fcs; /* FPU IP Selector */
321 u32 foo; /* FPU Operand Offset */
322 u32 fos; /* FPU Operand Selector */
Roland McGrath99f8ecd2008-01-30 13:31:48 +0100323 };
324 };
Ingo Molnarca9cda22008-03-05 15:15:42 +0100325 u32 mxcsr; /* MXCSR Register State */
326 u32 mxcsr_mask; /* MXCSR Mask */
327
328 /* 8*16 bytes for each FP-reg = 128 bytes: */
Ingo Molnar4d46a892008-02-21 04:24:40 +0100329 u32 st_space[32];
Ingo Molnarca9cda22008-03-05 15:15:42 +0100330
331 /* 16*16 bytes for each XMM-reg = 256 bytes: */
Ingo Molnar4d46a892008-02-21 04:24:40 +0100332 u32 xmm_space[64];
Ingo Molnarca9cda22008-03-05 15:15:42 +0100333
Ingo Molnar4d46a892008-02-21 04:24:40 +0100334 u32 padding[24];
335
Glauber de Oliveira Costa46265df2008-01-30 13:31:41 +0100336} __attribute__((aligned(16)));
337
Roland McGrath99f8ecd2008-01-30 13:31:48 +0100338struct i387_soft_struct {
Ingo Molnar4d46a892008-02-21 04:24:40 +0100339 u32 cwd;
340 u32 swd;
341 u32 twd;
342 u32 fip;
343 u32 fcs;
344 u32 foo;
345 u32 fos;
346 /* 8*10 bytes for each FP-reg = 80 bytes: */
347 u32 st_space[20];
348 u8 ftop;
349 u8 changed;
350 u8 lookahead;
351 u8 no_update;
352 u8 rm;
353 u8 alimit;
354 struct info *info;
355 u32 entry_eip;
Glauber de Oliveira Costa46265df2008-01-30 13:31:41 +0100356};
357
Roland McGrath99f8ecd2008-01-30 13:31:48 +0100358union i387_union {
359 struct i387_fsave_struct fsave;
360 struct i387_fxsave_struct fxsave;
Ingo Molnar4d46a892008-02-21 04:24:40 +0100361 struct i387_soft_struct soft;
Roland McGrath99f8ecd2008-01-30 13:31:48 +0100362};
363
Glauber Costafe676202008-03-03 14:12:56 -0300364#ifdef CONFIG_X86_64
Glauber de Oliveira Costa2f66dcc2008-01-30 13:31:57 +0100365DECLARE_PER_CPU(struct orig_ist, orig_ist);
Thomas Gleixner96a388d2007-10-11 11:20:03 +0200366#endif
Glauber de Oliveira Costac758ecf2008-01-30 13:31:03 +0100367
Glauber de Oliveira Costa683e0252008-01-30 13:31:27 +0100368extern void print_cpu_info(struct cpuinfo_x86 *);
369extern void init_scattered_cpuid_features(struct cpuinfo_x86 *c);
370extern unsigned int init_intel_cacheinfo(struct cpuinfo_x86 *c);
371extern unsigned short num_cache_leaves;
372
Glauber de Oliveira Costacb38d372008-01-30 13:31:31 +0100373struct thread_struct {
Ingo Molnar4d46a892008-02-21 04:24:40 +0100374 /* Cached TLS descriptors: */
375 struct desc_struct tls_array[GDT_ENTRY_TLS_ENTRIES];
376 unsigned long sp0;
377 unsigned long sp;
Glauber de Oliveira Costacb38d372008-01-30 13:31:31 +0100378#ifdef CONFIG_X86_32
Ingo Molnar4d46a892008-02-21 04:24:40 +0100379 unsigned long sysenter_cs;
Glauber de Oliveira Costacb38d372008-01-30 13:31:31 +0100380#else
Ingo Molnar4d46a892008-02-21 04:24:40 +0100381 unsigned long usersp; /* Copy from PDA */
382 unsigned short es;
383 unsigned short ds;
384 unsigned short fsindex;
385 unsigned short gsindex;
Glauber de Oliveira Costacb38d372008-01-30 13:31:31 +0100386#endif
Ingo Molnar4d46a892008-02-21 04:24:40 +0100387 unsigned long ip;
388 unsigned long fs;
389 unsigned long gs;
390 /* Hardware debugging registers: */
391 unsigned long debugreg0;
392 unsigned long debugreg1;
393 unsigned long debugreg2;
394 unsigned long debugreg3;
395 unsigned long debugreg6;
396 unsigned long debugreg7;
397 /* Fault info: */
398 unsigned long cr2;
399 unsigned long trap_no;
400 unsigned long error_code;
401 /* Floating point info: */
Glauber de Oliveira Costacb38d372008-01-30 13:31:31 +0100402 union i387_union i387 __attribute__((aligned(16)));;
403#ifdef CONFIG_X86_32
Ingo Molnar4d46a892008-02-21 04:24:40 +0100404 /* Virtual 86 mode info */
Glauber de Oliveira Costacb38d372008-01-30 13:31:31 +0100405 struct vm86_struct __user *vm86_info;
406 unsigned long screen_bitmap;
Ingo Molnar4d46a892008-02-21 04:24:40 +0100407 unsigned long v86flags;
408 unsigned long v86mask;
409 unsigned long saved_sp0;
410 unsigned int saved_fs;
411 unsigned int saved_gs;
Glauber de Oliveira Costacb38d372008-01-30 13:31:31 +0100412#endif
Ingo Molnar4d46a892008-02-21 04:24:40 +0100413 /* IO permissions: */
414 unsigned long *io_bitmap_ptr;
415 unsigned long iopl;
416 /* Max allowed port in the bitmap, in bytes: */
417 unsigned io_bitmap_max;
Glauber de Oliveira Costacb38d372008-01-30 13:31:31 +0100418/* MSR_IA32_DEBUGCTLMSR value to switch in if TIF_DEBUGCTLMSR is set. */
419 unsigned long debugctlmsr;
420/* Debug Store - if not 0 points to a DS Save Area configuration;
421 * goes into MSR_IA32_DS_AREA */
422 unsigned long ds_area_msr;
423};
424
Glauber de Oliveira Costa1b46cbe2008-01-30 13:31:27 +0100425static inline unsigned long native_get_debugreg(int regno)
426{
Ingo Molnar4d46a892008-02-21 04:24:40 +0100427 unsigned long val = 0; /* Damn you, gcc! */
Glauber de Oliveira Costa1b46cbe2008-01-30 13:31:27 +0100428
429 switch (regno) {
430 case 0:
431 asm("mov %%db0, %0" :"=r" (val)); break;
432 case 1:
433 asm("mov %%db1, %0" :"=r" (val)); break;
434 case 2:
435 asm("mov %%db2, %0" :"=r" (val)); break;
436 case 3:
437 asm("mov %%db3, %0" :"=r" (val)); break;
438 case 6:
439 asm("mov %%db6, %0" :"=r" (val)); break;
440 case 7:
441 asm("mov %%db7, %0" :"=r" (val)); break;
442 default:
443 BUG();
444 }
445 return val;
446}
447
448static inline void native_set_debugreg(int regno, unsigned long value)
449{
450 switch (regno) {
451 case 0:
Ingo Molnar4d46a892008-02-21 04:24:40 +0100452 asm("mov %0, %%db0" ::"r" (value));
Glauber de Oliveira Costa1b46cbe2008-01-30 13:31:27 +0100453 break;
454 case 1:
Ingo Molnar4d46a892008-02-21 04:24:40 +0100455 asm("mov %0, %%db1" ::"r" (value));
Glauber de Oliveira Costa1b46cbe2008-01-30 13:31:27 +0100456 break;
457 case 2:
Ingo Molnar4d46a892008-02-21 04:24:40 +0100458 asm("mov %0, %%db2" ::"r" (value));
Glauber de Oliveira Costa1b46cbe2008-01-30 13:31:27 +0100459 break;
460 case 3:
Ingo Molnar4d46a892008-02-21 04:24:40 +0100461 asm("mov %0, %%db3" ::"r" (value));
Glauber de Oliveira Costa1b46cbe2008-01-30 13:31:27 +0100462 break;
463 case 6:
Ingo Molnar4d46a892008-02-21 04:24:40 +0100464 asm("mov %0, %%db6" ::"r" (value));
Glauber de Oliveira Costa1b46cbe2008-01-30 13:31:27 +0100465 break;
466 case 7:
Ingo Molnar4d46a892008-02-21 04:24:40 +0100467 asm("mov %0, %%db7" ::"r" (value));
Glauber de Oliveira Costa1b46cbe2008-01-30 13:31:27 +0100468 break;
469 default:
470 BUG();
471 }
472}
473
Glauber de Oliveira Costa62d7d7e2008-01-30 13:31:27 +0100474/*
475 * Set IOPL bits in EFLAGS from given mask
476 */
477static inline void native_set_iopl_mask(unsigned mask)
478{
479#ifdef CONFIG_X86_32
480 unsigned int reg;
Ingo Molnar4d46a892008-02-21 04:24:40 +0100481
Glauber de Oliveira Costa62d7d7e2008-01-30 13:31:27 +0100482 __asm__ __volatile__ ("pushfl;"
483 "popl %0;"
484 "andl %1, %0;"
485 "orl %2, %0;"
486 "pushl %0;"
487 "popfl"
488 : "=&r" (reg)
489 : "i" (~X86_EFLAGS_IOPL), "r" (mask));
490#endif
491}
492
Ingo Molnar4d46a892008-02-21 04:24:40 +0100493static inline void
494native_load_sp0(struct tss_struct *tss, struct thread_struct *thread)
Glauber de Oliveira Costa7818a1e2008-01-30 13:31:31 +0100495{
496 tss->x86_tss.sp0 = thread->sp0;
497#ifdef CONFIG_X86_32
Ingo Molnar4d46a892008-02-21 04:24:40 +0100498 /* Only happens when SEP is enabled, no need to test "SEP"arately: */
Glauber de Oliveira Costa7818a1e2008-01-30 13:31:31 +0100499 if (unlikely(tss->x86_tss.ss1 != thread->sysenter_cs)) {
500 tss->x86_tss.ss1 = thread->sysenter_cs;
501 wrmsr(MSR_IA32_SYSENTER_CS, thread->sysenter_cs, 0);
502 }
503#endif
504}
Glauber de Oliveira Costa1b46cbe2008-01-30 13:31:27 +0100505
Glauber de Oliveira Costae801f862008-01-30 13:32:08 +0100506static inline void native_swapgs(void)
507{
508#ifdef CONFIG_X86_64
509 asm volatile("swapgs" ::: "memory");
510#endif
511}
512
Glauber de Oliveira Costa7818a1e2008-01-30 13:31:31 +0100513#ifdef CONFIG_PARAVIRT
514#include <asm/paravirt.h>
515#else
Ingo Molnar4d46a892008-02-21 04:24:40 +0100516#define __cpuid native_cpuid
517#define paravirt_enabled() 0
Glauber de Oliveira Costa1b46cbe2008-01-30 13:31:27 +0100518
519/*
520 * These special macros can be used to get or set a debugging register
521 */
522#define get_debugreg(var, register) \
523 (var) = native_get_debugreg(register)
524#define set_debugreg(value, register) \
525 native_set_debugreg(register, value)
526
Ingo Molnar4d46a892008-02-21 04:24:40 +0100527static inline void
528load_sp0(struct tss_struct *tss, struct thread_struct *thread)
Glauber de Oliveira Costa7818a1e2008-01-30 13:31:31 +0100529{
530 native_load_sp0(tss, thread);
531}
532
Glauber de Oliveira Costa62d7d7e2008-01-30 13:31:27 +0100533#define set_iopl_mask native_set_iopl_mask
Glauber de Oliveira Costae801f862008-01-30 13:32:08 +0100534#define SWAPGS swapgs
Glauber de Oliveira Costa1b46cbe2008-01-30 13:31:27 +0100535#endif /* CONFIG_PARAVIRT */
536
537/*
538 * Save the cr4 feature set we're using (ie
539 * Pentium 4MB enable and PPro Global page
540 * enable), so that any CPU's that boot up
541 * after us can get the correct flags.
542 */
Ingo Molnar4d46a892008-02-21 04:24:40 +0100543extern unsigned long mmu_cr4_features;
Glauber de Oliveira Costa1b46cbe2008-01-30 13:31:27 +0100544
545static inline void set_in_cr4(unsigned long mask)
546{
547 unsigned cr4;
Ingo Molnar4d46a892008-02-21 04:24:40 +0100548
Glauber de Oliveira Costa1b46cbe2008-01-30 13:31:27 +0100549 mmu_cr4_features |= mask;
550 cr4 = read_cr4();
551 cr4 |= mask;
552 write_cr4(cr4);
553}
554
555static inline void clear_in_cr4(unsigned long mask)
556{
557 unsigned cr4;
Ingo Molnar4d46a892008-02-21 04:24:40 +0100558
Glauber de Oliveira Costa1b46cbe2008-01-30 13:31:27 +0100559 mmu_cr4_features &= ~mask;
560 cr4 = read_cr4();
561 cr4 &= ~mask;
562 write_cr4(cr4);
563}
564
Glauber de Oliveira Costa683e0252008-01-30 13:31:27 +0100565struct microcode_header {
Ingo Molnar4d46a892008-02-21 04:24:40 +0100566 unsigned int hdrver;
567 unsigned int rev;
568 unsigned int date;
569 unsigned int sig;
570 unsigned int cksum;
571 unsigned int ldrver;
572 unsigned int pf;
573 unsigned int datasize;
574 unsigned int totalsize;
575 unsigned int reserved[3];
Glauber de Oliveira Costa683e0252008-01-30 13:31:27 +0100576};
Glauber de Oliveira Costa1b46cbe2008-01-30 13:31:27 +0100577
Glauber de Oliveira Costa683e0252008-01-30 13:31:27 +0100578struct microcode {
Ingo Molnar4d46a892008-02-21 04:24:40 +0100579 struct microcode_header hdr;
580 unsigned int bits[0];
Glauber de Oliveira Costa683e0252008-01-30 13:31:27 +0100581};
582
Ingo Molnar4d46a892008-02-21 04:24:40 +0100583typedef struct microcode microcode_t;
584typedef struct microcode_header microcode_header_t;
Glauber de Oliveira Costa683e0252008-01-30 13:31:27 +0100585
586/* microcode format is extended from prescott processors */
587struct extended_signature {
Ingo Molnar4d46a892008-02-21 04:24:40 +0100588 unsigned int sig;
589 unsigned int pf;
590 unsigned int cksum;
Glauber de Oliveira Costa683e0252008-01-30 13:31:27 +0100591};
592
593struct extended_sigtable {
Ingo Molnar4d46a892008-02-21 04:24:40 +0100594 unsigned int count;
595 unsigned int cksum;
596 unsigned int reserved[3];
Glauber de Oliveira Costa683e0252008-01-30 13:31:27 +0100597 struct extended_signature sigs[0];
598};
599
Glauber de Oliveira Costafc87e902008-01-30 13:31:38 +0100600typedef struct {
Ingo Molnar4d46a892008-02-21 04:24:40 +0100601 unsigned long seg;
Glauber de Oliveira Costafc87e902008-01-30 13:31:38 +0100602} mm_segment_t;
603
604
Glauber de Oliveira Costa683e0252008-01-30 13:31:27 +0100605/*
606 * create a kernel thread without removing it from tasklists
607 */
608extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
609
610/* Free all resources held by a thread. */
611extern void release_thread(struct task_struct *);
612
Ingo Molnar4d46a892008-02-21 04:24:40 +0100613/* Prepare to copy thread state - unlazy all lazy state */
Glauber de Oliveira Costa683e0252008-01-30 13:31:27 +0100614extern void prepare_to_copy(struct task_struct *tsk);
615
616unsigned long get_wchan(struct task_struct *p);
Glauber de Oliveira Costac758ecf2008-01-30 13:31:03 +0100617
618/*
619 * Generic CPUID function
620 * clear %ecx since some cpus (Cyrix MII) do not set or clear %ecx
621 * resulting in stale register contents being returned.
622 */
623static inline void cpuid(unsigned int op,
624 unsigned int *eax, unsigned int *ebx,
625 unsigned int *ecx, unsigned int *edx)
626{
627 *eax = op;
628 *ecx = 0;
629 __cpuid(eax, ebx, ecx, edx);
630}
631
632/* Some CPUID calls want 'count' to be placed in ecx */
633static inline void cpuid_count(unsigned int op, int count,
634 unsigned int *eax, unsigned int *ebx,
635 unsigned int *ecx, unsigned int *edx)
636{
637 *eax = op;
638 *ecx = count;
639 __cpuid(eax, ebx, ecx, edx);
640}
641
642/*
643 * CPUID functions returning a single datum
644 */
645static inline unsigned int cpuid_eax(unsigned int op)
646{
647 unsigned int eax, ebx, ecx, edx;
648
649 cpuid(op, &eax, &ebx, &ecx, &edx);
Ingo Molnar4d46a892008-02-21 04:24:40 +0100650
Glauber de Oliveira Costac758ecf2008-01-30 13:31:03 +0100651 return eax;
652}
Ingo Molnar4d46a892008-02-21 04:24:40 +0100653
Glauber de Oliveira Costac758ecf2008-01-30 13:31:03 +0100654static inline unsigned int cpuid_ebx(unsigned int op)
655{
656 unsigned int eax, ebx, ecx, edx;
657
658 cpuid(op, &eax, &ebx, &ecx, &edx);
Ingo Molnar4d46a892008-02-21 04:24:40 +0100659
Glauber de Oliveira Costac758ecf2008-01-30 13:31:03 +0100660 return ebx;
661}
Ingo Molnar4d46a892008-02-21 04:24:40 +0100662
Glauber de Oliveira Costac758ecf2008-01-30 13:31:03 +0100663static inline unsigned int cpuid_ecx(unsigned int op)
664{
665 unsigned int eax, ebx, ecx, edx;
666
667 cpuid(op, &eax, &ebx, &ecx, &edx);
Ingo Molnar4d46a892008-02-21 04:24:40 +0100668
Glauber de Oliveira Costac758ecf2008-01-30 13:31:03 +0100669 return ecx;
670}
Ingo Molnar4d46a892008-02-21 04:24:40 +0100671
Glauber de Oliveira Costac758ecf2008-01-30 13:31:03 +0100672static inline unsigned int cpuid_edx(unsigned int op)
673{
674 unsigned int eax, ebx, ecx, edx;
675
676 cpuid(op, &eax, &ebx, &ecx, &edx);
Ingo Molnar4d46a892008-02-21 04:24:40 +0100677
Glauber de Oliveira Costac758ecf2008-01-30 13:31:03 +0100678 return edx;
679}
680
Glauber de Oliveira Costa683e0252008-01-30 13:31:27 +0100681/* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */
682static inline void rep_nop(void)
683{
Ingo Molnar4d46a892008-02-21 04:24:40 +0100684 __asm__ __volatile__("rep; nop" ::: "memory");
Glauber de Oliveira Costa683e0252008-01-30 13:31:27 +0100685}
686
Ingo Molnar4d46a892008-02-21 04:24:40 +0100687static inline void cpu_relax(void)
688{
689 rep_nop();
690}
691
692/* Stop speculative execution: */
Glauber de Oliveira Costa683e0252008-01-30 13:31:27 +0100693static inline void sync_core(void)
694{
695 int tmp;
Ingo Molnar4d46a892008-02-21 04:24:40 +0100696
Glauber de Oliveira Costa683e0252008-01-30 13:31:27 +0100697 asm volatile("cpuid" : "=a" (tmp) : "0" (1)
698 : "ebx", "ecx", "edx", "memory");
699}
700
Ingo Molnar4d46a892008-02-21 04:24:40 +0100701static inline void
702__monitor(const void *eax, unsigned long ecx, unsigned long edx)
Glauber de Oliveira Costa683e0252008-01-30 13:31:27 +0100703{
Ingo Molnar4d46a892008-02-21 04:24:40 +0100704 /* "monitor %eax, %ecx, %edx;" */
Glauber de Oliveira Costa683e0252008-01-30 13:31:27 +0100705 asm volatile(
Ingo Molnar4d46a892008-02-21 04:24:40 +0100706 ".byte 0x0f, 0x01, 0xc8;"
707 :: "a" (eax), "c" (ecx), "d"(edx));
Glauber de Oliveira Costa683e0252008-01-30 13:31:27 +0100708}
709
710static inline void __mwait(unsigned long eax, unsigned long ecx)
711{
Ingo Molnar4d46a892008-02-21 04:24:40 +0100712 /* "mwait %eax, %ecx;" */
Glauber de Oliveira Costa683e0252008-01-30 13:31:27 +0100713 asm volatile(
Ingo Molnar4d46a892008-02-21 04:24:40 +0100714 ".byte 0x0f, 0x01, 0xc9;"
715 :: "a" (eax), "c" (ecx));
Glauber de Oliveira Costa683e0252008-01-30 13:31:27 +0100716}
717
718static inline void __sti_mwait(unsigned long eax, unsigned long ecx)
719{
Ingo Molnar4d46a892008-02-21 04:24:40 +0100720 /* "mwait %eax, %ecx;" */
Glauber de Oliveira Costa683e0252008-01-30 13:31:27 +0100721 asm volatile(
Ingo Molnar4d46a892008-02-21 04:24:40 +0100722 "sti; .byte 0x0f, 0x01, 0xc9;"
723 :: "a" (eax), "c" (ecx));
Glauber de Oliveira Costa683e0252008-01-30 13:31:27 +0100724}
725
726extern void mwait_idle_with_hints(unsigned long eax, unsigned long ecx);
727
Ingo Molnar4d46a892008-02-21 04:24:40 +0100728extern int force_mwait;
Glauber de Oliveira Costa683e0252008-01-30 13:31:27 +0100729
730extern void select_idle_routine(const struct cpuinfo_x86 *c);
731
Ingo Molnar4d46a892008-02-21 04:24:40 +0100732extern unsigned long boot_option_idle_override;
Glauber de Oliveira Costa683e0252008-01-30 13:31:27 +0100733
Glauber de Oliveira Costa1a539052008-01-30 13:31:39 +0100734extern void enable_sep_cpu(void);
735extern int sysenter_setup(void);
736
737/* Defined in head.S */
Ingo Molnar4d46a892008-02-21 04:24:40 +0100738extern struct desc_ptr early_gdt_descr;
Glauber de Oliveira Costa1a539052008-01-30 13:31:39 +0100739
740extern void cpu_set_gdt(int);
741extern void switch_to_new_gdt(void);
742extern void cpu_init(void);
743extern void init_gdt(int cpu);
744
Ingo Molnar4d46a892008-02-21 04:24:40 +0100745/*
746 * from system description table in BIOS. Mostly for MCA use, but
747 * others may find it useful:
748 */
749extern unsigned int machine_id;
750extern unsigned int machine_submodel_id;
751extern unsigned int BIOS_revision;
Glauber de Oliveira Costa1a539052008-01-30 13:31:39 +0100752
Ingo Molnar4d46a892008-02-21 04:24:40 +0100753/* Boot loader type from the setup header: */
754extern int bootloader_type;
Glauber de Oliveira Costa1a539052008-01-30 13:31:39 +0100755
Ingo Molnar4d46a892008-02-21 04:24:40 +0100756extern char ignore_fpu_irq;
Glauber de Oliveira Costa683e0252008-01-30 13:31:27 +0100757
758#define HAVE_ARCH_PICK_MMAP_LAYOUT 1
759#define ARCH_HAS_PREFETCHW
760#define ARCH_HAS_SPINLOCK_PREFETCH
761
Glauber de Oliveira Costaae2e15e2008-01-30 13:31:40 +0100762#ifdef CONFIG_X86_32
Ingo Molnar4d46a892008-02-21 04:24:40 +0100763# define BASE_PREFETCH ASM_NOP4
764# define ARCH_HAS_PREFETCH
Glauber de Oliveira Costaae2e15e2008-01-30 13:31:40 +0100765#else
Ingo Molnar4d46a892008-02-21 04:24:40 +0100766# define BASE_PREFETCH "prefetcht0 (%1)"
Glauber de Oliveira Costaae2e15e2008-01-30 13:31:40 +0100767#endif
768
Ingo Molnar4d46a892008-02-21 04:24:40 +0100769/*
770 * Prefetch instructions for Pentium III (+) and AMD Athlon (+)
771 *
772 * It's not worth to care about 3dnow prefetches for the K6
773 * because they are microcoded there and very slow.
774 */
Glauber de Oliveira Costaae2e15e2008-01-30 13:31:40 +0100775static inline void prefetch(const void *x)
776{
777 alternative_input(BASE_PREFETCH,
778 "prefetchnta (%1)",
779 X86_FEATURE_XMM,
780 "r" (x));
781}
782
Ingo Molnar4d46a892008-02-21 04:24:40 +0100783/*
784 * 3dnow prefetch to get an exclusive cache line.
785 * Useful for spinlocks to avoid one state transition in the
786 * cache coherency protocol:
787 */
Glauber de Oliveira Costaae2e15e2008-01-30 13:31:40 +0100788static inline void prefetchw(const void *x)
789{
790 alternative_input(BASE_PREFETCH,
791 "prefetchw (%1)",
792 X86_FEATURE_3DNOW,
793 "r" (x));
794}
795
Ingo Molnar4d46a892008-02-21 04:24:40 +0100796static inline void spin_lock_prefetch(const void *x)
797{
798 prefetchw(x);
799}
800
Glauber de Oliveira Costa2f66dcc2008-01-30 13:31:57 +0100801#ifdef CONFIG_X86_32
802/*
803 * User space process size: 3GB (default).
804 */
Ingo Molnar4d46a892008-02-21 04:24:40 +0100805#define TASK_SIZE PAGE_OFFSET
806#define STACK_TOP TASK_SIZE
807#define STACK_TOP_MAX STACK_TOP
Glauber de Oliveira Costa2f66dcc2008-01-30 13:31:57 +0100808
Ingo Molnar4d46a892008-02-21 04:24:40 +0100809#define INIT_THREAD { \
810 .sp0 = sizeof(init_stack) + (long)&init_stack, \
811 .vm86_info = NULL, \
812 .sysenter_cs = __KERNEL_CS, \
813 .io_bitmap_ptr = NULL, \
814 .fs = __KERNEL_PERCPU, \
Glauber de Oliveira Costa2f66dcc2008-01-30 13:31:57 +0100815}
816
817/*
818 * Note that the .io_bitmap member must be extra-big. This is because
819 * the CPU will access an additional byte beyond the end of the IO
820 * permission bitmap. The extra byte must be all 1 bits, and must
821 * be within the limit.
822 */
Ingo Molnar4d46a892008-02-21 04:24:40 +0100823#define INIT_TSS { \
824 .x86_tss = { \
Glauber de Oliveira Costa2f66dcc2008-01-30 13:31:57 +0100825 .sp0 = sizeof(init_stack) + (long)&init_stack, \
Ingo Molnar4d46a892008-02-21 04:24:40 +0100826 .ss0 = __KERNEL_DS, \
827 .ss1 = __KERNEL_CS, \
828 .io_bitmap_base = INVALID_IO_BITMAP_OFFSET, \
829 }, \
830 .io_bitmap = { [0 ... IO_BITMAP_LONGS] = ~0 }, \
Glauber de Oliveira Costa2f66dcc2008-01-30 13:31:57 +0100831}
832
Glauber de Oliveira Costa2f66dcc2008-01-30 13:31:57 +0100833extern unsigned long thread_saved_pc(struct task_struct *tsk);
834
835#define THREAD_SIZE_LONGS (THREAD_SIZE/sizeof(unsigned long))
836#define KSTK_TOP(info) \
837({ \
838 unsigned long *__ptr = (unsigned long *)(info); \
839 (unsigned long)(&__ptr[THREAD_SIZE_LONGS]); \
840})
841
842/*
843 * The below -8 is to reserve 8 bytes on top of the ring0 stack.
844 * This is necessary to guarantee that the entire "struct pt_regs"
845 * is accessable even if the CPU haven't stored the SS/ESP registers
846 * on the stack (interrupt gate does not save these registers
847 * when switching to the same priv ring).
848 * Therefore beware: accessing the ss/esp fields of the
849 * "struct pt_regs" is possible, but they may contain the
850 * completely wrong values.
851 */
852#define task_pt_regs(task) \
853({ \
854 struct pt_regs *__regs__; \
855 __regs__ = (struct pt_regs *)(KSTK_TOP(task_stack_page(task))-8); \
856 __regs__ - 1; \
857})
858
Ingo Molnar4d46a892008-02-21 04:24:40 +0100859#define KSTK_ESP(task) (task_pt_regs(task)->sp)
Glauber de Oliveira Costa2f66dcc2008-01-30 13:31:57 +0100860
861#else
862/*
863 * User space process size. 47bits minus one guard page.
864 */
Ingo Molnar4d46a892008-02-21 04:24:40 +0100865#define TASK_SIZE64 (0x800000000000UL - 4096)
Glauber de Oliveira Costa2f66dcc2008-01-30 13:31:57 +0100866
867/* This decides where the kernel will search for a free chunk of vm
868 * space during mmap's.
869 */
Ingo Molnar4d46a892008-02-21 04:24:40 +0100870#define IA32_PAGE_OFFSET ((current->personality & ADDR_LIMIT_3GB) ? \
871 0xc0000000 : 0xFFFFe000)
Glauber de Oliveira Costa2f66dcc2008-01-30 13:31:57 +0100872
Ingo Molnar4d46a892008-02-21 04:24:40 +0100873#define TASK_SIZE (test_thread_flag(TIF_IA32) ? \
874 IA32_PAGE_OFFSET : TASK_SIZE64)
875#define TASK_SIZE_OF(child) ((test_tsk_thread_flag(child, TIF_IA32)) ? \
876 IA32_PAGE_OFFSET : TASK_SIZE64)
Glauber de Oliveira Costa2f66dcc2008-01-30 13:31:57 +0100877
David Howells922a70d2008-02-08 04:19:26 -0800878#define STACK_TOP TASK_SIZE
879#define STACK_TOP_MAX TASK_SIZE64
880
Glauber de Oliveira Costa2f66dcc2008-01-30 13:31:57 +0100881#define INIT_THREAD { \
882 .sp0 = (unsigned long)&init_stack + sizeof(init_stack) \
883}
884
885#define INIT_TSS { \
886 .x86_tss.sp0 = (unsigned long)&init_stack + sizeof(init_stack) \
887}
888
Glauber de Oliveira Costa2f66dcc2008-01-30 13:31:57 +0100889/*
890 * Return saved PC of a blocked thread.
891 * What is this good for? it will be always the scheduler or ret_from_fork.
892 */
Ingo Molnar4d46a892008-02-21 04:24:40 +0100893#define thread_saved_pc(t) (*(unsigned long *)((t)->thread.sp - 8))
Glauber de Oliveira Costa2f66dcc2008-01-30 13:31:57 +0100894
Ingo Molnar4d46a892008-02-21 04:24:40 +0100895#define task_pt_regs(tsk) ((struct pt_regs *)(tsk)->thread.sp0 - 1)
896#define KSTK_ESP(tsk) -1 /* sorry. doesn't work for syscall. */
Glauber de Oliveira Costa2f66dcc2008-01-30 13:31:57 +0100897#endif /* CONFIG_X86_64 */
898
Ingo Molnar513ad842008-02-21 05:18:40 +0100899extern void start_thread(struct pt_regs *regs, unsigned long new_ip,
900 unsigned long new_sp);
901
Ingo Molnar4d46a892008-02-21 04:24:40 +0100902/*
903 * This decides where the kernel will search for a free chunk of vm
Glauber de Oliveira Costa683e0252008-01-30 13:31:27 +0100904 * space during mmap's.
905 */
906#define TASK_UNMAPPED_BASE (PAGE_ALIGN(TASK_SIZE / 3))
907
Ingo Molnar4d46a892008-02-21 04:24:40 +0100908#define KSTK_EIP(task) (task_pt_regs(task)->ip)
Glauber de Oliveira Costa683e0252008-01-30 13:31:27 +0100909
Glauber de Oliveira Costac758ecf2008-01-30 13:31:03 +0100910#endif