Rev 4339 | Rev 4345 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4339 | Rev 4344 | ||
---|---|---|---|
Line 99... | Line 99... | ||
99 | mov %di, KA2PA(vesa_width) |
99 | mov %di, KA2PA(vesa_width) |
100 | mov %bx, KA2PA(vesa_scanline) |
100 | mov %bx, KA2PA(vesa_scanline) |
101 | shr $16, %ebx |
101 | shr $16, %ebx |
102 | mov %bx, KA2PA(vesa_bpp) |
102 | mov %bx, KA2PA(vesa_bpp) |
103 | #endif |
103 | #endif |
104 | 104 | ||
105 | call map_kernel # map kernel and turn paging on |
105 | call map_kernel # map kernel and turn paging on |
106 | - | ||
107 | movl grub_eax, %eax |
- | |
108 | movl grub_ebx, %ebx |
- | |
109 | cmpl $MULTIBOOT_LOADER_MAGIC, %eax # compare GRUB signature |
- | |
110 | je valid_boot |
- | |
111 | - | ||
112 | xorl %ecx, %ecx # no memory map available |
- | |
113 | movl %ecx, e820counter |
- | |
114 | - | ||
115 | jmp invalid_boot |
- | |
116 | - | ||
117 | valid_boot: |
- | |
118 | - | ||
119 | movl (%ebx), %eax # ebx = physical address of struct multiboot_info |
- | |
120 | - | ||
121 | bt $3, %eax # mbi->flags[3] (mods_count, mods_addr valid) |
- | |
122 | jc mods_valid |
- | |
123 | - | ||
124 | xorl %ecx, %ecx |
- | |
125 | movl %ecx, init |
- | |
126 | jmp mods_end |
- | |
127 | - | ||
128 | mods_valid: |
- | |
129 | - | ||
130 | movl 20(%ebx), %ecx # mbi->mods_count |
- | |
131 | movl %ecx, init |
- | |
132 | - | ||
133 | cmpl $0, %ecx |
- | |
134 | je mods_end |
- | |
135 | - | ||
136 | movl 24(%ebx), %esi # mbi->mods_addr |
- | |
137 | movl $init, %edi |
- | |
138 | - | ||
139 | mods_loop: |
- | |
140 | - | ||
141 | movl 0(%esi), %edx # mods->mod_start |
- | |
142 | addl $0x80000000, %edx |
- | |
143 | movl %edx, 4(%edi) |
- | |
144 | - | ||
145 | movl 4(%esi), %edx |
- | |
146 | subl 0(%esi), %edx # mods->mod_end - mods->mod_start |
- | |
147 | movl %edx, 8(%edi) |
- | |
148 | - | ||
149 | addl $16, %esi |
- | |
150 | addl $8 , %edi |
- | |
151 | - | ||
152 | loop mods_loop |
- | |
153 | - | ||
154 | mods_end: |
- | |
155 | - | ||
156 | bt $6, %eax # mbi->flags[6] (mmap_length, mmap_addr valid) |
- | |
157 | jc mmap_valid |
- | |
158 | - | ||
159 | xorl %edx, %edx |
- | |
160 | jmp mmap_invalid |
- | |
161 | - | ||
162 | mmap_valid: |
- | |
163 | movl 44(%ebx), %ecx # mbi->mmap_length |
- | |
164 | movl 48(%ebx), %esi # mbi->mmap_addr |
- | |
165 | movl $e820table, %edi |
- | |
166 | xorl %edx, %edx |
- | |
167 | - | ||
168 | mmap_loop: |
- | |
169 | cmpl $0, %ecx |
- | |
170 | jle mmap_end |
- | |
171 | - | ||
172 | movl 4(%esi), %eax # mmap->base_addr_low |
- | |
173 | movl %eax, (%edi) |
- | |
174 | - | ||
175 | movl 8(%esi), %eax # mmap->base_addr_high |
- | |
176 | movl %eax, 4(%edi) |
- | |
177 | - | ||
178 | movl 12(%esi), %eax # mmap->length_low |
- | |
179 | movl %eax, 8(%edi) |
- | |
180 | - | ||
181 | movl 16(%esi), %eax # mmap->length_high |
- | |
182 | movl %eax, 12(%edi) |
- | |
183 | - | ||
184 | movl 20(%esi), %eax # mmap->type |
- | |
185 | movl %eax, 16(%edi) |
- | |
186 | - | ||
187 | movl (%esi), %eax # mmap->size |
- | |
188 | addl $0x4, %eax |
- | |
189 | addl %eax, %esi |
- | |
190 | subl %eax, %ecx |
- | |
191 | addl $MEMMAP_E820_RECORD_SIZE, %edi |
- | |
192 | incl %edx |
- | |
193 | jmp mmap_loop |
- | |
194 | - | ||
195 | mmap_end: |
- | |
196 | - | ||
197 | mmap_invalid: |
- | |
198 | movl %edx, e820counter |
- | |
199 | - | ||
200 | invalid_boot: |
- | |
201 | - | ||
202 | #ifdef CONFIG_SMP |
- | |
203 | - | ||
204 | # copy AP bootstrap routines below 1 MB |
- | |
205 | - | ||
206 | movl $BOOT_OFFSET, %esi |
- | |
207 | movl $AP_BOOT_OFFSET, %edi |
- | |
208 | movl $_hardcoded_unmapped_size, %ecx |
- | |
209 | rep movsb |
- | |
210 | - | ||
211 | #endif |
- | |
212 | 106 | ||
- | 107 | # ia32_cboot(grub_eax, grub_ebx) |
|
- | 108 | pushl grub_ebx |
|
- | 109 | pushl grub_eax |
|
213 | call main_bsp # never returns |
110 | call ia32_cboot # Does not return. |
- | 111 | ||
- | 112 | # Not reached. |
|
214 | 113 | ||
215 | cli |
114 | cli |
216 | hlt |
115 | hlt |
217 | 116 | ||
218 | .global map_kernel |
117 | .global map_kernel |