Ignore:
File:
1 edited

Legend:

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

    r1b20da0 ra35b458  
    6363        movl %edi, %edx  /* save %edi */
    6464        movl %esi, %eax  /* save %esi */
    65        
     65
    6666        movl MEMCPY_SIZE(%esp), %ecx
    6767        shrl $2, %ecx  /* size / 4 */
    68        
     68
    6969        movl MEMCPY_DST(%esp), %edi
    7070        movl MEMCPY_SRC(%esp), %esi
    71        
     71
    7272        /* Copy whole words */
    7373        rep movsl
    74        
     74
    7575        movl MEMCPY_SIZE(%esp), %ecx
    7676        andl $3, %ecx  /* size % 4 */
    7777        jz 0f
    78        
     78
    7979        /* Copy the rest byte by byte */
    8080        rep movsb
    81        
     81
    8282        0:
    83        
     83
    8484                movl %edx, %edi
    8585                movl %eax, %esi
    86                
     86
    8787                /* MEMCPY_DST(%esp), success */
    8888                movl MEMCPY_DST(%esp), %eax
     
    9999        movl %edx, %edi
    100100        movl %eax, %esi
    101        
     101
    102102        /* Return 0, failure */
    103103        xorl %eax, %eax
     
    112112        movl %cr0, %edx
    113113        orl $CR0_PG, %edx  /* paging on */
    114        
     114
    115115        /* Clear Cache Disable and not Write Though */
    116116        andl $~(CR0_CD | CR0_NW), %edx
    117117        movl %edx, %cr0
    118118        jmp 0f
    119        
     119
    120120        0:
    121121                ret
     
    174174        movl %edi, ISTATE_OFFSET_EDI(%esp)      /* observability; not needed */
    175175        movl %ebp, ISTATE_OFFSET_EBP(%esp)      /* observability; not needed */
    176        
     176
    177177        /*
    178178         * Fake up the stack trace linkage.
     
    190190        movl $(GDT_SELECTOR(VREG_DES)), %eax
    191191        movl %eax, %gs
    192        
     192
    193193        /*
    194194         * Sanitize EFLAGS.
     
    207207
    208208        call syscall_handler
    209        
     209
    210210        /*
    211211         * Prepare return address and userspace stack for SYSEXIT.
     
    252252        movl %es, %ecx
    253253        movl %ds, %edx
    254                
     254
    255255        movl %ecx, ISTATE_OFFSET_ES(%esp)
    256256        movl %edx, ISTATE_OFFSET_DS(%esp)
     
    264264        movl $(GDT_SELECTOR(VREG_DES)), %eax
    265265        movl %eax, %gs
    266                
     266
    267267        movl $0, ISTATE_OFFSET_EBP_FRAME(%esp)
    268268        movl ISTATE_OFFSET_EIP(%esp), %eax
    269269        movl %eax, ISTATE_OFFSET_EIP_FRAME(%esp)
    270270        leal ISTATE_OFFSET_EBP_FRAME(%esp), %ebp
    271                
     271
    272272        cld
    273                
     273
    274274        /* Call syscall_handler(edx, ecx, ebx, esi, edi, ebp, eax) */
    275275        call syscall_handler
    276                        
     276
    277277        /*
    278278         * Restore the segment registers.
     
    286286        movl ISTATE_OFFSET_ES(%esp), %ecx
    287287        movl ISTATE_OFFSET_DS(%esp), %edx
    288                        
     288
    289289        movl %ecx, %es
    290290        movl %edx, %ds
    291                        
     291
    292292        /*
    293293         * Restore the preserved registers the handler cloberred itself
     
    295295         */
    296296        movl ISTATE_OFFSET_EBP(%esp), %ebp
    297                        
     297
    298298        addl $(ISTATE_SOFT_SIZE + 4), %esp
    299299        iret
    300                
     300
    301301/**
    302302 * Mask for interrupts 0 - 31 (bits 0 - 31) where 0 means that int
     
    333333                subl $(ISTATE_SOFT_SIZE + 4), %esp
    334334        .endif
    335        
     335
    336336        /*
    337337         * Save the general purpose registers.
     
    344344        movl %esi, ISTATE_OFFSET_ESI(%esp)
    345345        movl %ebp, ISTATE_OFFSET_EBP(%esp)
    346        
     346
    347347        /*
    348348         * Save the segment registers.
     
    356356        movl %es, %ecx
    357357        movl %ds, %edx
    358        
     358
    359359        movl %ecx, ISTATE_OFFSET_ES(%esp)
    360360        movl %edx, ISTATE_OFFSET_DS(%esp)
    361        
     361
    362362        /*
    363363         * Switch to kernel selectors.
     
    368368        movl $(GDT_SELECTOR(VREG_DES)), %eax
    369369        movl %eax, %gs
    370        
     370
    371371        /*
    372372         * Imitate a regular stack frame linkage.
     
    387387        movl %eax, ISTATE_OFFSET_EIP_FRAME(%esp)
    388388        leal ISTATE_OFFSET_EBP_FRAME(%esp), %ebp
    389                
     389
    390390        cld
    391                
     391
    392392        pushl %esp   /* pass istate address */
    393393        pushl $(\i)  /* pass intnum */
    394                
     394
    395395        /* Call exc_dispatch(intnum, istate) */
    396396        call exc_dispatch
    397                
     397
    398398        addl $8, %esp  /* clear arguments from the stack */
    399                
     399
    400400        /*
    401401         * Restore the selector registers.
     
    409409        movl ISTATE_OFFSET_ES(%esp), %ecx
    410410        movl ISTATE_OFFSET_DS(%esp), %edx
    411                
     411
    412412        movl %ecx, %es
    413413        movl %edx, %ds
    414                
     414
    415415        /*
    416416         * Restore the scratch registers and the preserved
     
    422422        movl ISTATE_OFFSET_EDX(%esp), %edx
    423423        movl ISTATE_OFFSET_EBP(%esp), %ebp
    424                
     424
    425425        addl $(ISTATE_SOFT_SIZE + 4), %esp
    426426        iret
     
    452452 */
    453453FUNCTION_BEGIN(early_putchar)
    454        
     454
    455455#if ((defined(CONFIG_EGA)) && (!defined(CONFIG_FB)))
    456        
     456
    457457        /* Prologue, save preserved registers */
    458458        pushl %ebp
     
    461461        pushl %esi
    462462        pushl %edi
    463        
     463
    464464        movl $(PA2KA(0xb8000)), %edi  /* base of EGA text mode memory */
    465465        xorl %eax, %eax
    466        
     466
    467467        /* Read bits 8 - 15 of the cursor address */
    468468        movw $0x3d4, %dx
    469469        movb $0xe, %al
    470470        outb %al, %dx
    471        
     471
    472472        movw $0x3d5, %dx
    473473        inb %dx, %al
    474474        shl $8, %ax
    475        
     475
    476476        /* Read bits 0 - 7 of the cursor address */
    477477        movw $0x3d4, %dx
    478478        movb $0xf, %al
    479479        outb %al, %dx
    480        
     480
    481481        movw $0x3d5, %dx
    482482        inb %dx, %al
    483        
     483
    484484        /* Sanity check for the cursor on screen */
    485485        cmp $2000, %ax
    486486        jb early_putchar_cursor_ok
    487        
     487
    488488                movw $1998, %ax
    489        
     489
    490490        early_putchar_cursor_ok:
    491        
     491
    492492        movw %ax, %bx
    493493        shl $1, %eax
    494494        addl %eax, %edi
    495        
     495
    496496        movl 0x08(%ebp), %eax
    497        
     497
    498498        cmp $0x0a, %al
    499499        jne early_putchar_backspace
    500        
     500
    501501                /* Interpret newline */
    502                
     502
    503503                movw %bx, %ax  /* %bx -> %dx:%ax */
    504504                xorw %dx, %dx
    505                
     505
    506506                movw $80, %cx
    507507                idivw %cx, %ax  /* %dx = %bx % 80 */
    508                
     508
    509509                /* %bx <- %bx + 80 - (%bx % 80) */
    510510                addw %cx, %bx
    511511                subw %dx, %bx
    512                
     512
    513513                jmp early_putchar_skip
    514        
     514
    515515        early_putchar_backspace:
    516        
     516
    517517                cmp $0x08, %al
    518518                jne early_putchar_print
    519                
     519
    520520                /* Interpret backspace */
    521                
     521
    522522                cmp $0x0000, %bx
    523523                je early_putchar_skip
    524                
     524
    525525                dec %bx
    526526                jmp early_putchar_skip
    527        
     527
    528528        early_putchar_print:
    529        
     529
    530530                /* Print character */
    531                
     531
    532532                movb $0x0e, %ah  /* black background, yellow foreground */
    533533                stosw
    534534                inc %bx
    535        
     535
    536536        early_putchar_skip:
    537        
     537
    538538        /* Sanity check for the cursor on the last line */
    539539        cmp $2000, %bx
    540540        jb early_putchar_no_scroll
    541        
     541
    542542                /* Scroll the screen (24 rows) */
    543543                movl $(PA2KA(0xb80a0)), %esi
     
    545545                movl $960, %ecx
    546546                rep movsl
    547                
     547
    548548                /* Clear the 24th row */
    549549                xorl %eax, %eax
    550550                movl $40, %ecx
    551551                rep stosl
    552                
     552
    553553                /* Go to row 24 */
    554554                movw $1920, %bx
    555        
     555
    556556        early_putchar_no_scroll:
    557        
     557
    558558        /* Write bits 8 - 15 of the cursor address */
    559559        movw $0x3d4, %dx
    560560        movb $0xe, %al
    561561        outb %al, %dx
    562        
     562
    563563        movw $0x3d5, %dx
    564564        movb %bh, %al
    565565        outb %al, %dx
    566        
     566
    567567        /* Write bits 0 - 7 of the cursor address */
    568568        movw $0x3d4, %dx
    569569        movb $0xf, %al
    570570        outb %al, %dx
    571        
     571
    572572        movw $0x3d5, %dx
    573573        movb %bl, %al
    574574        outb %al, %dx
    575        
     575
    576576        /* Epilogue, restore preserved registers */
    577577        popl %edi
     
    579579        popl %ebx
    580580        leave
    581        
     581
    582582#endif
    583        
     583
    584584        ret
    585585FUNCTION_END(early_putchar)
Note: See TracChangeset for help on using the changeset viewer.