Skip to content

Commit

Permalink
[PATCH] i386: Initialize esp0 properly all the time
Browse files Browse the repository at this point in the history
Whenever we schedule, __switch_to calls load_esp0 which does:

	tss->esp0 = thread->esp0;

This is never initialized for the initial thread (ie "swapper"), so when we're
scheduling that, we end up setting esp0 to 0.  This is fine: the swapper never
leaves ring 0, so this field is never used.

lguest, however, gets upset that we're trying to used an unmapped page as our
kernel stack.  Rather than work around it there, let's initialize it.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Andi Kleen <ak@suse.de>
Cc: Andi Kleen <ak@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
  • Loading branch information
Rusty Russell authored and Andi Kleen committed May 2, 2007
1 parent 1b523fb commit 692174b
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions include/asm-i386/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@ struct thread_struct {
};

#define INIT_THREAD { \
.esp0 = sizeof(init_stack) + (long)&init_stack, \
.vm86_info = NULL, \
.sysenter_cs = __KERNEL_CS, \
.io_bitmap_ptr = NULL, \
Expand Down

0 comments on commit 692174b

Please sign in to comment.