X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=arch%2Fx86%2Fboot%2Fheader.S;h=af86e431acfae2af91957a9932c3bf5fb96bd5fb;hb=bd5d435a96837c3495e62eef37cbe4cb728b79ae;hp=6ef5a060fa11085df5be8d4616acd5541b53d5d2;hpb=3830de73000c07b2cbdf8cc31a46a01dda28c5df;p=linux-2.6-omap-h63xx.git diff --git a/arch/x86/boot/header.S b/arch/x86/boot/header.S index 6ef5a060fa1..af86e431acf 100644 --- a/arch/x86/boot/header.S +++ b/arch/x86/boot/header.S @@ -22,6 +22,7 @@ #include #include #include "boot.h" +#include "offsets.h" SETUPSECTS = 4 /* default nr of setup-sectors */ BOOTSEG = 0x07C0 /* original address of boot-sector */ @@ -119,7 +120,7 @@ _start: # Part 2 of the header, from the old setup.S .ascii "HdrS" # header signature - .word 0x0207 # header version number (>= 0x0105) + .word 0x0209 # header version number (>= 0x0105) # or else old loadlin-1.5 will fail) .globl realmode_swtch realmode_swtch: .word 0, 0 # default_switch, SETUPSEG @@ -195,10 +196,13 @@ cmd_line_ptr: .long 0 # (Header version 0x0202 or later) # can be located anywhere in # low memory 0x10000 or higher. -ramdisk_max: .long (-__PAGE_OFFSET-(512 << 20)-1) & 0x7fffffff +ramdisk_max: .long 0x7fffffff # (Header version 0x0203 or later) # The highest safe address for # the contents of an initrd + # The current kernel allows up to 4 GB, + # but leave it at 2 GB to avoid + # possible bootloader bugs. kernel_alignment: .long CONFIG_PHYSICAL_ALIGN #physical addr alignment #required for protected mode @@ -220,6 +224,13 @@ hardware_subarch: .long 0 # subarchitecture, added with 2.07 hardware_subarch_data: .quad 0 +payload_offset: .long input_data +payload_length: .long input_data_end-input_data + +setup_data: .quad 0 # 64-bit physical pointer to + # single linked list of + # struct setup_data + # End of setup header ##################################################### .section ".inittext", "ax" @@ -236,39 +247,30 @@ start_of_setup: movw %ax, %es cld -# Apparently some ancient versions of LILO invoked the kernel -# with %ss != %ds, which happened to work by accident for the -# old code. If the CAN_USE_HEAP flag is set in loadflags, or -# %ss != %ds, then adjust the stack pointer. +# Apparently some ancient versions of LILO invoked the kernel with %ss != %ds, +# which happened to work by accident for the old code. Recalculate the stack +# pointer if %ss is invalid. Otherwise leave it alone, LOADLIN sets up the +# stack behind its own code, so we can't blindly put it directly past the heap. - # Smallest possible stack we can tolerate - movw $(_end+STACK_SIZE), %cx - - movw heap_end_ptr, %dx - addw $512, %dx - jnc 1f - xorw %dx, %dx # Wraparound - whole segment available -1: testb $CAN_USE_HEAP, loadflags - jnz 2f - - # No CAN_USE_HEAP movw %ss, %dx cmpw %ax, %dx # %ds == %ss? movw %sp, %dx - # If so, assume %sp is reasonably set, otherwise use - # the smallest possible stack. - jne 4f # -> Smallest possible stack... + je 2f # -> assume %sp is reasonably set + + # Invalid %ss, make up a new stack + movw $_end, %dx + testb $CAN_USE_HEAP, loadflags + jz 1f + movw heap_end_ptr, %dx +1: addw $STACK_SIZE, %dx + jnc 2f + xorw %dx, %dx # Prevent wraparound - # Make sure the stack is at least minimum size. Take a value - # of zero to mean "full segment." -2: +2: # Now %dx should point to the end of our stack space andw $~3, %dx # dword align (might as well...) jnz 3f movw $0xfffc, %dx # Make sure we're not zero -3: cmpw %cx, %dx - jnb 5f -4: movw %cx, %dx # Minimum value we can possibly use -5: movw %ax, %ss +3: movw %ax, %ss movzwl %dx, %esp # Clear upper half of %esp sti # Now we should have a working stack