Rev 1063 | Rev 1291 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1063 | Rev 1289 | ||
---|---|---|---|
Line 70... | Line 70... | ||
70 | multiboot_meeting_point: |
70 | multiboot_meeting_point: |
71 | 71 | ||
72 | movl %eax, grub_eax # save parameters from GRUB |
72 | movl %eax, grub_eax # save parameters from GRUB |
73 | movl %ebx, grub_ebx |
73 | movl %ebx, grub_ebx |
74 | 74 | ||
- | 75 | #ifdef CONFIG_FB |
|
- | 76 | mov $vesa_init,%esi; |
|
- | 77 | mov $VESA_INIT_SEGMENT<<4,%edi; |
|
- | 78 | mov $e_vesa_init-vesa_init,%ecx; |
|
- | 79 | cld; |
|
- | 80 | rep movsb; |
|
- | 81 | ||
- | 82 | mov $VESA_INIT_SEGMENT<<4,%edi; |
|
- | 83 | call *%edi; |
|
- | 84 | mov %esi,KA2PA(vesa_ph_addr); |
|
- | 85 | mov %di,KA2PA(vesa_height); |
|
- | 86 | shr $16,%edi; |
|
- | 87 | mov %di,KA2PA(vesa_width); |
|
- | 88 | mov %bx,KA2PA(vesa_scanline); |
|
- | 89 | shr $16,%ebx; |
|
- | 90 | mov %bx,KA2PA(vesa_bpp); |
|
- | 91 | #endif |
|
- | 92 | ||
75 | # Protected 32-bit. We want to reuse the code-seg descriptor, |
93 | # Protected 32-bit. We want to reuse the code-seg descriptor, |
76 | # the Default operand size must not be 1 when entering long mode |
94 | # the Default operand size must not be 1 when entering long mode |
77 | 95 | ||
78 | movl $0x80000000, %eax |
96 | movl $0x80000000, %eax |
79 | cpuid |
97 | cpuid |
Line 250... | Line 268... | ||
250 | 268 | ||
251 | call main_bsp # never returns |
269 | call main_bsp # never returns |
252 | 270 | ||
253 | cli |
271 | cli |
254 | hlt |
272 | hlt |
- | 273 | ||
- | 274 | #ifdef CONFIG_FB |
|
- | 275 | .code32 |
|
- | 276 | vesa_init: |
|
- | 277 | jmp $gdtselector(VESA_INIT_DES),$vesa_init_real-vesa_init; |
|
- | 278 | .code16 |
|
- | 279 | vesa_init_real: |
|
- | 280 | ||
- | 281 | mov %cr0,%eax; |
|
- | 282 | and $~1,%eax; |
|
- | 283 | mov %eax,%cr0; |
|
- | 284 | ||
- | 285 | ||
- | 286 | jmp $VESA_INIT_SEGMENT,$vesa_init_real2-vesa_init; |
|
- | 287 | ||
- | 288 | vesa_init_real2: |
|
- | 289 | ||
- | 290 | ||
- | 291 | mov %esp,%ebp; |
|
- | 292 | mov %ss,%cx; |
|
- | 293 | mov $VESA_INIT_SEGMENT,%bx; |
|
- | 294 | mov %bx,%ss; |
|
- | 295 | mov $0x0000fffc,%esp; |
|
- | 296 | push %ds; |
|
- | 297 | push %es; |
|
- | 298 | push %fs; |
|
- | 299 | push %gs; |
|
- | 300 | push %ebp; |
|
- | 301 | push %cx; |
|
- | 302 | ||
- | 303 | mov %bx,%ds; |
|
- | 304 | mov %bx,%es; |
|
- | 305 | mov %bx,%fs; |
|
- | 306 | mov %bx,%gs; |
|
- | 307 | ||
- | 308 | ||
- | 309 | mov $vesa_idt-vesa_init,%ebx; |
|
- | 310 | lidtl (%ebx); |
|
- | 311 | ||
- | 312 | #define VESA_INFO_SIZE 1024 |
|
- | 313 | ||
- | 314 | #define VESA_MODE_LIST_PTR_OFFSET 14 |
|
- | 315 | #define VESA_MODE_WIDTH_OFFSET 18 |
|
- | 316 | #define VESA_MODE_HEIGHT_OFFSET 20 |
|
- | 317 | #define VESA_MODE_BPP_OFFSET 25 |
|
- | 318 | #define VESA_MODE_SCANLINE_OFFSET 16 |
|
- | 319 | #define VESA_MODE_PHADDR_OFFSET 40 |
|
- | 320 | ||
- | 321 | #define VESA_END_OF_MODES 0xffff |
|
- | 322 | ||
- | 323 | #define VESA_OK 0x4f |
|
- | 324 | ||
- | 325 | #define VESA_GET_INFO 0x4f00 |
|
- | 326 | #define VESA_GET_MODE_INFO 0x4f01 |
|
- | 327 | #define VESA_SET_MODE 0x4f02 |
|
- | 328 | ||
- | 329 | #define CONFIG_VESA_BPP_a 255 |
|
- | 330 | ||
- | 331 | #if CONFIG_VESA_BPP==24 |
|
- | 332 | #undef CONFIG_VESA_BPP_a |
|
- | 333 | #define CONFIG_VESA_BPP_a 32 |
|
- | 334 | #endif |
|
- | 335 | ||
- | 336 | ||
- | 337 | mov $VESA_GET_INFO,%ax; |
|
- | 338 | mov $e_vesa_init-vesa_init,%di |
|
- | 339 | push %di; |
|
- | 340 | int $0x10; |
|
- | 341 | pop %di; |
|
- | 342 | cmp $VESA_OK,%al; |
|
- | 343 | jnz 0f; |
|
- | 344 | mov 2+VESA_MODE_LIST_PTR_OFFSET(%di),%si; |
|
- | 345 | mov %si,%gs; |
|
- | 346 | mov VESA_MODE_LIST_PTR_OFFSET(%di),%si; |
|
- | 347 | ||
- | 348 | add $VESA_INFO_SIZE,%di; |
|
- | 349 | ||
- | 350 | 1:# Try next mode |
|
- | 351 | mov %gs:(%si),%cx; |
|
- | 352 | cmp $VESA_END_OF_MODES,%cx; |
|
- | 353 | jz 0f; |
|
- | 354 | inc %si; |
|
- | 355 | inc %si; |
|
- | 356 | push %cx; |
|
- | 357 | push %di; |
|
- | 358 | push %si; |
|
- | 359 | mov $VESA_GET_MODE_INFO,%ax; |
|
- | 360 | int $0x10; |
|
- | 361 | pop %si; |
|
- | 362 | pop %di; |
|
- | 363 | pop %cx; |
|
- | 364 | cmp $VESA_OK,%al; |
|
- | 365 | jnz 0f; |
|
- | 366 | ||
- | 367 | ||
- | 368 | mov $CONFIG_VESA_WIDTH,%ax; |
|
- | 369 | cmp VESA_MODE_WIDTH_OFFSET(%di),%ax; |
|
- | 370 | jnz 1b; |
|
- | 371 | mov $CONFIG_VESA_HEIGHT,%ax; |
|
- | 372 | cmp VESA_MODE_HEIGHT_OFFSET(%di),%ax; |
|
- | 373 | jnz 1b; |
|
- | 374 | mov $CONFIG_VESA_BPP,%al; |
|
- | 375 | cmp VESA_MODE_BPP_OFFSET(%di),%al; |
|
- | 376 | jz 2f; |
|
- | 377 | mov $CONFIG_VESA_BPP_a,%al; |
|
- | 378 | cmp VESA_MODE_BPP_OFFSET(%di),%al; |
|
- | 379 | jnz 1b; |
|
- | 380 | ||
- | 381 | 2: |
|
- | 382 | ||
- | 383 | mov %cx,%bx; |
|
- | 384 | or $0xC000,%bx; |
|
- | 385 | push %di; |
|
- | 386 | mov $VESA_SET_MODE,%ax; |
|
- | 387 | int $0x10; |
|
- | 388 | pop %di; |
|
- | 389 | cmp $VESA_OK,%al; |
|
- | 390 | jnz 0f; |
|
- | 391 | ||
- | 392 | mov VESA_MODE_PHADDR_OFFSET(%di),%esi; |
|
- | 393 | mov VESA_MODE_WIDTH_OFFSET(%di),%ax; |
|
- | 394 | shl $16,%eax; |
|
- | 395 | mov VESA_MODE_HEIGHT_OFFSET(%di),%ax; |
|
- | 396 | mov VESA_MODE_BPP_OFFSET(%di),%bl; |
|
- | 397 | xor %bh,%bh; |
|
- | 398 | shl $16,%ebx; |
|
- | 399 | mov VESA_MODE_SCANLINE_OFFSET(%di),%bx; |
|
- | 400 | mov %eax,%edi; |
|
- | 401 | ||
- | 402 | ||
- | 403 | ||
- | 404 | 8: |
|
- | 405 | ||
- | 406 | mov %cr0,%eax; |
|
- | 407 | or $1,%eax; |
|
- | 408 | mov %eax,%cr0; |
|
- | 409 | ||
- | 410 | jmp 9f; |
|
- | 411 | 9: |
|
- | 412 | ||
- | 413 | pop %cx; |
|
- | 414 | pop %ebp; |
|
- | 415 | pop %gs; |
|
- | 416 | pop %fs; |
|
- | 417 | pop %es; |
|
- | 418 | pop %ds; |
|
- | 419 | mov %cx,%ss; |
|
- | 420 | mov %ebp,%esp; |
|
- | 421 | ||
- | 422 | ljmpl $gdtselector(KTEXT32_DES),$(vesa_init_protect-vesa_init+VESA_INIT_SEGMENT<<4); |
|
- | 423 | ||
- | 424 | vesa_init_protect: |
|
- | 425 | .code32 |
|
- | 426 | ret; |
|
- | 427 | ||
- | 428 | 0: #Error no Prefered mode found |
|
- | 429 | ||
- | 430 | mov $0x111,%cx; |
|
- | 431 | push %di; |
|
- | 432 | push %cx; |
|
- | 433 | mov $VESA_GET_MODE_INFO,%ax; |
|
- | 434 | int $0x10; |
|
- | 435 | pop %cx; |
|
- | 436 | pop %di; |
|
- | 437 | cmp $VESA_OK,%al; |
|
- | 438 | jnz 1f; |
|
- | 439 | jmp 2b; |
|
- | 440 | ||
- | 441 | 1:mov $0x0003,%ax; |
|
- | 442 | int $0x10; |
|
- | 443 | mov $0xffffffff,%edi; /* EGA text mode used, because of problems with VESA */ |
|
- | 444 | jmp 8; |
|
- | 445 | ||
- | 446 | ||
- | 447 | vesa_idt: |
|
- | 448 | .word 0x03ff |
|
- | 449 | .long 0 |
|
- | 450 | .align 4 |
|
- | 451 | e_vesa_init: |
|
- | 452 | #endif |
|
- | 453 | ||
- | 454 | ||
255 | 455 | ||
256 | .section K_DATA_START, "aw", @progbits |
456 | .section K_DATA_START, "aw", @progbits |
257 | .align 4096 |
457 | .align 4096 |
258 | 458 | ||
259 | # Identical mapping of first 64MB and the same of -2GB -> 0 |
459 | # Identical mapping of first 64MB and the same of -2GB -> 0 |