Changeset 8778271 in mainline
- Timestamp:
- 2006-06-07T10:30:35Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 06a583e
- Parents:
- ff133e2
- Location:
- arch
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
arch/amd64/src/boot/boot.S
rff133e2 r8778271 74 74 75 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); 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 jmpl *%edi 84 85 vesa_meeting_point: 86 87 mov %esi, KA2PA(vesa_ph_addr) 88 mov %di, KA2PA(vesa_height) 89 shr $16, %edi 90 mov %di, KA2PA(vesa_width) 91 mov %bx, KA2PA(vesa_scanline) 92 shr $16, %ebx 93 mov %bx, KA2PA(vesa_bpp) 91 94 #endif 92 95 … … 275 278 .code32 276 279 vesa_init: 277 jmp $gdtselector(VESA_INIT_DES),$vesa_init_real-vesa_init; 280 jmp $gdtselector(VESA_INIT_DES), $vesa_init_real - vesa_init 281 278 282 .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 283 vesa_init_real: 284 285 mov %cr0, %eax 286 and $~1, %eax 287 mov %eax, %cr0 288 289 jmp $VESA_INIT_SEGMENT, $vesa_init_real2 - vesa_init 290 291 vesa_init_real2: 292 293 mov $VESA_INIT_SEGMENT, %bx 294 295 mov %bx, %es 296 mov %bx, %fs 297 mov %bx, %gs 298 mov %bx, %ds 299 mov %bx, %ss 300 301 movl $0x0000fffc, %esp 302 movl $0x0000fffc, %ebp 303 312 304 #define VESA_INFO_SIZE 1024 313 305 314 #define VESA_MODE_LIST_PTR_OFFSET 14 306 #define VESA_MODE_LIST_PTR_OFFSET 14 315 307 #define VESA_MODE_WIDTH_OFFSET 18 316 308 #define VESA_MODE_HEIGHT_OFFSET 20 … … 319 311 #define VESA_MODE_PHADDR_OFFSET 40 320 312 321 #define VESA_END_OF_MODES 0xffff 322 323 #define VESA_OK 0x4f 324 325 #define VESA_GET_INFO 0x4f00 313 #define VESA_END_OF_MODES 0xffff 314 315 #define VESA_OK 0x4f 316 317 #define VESA_GET_INFO 0x4f00 326 318 #define VESA_GET_MODE_INFO 0x4f01 327 319 #define VESA_SET_MODE 0x4f02 … … 329 321 #define CONFIG_VESA_BPP_a 255 330 322 331 #if CONFIG_VESA_BPP ==24323 #if CONFIG_VESA_BPP == 24 332 324 #undef CONFIG_VESA_BPP_a 333 325 #define CONFIG_VESA_BPP_a 32 334 326 #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 327 328 mov $VESA_GET_INFO, %ax 329 mov $e_vesa_init - vesa_init, %di 330 push %di 331 int $0x10 332 333 pop %di 334 cmp $VESA_OK, %al 335 jnz 0f 336 337 mov 2 + VESA_MODE_LIST_PTR_OFFSET(%di), %si 338 mov %si, %gs 339 mov VESA_MODE_LIST_PTR_OFFSET(%di), %si 340 341 add $VESA_INFO_SIZE, %di 342 350 343 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 344 mov %gs:(%si), %cx 345 cmp $VESA_END_OF_MODES, %cx 346 jz 0f 347 348 inc %si 349 inc %si 350 push %cx 351 push %di 352 push %si 353 mov $VESA_GET_MODE_INFO, %ax 354 int $0x10 355 356 pop %si 357 pop %di 358 pop %cx 359 cmp $VESA_OK, %al 360 jnz 0f 361 362 mov $CONFIG_VESA_WIDTH, %ax 363 cmp VESA_MODE_WIDTH_OFFSET(%di), %ax 364 jnz 1b 365 366 mov $CONFIG_VESA_HEIGHT, %ax 367 cmp VESA_MODE_HEIGHT_OFFSET(%di), %ax 368 jnz 1b 369 370 mov $CONFIG_VESA_BPP, %al 371 cmp VESA_MODE_BPP_OFFSET(%di), %al 372 jz 2f 373 374 mov $CONFIG_VESA_BPP_a, %al 375 cmp VESA_MODE_BPP_OFFSET(%di), %al 376 jnz 1b 377 381 378 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; 379 380 mov %cx, %bx 381 or $0xc000, %bx 382 push %di 383 mov $VESA_SET_MODE, %ax 384 int $0x10 385 386 pop %di 387 cmp $VESA_OK, %al 388 jnz 0f 389 390 mov VESA_MODE_PHADDR_OFFSET(%di), %esi 391 mov VESA_MODE_WIDTH_OFFSET(%di), %ax 392 shl $16, %eax 393 mov VESA_MODE_HEIGHT_OFFSET(%di), %ax 394 mov VESA_MODE_BPP_OFFSET(%di), %bl 395 xor %bh, %bh 396 shl $16, %ebx 397 mov VESA_MODE_SCANLINE_OFFSET(%di), %bx 398 mov %eax, %edi 399 400 8: 401 402 mov %cr0, %eax 403 or $1, %eax 404 mov %eax, %cr0 405 406 jmp 9f 411 407 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 425 0:#Error no Prefered mode found 426 mov $0x111,%cx; 427 push %di; 428 push %cx; 429 mov $VESA_GET_MODE_INFO,%ax; 430 int $0x10; 431 pop %cx; 432 pop %di; 433 cmp $VESA_OK,%al; 434 jnz 1f; 435 jz 2b; /* Force relative jump */ 436 437 438 1:mov $0x0003,%ax; 439 int $0x10; 440 mov $0xffffffff,%edi; /* EGA text mode used, because of problems with VESA */ 441 xor %ax,%ax 442 jz 8b; /* Force relative jump */ 443 444 445 vesa_init_protect: 408 409 ljmpl $gdtselector(KTEXT32_DES), $(vesa_init_protect - vesa_init + VESA_INIT_SEGMENT << 4) 410 411 0:# No prefered mode found 412 mov $0x111, %cx 413 push %di 414 push %cx 415 mov $VESA_GET_MODE_INFO, %ax 416 int $0x10 417 418 pop %cx 419 pop %di 420 cmp $VESA_OK, %al 421 jnz 1f 422 jz 2b # Force relative jump 423 424 1: 425 mov $0x0003, %ax 426 int $0x10 427 mov $0xffffffff, %edi # EGA text mode used, because of problems with VESA 428 xor %ax, %ax 429 jz 8b # Force relative jump 430 431 446 432 .code32 447 ret; 448 449 450 vesa_idt: 451 .word 0x03ff 452 .long 0 433 vesa_init_protect: 434 movw $gdtselector(KDATA_DES), %cx 435 movw %cx, %es 436 movw %cx, %ds # kernel data + stack 437 movw %cx, %ss 438 # Simics seems to remove hidden part of GS on entering user mode 439 # when _visible_ part of GS does not point to user-mode segment 440 movw $gdtselector(UDATA_DES), %cx 441 movw %cx, %fs 442 movw %cx, %gs 443 444 jmpl $gdtselector(KTEXT32_DES), $vesa_meeting_point 445 453 446 .align 4 454 447 e_vesa_init: 455 448 #endif 456 457 458 449 459 450 .section K_DATA_START, "aw", @progbits -
arch/ia32/src/boot/boot.S
rff133e2 r8778271 380 380 mov %cr0, %eax 381 381 or $1, %eax 382 mov %eax, %cr0382 mov %eax, %cr0 383 383 384 384 jmp 9f
Note:
See TracChangeset
for help on using the changeset viewer.