0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025 .text
0026
0027 #include <linux/init.h>
0028 #include <linux/linkage.h>
0029 #include <asm/segment.h>
0030 #include <asm/page_types.h>
0031 #include <asm/boot.h>
0032 #include <asm/asm-offsets.h>
0033 #include <asm/bootparam.h>
0034
0035
0036
0037
0038
0039
0040
0041 .hidden _bss
0042 .hidden _ebss
0043 .hidden _end
0044
0045 __HEAD
0046 SYM_FUNC_START(startup_32)
0047 cld
0048 cli
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058 leal (BP_scratch+4)(%esi), %esp
0059 call 1f
0060 1: popl %edx
0061 addl $_GLOBAL_OFFSET_TABLE_+(.-1b), %edx
0062
0063
0064 leal gdt@GOTOFF(%edx), %eax
0065 movl %eax, 2(%eax)
0066 lgdt (%eax)
0067
0068
0069 movl $__BOOT_DS, %eax
0070 movl %eax, %ds
0071 movl %eax, %es
0072 movl %eax, %fs
0073 movl %eax, %gs
0074 movl %eax, %ss
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085 #ifdef CONFIG_RELOCATABLE
0086 leal startup_32@GOTOFF(%edx), %ebx
0087
0088 #ifdef CONFIG_EFI_STUB
0089
0090
0091
0092
0093
0094
0095
0096
0097 subl image_offset@GOTOFF(%edx), %ebx
0098 #endif
0099
0100 movl BP_kernel_alignment(%esi), %eax
0101 decl %eax
0102 addl %eax, %ebx
0103 notl %eax
0104 andl %eax, %ebx
0105 cmpl $LOAD_PHYSICAL_ADDR, %ebx
0106 jae 1f
0107 #endif
0108 movl $LOAD_PHYSICAL_ADDR, %ebx
0109 1:
0110
0111 movl %ebx, %ebp // Save the output address for later
0112
0113 addl BP_init_size(%esi), %ebx
0114 subl $_end@GOTOFF, %ebx
0115
0116
0117 leal boot_stack_end@GOTOFF(%ebx), %esp
0118
0119
0120 pushl $0
0121 popfl
0122
0123
0124
0125
0126
0127 pushl %esi
0128 leal (_bss@GOTOFF-4)(%edx), %esi
0129 leal (_bss@GOTOFF-4)(%ebx), %edi
0130 movl $(_bss - startup_32), %ecx
0131 shrl $2, %ecx
0132 std
0133 rep movsl
0134 cld
0135 popl %esi
0136
0137
0138
0139
0140
0141
0142 leal gdt@GOTOFF(%ebx), %eax
0143 movl %eax, 2(%eax)
0144 lgdt (%eax)
0145
0146
0147
0148
0149 leal .Lrelocated@GOTOFF(%ebx), %eax
0150 jmp *%eax
0151 SYM_FUNC_END(startup_32)
0152
0153 #ifdef CONFIG_EFI_STUB
0154 SYM_FUNC_START(efi32_stub_entry)
0155 add $0x4, %esp
0156 movl 8(%esp), %esi
0157 call efi_main
0158
0159 jmp *%eax
0160 SYM_FUNC_END(efi32_stub_entry)
0161 SYM_FUNC_ALIAS(efi_stub_entry, efi32_stub_entry)
0162 #endif
0163
0164 .text
0165 SYM_FUNC_START_LOCAL_NOALIGN(.Lrelocated)
0166
0167
0168
0169
0170 xorl %eax, %eax
0171 leal _bss@GOTOFF(%ebx), %edi
0172 leal _ebss@GOTOFF(%ebx), %ecx
0173 subl %edi, %ecx
0174 shrl $2, %ecx
0175 rep stosl
0176
0177
0178
0179
0180
0181
0182 pushl output_len@GOTOFF(%ebx)
0183 pushl %ebp
0184 pushl input_len@GOTOFF(%ebx)
0185 leal input_data@GOTOFF(%ebx), %eax
0186 pushl %eax
0187 leal boot_heap@GOTOFF(%ebx), %eax
0188 pushl %eax
0189 pushl %esi
0190 call extract_kernel
0191 addl $24, %esp
0192
0193
0194
0195
0196 xorl %ebx, %ebx
0197 jmp *%eax
0198 SYM_FUNC_END(.Lrelocated)
0199
0200 .data
0201 .balign 8
0202 SYM_DATA_START_LOCAL(gdt)
0203 .word gdt_end - gdt - 1
0204 .long 0
0205 .word 0
0206 .quad 0x0000000000000000
0207 .quad 0x00cf9a000000ffff
0208 .quad 0x00cf92000000ffff
0209 SYM_DATA_END_LABEL(gdt, SYM_L_LOCAL, gdt_end)
0210
0211 #ifdef CONFIG_EFI_STUB
0212 SYM_DATA(image_offset, .long 0)
0213 #endif
0214
0215
0216
0217
0218 .bss
0219 .balign 4
0220 boot_heap:
0221 .fill BOOT_HEAP_SIZE, 1, 0
0222 boot_stack:
0223 .fill BOOT_STACK_SIZE, 1, 0
0224 boot_stack_end: