Rev 2089 | Rev 2221 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 2089 | Rev 2220 | ||
|---|---|---|---|
| Line 64... | Line 64... | ||
| 64 | multiboot_meeting_point: |
64 | multiboot_meeting_point: |
| 65 | 65 | ||
| 66 | pushl %ebx # save parameters from GRUB |
66 | pushl %ebx # save parameters from GRUB |
| 67 | pushl %eax |
67 | pushl %eax |
| 68 | 68 | ||
| - | 69 | xorl %eax, %eax |
|
| - | 70 | cpuid |
|
| - | 71 | cmp $0x0, %eax # any function > 0? |
|
| - | 72 | jbe pse_unsupported |
|
| - | 73 | movl $0x1, %eax # Basic function code 80000001 |
|
| - | 74 | cpuid |
|
| - | 75 | bt $3, %edx # Test if PSE is supported |
|
| - | 76 | jc pse_supported |
|
| - | 77 | ||
| - | 78 | pse_unsupported: |
|
| - | 79 | movl $pse_msg, %esi |
|
| - | 80 | jmp error_halt |
|
| - | 81 | ||
| - | 82 | pse_supported: |
|
| - | 83 | ||
| 69 | #ifdef CONFIG_FB |
84 | #ifdef CONFIG_FB |
| 70 | mov $vesa_init, %esi |
85 | mov $vesa_init, %esi |
| 71 | mov $VESA_INIT_SEGMENT << 4, %edi |
86 | mov $VESA_INIT_SEGMENT << 4, %edi |
| 72 | mov $e_vesa_init - vesa_init, %ecx |
87 | mov $e_vesa_init - vesa_init, %ecx |
| 73 | cld |
88 | cld |
| Line 207... | Line 222... | ||
| 207 | movl $_hardcoded_unmapped_size, %ecx |
222 | movl $_hardcoded_unmapped_size, %ecx |
| 208 | cld |
223 | cld |
| 209 | rep movsb |
224 | rep movsb |
| 210 | 225 | ||
| 211 | #endif |
226 | #endif |
| 212 | 227 | ||
| 213 | call main_bsp # never returns |
228 | call main_bsp # never returns |
| 214 | 229 | ||
| 215 | cli |
230 | cli |
| 216 | hlt |
231 | hlt |
| 217 | 232 | ||
| Line 220... | Line 235... | ||
| 220 | # |
235 | # |
| 221 | # Here we setup mapping for both the unmapped and mapped sections of the kernel. |
236 | # Here we setup mapping for both the unmapped and mapped sections of the kernel. |
| 222 | # For simplicity, we map the entire 4G space. |
237 | # For simplicity, we map the entire 4G space. |
| 223 | # |
238 | # |
| 224 | movl %cr4, %ecx |
239 | movl %cr4, %ecx |
| 225 | orl $(1<<4), %ecx |
240 | orl $(1 << 4), %ecx # turn PSE on |
| 226 | movl %ecx, %cr4 # turn PSE on |
241 | andl $(~(1 << 5)), %ecx # turn PAE off |
| - | 242 | movl %ecx, %cr4 |
|
| 227 | 243 | ||
| 228 | movl $(page_directory+0), %esi |
244 | movl $(page_directory + 0), %esi |
| 229 | movl $(page_directory+2048), %edi |
245 | movl $(page_directory + 2048), %edi |
| 230 | xorl %ecx, %ecx |
246 | xorl %ecx, %ecx |
| 231 | xorl %ebx, %ebx |
247 | xorl %ebx, %ebx |
| 232 | 0: |
248 | 0: |
| 233 | movl $((1<<7)|(1<<0)), %eax |
249 | movl $((1 << 7) | (1 << 1) | (1 << 0)), %eax |
| 234 | orl %ebx, %eax |
250 | orl %ebx, %eax |
| 235 | movl %eax, (%esi,%ecx,4) # mapping 0x00000000+%ecx*4M => 0x00000000+%ecx*4M |
251 | movl %eax, (%esi, %ecx, 4) # mapping 0x00000000 + %ecx * 4M => 0x00000000 + %ecx * 4M |
| 236 | movl %eax, (%edi,%ecx,4) # mapping 0x80000000+%ecx*4M => 0x00000000+%ecx*4M |
252 | movl %eax, (%edi, %ecx, 4) # mapping 0x80000000 + %ecx * 4M => 0x00000000 + %ecx * 4M |
| 237 | addl $(4*1024*1024), %ebx |
253 | addl $(4 * 1024 * 1024), %ebx |
| 238 | 254 | ||
| 239 | incl %ecx |
255 | incl %ecx |
| 240 | cmpl $512, %ecx |
256 | cmpl $512, %ecx |
| 241 | jl 0b |
257 | jl 0b |
| 242 | 258 | ||
| 243 | movl %esi, %cr3 |
259 | movl %esi, %cr3 |
| 244 | 260 | ||
| 245 | # turn paging on |
- | |
| 246 | movl %cr0, %ebx |
261 | movl %cr0, %ebx |
| 247 | orl $(1<<31), %ebx |
262 | orl $(1 << 31), %ebx # turn paging on |
| 248 | movl %ebx, %cr0 |
263 | movl %ebx, %cr0 |
| 249 | ret |
264 | ret |
| 250 | 265 | ||
| - | 266 | # Print string from %esi to EGA display (in red) and halt |
|
| - | 267 | error_halt: |
|
| - | 268 | movl $0xb8000, %edi # base of EGA text mode memory |
|
| - | 269 | xorl %eax, %eax |
|
| - | 270 | ||
| - | 271 | movw $0x3d4, %dx # read bits 8 - 15 of the cursor address |
|
| - | 272 | movb $0xe, %al |
|
| - | 273 | outb %al, %dx |
|
| - | 274 | ||
| - | 275 | movw $0x3d5, %dx |
|
| - | 276 | inb %dx, %al |
|
| - | 277 | shl $8, %ax |
|
| - | 278 | ||
| - | 279 | movw $0x3d4, %dx # read bits 0 - 7 of the cursor address |
|
| - | 280 | movb $0xf, %al |
|
| - | 281 | outb %al, %dx |
|
| - | 282 | ||
| - | 283 | movw $0x3d5, %dx |
|
| - | 284 | inb %dx, %al |
|
| - | 285 | ||
| - | 286 | cmp $1920, %ax |
|
| - | 287 | jbe cursor_ok |
|
| - | 288 | movw $1920, %ax # sanity check for the cursor on the last line |
|
| - | 289 | cursor_ok: |
|
| - | 290 | ||
| - | 291 | movw %ax, %bx |
|
| - | 292 | shl $1, %eax |
|
| - | 293 | addl %eax, %edi |
|
| - | 294 | ||
| - | 295 | movw $0x0c00, %ax # black background, light red foreground |
|
| - | 296 | cld |
|
| - | 297 | ||
| - | 298 | ploop: |
|
| - | 299 | lodsb |
|
| - | 300 | cmp $0, %al |
|
| - | 301 | je ploop_end |
|
| - | 302 | stosw |
|
| - | 303 | inc %bx |
|
| - | 304 | jmp ploop |
|
| - | 305 | ploop_end: |
|
| - | 306 | ||
| - | 307 | movw $0x3d4, %dx # write bits 8 - 15 of the cursor address |
|
| - | 308 | movb $0xe, %al |
|
| - | 309 | outb %al, %dx |
|
| - | 310 | ||
| - | 311 | movw $0x3d5, %dx |
|
| - | 312 | movb %bh, %al |
|
| - | 313 | outb %al, %dx |
|
| - | 314 | ||
| - | 315 | movw $0x3d4, %dx # write bits 0 - 7 of the cursor address |
|
| - | 316 | movb $0xf, %al |
|
| - | 317 | outb %al, %dx |
|
| - | 318 | ||
| - | 319 | movw $0x3d5, %dx |
|
| - | 320 | movb %bl, %al |
|
| - | 321 | outb %al, %dx |
|
| - | 322 | ||
| - | 323 | cli |
|
| - | 324 | hlt |
|
| - | 325 | ||
| 251 | #ifdef CONFIG_FB |
326 | #ifdef CONFIG_FB |
| 252 | vesa_init: |
327 | vesa_init: |
| 253 | jmp $selector(VESA_INIT_DES), $vesa_init_real - vesa_init |
328 | jmp $selector(VESA_INIT_DES), $vesa_init_real - vesa_init |
| 254 | 329 | ||
| 255 | .code16 |
330 | .code16 |
| Line 424... | Line 499... | ||
| 424 | .section K_DATA_START, "aw", @progbits |
499 | .section K_DATA_START, "aw", @progbits |
| 425 | 500 | ||
| 426 | .align 4096 |
501 | .align 4096 |
| 427 | page_directory: |
502 | page_directory: |
| 428 | .space 4096, 0 |
503 | .space 4096, 0 |
| - | 504 | ||
| - | 505 | pse_msg: |
|
| - | 506 | .ascii "Page Size Extension not supported. System halted.\0" |
|