ia64/xen-unstable

changeset 16431:75cb82d277be

[Mini-OS] Fix x86 initial stack alignment

This fixes the initial stack alignment for x86, which is required for
current to return a fine NULL instead of a random value or possibly
crash during initialization.

Signed-off-by: Grzegorz Milos <gm281@cam.ac.uk>
Signed-off-by: Samuel Thibault <samuel.thibault@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri Nov 23 16:22:13 2007 +0000 (2007-11-23)
parents 2e05a6173be0
children f28d36628de8
files extras/mini-os/arch/x86/setup.c extras/mini-os/arch/x86/x86_32.S extras/mini-os/arch/x86/x86_64.S
line diff
     1.1 --- a/extras/mini-os/arch/x86/setup.c	Fri Nov 23 11:58:11 2007 +0000
     1.2 +++ b/extras/mini-os/arch/x86/setup.c	Fri Nov 23 16:22:13 2007 +0000
     1.3 @@ -45,7 +45,7 @@ union start_info_union start_info_union;
     1.4   * Just allocate the kernel stack here. SS:ESP is set up to point here
     1.5   * in head.S.
     1.6   */
     1.7 -char stack[8192];
     1.8 +char stack[2*8192];
     1.9  
    1.10  extern char shared_info[PAGE_SIZE];
    1.11  
    1.12 @@ -102,7 +102,7 @@ arch_init(start_info_t *si)
    1.13  void
    1.14  arch_print_info(void)
    1.15  {
    1.16 -	printk("  stack:      %p-%p\n", stack, stack + 8192);
    1.17 +	printk("  stack:      %p-%p\n", stack, stack + 2*8192);
    1.18  }
    1.19  
    1.20  
     2.1 --- a/extras/mini-os/arch/x86/x86_32.S	Fri Nov 23 11:58:11 2007 +0000
     2.2 +++ b/extras/mini-os/arch/x86/x86_32.S	Fri Nov 23 16:22:13 2007 +0000
     2.3 @@ -21,11 +21,12 @@
     2.4  _start:
     2.5          cld
     2.6          lss stack_start,%esp
     2.7 +        andl $(~(8192-1)), %esp
     2.8          push %esi 
     2.9          call start_kernel
    2.10  
    2.11  stack_start:
    2.12 -	.long stack+8192, __KERNEL_SS
    2.13 +	.long stack+(2*8192), __KERNEL_SS
    2.14  
    2.15          /* Unpleasant -- the PTE that maps this page is actually overwritten */
    2.16          /* to map the real shared-info page! :-)                             */
     3.1 --- a/extras/mini-os/arch/x86/x86_64.S	Fri Nov 23 11:58:11 2007 +0000
     3.2 +++ b/extras/mini-os/arch/x86/x86_64.S	Fri Nov 23 16:22:13 2007 +0000
     3.3 @@ -18,11 +18,12 @@
     3.4  _start:
     3.5          cld
     3.6          movq stack_start(%rip),%rsp
     3.7 +        andq $(~(8192-1)), %rsp
     3.8          movq %rsi,%rdi
     3.9          call start_kernel
    3.10  
    3.11  stack_start:
    3.12 -        .quad stack+8192
    3.13 +        .quad stack+(2*8192)
    3.14  
    3.15          /* Unpleasant -- the PTE that maps this page is actually overwritten */
    3.16          /* to map the real shared-info page! :-)                             */