diff options
Diffstat (limited to 'arch/i386/boot/setup.S')
-rw-r--r-- | arch/i386/boot/setup.S | 42 |
1 files changed, 33 insertions, 9 deletions
diff --git a/arch/i386/boot/setup.S b/arch/i386/boot/setup.S index 3aec4538a113..06edf1c66242 100644 --- a/arch/i386/boot/setup.S +++ b/arch/i386/boot/setup.S | |||
@@ -81,7 +81,7 @@ start: | |||
81 | # This is the setup header, and it must start at %cs:2 (old 0x9020:2) | 81 | # This is the setup header, and it must start at %cs:2 (old 0x9020:2) |
82 | 82 | ||
83 | .ascii "HdrS" # header signature | 83 | .ascii "HdrS" # header signature |
84 | .word 0x0204 # header version number (>= 0x0105) | 84 | .word 0x0205 # header version number (>= 0x0105) |
85 | # or else old loadlin-1.5 will fail) | 85 | # or else old loadlin-1.5 will fail) |
86 | realmode_swtch: .word 0, 0 # default_switch, SETUPSEG | 86 | realmode_swtch: .word 0, 0 # default_switch, SETUPSEG |
87 | start_sys_seg: .word SYSSEG | 87 | start_sys_seg: .word SYSSEG |
@@ -160,6 +160,17 @@ ramdisk_max: .long (-__PAGE_OFFSET-(512 << 20)-1) & 0x7fffffff | |||
160 | # The highest safe address for | 160 | # The highest safe address for |
161 | # the contents of an initrd | 161 | # the contents of an initrd |
162 | 162 | ||
163 | kernel_alignment: .long CONFIG_PHYSICAL_ALIGN #physical addr alignment | ||
164 | #required for protected mode | ||
165 | #kernel | ||
166 | #ifdef CONFIG_RELOCATABLE | ||
167 | relocatable_kernel: .byte 1 | ||
168 | #else | ||
169 | relocatable_kernel: .byte 0 | ||
170 | #endif | ||
171 | pad2: .byte 0 | ||
172 | pad3: .word 0 | ||
173 | |||
163 | trampoline: call start_of_setup | 174 | trampoline: call start_of_setup |
164 | .align 16 | 175 | .align 16 |
165 | # The offset at this point is 0x240 | 176 | # The offset at this point is 0x240 |
@@ -588,11 +599,6 @@ rmodeswtch_normal: | |||
588 | call default_switch | 599 | call default_switch |
589 | 600 | ||
590 | rmodeswtch_end: | 601 | rmodeswtch_end: |
591 | # we get the code32 start address and modify the below 'jmpi' | ||
592 | # (loader may have changed it) | ||
593 | movl %cs:code32_start, %eax | ||
594 | movl %eax, %cs:code32 | ||
595 | |||
596 | # Now we move the system to its rightful place ... but we check if we have a | 602 | # Now we move the system to its rightful place ... but we check if we have a |
597 | # big-kernel. In that case we *must* not move it ... | 603 | # big-kernel. In that case we *must* not move it ... |
598 | testb $LOADED_HIGH, %cs:loadflags | 604 | testb $LOADED_HIGH, %cs:loadflags |
@@ -788,11 +794,12 @@ a20_err_msg: | |||
788 | a20_done: | 794 | a20_done: |
789 | 795 | ||
790 | #endif /* CONFIG_X86_VOYAGER */ | 796 | #endif /* CONFIG_X86_VOYAGER */ |
791 | # set up gdt and idt | 797 | # set up gdt and idt and 32bit start address |
792 | lidt idt_48 # load idt with 0,0 | 798 | lidt idt_48 # load idt with 0,0 |
793 | xorl %eax, %eax # Compute gdt_base | 799 | xorl %eax, %eax # Compute gdt_base |
794 | movw %ds, %ax # (Convert %ds:gdt to a linear ptr) | 800 | movw %ds, %ax # (Convert %ds:gdt to a linear ptr) |
795 | shll $4, %eax | 801 | shll $4, %eax |
802 | addl %eax, code32 | ||
796 | addl $gdt, %eax | 803 | addl $gdt, %eax |
797 | movl %eax, (gdt_48+2) | 804 | movl %eax, (gdt_48+2) |
798 | lgdt gdt_48 # load gdt with whatever is | 805 | lgdt gdt_48 # load gdt with whatever is |
@@ -851,9 +858,26 @@ flush_instr: | |||
851 | # Manual, Mixing 16-bit and 32-bit code, page 16-6) | 858 | # Manual, Mixing 16-bit and 32-bit code, page 16-6) |
852 | 859 | ||
853 | .byte 0x66, 0xea # prefix + jmpi-opcode | 860 | .byte 0x66, 0xea # prefix + jmpi-opcode |
854 | code32: .long 0x1000 # will be set to 0x100000 | 861 | code32: .long startup_32 # will be set to %cs+startup_32 |
855 | # for big kernels | ||
856 | .word __BOOT_CS | 862 | .word __BOOT_CS |
863 | .code32 | ||
864 | startup_32: | ||
865 | movl $(__BOOT_DS), %eax | ||
866 | movl %eax, %ds | ||
867 | movl %eax, %es | ||
868 | movl %eax, %fs | ||
869 | movl %eax, %gs | ||
870 | movl %eax, %ss | ||
871 | |||
872 | xorl %eax, %eax | ||
873 | 1: incl %eax # check that A20 really IS enabled | ||
874 | movl %eax, 0x00000000 # loop forever if it isn't | ||
875 | cmpl %eax, 0x00100000 | ||
876 | je 1b | ||
877 | |||
878 | # Jump to the 32bit entry point | ||
879 | jmpl *(code32_start - start + (DELTA_INITSEG << 4))(%esi) | ||
880 | .code16 | ||
857 | 881 | ||
858 | # Here's a bunch of information about your current kernel.. | 882 | # Here's a bunch of information about your current kernel.. |
859 | kernel_version: .ascii UTS_RELEASE | 883 | kernel_version: .ascii UTS_RELEASE |