Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/amd64/src/asm.S

    r1b20da0 ra35b458  
    6060FUNCTION_BEGIN(memcpy_to_uspace)
    6161        movq MEMCPY_DST, %rax
    62        
     62
    6363        movq MEMCPY_SIZE, %rcx
    6464        shrq $3, %rcx           /* size / 8 */
    65        
     65
    6666        rep movsq               /* copy as much as possible word by word */
    67        
     67
    6868        movq MEMCPY_SIZE, %rcx
    6969        andq $7, %rcx           /* size % 8 */
    7070        jz 0f
    71        
     71
    7272        rep movsb               /* copy the rest byte by byte */
    73        
     73
    7474        0:
    7575                ret                 /* return MEMCPY_SRC, success */
     
    9292        popq %rax
    9393        movq %rax, %rdx
    94        
     94
    9595        /* Flip the ID bit */
    9696        xorl $RFLAGS_ID, %edx
    97        
     97
    9898        /* Store RFLAGS */
    9999        pushq %rdx
    100100        popfq
    101101        pushfq
    102        
     102
    103103        /* Get the ID bit again */
    104104        popq %rdx
    105105        andl $RFLAGS_ID, %eax
    106106        andl $RFLAGS_ID, %edx
    107        
     107
    108108        /* 0 if not supported, 1 if supported */
    109109        xorl %edx, %eax
     
    114114        /* Preserve %rbx across function calls */
    115115        movq %rbx, %r10
    116        
     116
    117117        /* Load the command into %eax */
    118118        movl %edi, %eax
    119        
     119
    120120        cpuid
    121121        movl %eax, 0(%rsi)
     
    123123        movl %ecx, 8(%rsi)
    124124        movl %edx, 12(%rsi)
    125        
     125
    126126        movq %r10, %rbx
    127127        ret
     
    161161         * code.
    162162         */
    163        
     163
    164164        .iflt \i-32
    165165                .if (1 << \i) & ERROR_WORD_INTERRUPT_LIST
     
    180180                subq $(ISTATE_SOFT_SIZE + 8), %rsp
    181181        .endif
    182        
     182
    183183        /*
    184184         * Save the general purpose registers.
     
    230230        movq $(\i), %rdi   /* pass intnum in the first argument */
    231231        movq %rsp, %rsi    /* pass istate address in the second argument */
    232        
     232
    233233        cld
    234234
     
    250250        movq ISTATE_OFFSET_R10(%rsp), %r10
    251251        movq ISTATE_OFFSET_R11(%rsp), %r11
    252        
     252
    253253        /* $8 = Skip error word */
    254254        addq $(ISTATE_SOFT_SIZE + 8), %rsp
     
    288288        /* Switch to hidden %gs */
    289289        swapgs
    290        
     290
    291291        movq %rsp, %gs:KSEG_OFFSET_USTACK_RSP  /* save this thread's user RSP */
    292292        movq %gs:KSEG_OFFSET_KSTACK_RSP, %rsp  /* set this thread's kernel RSP */
     
    346346        swapgs
    347347        sti
    348        
     348
    349349        /* Copy the 4th argument where it is expected  */
    350350        movq %r10, %rcx
     
    364364
    365365        cli
    366        
     366
    367367        /*
    368368         * Restore registers needed for return via the SYSRET instruction and
     
    394394        callq fault_from_uspace
    395395        /* not reached */
    396        
     396
    397397bad_rip_msg:
    398398        .asciz "Invalid instruction pointer."
     
    414414FUNCTION_BEGIN(early_putchar)
    415415#if ((defined(CONFIG_EGA)) && (!defined(CONFIG_FB)))
    416        
     416
    417417        /* Prologue, save preserved registers */
    418418        pushq %rbp
    419419        movq %rsp, %rbp
    420420        pushq %rbx
    421        
     421
    422422        movq %rdi, %rsi
    423423        movq $(PA2KA(0xb8000)), %rdi  /* base of EGA text mode memory */
    424424        xorl %eax, %eax
    425        
     425
    426426        /* Read bits 8 - 15 of the cursor address */
    427427        movw $0x3d4, %dx
    428428        movb $0xe, %al
    429429        outb %al, %dx
    430        
     430
    431431        movw $0x3d5, %dx
    432432        inb %dx, %al
    433433        shl $8, %ax
    434        
     434
    435435        /* Read bits 0 - 7 of the cursor address */
    436436        movw $0x3d4, %dx
    437437        movb $0xf, %al
    438438        outb %al, %dx
    439        
     439
    440440        movw $0x3d5, %dx
    441441        inb %dx, %al
    442        
     442
    443443        /* Sanity check for the cursor on screen */
    444444        cmp $2000, %ax
    445445        jb early_putchar_cursor_ok
    446        
     446
    447447                movw $1998, %ax
    448        
     448
    449449        early_putchar_cursor_ok:
    450        
     450
    451451        movw %ax, %bx
    452452        shl $1, %rax
    453453        addq %rax, %rdi
    454        
     454
    455455        movq %rsi, %rax
    456        
     456
    457457        cmp $0x0a, %al
    458458        jne early_putchar_backspace
    459        
     459
    460460                /* Interpret newline */
    461                
     461
    462462                movw %bx, %ax  /* %bx -> %dx:%ax */
    463463                xorw %dx, %dx
    464                
     464
    465465                movw $80, %cx
    466466                idivw %cx, %ax  /* %dx = %bx % 80 */
    467                
     467
    468468                /* %bx <- %bx + 80 - (%bx % 80) */
    469469                addw %cx, %bx
    470470                subw %dx, %bx
    471                
     471
    472472                jmp early_putchar_skip
    473        
     473
    474474        early_putchar_backspace:
    475        
     475
    476476                cmp $0x08, %al
    477477                jne early_putchar_print
    478                
     478
    479479                /* Interpret backspace */
    480                
     480
    481481                cmp $0x0000, %bx
    482482                je early_putchar_skip
    483                
     483
    484484                dec %bx
    485485                jmp early_putchar_skip
    486        
     486
    487487        early_putchar_print:
    488        
     488
    489489                /* Print character */
    490                
     490
    491491                movb $0x0e, %ah  /* black background, yellow foreground */
    492492                stosw
    493493                inc %bx
    494        
     494
    495495        early_putchar_skip:
    496        
     496
    497497        /* Sanity check for the cursor on the last line */
    498498        cmp $2000, %bx
    499499        jb early_putchar_no_scroll
    500        
     500
    501501                /* Scroll the screen (24 rows) */
    502502                movq $(PA2KA(0xb80a0)), %rsi
     
    504504                movl $480, %ecx
    505505                rep movsq
    506                
     506
    507507                /* Clear the 24th row */
    508508                xorl %eax, %eax
    509509                movl $20, %ecx
    510510                rep stosq
    511                
     511
    512512                /* Go to row 24 */
    513513                movw $1920, %bx
    514        
     514
    515515        early_putchar_no_scroll:
    516        
     516
    517517        /* Write bits 8 - 15 of the cursor address */
    518518        movw $0x3d4, %dx
    519519        movb $0xe, %al
    520520        outb %al, %dx
    521        
     521
    522522        movw $0x3d5, %dx
    523523        movb %bh, %al
    524524        outb %al, %dx
    525        
     525
    526526        /* Write bits 0 - 7 of the cursor address */
    527527        movw $0x3d4, %dx
    528528        movb $0xf, %al
    529529        outb %al, %dx
    530        
     530
    531531        movw $0x3d5, %dx
    532532        movb %bl, %al
    533533        outb %al, %dx
    534        
     534
    535535        /* Epilogue, restore preserved registers */
    536536        popq %rbx
    537537        leave
    538        
     538
    539539#endif
    540        
     540
    541541        ret
    542542FUNCTION_END(early_putchar)
Note: See TracChangeset for help on using the changeset viewer.