Rev 1037 | Rev 1288 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1037 | Rev 1287 | ||
---|---|---|---|
Line 32... | Line 32... | ||
32 | #include <arch/mm/page.h> |
32 | #include <arch/mm/page.h> |
33 | #include <arch/pm.h> |
33 | #include <arch/pm.h> |
34 | 34 | ||
35 | #define START_STACK (BOOT_OFFSET - BOOT_STACK_SIZE) |
35 | #define START_STACK (BOOT_OFFSET - BOOT_STACK_SIZE) |
36 | 36 | ||
- | 37 | ||
- | 38 | ||
- | 39 | ||
- | 40 | ||
- | 41 | ||
- | 42 | ||
- | 43 | ||
- | 44 | ||
37 | .section K_TEXT_START, "ax" |
45 | .section K_TEXT_START, "ax" |
38 | 46 | ||
39 | KTEXT=8 |
47 | KTEXT=8 |
40 | KDATA=16 |
48 | KDATA=16 |
41 | 49 | ||
Line 66... | Line 74... | ||
66 | jmpl $KTEXT, $multiboot_meeting_point |
74 | jmpl $KTEXT, $multiboot_meeting_point |
67 | multiboot_meeting_point: |
75 | multiboot_meeting_point: |
68 | 76 | ||
69 | pushl %ebx # save parameters from GRUB |
77 | pushl %ebx # save parameters from GRUB |
70 | pushl %eax |
78 | pushl %eax |
- | 79 | ||
- | 80 | #ifdef CONFIG_FB |
|
- | 81 | mov $vesa_init,%esi; |
|
- | 82 | mov $VESA_INIT_SEGMENT<<4,%edi; |
|
- | 83 | mov $e_vesa_init-vesa_init,%ecx; |
|
- | 84 | cld; |
|
- | 85 | rep movsb; |
|
- | 86 | ||
- | 87 | mov $VESA_INIT_SEGMENT<<4,%edi; |
|
- | 88 | call *%edi; |
|
- | 89 | mov %esi,KA2PA(vesa_ph_addr); |
|
- | 90 | mov %di,KA2PA(vesa_height); |
|
- | 91 | shr $16,%edi; |
|
- | 92 | mov %di,KA2PA(vesa_width); |
|
- | 93 | mov %bx,KA2PA(vesa_scanline); |
|
- | 94 | shr $16,%ebx; |
|
- | 95 | mov %bx,KA2PA(vesa_bpp); |
|
- | 96 | #endif |
|
71 | 97 | ||
72 | call map_kernel # map kernel and turn paging on |
98 | call map_kernel # map kernel and turn paging on |
73 | 99 | ||
74 | popl %eax |
100 | popl %eax |
75 | popl %ebx |
101 | popl %ebx |
Line 228... | Line 254... | ||
228 | movl %cr0, %ebx |
254 | movl %cr0, %ebx |
229 | orl $(1<<31), %ebx |
255 | orl $(1<<31), %ebx |
230 | movl %ebx, %cr0 |
256 | movl %ebx, %cr0 |
231 | ret |
257 | ret |
232 | 258 | ||
- | 259 | #ifdef CONFIG_FB |
|
- | 260 | vesa_init: |
|
- | 261 | jmp $selector(VESA_INIT_DES),$vesa_init_real-vesa_init; |
|
- | 262 | .code16 |
|
- | 263 | vesa_init_real: |
|
- | 264 | ||
- | 265 | mov %cr0,%eax; |
|
- | 266 | and $~1,%eax; |
|
- | 267 | mov %eax,%cr0; |
|
- | 268 | ||
- | 269 | ||
- | 270 | jmp $VESA_INIT_SEGMENT,$vesa_init_real2-vesa_init; |
|
- | 271 | ||
- | 272 | vesa_init_real2: |
|
- | 273 | ||
- | 274 | ||
- | 275 | mov %esp,%ebp; |
|
- | 276 | mov %ss,%cx; |
|
- | 277 | mov $VESA_INIT_SEGMENT,%bx; |
|
- | 278 | mov %bx,%ss; |
|
- | 279 | mov $0x0000fffc,%esp; |
|
- | 280 | push %ds; |
|
- | 281 | push %es; |
|
- | 282 | push %fs; |
|
- | 283 | push %gs; |
|
- | 284 | push %ebp; |
|
- | 285 | push %cx; |
|
- | 286 | ||
- | 287 | mov %bx,%ds; |
|
- | 288 | mov %bx,%es; |
|
- | 289 | mov %bx,%fs; |
|
- | 290 | mov %bx,%gs; |
|
- | 291 | ||
- | 292 | ||
- | 293 | mov $vesa_idt-vesa_init,%ebx; |
|
- | 294 | lidtl (%ebx); |
|
- | 295 | ||
- | 296 | #define VESA_INFO_SIZE 1024 |
|
- | 297 | ||
- | 298 | #define VESA_MODE_LIST_PTR_OFFSET 14 |
|
- | 299 | #define VESA_MODE_WIDTH_OFFSET 18 |
|
- | 300 | #define VESA_MODE_HEIGHT_OFFSET 20 |
|
- | 301 | #define VESA_MODE_BPP_OFFSET 25 |
|
- | 302 | #define VESA_MODE_SCANLINE_OFFSET 16 |
|
- | 303 | #define VESA_MODE_PHADDR_OFFSET 40 |
|
- | 304 | ||
- | 305 | #define VESA_END_OF_MODES 0xffff |
|
- | 306 | ||
- | 307 | #define VESA_OK 0x4f |
|
- | 308 | ||
- | 309 | #define VESA_GET_INFO 0x4f00 |
|
- | 310 | #define VESA_GET_MODE_INFO 0x4f01 |
|
- | 311 | #define VESA_SET_MODE 0x4f02 |
|
- | 312 | ||
- | 313 | #define CONFIG_VESA_BPP_a 255 |
|
- | 314 | ||
- | 315 | #if CONFIG_VESA_BPP==24 |
|
- | 316 | #undef CONFIG_VESA_BPP_a |
|
- | 317 | #define CONFIG_VESA_BPP_a 32 |
|
- | 318 | #endif |
|
- | 319 | ||
- | 320 | ||
- | 321 | mov $VESA_GET_INFO,%ax; |
|
- | 322 | mov $e_vesa_init-vesa_init,%di |
|
- | 323 | push %di; |
|
- | 324 | int $0x10; |
|
- | 325 | pop %di; |
|
- | 326 | cmp $VESA_OK,%al; |
|
- | 327 | jnz 0f; |
|
- | 328 | mov 2+VESA_MODE_LIST_PTR_OFFSET(%di),%si; |
|
- | 329 | mov %si,%gs; |
|
- | 330 | mov VESA_MODE_LIST_PTR_OFFSET(%di),%si; |
|
- | 331 | ||
- | 332 | add $VESA_INFO_SIZE,%di; |
|
- | 333 | ||
- | 334 | 1:# Try next mode |
|
- | 335 | mov %gs:(%si),%cx; |
|
- | 336 | cmp $VESA_END_OF_MODES,%cx; |
|
- | 337 | jz 0f; |
|
- | 338 | inc %si; |
|
- | 339 | inc %si; |
|
- | 340 | push %cx; |
|
- | 341 | push %di; |
|
- | 342 | push %si; |
|
- | 343 | mov $VESA_GET_MODE_INFO,%ax; |
|
- | 344 | int $0x10; |
|
- | 345 | pop %si; |
|
- | 346 | pop %di; |
|
- | 347 | pop %cx; |
|
- | 348 | cmp $VESA_OK,%al; |
|
- | 349 | jnz 0f; |
|
- | 350 | ||
- | 351 | ||
- | 352 | mov $CONFIG_VESA_WIDTH,%ax; |
|
- | 353 | cmp VESA_MODE_WIDTH_OFFSET(%di),%ax; |
|
- | 354 | jnz 1b; |
|
- | 355 | mov $CONFIG_VESA_HEIGHT,%ax; |
|
- | 356 | cmp VESA_MODE_HEIGHT_OFFSET(%di),%ax; |
|
- | 357 | jnz 1b; |
|
- | 358 | mov $CONFIG_VESA_BPP,%al; |
|
- | 359 | cmp VESA_MODE_BPP_OFFSET(%di),%al; |
|
- | 360 | jz 2f; |
|
- | 361 | mov $CONFIG_VESA_BPP_a,%al; |
|
- | 362 | cmp VESA_MODE_BPP_OFFSET(%di),%al; |
|
- | 363 | jnz 1b; |
|
- | 364 | ||
- | 365 | 2: |
|
- | 366 | ||
- | 367 | mov %cx,%bx; |
|
- | 368 | or $0xC000,%bx; |
|
- | 369 | push %di; |
|
- | 370 | mov $VESA_SET_MODE,%ax; |
|
- | 371 | int $0x10; |
|
- | 372 | pop %di; |
|
- | 373 | cmp $VESA_OK,%al; |
|
- | 374 | jnz 0f; |
|
- | 375 | ||
- | 376 | mov VESA_MODE_PHADDR_OFFSET(%di),%esi; |
|
- | 377 | mov VESA_MODE_WIDTH_OFFSET(%di),%ax; |
|
- | 378 | shl $16,%eax; |
|
- | 379 | mov VESA_MODE_HEIGHT_OFFSET(%di),%ax; |
|
- | 380 | mov VESA_MODE_BPP_OFFSET(%di),%bl; |
|
- | 381 | xor %bh,%bh; |
|
- | 382 | shl $16,%ebx; |
|
- | 383 | mov VESA_MODE_SCANLINE_OFFSET(%di),%bx; |
|
- | 384 | mov %eax,%edi; |
|
- | 385 | ||
- | 386 | ||
- | 387 | ||
- | 388 | 8: |
|
- | 389 | ||
- | 390 | mov %cr0,%eax; |
|
- | 391 | or $1,%eax; |
|
- | 392 | mov %eax,%cr0; |
|
- | 393 | ||
- | 394 | jmp 9f; |
|
- | 395 | 9: |
|
- | 396 | ||
- | 397 | pop %cx; |
|
- | 398 | pop %ebp; |
|
- | 399 | pop %gs; |
|
- | 400 | pop %fs; |
|
- | 401 | pop %es; |
|
- | 402 | pop %ds; |
|
- | 403 | mov %cx,%ss; |
|
- | 404 | mov %ebp,%esp; |
|
- | 405 | ||
- | 406 | ljmpl $KTEXT,$(vesa_init_protect-vesa_init+VESA_INIT_SEGMENT<<4); |
|
- | 407 | ||
- | 408 | vesa_init_protect: |
|
- | 409 | .code32 |
|
- | 410 | ret; |
|
- | 411 | ||
- | 412 | 0: #Error no Prefered mode found |
|
- | 413 | ||
- | 414 | mov $0x111,%cx; |
|
- | 415 | push %di; |
|
- | 416 | push %cx; |
|
- | 417 | mov $VESA_GET_MODE_INFO,%ax; |
|
- | 418 | int $0x10; |
|
- | 419 | pop %cx; |
|
- | 420 | pop %di; |
|
- | 421 | cmp $VESA_OK,%al; |
|
- | 422 | jnz 1f; |
|
- | 423 | jmp 2b; |
|
- | 424 | ||
- | 425 | 1:mov $0x0003,%ax; |
|
- | 426 | int $0x10; |
|
- | 427 | mov $0xffffffff,%edi; /* EGA text mode used, because of problems with VESA */ |
|
- | 428 | jmp 8; |
|
- | 429 | ||
- | 430 | ||
- | 431 | vesa_idt: |
|
- | 432 | .word 0x03ff |
|
- | 433 | .long 0 |
|
- | 434 | .align 4 |
|
- | 435 | e_vesa_init: |
|
- | 436 | #endif |
|
- | 437 | ||
- | 438 | ||
233 | 439 | ||
234 | .section K_DATA_START, "aw", @progbits |
440 | .section K_DATA_START, "aw", @progbits |
235 | 441 | ||
- | 442 | ||
- | 443 | ||
236 | .align 4096 |
444 | .align 4096 |
237 | page_directory: |
445 | page_directory: |
238 | .space 4096, 0 |
446 | .space 4096, 0 |