Changeset 22cf454d in mainline for arch/ia32/src/boot/boot.S
- Timestamp:
- 2006-05-05T10:32:21Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e3c762cd
- Parents:
- bdc5c516
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
arch/ia32/src/boot/boot.S
rbdc5c516 r22cf454d 35 35 #define START_STACK (BOOT_OFFSET - BOOT_STACK_SIZE) 36 36 37 38 39 40 41 42 43 44 37 45 .section K_TEXT_START, "ax" 38 46 … … 69 77 pushl %ebx # save parameters from GRUB 70 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 98 call map_kernel # map kernel and turn paging on … … 231 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 440 .section K_DATA_START, "aw", @progbits 441 442 235 443 236 444 .align 4096
Note:
See TracChangeset
for help on using the changeset viewer.