X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=arch%2Fx86%2Fboot%2Fmain.c;h=7828da5cfd07475376c7d4d3fc95282334b60a3d;hb=6598b60fd56ba5e915a001cc4e307880a94d19ae;hp=0eeef3989a17daadf47a0427edd4490b1417cf91;hpb=541010e4b8921cd781ff02ae68028501457045b6;p=linux-2.6-omap-h63xx.git diff --git a/arch/x86/boot/main.c b/arch/x86/boot/main.c index 0eeef3989a1..7828da5cfd0 100644 --- a/arch/x86/boot/main.c +++ b/arch/x86/boot/main.c @@ -26,8 +26,6 @@ char *heap_end = _end; /* Default end of heap = no heap */ * screws up the old-style command line protocol, adjust by * filling in the new-style command line pointer instead. */ -#define OLD_CL_MAGIC 0xA33F -#define OLD_CL_ADDRESS 0x20 static void copy_boot_params(void) { @@ -102,20 +100,32 @@ static void set_bios_mode(void) #endif } -void main(void) +static void init_heap(void) { - /* First, copy the boot header into the "zeropage" */ - copy_boot_params(); + char *stack_end; - /* End of heap check */ if (boot_params.hdr.loadflags & CAN_USE_HEAP) { - heap_end = (char *)(boot_params.hdr.heap_end_ptr - +0x200-STACK_SIZE); + asm("leal %P1(%%esp),%0" + : "=r" (stack_end) : "i" (-STACK_SIZE)); + + heap_end = (char *) + ((size_t)boot_params.hdr.heap_end_ptr + 0x200); + if (heap_end > stack_end) + heap_end = stack_end; } else { /* Boot protocol 2.00 only, no heap available */ puts("WARNING: Ancient bootloader, some functionality " "may be limited!\n"); } +} + +void main(void) +{ + /* First, copy the boot header into the "zeropage" */ + copy_boot_params(); + + /* End of heap check */ + init_heap(); /* Make sure we have all the proper CPU support */ if (validate_cpu()) { @@ -133,9 +143,6 @@ void main(void) /* Set keyboard repeat rate (why?) */ keyboard_set_repeat(); - /* Set the video mode */ - set_video(); - /* Query MCA information */ query_mca(); @@ -156,6 +163,10 @@ void main(void) #if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE) query_edd(); #endif + + /* Set the video mode */ + set_video(); + /* Do the last things and invoke protected mode */ go_to_protected_mode(); }