Changeset da52547 in mainline for kernel/arch/amd64/src/asm.S
- Timestamp:
- 2010-07-02T10:16:38Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b5382d4f
- Parents:
- ad8f03d2
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/amd64/src/asm.S
rad8f03d2 rda52547 64 64 .global memcpy_from_uspace_failover_address 65 65 .global memcpy_to_uspace_failover_address 66 .global early_putchar 66 67 67 68 /* Wrapper for generic memsetb */ … … 339 340 sysretq 340 341 342 /** Print Unicode character to EGA display. 343 * 344 * If CONFIG_EGA is undefined or CONFIG_FB is defined 345 * then this function does nothing. 346 * 347 * Since the EGA can only display Extended ASCII (usually 348 * ISO Latin 1) characters, some of the Unicode characters 349 * can be displayed in a wrong way. Only the newline character 350 * is interpreted, all other characters (even unprintable) are 351 * printed verbatim. 352 * 353 * @param %rdi Unicode character to be printed. 354 * 355 */ 356 early_putchar: 357 358 #if ((defined(CONFIG_EGA)) && (!defined(CONFIG_FB))) 359 360 /* Prologue, save preserved registers */ 361 pushq %rbp 362 movq %rsp, %rbp 363 pushq %rbx 364 365 movq %rdi, %rsi 366 movq $(PA2KA(0xb8000)), %rdi /* base of EGA text mode memory */ 367 xorq %rax, %rax 368 369 /* Read bits 8 - 15 of the cursor address */ 370 movw $0x3d4, %dx 371 movb $0xe, %al 372 outb %al, %dx 373 374 movw $0x3d5, %dx 375 inb %dx, %al 376 shl $8, %ax 377 378 /* Read bits 0 - 7 of the cursor address */ 379 movw $0x3d4, %dx 380 movb $0xf, %al 381 outb %al, %dx 382 383 movw $0x3d5, %dx 384 inb %dx, %al 385 386 /* Sanity check for the cursor on screen */ 387 cmp $2000, %ax 388 jb early_putchar_cursor_ok 389 390 movw $1998, %ax 391 392 early_putchar_cursor_ok: 393 394 movw %ax, %bx 395 shl $1, %rax 396 addq %rax, %rdi 397 398 movq %rsi, %rax 399 400 cmp $0x0a, %al 401 jne early_putchar_print 402 403 /* Interpret newline */ 404 405 movw %bx, %ax /* %bx -> %dx:%ax */ 406 xorw %dx, %dx 407 408 movw $80, %cx 409 idivw %cx, %ax /* %dx = %bx % 80 */ 410 411 /* %bx <- %bx + 80 - (%bx % 80) */ 412 addw %cx, %bx 413 subw %dx, %bx 414 415 jmp early_putchar_newline 416 417 early_putchar_print: 418 419 /* Print character */ 420 421 movb $0x0e, %ah /* black background, yellow foreground */ 422 stosw 423 424 early_putchar_newline: 425 426 /* Sanity check for the cursor on the last line */ 427 inc %bx 428 cmp $2000, %bx 429 jb early_putchar_no_scroll 430 431 /* Scroll the screen (24 rows) */ 432 movq $(PA2KA(0xb80a0)), %rsi 433 movq $(PA2KA(0xb8000)), %rdi 434 movq $1920, %rcx 435 rep movsw 436 437 /* Clear the 24th row */ 438 xorq %rax, %rax 439 movq $80, %rcx 440 rep stosw 441 442 /* Go to row 24 */ 443 movw $1920, %bx 444 445 early_putchar_no_scroll: 446 447 /* Write bits 8 - 15 of the cursor address */ 448 movw $0x3d4, %dx 449 movb $0xe, %al 450 outb %al, %dx 451 452 movw $0x3d5, %dx 453 movb %bh, %al 454 outb %al, %dx 455 456 /* Write bits 0 - 7 of the cursor address */ 457 movw $0x3d4, %dx 458 movb $0xf, %al 459 outb %al, %dx 460 461 movw $0x3d5, %dx 462 movb %bl, %al 463 outb %al, %dx 464 465 /* Epilogue, restore preserved registers */ 466 popq %rbx 467 leave 468 469 #endif 470 471 ret 472 341 473 .data 342 474 .global interrupt_handler_size
Note:
See TracChangeset
for help on using the changeset viewer.