aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-01-30 07:31:02 -0500
committerIngo Molnar <mingo@elte.hu>2008-01-30 07:31:02 -0500
commitfaca62273b602ab482fb7d3d940dbf41ef08b00e (patch)
tree913fb1c565a2b719b00ae4b745c38cc9b0ebf279
parent25149b62d3e6a3e737af39bd4a0b4e97de0811b7 (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>
-rw-r--r--arch/x86/kernel/asm-offsets_32.c4
-rw-r--r--arch/x86/kernel/cpu/common.c2
-rw-r--r--arch/x86/kernel/doublefault_32.c15
-rw-r--r--arch/x86/kernel/entry_32.S6
-rw-r--r--arch/x86/kernel/paravirt_32.c2
-rw-r--r--arch/x86/kernel/process_32.c12
-rw-r--r--arch/x86/kernel/process_64.c16
-rw-r--r--arch/x86/kernel/smpboot_32.c8
-rw-r--r--arch/x86/kernel/smpboot_64.c6
-rw-r--r--arch/x86/kernel/traps_32.c6
-rw-r--r--arch/x86/kernel/traps_64.c4
-rw-r--r--arch/x86/kernel/vm86_32.c16
-rw-r--r--arch/x86/kernel/vmi_32.c10
-rw-r--r--arch/x86/lguest/boot.c6
-rw-r--r--arch/x86/vdso/vdso32-setup.c4
-rw-r--r--arch/x86/xen/enlighten.c6
-rw-r--r--arch/x86/xen/smp.c4
-rw-r--r--drivers/lguest/x86/core.c4
-rw-r--r--include/asm-x86/paravirt.h6
-rw-r--r--include/asm-x86/processor_32.h37
-rw-r--r--include/asm-x86/processor_64.h20
-rw-r--r--include/asm-x86/system_32.h4
-rw-r--r--include/asm-x86/system_64.h2
23 files changed, 99 insertions, 101 deletions
diff --git a/arch/x86/kernel/asm-offsets_32.c b/arch/x86/kernel/asm-offsets_32.c
index 4fc24a61f431..415313556708 100644
--- a/arch/x86/kernel/asm-offsets_32.c
+++ b/arch/x86/kernel/asm-offsets_32.c
@@ -101,8 +101,8 @@ void foo(void)
101 OFFSET(pbe_orig_address, pbe, orig_address); 101 OFFSET(pbe_orig_address, pbe, orig_address);
102 OFFSET(pbe_next, pbe, next); 102 OFFSET(pbe_next, pbe, next);
103 103
104 /* Offset from the sysenter stack to tss.esp0 */ 104 /* Offset from the sysenter stack to tss.sp0 */
105 DEFINE(TSS_sysenter_esp0, offsetof(struct tss_struct, x86_tss.esp0) - 105 DEFINE(TSS_sysenter_sp0, offsetof(struct tss_struct, x86_tss.sp0) -
106 sizeof(struct tss_struct)); 106 sizeof(struct tss_struct));
107 107
108 DEFINE(PAGE_SIZE_asm, PAGE_SIZE); 108 DEFINE(PAGE_SIZE_asm, PAGE_SIZE);
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 5db2a163bf4b..235cd615b89d 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -691,7 +691,7 @@ void __cpuinit cpu_init(void)
691 BUG(); 691 BUG();
692 enter_lazy_tlb(&init_mm, curr); 692 enter_lazy_tlb(&init_mm, curr);
693 693
694 load_esp0(t, thread); 694 load_sp0(t, thread);
695 set_tss_desc(cpu,t); 695 set_tss_desc(cpu,t);
696 load_TR_desc(); 696 load_TR_desc();
697 load_LDT(&init_mm.context); 697 load_LDT(&init_mm.context);
diff --git a/arch/x86/kernel/doublefault_32.c b/arch/x86/kernel/doublefault_32.c
index 40978af630e7..cc19a3ea403a 100644
--- a/arch/x86/kernel/doublefault_32.c
+++ b/arch/x86/kernel/doublefault_32.c
@@ -35,12 +35,13 @@ static void doublefault_fn(void)
35 if (ptr_ok(tss)) { 35 if (ptr_ok(tss)) {
36 struct i386_hw_tss *t = (struct i386_hw_tss *)tss; 36 struct i386_hw_tss *t = (struct i386_hw_tss *)tss;
37 37
38 printk(KERN_EMERG "eip = %08lx, esp = %08lx\n", t->eip, t->esp); 38 printk(KERN_EMERG "eip = %08lx, esp = %08lx\n",
39 t->ip, t->sp);
39 40
40 printk(KERN_EMERG "eax = %08lx, ebx = %08lx, ecx = %08lx, edx = %08lx\n", 41 printk(KERN_EMERG "eax = %08lx, ebx = %08lx, ecx = %08lx, edx = %08lx\n",
41 t->eax, t->ebx, t->ecx, t->edx); 42 t->ax, t->bx, t->cx, t->dx);
42 printk(KERN_EMERG "esi = %08lx, edi = %08lx\n", 43 printk(KERN_EMERG "esi = %08lx, edi = %08lx\n",
43 t->esi, t->edi); 44 t->si, t->di);
44 } 45 }
45 } 46 }
46 47
@@ -50,15 +51,15 @@ static void doublefault_fn(void)
50 51
51struct tss_struct doublefault_tss __cacheline_aligned = { 52struct tss_struct doublefault_tss __cacheline_aligned = {
52 .x86_tss = { 53 .x86_tss = {
53 .esp0 = STACK_START, 54 .sp0 = STACK_START,
54 .ss0 = __KERNEL_DS, 55 .ss0 = __KERNEL_DS,
55 .ldt = 0, 56 .ldt = 0,
56 .io_bitmap_base = INVALID_IO_BITMAP_OFFSET, 57 .io_bitmap_base = INVALID_IO_BITMAP_OFFSET,
57 58
58 .eip = (unsigned long) doublefault_fn, 59 .ip = (unsigned long) doublefault_fn,
59 /* 0x2 bit is always set */ 60 /* 0x2 bit is always set */
60 .eflags = X86_EFLAGS_SF | 0x2, 61 .flags = X86_EFLAGS_SF | 0x2,
61 .esp = STACK_START, 62 .sp = STACK_START,
62 .es = __USER_DS, 63 .es = __USER_DS,
63 .cs = __KERNEL_CS, 64 .cs = __KERNEL_CS,
64 .ss = __KERNEL_DS, 65 .ss = __KERNEL_DS,
diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S
index 153bb87a4eea..6a474e1028c7 100644
--- a/arch/x86/kernel/entry_32.S
+++ b/arch/x86/kernel/entry_32.S
@@ -288,7 +288,7 @@ ENTRY(ia32_sysenter_target)
288 CFI_SIGNAL_FRAME 288 CFI_SIGNAL_FRAME
289 CFI_DEF_CFA esp, 0 289 CFI_DEF_CFA esp, 0
290 CFI_REGISTER esp, ebp 290 CFI_REGISTER esp, ebp
291 movl TSS_sysenter_esp0(%esp),%esp 291 movl TSS_sysenter_sp0(%esp),%esp
292sysenter_past_esp: 292sysenter_past_esp:
293 /* 293 /*
294 * No need to follow this irqs on/off section: the syscall 294 * No need to follow this irqs on/off section: the syscall
@@ -743,7 +743,7 @@ END(device_not_available)
743 * that sets up the real kernel stack. Check here, since we can't 743 * that sets up the real kernel stack. Check here, since we can't
744 * allow the wrong stack to be used. 744 * allow the wrong stack to be used.
745 * 745 *
746 * "TSS_sysenter_esp0+12" is because the NMI/debug handler will have 746 * "TSS_sysenter_sp0+12" is because the NMI/debug handler will have
747 * already pushed 3 words if it hits on the sysenter instruction: 747 * already pushed 3 words if it hits on the sysenter instruction:
748 * eflags, cs and eip. 748 * eflags, cs and eip.
749 * 749 *
@@ -755,7 +755,7 @@ END(device_not_available)
755 cmpw $__KERNEL_CS,4(%esp); \ 755 cmpw $__KERNEL_CS,4(%esp); \
756 jne ok; \ 756 jne ok; \
757label: \ 757label: \
758 movl TSS_sysenter_esp0+offset(%esp),%esp; \ 758 movl TSS_sysenter_sp0+offset(%esp),%esp; \
759 CFI_DEF_CFA esp, 0; \ 759 CFI_DEF_CFA esp, 0; \
760 CFI_UNDEFINED eip; \ 760 CFI_UNDEFINED eip; \
761 pushfl; \ 761 pushfl; \
diff --git a/arch/x86/kernel/paravirt_32.c b/arch/x86/kernel/paravirt_32.c
index 706b0562ea40..f4e3a8e01cf2 100644
--- a/arch/x86/kernel/paravirt_32.c
+++ b/arch/x86/kernel/paravirt_32.c
@@ -382,7 +382,7 @@ struct pv_cpu_ops pv_cpu_ops = {
382 .write_ldt_entry = write_dt_entry, 382 .write_ldt_entry = write_dt_entry,
383 .write_gdt_entry = write_dt_entry, 383 .write_gdt_entry = write_dt_entry,
384 .write_idt_entry = write_dt_entry, 384 .write_idt_entry = write_dt_entry,
385 .load_esp0 = native_load_esp0, 385 .load_sp0 = native_load_sp0,
386 386
387 .irq_enable_syscall_ret = native_irq_enable_syscall_ret, 387 .irq_enable_syscall_ret = native_irq_enable_syscall_ret,
388 .iret = native_iret, 388 .iret = native_iret,
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index 3744cf63682c..add3bf34e205 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -75,7 +75,7 @@ EXPORT_PER_CPU_SYMBOL(cpu_number);
75 */ 75 */
76unsigned long thread_saved_pc(struct task_struct *tsk) 76unsigned long thread_saved_pc(struct task_struct *tsk)
77{ 77{
78 return ((unsigned long *)tsk->thread.esp)[3]; 78 return ((unsigned long *)tsk->thread.sp)[3];
79} 79}
80 80
81/* 81/*
@@ -488,10 +488,10 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
488 childregs->ax = 0; 488 childregs->ax = 0;
489 childregs->sp = sp; 489 childregs->sp = sp;
490 490
491 p->thread.esp = (unsigned long) childregs; 491 p->thread.sp = (unsigned long) childregs;
492 p->thread.esp0 = (unsigned long) (childregs+1); 492 p->thread.sp0 = (unsigned long) (childregs+1);
493 493
494 p->thread.eip = (unsigned long) ret_from_fork; 494 p->thread.ip = (unsigned long) ret_from_fork;
495 495
496 savesegment(gs,p->thread.gs); 496 savesegment(gs,p->thread.gs);
497 497
@@ -718,7 +718,7 @@ struct task_struct fastcall * __switch_to(struct task_struct *prev_p, struct tas
718 /* 718 /*
719 * Reload esp0. 719 * Reload esp0.
720 */ 720 */
721 load_esp0(tss, next); 721 load_sp0(tss, next);
722 722
723 /* 723 /*
724 * Save away %gs. No need to save %fs, as it was saved on the 724 * Save away %gs. No need to save %fs, as it was saved on the
@@ -851,7 +851,7 @@ unsigned long get_wchan(struct task_struct *p)
851 if (!p || p == current || p->state == TASK_RUNNING) 851 if (!p || p == current || p->state == TASK_RUNNING)
852 return 0; 852 return 0;
853 stack_page = (unsigned long)task_stack_page(p); 853 stack_page = (unsigned long)task_stack_page(p);
854 sp = p->thread.esp; 854 sp = p->thread.sp;
855 if (!stack_page || sp < stack_page || sp > top_esp+stack_page) 855 if (!stack_page || sp < stack_page || sp > top_esp+stack_page)
856 return 0; 856 return 0;
857 /* include/asm-i386/system.h:switch_to() pushes bp last. */ 857 /* include/asm-i386/system.h:switch_to() pushes bp last. */
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index efbb1a2eab97..238193822e23 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -493,9 +493,9 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
493 if (sp == ~0UL) 493 if (sp == ~0UL)
494 childregs->sp = (unsigned long)childregs; 494 childregs->sp = (unsigned long)childregs;
495 495
496 p->thread.rsp = (unsigned long) childregs; 496 p->thread.sp = (unsigned long) childregs;
497 p->thread.rsp0 = (unsigned long) (childregs+1); 497 p->thread.sp0 = (unsigned long) (childregs+1);
498 p->thread.userrsp = me->thread.userrsp; 498 p->thread.usersp = me->thread.usersp;
499 499
500 set_tsk_thread_flag(p, TIF_FORK); 500 set_tsk_thread_flag(p, TIF_FORK);
501 501
@@ -607,7 +607,7 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
607 /* 607 /*
608 * Reload esp0, LDT and the page table pointer: 608 * Reload esp0, LDT and the page table pointer:
609 */ 609 */
610 tss->rsp0 = next->rsp0; 610 tss->sp0 = next->sp0;
611 611
612 /* 612 /*
613 * Switch DS and ES. 613 * Switch DS and ES.
@@ -666,8 +666,8 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
666 /* 666 /*
667 * Switch the PDA and FPU contexts. 667 * Switch the PDA and FPU contexts.
668 */ 668 */
669 prev->userrsp = read_pda(oldrsp); 669 prev->usersp = read_pda(oldrsp);
670 write_pda(oldrsp, next->userrsp); 670 write_pda(oldrsp, next->usersp);
671 write_pda(pcurrent, next_p); 671 write_pda(pcurrent, next_p);
672 672
673 write_pda(kernelstack, 673 write_pda(kernelstack,
@@ -769,9 +769,9 @@ unsigned long get_wchan(struct task_struct *p)
769 if (!p || p == current || p->state==TASK_RUNNING) 769 if (!p || p == current || p->state==TASK_RUNNING)
770 return 0; 770 return 0;
771 stack = (unsigned long)task_stack_page(p); 771 stack = (unsigned long)task_stack_page(p);
772 if (p->thread.rsp < stack || p->thread.rsp > stack+THREAD_SIZE) 772 if (p->thread.sp < stack || p->thread.sp > stack+THREAD_SIZE)
773 return 0; 773 return 0;
774 fp = *(u64 *)(p->thread.rsp); 774 fp = *(u64 *)(p->thread.sp);
775 do { 775 do {
776 if (fp < (unsigned long)stack || 776 if (fp < (unsigned long)stack ||
777 fp > (unsigned long)stack+THREAD_SIZE) 777 fp > (unsigned long)stack+THREAD_SIZE)
diff --git a/arch/x86/kernel/smpboot_32.c b/arch/x86/kernel/smpboot_32.c
index 3566191832b3..0f294d6e22cf 100644
--- a/arch/x86/kernel/smpboot_32.c
+++ b/arch/x86/kernel/smpboot_32.c
@@ -454,7 +454,7 @@ void __devinit initialize_secondary(void)
454 "movl %0,%%esp\n\t" 454 "movl %0,%%esp\n\t"
455 "jmp *%1" 455 "jmp *%1"
456 : 456 :
457 :"m" (current->thread.esp),"m" (current->thread.eip)); 457 :"m" (current->thread.sp),"m" (current->thread.ip));
458} 458}
459 459
460/* Static state in head.S used to set up a CPU */ 460/* Static state in head.S used to set up a CPU */
@@ -753,7 +753,7 @@ static inline struct task_struct * __cpuinit alloc_idle_task(int cpu)
753 /* initialize thread_struct. we really want to avoid destroy 753 /* initialize thread_struct. we really want to avoid destroy
754 * idle tread 754 * idle tread
755 */ 755 */
756 idle->thread.esp = (unsigned long)task_pt_regs(idle); 756 idle->thread.sp = (unsigned long)task_pt_regs(idle);
757 init_idle(idle, cpu); 757 init_idle(idle, cpu);
758 return idle; 758 return idle;
759 } 759 }
@@ -798,7 +798,7 @@ static int __cpuinit do_boot_cpu(int apicid, int cpu)
798 per_cpu(current_task, cpu) = idle; 798 per_cpu(current_task, cpu) = idle;
799 early_gdt_descr.address = (unsigned long)get_cpu_gdt_table(cpu); 799 early_gdt_descr.address = (unsigned long)get_cpu_gdt_table(cpu);
800 800
801 idle->thread.eip = (unsigned long) start_secondary; 801 idle->thread.ip = (unsigned long) start_secondary;
802 /* start_eip had better be page-aligned! */ 802 /* start_eip had better be page-aligned! */
803 start_eip = setup_trampoline(); 803 start_eip = setup_trampoline();
804 804
@@ -808,7 +808,7 @@ static int __cpuinit do_boot_cpu(int apicid, int cpu)
808 /* So we see what's up */ 808 /* So we see what's up */
809 printk("Booting processor %d/%d ip %lx\n", cpu, apicid, start_eip); 809 printk("Booting processor %d/%d ip %lx\n", cpu, apicid, start_eip);
810 /* Stack for startup_32 can be just as for start_secondary onwards */ 810 /* Stack for startup_32 can be just as for start_secondary onwards */
811 stack_start.sp = (void *) idle->thread.esp; 811 stack_start.sp = (void *) idle->thread.sp;
812 812
813 irq_ctx_init(cpu); 813 irq_ctx_init(cpu);
814 814
diff --git a/arch/x86/kernel/smpboot_64.c b/arch/x86/kernel/smpboot_64.c
index ac1089f2b917..c3f2736ba530 100644
--- a/arch/x86/kernel/smpboot_64.c
+++ b/arch/x86/kernel/smpboot_64.c
@@ -577,7 +577,7 @@ static int __cpuinit do_boot_cpu(int cpu, int apicid)
577 c_idle.idle = get_idle_for_cpu(cpu); 577 c_idle.idle = get_idle_for_cpu(cpu);
578 578
579 if (c_idle.idle) { 579 if (c_idle.idle) {
580 c_idle.idle->thread.rsp = (unsigned long) (((struct pt_regs *) 580 c_idle.idle->thread.sp = (unsigned long) (((struct pt_regs *)
581 (THREAD_SIZE + task_stack_page(c_idle.idle))) - 1); 581 (THREAD_SIZE + task_stack_page(c_idle.idle))) - 1);
582 init_idle(c_idle.idle, cpu); 582 init_idle(c_idle.idle, cpu);
583 goto do_rest; 583 goto do_rest;
@@ -613,8 +613,8 @@ do_rest:
613 613
614 start_rip = setup_trampoline(); 614 start_rip = setup_trampoline();
615 615
616 init_rsp = c_idle.idle->thread.rsp; 616 init_rsp = c_idle.idle->thread.sp;
617 per_cpu(init_tss,cpu).rsp0 = init_rsp; 617 per_cpu(init_tss,cpu).sp0 = init_rsp;
618 initial_code = start_secondary; 618 initial_code = start_secondary;
619 clear_tsk_thread_flag(c_idle.idle, TIF_FORK); 619 clear_tsk_thread_flag(c_idle.idle, TIF_FORK);
620 620
diff --git a/arch/x86/kernel/traps_32.c b/arch/x86/kernel/traps_32.c
index 27713553cc59..57491942cc4e 100644
--- a/arch/x86/kernel/traps_32.c
+++ b/arch/x86/kernel/traps_32.c
@@ -163,7 +163,7 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
163 unsigned long dummy; 163 unsigned long dummy;
164 stack = &dummy; 164 stack = &dummy;
165 if (task != current) 165 if (task != current)
166 stack = (unsigned long *)task->thread.esp; 166 stack = (unsigned long *)task->thread.sp;
167 } 167 }
168 168
169#ifdef CONFIG_FRAME_POINTER 169#ifdef CONFIG_FRAME_POINTER
@@ -173,7 +173,7 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
173 asm ("movl %%ebp, %0" : "=r" (bp) : ); 173 asm ("movl %%ebp, %0" : "=r" (bp) : );
174 } else { 174 } else {
175 /* bp is the last reg pushed by switch_to */ 175 /* bp is the last reg pushed by switch_to */
176 bp = *(unsigned long *) task->thread.esp; 176 bp = *(unsigned long *) task->thread.sp;
177 } 177 }
178 } 178 }
179#endif 179#endif
@@ -253,7 +253,7 @@ static void show_stack_log_lvl(struct task_struct *task, struct pt_regs *regs,
253 253
254 if (sp == NULL) { 254 if (sp == NULL) {
255 if (task) 255 if (task)
256 sp = (unsigned long*)task->thread.esp; 256 sp = (unsigned long*)task->thread.sp;
257 else 257 else
258 sp = (unsigned long *)&sp; 258 sp = (unsigned long *)&sp;
259 } 259 }
diff --git a/arch/x86/kernel/traps_64.c b/arch/x86/kernel/traps_64.c
index f7fecf9d47c3..965f2cc3a013 100644
--- a/arch/x86/kernel/traps_64.c
+++ b/arch/x86/kernel/traps_64.c
@@ -230,7 +230,7 @@ void dump_trace(struct task_struct *tsk, struct pt_regs *regs,
230 unsigned long dummy; 230 unsigned long dummy;
231 stack = &dummy; 231 stack = &dummy;
232 if (tsk && tsk != current) 232 if (tsk && tsk != current)
233 stack = (unsigned long *)tsk->thread.rsp; 233 stack = (unsigned long *)tsk->thread.sp;
234 } 234 }
235 235
236 /* 236 /*
@@ -366,7 +366,7 @@ _show_stack(struct task_struct *tsk, struct pt_regs *regs, unsigned long *sp)
366 366
367 if (sp == NULL) { 367 if (sp == NULL) {
368 if (tsk) 368 if (tsk)
369 sp = (unsigned long *)tsk->thread.rsp; 369 sp = (unsigned long *)tsk->thread.sp;
370 else 370 else
371 sp = (unsigned long *)&sp; 371 sp = (unsigned long *)&sp;
372 } 372 }
diff --git a/arch/x86/kernel/vm86_32.c b/arch/x86/kernel/vm86_32.c
index 980e85b90091..e85bb44265cb 100644
--- a/arch/x86/kernel/vm86_32.c
+++ b/arch/x86/kernel/vm86_32.c
@@ -147,10 +147,10 @@ struct pt_regs * fastcall save_v86_state(struct kernel_vm86_regs * regs)
147 } 147 }
148 148
149 tss = &per_cpu(init_tss, get_cpu()); 149 tss = &per_cpu(init_tss, get_cpu());
150 current->thread.esp0 = current->thread.saved_esp0; 150 current->thread.sp0 = current->thread.saved_sp0;
151 current->thread.sysenter_cs = __KERNEL_CS; 151 current->thread.sysenter_cs = __KERNEL_CS;
152 load_esp0(tss, &current->thread); 152 load_sp0(tss, &current->thread);
153 current->thread.saved_esp0 = 0; 153 current->thread.saved_sp0 = 0;
154 put_cpu(); 154 put_cpu();
155 155
156 ret = KVM86->regs32; 156 ret = KVM86->regs32;
@@ -207,7 +207,7 @@ asmlinkage int sys_vm86old(struct pt_regs regs)
207 int tmp, ret = -EPERM; 207 int tmp, ret = -EPERM;
208 208
209 tsk = current; 209 tsk = current;
210 if (tsk->thread.saved_esp0) 210 if (tsk->thread.saved_sp0)
211 goto out; 211 goto out;
212 tmp = copy_vm86_regs_from_user(&info.regs, &v86->regs, 212 tmp = copy_vm86_regs_from_user(&info.regs, &v86->regs,
213 offsetof(struct kernel_vm86_struct, vm86plus) - 213 offsetof(struct kernel_vm86_struct, vm86plus) -
@@ -256,7 +256,7 @@ asmlinkage int sys_vm86(struct pt_regs regs)
256 256
257 /* we come here only for functions VM86_ENTER, VM86_ENTER_NO_BYPASS */ 257 /* we come here only for functions VM86_ENTER, VM86_ENTER_NO_BYPASS */
258 ret = -EPERM; 258 ret = -EPERM;
259 if (tsk->thread.saved_esp0) 259 if (tsk->thread.saved_sp0)
260 goto out; 260 goto out;
261 v86 = (struct vm86plus_struct __user *)regs.cx; 261 v86 = (struct vm86plus_struct __user *)regs.cx;
262 tmp = copy_vm86_regs_from_user(&info.regs, &v86->regs, 262 tmp = copy_vm86_regs_from_user(&info.regs, &v86->regs,
@@ -318,15 +318,15 @@ static void do_sys_vm86(struct kernel_vm86_struct *info, struct task_struct *tsk
318 * Save old state, set default return value (%ax) to 0 318 * Save old state, set default return value (%ax) to 0
319 */ 319 */
320 info->regs32->ax = 0; 320 info->regs32->ax = 0;
321 tsk->thread.saved_esp0 = tsk->thread.esp0; 321 tsk->thread.saved_sp0 = tsk->thread.sp0;
322 tsk->thread.saved_fs = info->regs32->fs; 322 tsk->thread.saved_fs = info->regs32->fs;
323 savesegment(gs, tsk->thread.saved_gs); 323 savesegment(gs, tsk->thread.saved_gs);
324 324
325 tss = &per_cpu(init_tss, get_cpu()); 325 tss = &per_cpu(init_tss, get_cpu());
326 tsk->thread.esp0 = (unsigned long) &info->VM86_TSS_ESP0; 326 tsk->thread.sp0 = (unsigned long) &info->VM86_TSS_ESP0;
327 if (cpu_has_sep) 327 if (cpu_has_sep)
328 tsk->thread.sysenter_cs = 0; 328 tsk->thread.sysenter_cs = 0;
329 load_esp0(tss, &tsk->thread); 329 load_sp0(tss, &tsk->thread);
330 put_cpu(); 330 put_cpu();
331 331
332 tsk->thread.screen_bitmap = info->screen_bitmap; 332 tsk->thread.screen_bitmap = info->screen_bitmap;
diff --git a/arch/x86/kernel/vmi_32.c b/arch/x86/kernel/vmi_32.c
index 599b6f2ed562..4cfda7dbe90f 100644
--- a/arch/x86/kernel/vmi_32.c
+++ b/arch/x86/kernel/vmi_32.c
@@ -62,7 +62,7 @@ static struct {
62 void (*cpuid)(void /* non-c */); 62 void (*cpuid)(void /* non-c */);
63 void (*_set_ldt)(u32 selector); 63 void (*_set_ldt)(u32 selector);
64 void (*set_tr)(u32 selector); 64 void (*set_tr)(u32 selector);
65 void (*set_kernel_stack)(u32 selector, u32 esp0); 65 void (*set_kernel_stack)(u32 selector, u32 sp0);
66 void (*allocate_page)(u32, u32, u32, u32, u32); 66 void (*allocate_page)(u32, u32, u32, u32, u32);
67 void (*release_page)(u32, u32); 67 void (*release_page)(u32, u32);
68 void (*set_pte)(pte_t, pte_t *, unsigned); 68 void (*set_pte)(pte_t, pte_t *, unsigned);
@@ -214,17 +214,17 @@ static void vmi_set_tr(void)
214 vmi_ops.set_tr(GDT_ENTRY_TSS*sizeof(struct desc_struct)); 214 vmi_ops.set_tr(GDT_ENTRY_TSS*sizeof(struct desc_struct));
215} 215}
216 216
217static void vmi_load_esp0(struct tss_struct *tss, 217static void vmi_load_sp0(struct tss_struct *tss,
218 struct thread_struct *thread) 218 struct thread_struct *thread)
219{ 219{
220 tss->x86_tss.esp0 = thread->esp0; 220 tss->x86_tss.sp0 = thread->sp0;
221 221
222 /* This can only happen when SEP is enabled, no need to test "SEP"arately */ 222 /* This can only happen when SEP is enabled, no need to test "SEP"arately */
223 if (unlikely(tss->x86_tss.ss1 != thread->sysenter_cs)) { 223 if (unlikely(tss->x86_tss.ss1 != thread->sysenter_cs)) {
224 tss->x86_tss.ss1 = thread->sysenter_cs; 224 tss->x86_tss.ss1 = thread->sysenter_cs;
225 wrmsr(MSR_IA32_SYSENTER_CS, thread->sysenter_cs, 0); 225 wrmsr(MSR_IA32_SYSENTER_CS, thread->sysenter_cs, 0);
226 } 226 }
227 vmi_ops.set_kernel_stack(__KERNEL_DS, tss->x86_tss.esp0); 227 vmi_ops.set_kernel_stack(__KERNEL_DS, tss->x86_tss.sp0);
228} 228}
229 229
230static void vmi_flush_tlb_user(void) 230static void vmi_flush_tlb_user(void)
@@ -793,7 +793,7 @@ static inline int __init activate_vmi(void)
793 para_fill(pv_cpu_ops.write_ldt_entry, WriteLDTEntry); 793 para_fill(pv_cpu_ops.write_ldt_entry, WriteLDTEntry);
794 para_fill(pv_cpu_ops.write_gdt_entry, WriteGDTEntry); 794 para_fill(pv_cpu_ops.write_gdt_entry, WriteGDTEntry);
795 para_fill(pv_cpu_ops.write_idt_entry, WriteIDTEntry); 795 para_fill(pv_cpu_ops.write_idt_entry, WriteIDTEntry);
796 para_wrap(pv_cpu_ops.load_esp0, vmi_load_esp0, set_kernel_stack, UpdateKernelStack); 796 para_wrap(pv_cpu_ops.load_sp0, vmi_load_sp0, set_kernel_stack, UpdateKernelStack);
797 para_fill(pv_cpu_ops.set_iopl_mask, SetIOPLMask); 797 para_fill(pv_cpu_ops.set_iopl_mask, SetIOPLMask);
798 para_fill(pv_cpu_ops.io_delay, IODelay); 798 para_fill(pv_cpu_ops.io_delay, IODelay);
799 799
diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c
index ea46d05853bb..c751e3c03e85 100644
--- a/arch/x86/lguest/boot.c
+++ b/arch/x86/lguest/boot.c
@@ -755,10 +755,10 @@ static void lguest_time_init(void)
755 * segment), the privilege level (we're privilege level 1, the Host is 0 and 755 * segment), the privilege level (we're privilege level 1, the Host is 0 and
756 * will not tolerate us trying to use that), the stack pointer, and the number 756 * will not tolerate us trying to use that), the stack pointer, and the number
757 * of pages in the stack. */ 757 * of pages in the stack. */
758static void lguest_load_esp0(struct tss_struct *tss, 758static void lguest_load_sp0(struct tss_struct *tss,
759 struct thread_struct *thread) 759 struct thread_struct *thread)
760{ 760{
761 lazy_hcall(LHCALL_SET_STACK, __KERNEL_DS|0x1, thread->esp0, 761 lazy_hcall(LHCALL_SET_STACK, __KERNEL_DS|0x1, thread->sp0,
762 THREAD_SIZE/PAGE_SIZE); 762 THREAD_SIZE/PAGE_SIZE);
763} 763}
764 764
@@ -957,7 +957,7 @@ __init void lguest_init(void)
957 pv_cpu_ops.cpuid = lguest_cpuid; 957 pv_cpu_ops.cpuid = lguest_cpuid;
958 pv_cpu_ops.load_idt = lguest_load_idt; 958 pv_cpu_ops.load_idt = lguest_load_idt;
959 pv_cpu_ops.iret = lguest_iret; 959 pv_cpu_ops.iret = lguest_iret;
960 pv_cpu_ops.load_esp0 = lguest_load_esp0; 960 pv_cpu_ops.load_sp0 = lguest_load_sp0;
961 pv_cpu_ops.load_tr_desc = lguest_load_tr_desc; 961 pv_cpu_ops.load_tr_desc = lguest_load_tr_desc;
962 pv_cpu_ops.set_ldt = lguest_set_ldt; 962 pv_cpu_ops.set_ldt = lguest_set_ldt;
963 pv_cpu_ops.load_tls = lguest_load_tls; 963 pv_cpu_ops.load_tls = lguest_load_tls;
diff --git a/arch/x86/vdso/vdso32-setup.c b/arch/x86/vdso/vdso32-setup.c
index d97a6d7d062b..e0feb66a2408 100644
--- a/arch/x86/vdso/vdso32-setup.c
+++ b/arch/x86/vdso/vdso32-setup.c
@@ -243,9 +243,9 @@ void enable_sep_cpu(void)
243 } 243 }
244 244
245 tss->x86_tss.ss1 = __KERNEL_CS; 245 tss->x86_tss.ss1 = __KERNEL_CS;
246 tss->x86_tss.esp1 = sizeof(struct tss_struct) + (unsigned long) tss; 246 tss->x86_tss.sp1 = sizeof(struct tss_struct) + (unsigned long) tss;
247 wrmsr(MSR_IA32_SYSENTER_CS, __KERNEL_CS, 0); 247 wrmsr(MSR_IA32_SYSENTER_CS, __KERNEL_CS, 0);
248 wrmsr(MSR_IA32_SYSENTER_ESP, tss->x86_tss.esp1, 0); 248 wrmsr(MSR_IA32_SYSENTER_ESP, tss->x86_tss.sp1, 0);
249 wrmsr(MSR_IA32_SYSENTER_EIP, (unsigned long) ia32_sysenter_target, 0); 249 wrmsr(MSR_IA32_SYSENTER_EIP, (unsigned long) ia32_sysenter_target, 0);
250 put_cpu(); 250 put_cpu();
251} 251}
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 29517faaa735..d81e8d709102 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -499,11 +499,11 @@ static void xen_write_gdt_entry(struct desc_struct *dt, int entry,
499 preempt_enable(); 499 preempt_enable();
500} 500}
501 501
502static void xen_load_esp0(struct tss_struct *tss, 502static void xen_load_sp0(struct tss_struct *tss,
503 struct thread_struct *thread) 503 struct thread_struct *thread)
504{ 504{
505 struct multicall_space mcs = xen_mc_entry(0); 505 struct multicall_space mcs = xen_mc_entry(0);
506 MULTI_stack_switch(mcs.mc, __KERNEL_DS, thread->esp0); 506 MULTI_stack_switch(mcs.mc, __KERNEL_DS, thread->sp0);
507 xen_mc_issue(PARAVIRT_LAZY_CPU); 507 xen_mc_issue(PARAVIRT_LAZY_CPU);
508} 508}
509 509
@@ -968,7 +968,7 @@ static const struct pv_cpu_ops xen_cpu_ops __initdata = {
968 .write_ldt_entry = xen_write_ldt_entry, 968 .write_ldt_entry = xen_write_ldt_entry,
969 .write_gdt_entry = xen_write_gdt_entry, 969 .write_gdt_entry = xen_write_gdt_entry,
970 .write_idt_entry = xen_write_idt_entry, 970 .write_idt_entry = xen_write_idt_entry,
971 .load_esp0 = xen_load_esp0, 971 .load_sp0 = xen_load_sp0,
972 972
973 .set_iopl_mask = xen_set_iopl_mask, 973 .set_iopl_mask = xen_set_iopl_mask,
974 .io_delay = xen_io_delay, 974 .io_delay = xen_io_delay,
diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c
index 8e1234e14559..aafc54437403 100644
--- a/arch/x86/xen/smp.c
+++ b/arch/x86/xen/smp.c
@@ -239,10 +239,10 @@ cpu_initialize_context(unsigned int cpu, struct task_struct *idle)
239 ctxt->gdt_ents = ARRAY_SIZE(gdt->gdt); 239 ctxt->gdt_ents = ARRAY_SIZE(gdt->gdt);
240 240
241 ctxt->user_regs.cs = __KERNEL_CS; 241 ctxt->user_regs.cs = __KERNEL_CS;
242 ctxt->user_regs.esp = idle->thread.esp0 - sizeof(struct pt_regs); 242 ctxt->user_regs.esp = idle->thread.sp0 - sizeof(struct pt_regs);
243 243
244 ctxt->kernel_ss = __KERNEL_DS; 244 ctxt->kernel_ss = __KERNEL_DS;
245 ctxt->kernel_sp = idle->thread.esp0; 245 ctxt->kernel_sp = idle->thread.sp0;
246 246
247 ctxt->event_callback_cs = __KERNEL_CS; 247 ctxt->event_callback_cs = __KERNEL_CS;
248 ctxt->event_callback_eip = (unsigned long)xen_hypervisor_callback; 248 ctxt->event_callback_eip = (unsigned long)xen_hypervisor_callback;
diff --git a/drivers/lguest/x86/core.c b/drivers/lguest/x86/core.c
index 96d0fd07c57d..44adb00e1490 100644
--- a/drivers/lguest/x86/core.c
+++ b/drivers/lguest/x86/core.c
@@ -94,7 +94,7 @@ static void copy_in_guest_info(struct lguest *lg, struct lguest_pages *pages)
94 /* Set up the two "TSS" members which tell the CPU what stack to use 94 /* Set up the two "TSS" members which tell the CPU what stack to use
95 * for traps which do directly into the Guest (ie. traps at privilege 95 * for traps which do directly into the Guest (ie. traps at privilege
96 * level 1). */ 96 * level 1). */
97 pages->state.guest_tss.esp1 = lg->esp1; 97 pages->state.guest_tss.sp1 = lg->esp1;
98 pages->state.guest_tss.ss1 = lg->ss1; 98 pages->state.guest_tss.ss1 = lg->ss1;
99 99
100 /* Copy direct-to-Guest trap entries. */ 100 /* Copy direct-to-Guest trap entries. */
@@ -416,7 +416,7 @@ void __init lguest_arch_host_init(void)
416 /* We know where we want the stack to be when the Guest enters 416 /* We know where we want the stack to be when the Guest enters
417 * the switcher: in pages->regs. The stack grows upwards, so 417 * the switcher: in pages->regs. The stack grows upwards, so
418 * we start it at the end of that structure. */ 418 * we start it at the end of that structure. */
419 state->guest_tss.esp0 = (long)(&pages->regs + 1); 419 state->guest_tss.sp0 = (long)(&pages->regs + 1);
420 /* And this is the GDT entry to use for the stack: we keep a 420 /* And this is the GDT entry to use for the stack: we keep a
421 * couple of special LGUEST entries. */ 421 * couple of special LGUEST entries. */
422 state->guest_tss.ss0 = LGUEST_DS; 422 state->guest_tss.ss0 = LGUEST_DS;
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
452static inline void load_esp0(struct tss_struct *tss, 452static 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. */
293struct i386_hw_tss { 293struct 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 {
346struct thread_struct { 343struct 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
506static inline void native_load_esp0(struct tss_struct *tss, struct thread_struct *thread) 503static 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
588static inline void load_esp0(struct tss_struct *tss, struct thread_struct *thread) 585static 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
178struct tss_struct { 178struct 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
218struct thread_struct { 218struct 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
298extern unsigned long get_wchan(struct task_struct *p); 298extern 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)), \