diff options
author | H. Peter Anvin <hpa@zytor.com> | 2008-01-30 07:31:02 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-01-30 07:31:02 -0500 |
commit | faca62273b602ab482fb7d3d940dbf41ef08b00e (patch) | |
tree | 913fb1c565a2b719b00ae4b745c38cc9b0ebf279 /include | |
parent | 25149b62d3e6a3e737af39bd4a0b4e97de0811b7 (diff) |
x86: use generic register name in the thread and tss structures
This changes size-specific register names (eip/rip, esp/rsp, etc.) to
generic names in the thread and tss structures.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-x86/paravirt.h | 6 | ||||
-rw-r--r-- | include/asm-x86/processor_32.h | 37 | ||||
-rw-r--r-- | include/asm-x86/processor_64.h | 20 | ||||
-rw-r--r-- | include/asm-x86/system_32.h | 4 | ||||
-rw-r--r-- | include/asm-x86/system_64.h | 2 |
5 files changed, 33 insertions, 36 deletions
diff --git a/include/asm-x86/paravirt.h b/include/asm-x86/paravirt.h index be7b934f6c54..d1780e32722e 100644 --- a/include/asm-x86/paravirt.h +++ b/include/asm-x86/paravirt.h | |||
@@ -101,7 +101,7 @@ struct pv_cpu_ops { | |||
101 | int entrynum, u32 low, u32 high); | 101 | int entrynum, u32 low, u32 high); |
102 | void (*write_idt_entry)(struct desc_struct *, | 102 | void (*write_idt_entry)(struct desc_struct *, |
103 | int entrynum, u32 low, u32 high); | 103 | int entrynum, u32 low, u32 high); |
104 | void (*load_esp0)(struct tss_struct *tss, struct thread_struct *t); | 104 | void (*load_sp0)(struct tss_struct *tss, struct thread_struct *t); |
105 | 105 | ||
106 | void (*set_iopl_mask)(unsigned mask); | 106 | void (*set_iopl_mask)(unsigned mask); |
107 | 107 | ||
@@ -449,10 +449,10 @@ static inline int paravirt_enabled(void) | |||
449 | return pv_info.paravirt_enabled; | 449 | return pv_info.paravirt_enabled; |
450 | } | 450 | } |
451 | 451 | ||
452 | static inline void load_esp0(struct tss_struct *tss, | 452 | static inline void load_sp0(struct tss_struct *tss, |
453 | struct thread_struct *thread) | 453 | struct thread_struct *thread) |
454 | { | 454 | { |
455 | PVOP_VCALL2(pv_cpu_ops.load_esp0, tss, thread); | 455 | PVOP_VCALL2(pv_cpu_ops.load_sp0, tss, thread); |
456 | } | 456 | } |
457 | 457 | ||
458 | #define ARCH_SETUP pv_init_ops.arch_setup(); | 458 | #define ARCH_SETUP pv_init_ops.arch_setup(); |
diff --git a/include/asm-x86/processor_32.h b/include/asm-x86/processor_32.h index d50a4b48d441..6846cc346400 100644 --- a/include/asm-x86/processor_32.h +++ b/include/asm-x86/processor_32.h | |||
@@ -292,20 +292,17 @@ struct thread_struct; | |||
292 | /* This is the TSS defined by the hardware. */ | 292 | /* This is the TSS defined by the hardware. */ |
293 | struct i386_hw_tss { | 293 | struct i386_hw_tss { |
294 | unsigned short back_link,__blh; | 294 | unsigned short back_link,__blh; |
295 | unsigned long esp0; | 295 | unsigned long sp0; |
296 | unsigned short ss0,__ss0h; | 296 | unsigned short ss0,__ss0h; |
297 | unsigned long esp1; | 297 | unsigned long sp1; |
298 | unsigned short ss1,__ss1h; /* ss1 is used to cache MSR_IA32_SYSENTER_CS */ | 298 | unsigned short ss1,__ss1h; /* ss1 is used to cache MSR_IA32_SYSENTER_CS */ |
299 | unsigned long esp2; | 299 | unsigned long sp2; |
300 | unsigned short ss2,__ss2h; | 300 | unsigned short ss2,__ss2h; |
301 | unsigned long __cr3; | 301 | unsigned long __cr3; |
302 | unsigned long eip; | 302 | unsigned long ip; |
303 | unsigned long eflags; | 303 | unsigned long flags; |
304 | unsigned long eax,ecx,edx,ebx; | 304 | unsigned long ax, cx, dx, bx; |
305 | unsigned long esp; | 305 | unsigned long sp, bp, si, di; |
306 | unsigned long ebp; | ||
307 | unsigned long esi; | ||
308 | unsigned long edi; | ||
309 | unsigned short es, __esh; | 306 | unsigned short es, __esh; |
310 | unsigned short cs, __csh; | 307 | unsigned short cs, __csh; |
311 | unsigned short ss, __ssh; | 308 | unsigned short ss, __ssh; |
@@ -346,10 +343,10 @@ struct tss_struct { | |||
346 | struct thread_struct { | 343 | struct thread_struct { |
347 | /* cached TLS descriptors. */ | 344 | /* cached TLS descriptors. */ |
348 | struct desc_struct tls_array[GDT_ENTRY_TLS_ENTRIES]; | 345 | struct desc_struct tls_array[GDT_ENTRY_TLS_ENTRIES]; |
349 | unsigned long esp0; | 346 | unsigned long sp0; |
350 | unsigned long sysenter_cs; | 347 | unsigned long sysenter_cs; |
351 | unsigned long eip; | 348 | unsigned long ip; |
352 | unsigned long esp; | 349 | unsigned long sp; |
353 | unsigned long fs; | 350 | unsigned long fs; |
354 | unsigned long gs; | 351 | unsigned long gs; |
355 | /* Hardware debugging registers */ | 352 | /* Hardware debugging registers */ |
@@ -366,7 +363,7 @@ struct thread_struct { | |||
366 | /* virtual 86 mode info */ | 363 | /* virtual 86 mode info */ |
367 | struct vm86_struct __user * vm86_info; | 364 | struct vm86_struct __user * vm86_info; |
368 | unsigned long screen_bitmap; | 365 | unsigned long screen_bitmap; |
369 | unsigned long v86flags, v86mask, saved_esp0; | 366 | unsigned long v86flags, v86mask, saved_sp0; |
370 | unsigned int saved_fs, saved_gs; | 367 | unsigned int saved_fs, saved_gs; |
371 | /* IO permissions */ | 368 | /* IO permissions */ |
372 | unsigned long *io_bitmap_ptr; | 369 | unsigned long *io_bitmap_ptr; |
@@ -378,7 +375,7 @@ struct thread_struct { | |||
378 | }; | 375 | }; |
379 | 376 | ||
380 | #define INIT_THREAD { \ | 377 | #define INIT_THREAD { \ |
381 | .esp0 = sizeof(init_stack) + (long)&init_stack, \ | 378 | .sp0 = sizeof(init_stack) + (long)&init_stack, \ |
382 | .vm86_info = NULL, \ | 379 | .vm86_info = NULL, \ |
383 | .sysenter_cs = __KERNEL_CS, \ | 380 | .sysenter_cs = __KERNEL_CS, \ |
384 | .io_bitmap_ptr = NULL, \ | 381 | .io_bitmap_ptr = NULL, \ |
@@ -393,7 +390,7 @@ struct thread_struct { | |||
393 | */ | 390 | */ |
394 | #define INIT_TSS { \ | 391 | #define INIT_TSS { \ |
395 | .x86_tss = { \ | 392 | .x86_tss = { \ |
396 | .esp0 = sizeof(init_stack) + (long)&init_stack, \ | 393 | .sp0 = sizeof(init_stack) + (long)&init_stack, \ |
397 | .ss0 = __KERNEL_DS, \ | 394 | .ss0 = __KERNEL_DS, \ |
398 | .ss1 = __KERNEL_CS, \ | 395 | .ss1 = __KERNEL_CS, \ |
399 | .io_bitmap_base = INVALID_IO_BITMAP_OFFSET, \ | 396 | .io_bitmap_base = INVALID_IO_BITMAP_OFFSET, \ |
@@ -503,9 +500,9 @@ static inline void rep_nop(void) | |||
503 | 500 | ||
504 | #define cpu_relax() rep_nop() | 501 | #define cpu_relax() rep_nop() |
505 | 502 | ||
506 | static inline void native_load_esp0(struct tss_struct *tss, struct thread_struct *thread) | 503 | static inline void native_load_sp0(struct tss_struct *tss, struct thread_struct *thread) |
507 | { | 504 | { |
508 | tss->x86_tss.esp0 = thread->esp0; | 505 | tss->x86_tss.sp0 = thread->sp0; |
509 | /* This can only happen when SEP is enabled, no need to test "SEP"arately */ | 506 | /* This can only happen when SEP is enabled, no need to test "SEP"arately */ |
510 | if (unlikely(tss->x86_tss.ss1 != thread->sysenter_cs)) { | 507 | if (unlikely(tss->x86_tss.ss1 != thread->sysenter_cs)) { |
511 | tss->x86_tss.ss1 = thread->sysenter_cs; | 508 | tss->x86_tss.ss1 = thread->sysenter_cs; |
@@ -585,9 +582,9 @@ static inline void native_set_iopl_mask(unsigned mask) | |||
585 | #define paravirt_enabled() 0 | 582 | #define paravirt_enabled() 0 |
586 | #define __cpuid native_cpuid | 583 | #define __cpuid native_cpuid |
587 | 584 | ||
588 | static inline void load_esp0(struct tss_struct *tss, struct thread_struct *thread) | 585 | static inline void load_sp0(struct tss_struct *tss, struct thread_struct *thread) |
589 | { | 586 | { |
590 | native_load_esp0(tss, thread); | 587 | native_load_sp0(tss, thread); |
591 | } | 588 | } |
592 | 589 | ||
593 | /* | 590 | /* |
diff --git a/include/asm-x86/processor_64.h b/include/asm-x86/processor_64.h index 797770113e6d..0780f3e3fdfe 100644 --- a/include/asm-x86/processor_64.h +++ b/include/asm-x86/processor_64.h | |||
@@ -177,9 +177,9 @@ union i387_union { | |||
177 | 177 | ||
178 | struct tss_struct { | 178 | struct tss_struct { |
179 | u32 reserved1; | 179 | u32 reserved1; |
180 | u64 rsp0; | 180 | u64 sp0; |
181 | u64 rsp1; | 181 | u64 sp1; |
182 | u64 rsp2; | 182 | u64 sp2; |
183 | u64 reserved2; | 183 | u64 reserved2; |
184 | u64 ist[7]; | 184 | u64 ist[7]; |
185 | u32 reserved3; | 185 | u32 reserved3; |
@@ -216,9 +216,9 @@ DECLARE_PER_CPU(struct orig_ist, orig_ist); | |||
216 | #endif | 216 | #endif |
217 | 217 | ||
218 | struct thread_struct { | 218 | struct thread_struct { |
219 | unsigned long rsp0; | 219 | unsigned long sp0; |
220 | unsigned long rsp; | 220 | unsigned long sp; |
221 | unsigned long userrsp; /* Copy from PDA */ | 221 | unsigned long usersp; /* Copy from PDA */ |
222 | unsigned long fs; | 222 | unsigned long fs; |
223 | unsigned long gs; | 223 | unsigned long gs; |
224 | unsigned short es, ds, fsindex, gsindex; | 224 | unsigned short es, ds, fsindex, gsindex; |
@@ -245,11 +245,11 @@ struct thread_struct { | |||
245 | } __attribute__((aligned(16))); | 245 | } __attribute__((aligned(16))); |
246 | 246 | ||
247 | #define INIT_THREAD { \ | 247 | #define INIT_THREAD { \ |
248 | .rsp0 = (unsigned long)&init_stack + sizeof(init_stack) \ | 248 | .sp0 = (unsigned long)&init_stack + sizeof(init_stack) \ |
249 | } | 249 | } |
250 | 250 | ||
251 | #define INIT_TSS { \ | 251 | #define INIT_TSS { \ |
252 | .rsp0 = (unsigned long)&init_stack + sizeof(init_stack) \ | 252 | .sp0 = (unsigned long)&init_stack + sizeof(init_stack) \ |
253 | } | 253 | } |
254 | 254 | ||
255 | #define INIT_MMAP \ | 255 | #define INIT_MMAP \ |
@@ -293,10 +293,10 @@ extern long kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); | |||
293 | * Return saved PC of a blocked thread. | 293 | * Return saved PC of a blocked thread. |
294 | * What is this good for? it will be always the scheduler or ret_from_fork. | 294 | * What is this good for? it will be always the scheduler or ret_from_fork. |
295 | */ | 295 | */ |
296 | #define thread_saved_pc(t) (*(unsigned long *)((t)->thread.rsp - 8)) | 296 | #define thread_saved_pc(t) (*(unsigned long *)((t)->thread.sp - 8)) |
297 | 297 | ||
298 | extern unsigned long get_wchan(struct task_struct *p); | 298 | extern unsigned long get_wchan(struct task_struct *p); |
299 | #define task_pt_regs(tsk) ((struct pt_regs *)(tsk)->thread.rsp0 - 1) | 299 | #define task_pt_regs(tsk) ((struct pt_regs *)(tsk)->thread.sp0 - 1) |
300 | #define KSTK_EIP(tsk) (task_pt_regs(tsk)->ip) | 300 | #define KSTK_EIP(tsk) (task_pt_regs(tsk)->ip) |
301 | #define KSTK_ESP(tsk) -1 /* sorry. doesn't work for syscall. */ | 301 | #define KSTK_ESP(tsk) -1 /* sorry. doesn't work for syscall. */ |
302 | 302 | ||
diff --git a/include/asm-x86/system_32.h b/include/asm-x86/system_32.h index db6283eb5e46..f5b3f77f5310 100644 --- a/include/asm-x86/system_32.h +++ b/include/asm-x86/system_32.h | |||
@@ -28,9 +28,9 @@ extern struct task_struct * FASTCALL(__switch_to(struct task_struct *prev, struc | |||
28 | "1:\t" \ | 28 | "1:\t" \ |
29 | "popl %%ebp\n\t" \ | 29 | "popl %%ebp\n\t" \ |
30 | "popfl" \ | 30 | "popfl" \ |
31 | :"=m" (prev->thread.esp),"=m" (prev->thread.eip), \ | 31 | :"=m" (prev->thread.sp),"=m" (prev->thread.ip), \ |
32 | "=a" (last),"=S" (esi),"=D" (edi) \ | 32 | "=a" (last),"=S" (esi),"=D" (edi) \ |
33 | :"m" (next->thread.esp),"m" (next->thread.eip), \ | 33 | :"m" (next->thread.sp),"m" (next->thread.ip), \ |
34 | "2" (prev), "d" (next)); \ | 34 | "2" (prev), "d" (next)); \ |
35 | } while (0) | 35 | } while (0) |
36 | 36 | ||
diff --git a/include/asm-x86/system_64.h b/include/asm-x86/system_64.h index 6e9e4841a2da..3dcb217a7202 100644 --- a/include/asm-x86/system_64.h +++ b/include/asm-x86/system_64.h | |||
@@ -40,7 +40,7 @@ | |||
40 | RESTORE_CONTEXT \ | 40 | RESTORE_CONTEXT \ |
41 | : "=a" (last) \ | 41 | : "=a" (last) \ |
42 | : [next] "S" (next), [prev] "D" (prev), \ | 42 | : [next] "S" (next), [prev] "D" (prev), \ |
43 | [threadrsp] "i" (offsetof(struct task_struct, thread.rsp)), \ | 43 | [threadrsp] "i" (offsetof(struct task_struct, thread.sp)), \ |
44 | [ti_flags] "i" (offsetof(struct thread_info, flags)),\ | 44 | [ti_flags] "i" (offsetof(struct thread_info, flags)),\ |
45 | [tif_fork] "i" (TIF_FORK), \ | 45 | [tif_fork] "i" (TIF_FORK), \ |
46 | [thread_info] "i" (offsetof(struct task_struct, stack)), \ | 46 | [thread_info] "i" (offsetof(struct task_struct, stack)), \ |