Changeset 8565a42 in mainline for kernel/arch/ia32/src/boot


Ignore:
Timestamp:
2018-03-02T20:34:50Z (8 years ago)
Author:
GitHub <noreply@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a1a81f69, d5e5fd1
Parents:
3061bc1 (diff), 34e1206 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:34:50)
git-committer:
GitHub <noreply@…> (2018-03-02 20:34:50)
Message:

Remove all trailing whitespace, everywhere.

See individual commit messages for details.

Location:
kernel/arch/ia32/src/boot
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/ia32/src/boot/multiboot.S

    r3061bc1 r8565a42  
    7777        cli
    7878        cld
    79        
     79
    8080        /* Initialize stack pointer */
    8181        movl $START_STACK, %esp
    82        
     82
    8383        /*
    8484         * Initialize Global Descriptor Table and
     
    8787        lgdtl bootstrap_gdtr
    8888        lidtl bootstrap_idtr
    89        
     89
    9090        /* Kernel data + stack */
    9191        movw $GDT_SELECTOR(KDATA_DES), %cx
     
    9595        movw %cx, %ds
    9696        movw %cx, %ss
    97        
     97
    9898        jmpl $GDT_SELECTOR(KTEXT_DES), $multiboot_meeting_point
    9999        multiboot_meeting_point:
    100        
     100
    101101        /* Save multiboot arguments */
    102102        movl %eax, multiboot_eax
    103103        movl %ebx, multiboot_ebx
    104        
     104
    105105        pm_status $status_prot
    106        
     106
    107107#include "vesa_prot.inc"
    108        
     108
    109109#ifndef PROCESSOR_i486
    110        
     110
    111111        pm_status $status_prot2
    112        
     112
    113113        movl $(INTEL_CPUID_LEVEL), %eax
    114114        cpuid
    115115        cmp $0x0, %eax  /* any function > 0? */
    116116        jbe pse_unsupported
    117        
     117
    118118        movl $(INTEL_CPUID_STANDARD), %eax
    119119        cpuid
    120120        bt $(INTEL_PSE), %edx
    121121        jnc pse_unsupported
    122                
     122
    123123                /* Map kernel and turn paging on */
    124124                pm_status $status_pse
    125125                call map_kernel_pse
    126126                jmp stack_init
    127        
     127
    128128#endif /* PROCESSOR_i486 */
    129        
     129
    130130        pse_unsupported:
    131                
     131
    132132                /* Map kernel and turn paging on */
    133133                pm_status $status_non_pse
    134134                call map_kernel_non_pse
    135        
     135
    136136        stack_init:
    137        
     137
    138138        /* Create the first stack frame */
    139139        pushl $0
    140140        movl %esp, %ebp
    141        
     141
    142142        pm2_status $status_prot3
    143        
     143
    144144        /* Call ia32_pre_main(multiboot_eax, multiboot_ebx) */
    145145        pushl multiboot_ebx
    146146        pushl multiboot_eax
    147147        call ia32_pre_main
    148        
     148
    149149        pm2_status $status_main
    150        
     150
    151151        /* Call main_bsp() */
    152152        call main_bsp
    153        
     153
    154154        /* Not reached */
    155155        cli
     
    170170        andl $~CR4_PAE, %ecx    /* PAE off */
    171171        movl %ecx, %cr4
    172        
     172
    173173        movl $(page_directory + 0), %esi
    174174        movl $(page_directory + 2048), %edi
    175175        xorl %ecx, %ecx
    176176        xorl %ebx, %ebx
    177        
     177
    178178        floop_pse:
    179179                movl $(PDE_4M | PDE_RW | PDE_P), %eax
     
    184184                movl %eax, (%edi, %ecx, 4)
    185185                addl $(4 * 1024 * 1024), %ebx
    186                
     186
    187187                incl %ecx
    188188                cmpl $512, %ecx
    189189                jl floop_pse
    190        
     190
    191191        movl %esi, %cr3
    192        
     192
    193193        movl %cr0, %ebx
    194194        orl $CR0_PG, %ebx       /* paging on */
     
    208208        andl $~CR4_PAE, %ecx  /* PAE off */
    209209        movl %ecx, %cr4
    210        
     210
    211211        call calc_kernel_end
    212212        call find_mem_for_pt
    213        
     213
    214214        mov kernel_end, %esi
    215215        mov free_area, %ecx
    216        
     216
    217217        cmpl %esi, %ecx
    218218        jbe use_kernel_end
    219                
     219
    220220                mov %ecx, %esi
    221                
     221
    222222                /* Align address down to 4k */
    223223                andl $(~(PAGE_SIZE - 1)), %esi
    224                
     224
    225225        use_kernel_end:
    226                
     226
    227227                /* Align address to 4k */
    228228                addl $(PAGE_SIZE - 1), %esi
    229229                andl $(~(PAGE_SIZE - 1)), %esi
    230                
     230
    231231                /* Allocate space for page tables */
    232232                movl %esi, pt_loc
    233233                movl $KA2PA(ballocs), %edi
    234                
     234
    235235                movl %esi, (%edi)
    236236                addl $4, %edi
    237237                movl $(2 * 1024 * 1024), (%edi)
    238                
     238
    239239                /* Fill page tables */
    240240                xorl %ecx, %ecx
    241241                xorl %ebx, %ebx
    242                
     242
    243243                floop_pt:
    244244                        movl $(PTE_RW | PTE_P), %eax
     
    246246                        movl %eax, (%esi, %ecx, 4)
    247247                        addl $PAGE_SIZE, %ebx
    248                        
     248
    249249                        incl %ecx
    250250                        cmpl $(512 * 1024), %ecx
    251                        
     251
    252252                        jl floop_pt
    253                
     253
    254254                /* Fill page directory */
    255255                movl $(page_directory + 0), %esi
     
    257257                xorl %ecx, %ecx
    258258                movl pt_loc, %ebx
    259                
     259
    260260                floop:
    261261                        movl $(PDE_RW | PDE_P), %eax
    262262                        orl %ebx, %eax
    263                        
     263
    264264                        /* Mapping 0x00000000 + %ecx * 4M => 0x00000000 + %ecx * 4M */
    265265                        movl %eax, (%esi, %ecx, 4)
    266                        
     266
    267267                        /* Mapping 0x80000000 + %ecx * 4M => 0x00000000 + %ecx * 4M */
    268268                        movl %eax, (%edi, %ecx, 4)
    269269                        addl $PAGE_SIZE, %ebx
    270                        
     270
    271271                        incl %ecx
    272272                        cmpl $512, %ecx
    273                        
     273
    274274                        jl floop
    275                
     275
    276276                movl %esi, %cr3
    277                
     277
    278278                movl %cr0, %ebx
    279279                orl $CR0_PG, %ebx  /* paging on */
    280280                movl %ebx, %cr0
    281                
     281
    282282                ret
    283283FUNCTION_END(map_kernel_non_pse)
     
    288288        movl (%edi), %esi
    289289        leal KA2PA(0)(%esi), %esi
    290        
     290
    291291        movl $KA2PA(hardcoded_ktext_size), %edi
    292292        addl (%edi), %esi
    293293        leal KA2PA(0)(%esi), %esi
    294        
     294
    295295        movl $KA2PA(hardcoded_kdata_size), %edi
    296296        addl (%edi), %esi
    297297        leal KA2PA(0)(%esi), %esi
    298298        movl %esi, kernel_end
    299        
     299
    300300        ret
    301301
     
    305305        cmpl $MULTIBOOT_LOADER_MAGIC, multiboot_eax
    306306        je check_multiboot_map
    307                
     307
    308308                ret
    309        
     309
    310310        check_multiboot_map:
    311                
     311
    312312                /* Copy address of the multiboot info to ebx */
    313313                movl multiboot_ebx, %ebx
    314                
     314
    315315                /* Check if memory map flag is present */
    316316                movl (%ebx), %edx
    317317                andl $MULTIBOOT_INFO_FLAGS_MMAP, %edx
    318318                jnz use_multiboot_map
    319                        
     319
    320320                        ret
    321                
     321
    322322        use_multiboot_map:
    323                
     323
    324324                /* Copy address of the memory map to edx */
    325325                movl MULTIBOOT_INFO_OFFSET_MMAP_ADDR(%ebx), %edx
    326326                movl %edx, %ecx
    327                
     327
    328328                addl MULTIBOOT_INFO_OFFSET_MMAP_LENGTH(%ebx), %ecx
    329                
     329
    330330                /* Find a free region at least 2M in size */
    331331                check_memmap_loop:
    332                        
     332
    333333                        /* Is this a free region? */
    334334                        cmpl $MEMMAP_MEMORY_AVAILABLE, MULTIBOOT_MEMMAP_OFFSET_MM_INFO + E820MEMMAP_OFFSET_TYPE(%edx)
    335335                        jnz next_region
    336                        
     336
    337337                        /* Check size */
    338338                        cmpl $0, MULTIBOOT_MEMMAP_OFFSET_MM_INFO + E820MEMMAP_OFFSET_SIZE + 4(%edx)
     
    340340                        cmpl $(2 * 1024 * 1024 + PAGE_SIZE), MULTIBOOT_MEMMAP_OFFSET_MM_INFO + E820MEMMAP_OFFSET_SIZE(%edx)
    341341                        jbe next_region
    342                        
     342
    343343                        cmpl $0, MULTIBOOT_MEMMAP_OFFSET_MM_INFO + E820MEMMAP_OFFSET_BASE_ADDRESS + 4(%edx)
    344344                        jz found_region
    345                
     345
    346346                next_region:
    347                        
     347
    348348                        cmp %ecx, %edx
    349349                        jbe next_region_do
    350                        
     350
    351351                                ret
    352                
     352
    353353                next_region_do:
    354                        
     354
    355355                        addl MULTIBOOT_MEMMAP_OFFSET_SIZE(%edx), %edx
    356356                        addl $MULTIBOOT_MEMMAP_SIZE_SIZE, %edx
    357357                        jmp check_memmap_loop
    358                        
     358
    359359                found_region:
    360                        
     360
    361361                        /* Use end of the found region */
    362362                        mov MULTIBOOT_MEMMAP_OFFSET_MM_INFO + E820MEMMAP_OFFSET_BASE_ADDRESS(%edx), %ecx
     
    364364                        sub $(2 * 1024 * 1024), %ecx
    365365                        mov %ecx, free_area
    366                        
     366
    367367                        ret
    368368
     
    381381        movl $0xb8000, %edi  /* base of EGA text mode memory */
    382382        xorl %eax, %eax
    383        
     383
    384384        /* Read bits 8 - 15 of the cursor address */
    385385        movw $0x3d4, %dx
    386386        movb $0xe, %al
    387387        outb %al, %dx
    388        
     388
    389389        movw $0x3d5, %dx
    390390        inb %dx, %al
    391391        shl $8, %ax
    392        
     392
    393393        /* Read bits 0 - 7 of the cursor address */
    394394        movw $0x3d4, %dx
    395395        movb $0xf, %al
    396396        outb %al, %dx
    397        
     397
    398398        movw $0x3d5, %dx
    399399        inb %dx, %al
    400        
     400
    401401        /* Sanity check for the cursor on screen */
    402402        cmp $2000, %ax
    403403        jb err_cursor_ok
    404        
     404
    405405                movw $1998, %ax
    406        
     406
    407407        err_cursor_ok:
    408        
     408
    409409        movw %ax, %bx
    410410        shl $1, %eax
    411411        addl %eax, %edi
    412        
     412
    413413        err_ploop:
    414414                lodsb
    415                
     415
    416416                cmp $0, %al
    417417                je err_ploop_end
    418                
     418
    419419                movb $0x0c, %ah  /* black background, light red foreground */
    420420                stosw
    421                
     421
    422422                /* Sanity check for the cursor on the last line */
    423423                inc %bx
    424424                cmp $2000, %bx
    425425                jb err_ploop
    426                
     426
    427427                /* Scroll the screen (24 rows) */
    428428                movl %esi, %edx
     
    431431                movl $960, %ecx
    432432                rep movsl
    433                
     433
    434434                /* Clear the 24th row */
    435435                xorl %eax, %eax
    436436                movl $40, %ecx
    437437                rep stosl
    438                
     438
    439439                /* Go to row 24 */
    440440                movl %edx, %esi
    441441                movl $0xb8f00, %edi
    442442                movw $1920, %bx
    443                
     443
    444444                jmp err_ploop
    445445        err_ploop_end:
    446        
     446
    447447        /* Write bits 8 - 15 of the cursor address */
    448448        movw $0x3d4, %dx
    449449        movb $0xe, %al
    450450        outb %al, %dx
    451        
     451
    452452        movw $0x3d5, %dx
    453453        movb %bh, %al
    454454        outb %al, %dx
    455        
     455
    456456        /* Write bits 0 - 7 of the cursor address */
    457457        movw $0x3d4, %dx
    458458        movb $0xf, %al
    459459        outb %al, %dx
    460        
     460
    461461        movw $0x3d5, %dx
    462462        movb %bl, %al
    463463        outb %al, %dx
    464        
     464
    465465        cli
    466466        hlt1:
     
    486486        pushl %edx
    487487        pushl %edi
    488        
     488
    489489        movl $0xb8000, %edi  /* base of EGA text mode memory */
    490490        xorl %eax, %eax
    491        
     491
    492492        /* Read bits 8 - 15 of the cursor address */
    493493        movw $0x3d4, %dx
    494494        movb $0xe, %al
    495495        outb %al, %dx
    496        
     496
    497497        movw $0x3d5, %dx
    498498        inb %dx, %al
    499499        shl $8, %ax
    500        
     500
    501501        /* Read bits 0 - 7 of the cursor address */
    502502        movw $0x3d4, %dx
    503503        movb $0xf, %al
    504504        outb %al, %dx
    505        
     505
    506506        movw $0x3d5, %dx
    507507        inb %dx, %al
    508        
     508
    509509        /* Sanity check for the cursor on screen */
    510510        cmp $2000, %ax
    511511        jb pm_puts_cursor_ok
    512        
     512
    513513                movw $1998, %ax
    514        
     514
    515515        pm_puts_cursor_ok:
    516        
     516
    517517        movw %ax, %bx
    518518        shl $1, %eax
    519519        addl %eax, %edi
    520        
     520
    521521        pm_puts_ploop:
    522522                lodsb
    523                
     523
    524524                cmp $0, %al
    525525                je pm_puts_ploop_end
    526                
     526
    527527                movb $0x0a, %ah  /* black background, light green foreground */
    528528                stosw
    529                
     529
    530530                /* Sanity check for the cursor on the last line */
    531531                inc %bx
    532532                cmp $2000, %bx
    533533                jb pm_puts_ploop
    534                
     534
    535535                /* Scroll the screen (24 rows) */
    536536                movl %esi, %edx
     
    539539                movl $960, %ecx
    540540                rep movsl
    541                
     541
    542542                /* Clear the 24th row */
    543543                xorl %eax, %eax
    544544                movl $40, %ecx
    545545                rep stosl
    546                
     546
    547547                /* Go to row 24 */
    548548                movl %edx, %esi
    549549                movl $0xb8f00, %edi
    550550                movw $1920, %bx
    551                
     551
    552552                jmp pm_puts_ploop
    553553        pm_puts_ploop_end:
    554        
     554
    555555        /* Write bits 8 - 15 of the cursor address */
    556556        movw $0x3d4, %dx
    557557        movb $0xe, %al
    558558        outb %al, %dx
    559        
     559
    560560        movw $0x3d5, %dx
    561561        movb %bh, %al
    562562        outb %al, %dx
    563        
     563
    564564        /* Write bits 0 - 7 of the cursor address */
    565565        movw $0x3d4, %dx
    566566        movb $0xf, %al
    567567        outb %al, %dx
    568        
     568
    569569        movw $0x3d5, %dx
    570570        movb %bl, %al
    571571        outb %al, %dx
    572        
     572
    573573        popl %edi
    574574        popl %edx
     
    576576        popl %ebx
    577577        popl %eax
    578        
     578
    579579        ret
    580580
     
    591591 */
    592592early_puts:
    593        
     593
    594594#if ((defined(CONFIG_EGA)) && (!defined(CONFIG_FB)))
    595        
     595
    596596        /* Prologue, save preserved registers */
    597597        pushl %ebp
     
    600600        pushl %esi
    601601        pushl %edi
    602        
     602
    603603        movl 0x08(%ebp), %esi
    604604        movl $(PA2KA(0xb8000)), %edi  /* base of EGA text mode memory */
    605605        xorl %eax, %eax
    606        
     606
    607607        /* Read bits 8 - 15 of the cursor address */
    608608        movw $0x3d4, %dx
    609609        movb $0xe, %al
    610610        outb %al, %dx
    611        
     611
    612612        movw $0x3d5, %dx
    613613        inb %dx, %al
    614614        shl $8, %ax
    615        
     615
    616616        /* Read bits 0 - 7 of the cursor address */
    617617        movw $0x3d4, %dx
    618618        movb $0xf, %al
    619619        outb %al, %dx
    620        
     620
    621621        movw $0x3d5, %dx
    622622        inb %dx, %al
    623        
     623
    624624        /* Sanity check for the cursor on screen */
    625625        cmp $2000, %ax
    626626        jb early_puts_cursor_ok
    627        
     627
    628628                movw $1998, %ax
    629        
     629
    630630        early_puts_cursor_ok:
    631        
     631
    632632        movw %ax, %bx
    633633        shl $1, %eax
    634634        addl %eax, %edi
    635        
     635
    636636        early_puts_ploop:
    637637                lodsb
    638                
     638
    639639                cmp $0, %al
    640640                je early_puts_ploop_end
    641                
     641
    642642                movb $0x0e, %ah  /* black background, yellow foreground */
    643643                stosw
    644                
     644
    645645                /* Sanity check for the cursor on the last line */
    646646                inc %bx
    647647                cmp $2000, %bx
    648648                jb early_puts_ploop
    649                
     649
    650650                /* Scroll the screen (24 rows) */
    651651                movl %esi, %edx
     
    654654                movl $960, %ecx
    655655                rep movsl
    656                
     656
    657657                /* Clear the 24th row */
    658658                xorl %eax, %eax
    659659                movl $40, %ecx
    660660                rep stosl
    661                
     661
    662662                /* Go to row 24 */
    663663                movl %edx, %esi
    664664                movl $(PA2KA(0xb8f00)), %edi
    665665                movw $1920, %bx
    666                
     666
    667667                jmp early_puts_ploop
    668668        early_puts_ploop_end:
    669        
     669
    670670        /* Write bits 8 - 15 of the cursor address */
    671671        movw $0x3d4, %dx
    672672        movb $0xe, %al
    673673        outb %al, %dx
    674        
     674
    675675        movw $0x3d5, %dx
    676676        movb %bh, %al
    677677        outb %al, %dx
    678        
     678
    679679        /* Write bits 0 - 7 of the cursor address */
    680680        movw $0x3d4, %dx
    681681        movb $0xf, %al
    682682        outb %al, %dx
    683        
     683
    684684        movw $0x3d5, %dx
    685685        movb %bl, %al
    686686        outb %al, %dx
    687        
     687
    688688        /* Epilogue, restore preserved registers */
    689689        popl %edi
     
    691691        popl %ebx
    692692        leave
    693        
     693
    694694#endif
    695        
     695
    696696        ret
    697697
  • kernel/arch/ia32/src/boot/multiboot2.S

    r3061bc1 r8565a42  
    4545        .long multiboot2_header_end - multiboot2_header_start
    4646        .long -(MULTIBOOT2_HEADER_MAGIC + MULTIBOOT2_HEADER_ARCH_I386 + (multiboot2_header_end - multiboot2_header_start))
    47        
     47
    4848        /* Information request tag */
    4949        .align 8
     
    5959#endif
    6060        tag_info_req_end:
    61        
     61
    6262        /* Address tag */
    6363        .align 8
     
    7171                .long 0
    7272        tag_address_end:
    73        
     73
    7474        /* Entry address tag */
    7575        .align 8
     
    8080                .long multiboot2_image_start
    8181        tag_entry_address_end:
    82        
     82
    8383        /* Flags tag */
    8484        .align 8
     
    8989                .long MULTIBOOT2_FLAGS_CONSOLE
    9090        tag_flags_end:
    91        
     91
    9292#ifdef CONFIG_FB
    9393        /* Framebuffer tag */
     
    102102        tag_framebuffer_end:
    103103#endif
    104        
     104
    105105        /* Module alignment tag */
    106106        .align 8
     
    111111                .long 0
    112112        tag_module_align_end:
    113        
     113
    114114        /* Tag terminator */
    115115        .align 8
     
    124124        cli
    125125        cld
    126        
     126
    127127        /* Initialize stack pointer */
    128128        movl $START_STACK, %esp
    129        
     129
    130130        /*
    131131         * Initialize Global Descriptor Table and
     
    134134        lgdtl bootstrap_gdtr
    135135        lidtl bootstrap_idtr
    136        
     136
    137137        /* Kernel data + stack */
    138138        movw $GDT_SELECTOR(KDATA_DES), %cx
     
    142142        movw %cx, %ds
    143143        movw %cx, %ss
    144        
     144
    145145        jmpl $GDT_SELECTOR(KTEXT_DES), $multiboot2_meeting_point
    146146        multiboot2_meeting_point:
    147        
     147
    148148        /* Save multiboot arguments */
    149149        movl %eax, multiboot_eax
    150150        movl %ebx, multiboot_ebx
    151        
     151
    152152#ifndef PROCESSOR_i486
    153        
     153
    154154        movl $(INTEL_CPUID_LEVEL), %eax
    155155        cpuid
    156156        cmp $0x0, %eax  /* any function > 0? */
    157157        jbe pse_unsupported
    158        
     158
    159159        movl $(INTEL_CPUID_STANDARD), %eax
    160160        cpuid
    161161        bt $(INTEL_PSE), %edx
    162162        jnc pse_unsupported
    163                
     163
    164164                /* Map kernel and turn paging on */
    165165                call map_kernel_pse
    166166                jmp stack_init
    167        
     167
    168168#endif /* PROCESSOR_i486 */
    169        
     169
    170170        pse_unsupported:
    171                
     171
    172172                /* Map kernel and turn paging on */
    173173                call map_kernel_non_pse
    174        
     174
    175175        stack_init:
    176        
     176
    177177        /* Create the first stack frame */
    178178        pushl $0
    179179        movl %esp, %ebp
    180        
     180
    181181        /* Call ia32_pre_main(multiboot_eax, multiboot_ebx) */
    182182        pushl multiboot_ebx
    183183        pushl multiboot_eax
    184184        call ia32_pre_main
    185        
     185
    186186        /* Call main_bsp() */
    187187        call main_bsp
    188        
     188
    189189        /* Not reached */
    190190        cli
  • kernel/arch/ia32/src/boot/vesa_prot.inc

    r3061bc1 r8565a42  
    55
    66        /* Copy real mode VESA initialization code */
    7        
     7
    88        pm_status $status_vesa_copy
    9        
     9
    1010        mov $vesa_init, %esi
    1111        mov $VESA_INIT_SEGMENT << 4, %edi
    1212        mov $e_vesa_init - vesa_init, %ecx
    1313        rep movsb
    14        
     14
    1515        /* Check for multiboot command line */
    16        
     16
    1717        pm_status $status_multiboot_cmdline
    18        
     18
    1919        mov multiboot_eax, %eax
    2020        cmp $MULTIBOOT_LOADER_MAGIC, %eax
    2121        jne no_cmdline
    22        
     22
    2323        mov multiboot_ebx, %ebx
    2424        mov (%ebx), %eax
    2525        bt $MBINFO_BIT_CMDLINE, %eax
    2626        jnc no_cmdline
    27        
     27
    2828        /* Skip the kernel path in command line */
    29        
     29
    3030        mov MBINFO_OFFSET_CMDLINE(%ebx), %esi
    31        
     31
    3232        skip_loop:
    3333                lodsb
    34                
     34
    3535                cmp $0, %al
    3636                je no_cmdline
    37                
     37
    3838                cmp $' ', %al
    3939                je skip_loop_done
    40                
     40
    4141                jmp skip_loop
    4242        skip_loop_done:
    43        
     43
    4444        space_loop:
    4545                mov (%esi), %al
    46                
     46
    4747                cmp $0, %al
    4848                je no_cmdline
    49                
     49
    5050                cmp $' ', %al
    5151                jne space_loop_done
    52                
     52
    5353                inc %esi
    5454                jmp space_loop
    5555        space_loop_done:
    56        
     56
    5757        /* Copy at most 23 characters from command line */
    58        
     58
    5959        mov $VESA_INIT_SEGMENT << 4, %edi
    6060        add $default_mode - vesa_init, %edi
    6161        mov $23, %ecx
    62        
     62
    6363        cmd_loop:
    6464                lodsb
    6565                stosb
    66                
     66
    6767                cmp $0, %al
    6868                je cmd_loop_done
    69                
     69
    7070                loop cmd_loop
    7171        cmd_loop_done:
    72        
     72
    7373        /* Zero termination */
    74        
     74
    7575        xor %eax, %eax
    7676        stosb
    77        
     77
    7878        no_cmdline:
    79        
     79
    8080        /* Jump to the real mode */
    81        
     81
    8282        pm_status $status_vesa_real
    83        
     83
    8484        mov $VESA_INIT_SEGMENT << 4, %edi
    8585        jmpl *%edi
    86        
     86
    8787        vesa_meeting_point:
    8888                /* Returned back to protected mode */
    89                
     89
    9090                /*
    9191                 * Initialize Global Descriptor Table and
     
    9494                lgdtl bootstrap_gdtr
    9595                lidtl bootstrap_idtr
    96                
     96
    9797                movzx %ax, %ecx
    9898                mov %ecx, KA2PA(bfb_scanline)
    99                
     99
    100100                shr $16, %eax
    101101                mov %ax, KA2PA(bfb_bpp)
    102                
     102
    103103                movzx %bx, %ecx
    104104                mov %ecx, KA2PA(bfb_height)
    105                
     105
    106106                shr $16, %ebx
    107107                mov %ebx, KA2PA(bfb_width)
    108                
     108
    109109                mov %dl, KA2PA(bfb_green_pos)
    110                
     110
    111111                shr $8, %edx
    112112                mov %dl, KA2PA(bfb_green_size)
    113                
     113
    114114                shr $8, %edx
    115115                mov %dl, KA2PA(bfb_red_pos)
    116                
     116
    117117                shr $8, %edx
    118118                mov %dl, KA2PA(bfb_red_size)
    119                
     119
    120120                mov %esi, %edx
    121121                mov %dl, KA2PA(bfb_blue_pos)
    122                
     122
    123123                shr $8, %edx
    124124                mov %dl, KA2PA(bfb_blue_size)
    125                
     125
    126126                mov %edi, KA2PA(bfb_addr)
    127127#endif
  • kernel/arch/ia32/src/boot/vesa_real.inc

    r3061bc1 r8565a42  
    3131vesa_init:
    3232        lidtl vesa_idtr
    33        
     33
    3434        mov $GDT_SELECTOR(VESA_INIT_DATA_DES), %bx
    35        
     35
    3636        mov %bx, %es
    3737        mov %bx, %fs
     
    3939        mov %bx, %ds
    4040        mov %bx, %ss
    41        
     41
    4242        jmp $GDT_SELECTOR(VESA_INIT_CODE_DES), $vesa_init_real - vesa_init
    4343
     
    5151        and $~CR0_PE, %eax
    5252        mov %eax, %cr0
    53        
     53
    5454        jmp $VESA_INIT_SEGMENT, $vesa_init_real2 - vesa_init
    5555
    5656vesa_init_real2:
    5757        mov $VESA_INIT_SEGMENT, %bx
    58        
     58
    5959        mov %bx, %es
    6060        mov %bx, %fs
     
    6262        mov %bx, %ds
    6363        mov %bx, %ss
    64        
     64
    6565        movl %esp, %eax
    6666        movl $0x0000fffc, %esp
    6767        movl $0x0000fffc, %ebp
    6868        pushl %eax
    69        
     69
    7070        /* Parse default mode string */
    71        
     71
    7272        mov $default_mode - vesa_init, %di
    7373        xor %eax, %eax
    7474        xor %ebx, %ebx
    75        
     75
    7676        mov $8, %ecx
    7777        parse_width:
    7878                mov (%di), %al
    79                
     79
    8080                /* Check for digit */
    81                
     81
    8282                cmp $'0', %al
    8383                jb parse_width_done
    84                
     84
    8585                cmp $'9', %al
    8686                ja parse_width_done
    87                
     87
    8888                sub $'0', %al
    89                
     89
    9090                /* Multiply default_width by 10 and add digit */
    91                
     91
    9292                mov default_width - vesa_init, %bx
    9393                lea (%ebx, %ebx, 4), %ebx
     
    9595                add %ax, %bx
    9696                mov %bx, default_width - vesa_init
    97                
     97
    9898                inc %di
    9999                loop parse_width
    100100        parse_width_done:
    101        
     101
    102102        mov (%di), %al
    103103        cmp $0, %al
    104104        jz parse_done
    105105        inc %di
    106        
     106
    107107        mov $8, %ecx
    108108        parse_height:
    109109                mov (%di), %al
    110                
     110
    111111                /* Check for digit */
    112                
     112
    113113                cmp $'0', %al
    114114                jb parse_height_done
    115                
     115
    116116                cmp $'9', %al
    117117                ja parse_height_done
    118                
     118
    119119                sub $'0', %al
    120                
     120
    121121                /* Multiply default_height by 10 and add digit */
    122                
     122
    123123                mov default_height - vesa_init, %bx
    124124                lea (%ebx, %ebx, 4), %ebx
     
    126126                add %ax, %bx
    127127                mov %bx, default_height - vesa_init
    128                
     128
    129129                inc %di
    130130                loop parse_height
    131131        parse_height_done:
    132        
     132
    133133        mov (%di), %al
    134134        cmp $0, %al
    135135        jz parse_done
    136136        inc %di
    137        
     137
    138138        mov $4, %ecx
    139139        parse_bpp:
    140140                mov (%di), %al
    141                
     141
    142142                /* Check for digit */
    143                
     143
    144144                cmp $'0', %al
    145145                jb parse_bpp_done
    146                
     146
    147147                cmp $'9', %al
    148148                ja parse_bpp_done
    149                
     149
    150150                sub $'0', %al
    151                
     151
    152152                /* Multiply default_bpp by 10 and add digit */
    153                
     153
    154154                mov default_bpp - vesa_init, %bx
    155155                lea (%ebx, %ebx, 4), %ebx
     
    157157                add %ax, %bx
    158158                mov %bx, default_bpp - vesa_init
    159                
     159
    160160                inc %di
    161161                loop parse_bpp
    162162        parse_bpp_done:
    163        
     163
    164164        parse_done:
    165        
     165
    166166        mov $VESA_GET_INFO, %ax
    167167        mov $e_vesa_init - vesa_init, %di
     
    178178        movl $0x32454256, (%di)
    179179        int $0x10
    180        
     180
    181181        pop %di
    182182        cmp $VESA_OK, %al
    183183        jnz no_mode
    184        
     184
    185185        mov 2 + VESA_MODE_LIST_PTR_OFFSET(%di), %si
    186186        mov %si, %gs
    187187        mov VESA_MODE_LIST_PTR_OFFSET(%di), %si
    188        
     188
    189189        add $VESA_INFO_SIZE, %di
    190        
     190
    191191        next_mode:
    192192                /* Try next mode */
    193                
     193
    194194                mov %gs:(%si), %cx
    195195                cmp $VESA_END_OF_MODES, %cx
    196196                je no_mode
    197                
     197
    198198                inc %si
    199199                inc %si
     
    203203                mov $VESA_GET_MODE_INFO, %ax
    204204                int $0x10
    205                
     205
    206206                pop %si
    207207                pop %di
     
    209209                cmp $VESA_OK, %al
    210210                jne no_mode
    211                
     211
    212212                /*
    213213                 * Check for proper attributes (supported,
    214214                 * color, graphics, linear framebuffer).
    215215                 */
    216                
     216
    217217                mov VESA_MODE_ATTRIBUTES_OFFSET(%di), %ax
    218218                and $0x99, %ax
    219219                cmp $0x99, %ax
    220220                jne next_mode
    221                
     221
    222222                /* Check for proper resolution */
    223                
     223
    224224                mov default_width - vesa_init, %ax
    225225                cmp VESA_MODE_WIDTH_OFFSET(%di), %ax
    226226                jne next_mode
    227                
     227
    228228                mov default_height - vesa_init, %ax
    229229                cmp VESA_MODE_HEIGHT_OFFSET(%di), %ax
    230230                jne next_mode
    231                
     231
    232232                /* Check for proper bpp */
    233                
     233
    234234                mov default_bpp - vesa_init, %al
    235235                cmp VESA_MODE_BPP_OFFSET(%di), %al
    236236                je set_mode
    237                
     237
    238238                mov $24, %al
    239239                cmp default_bpp - vesa_init, %al
    240240                jne next_mode
    241                
     241
    242242                /* For 24 bpp modes accept also 32 bit bpp */
    243                
     243
    244244                mov $32, %al
    245245                cmp VESA_MODE_BPP_OFFSET(%di), %al
    246246                jne next_mode
    247        
     247
    248248        set_mode:
    249249                mov %cx, %bx
     
    252252                mov $VESA_SET_MODE, %ax
    253253                int $0x10
    254                
     254
    255255                pop %di
    256256                cmp $VESA_OK, %al
    257257                jnz no_mode
    258                
     258
    259259                /* Set 3:2:3 VGA palette */
    260                
     260
    261261                mov VESA_MODE_BPP_OFFSET(%di), %al
    262262                cmp $8, %al
    263263                jnz vga_not_set
    264                
     264
    265265                mov VESA_MODE_ATTRIBUTES_OFFSET(%di), %ax
    266266                push %di
    267267                mov $vga323 - vesa_init, %di
    268268                mov $0x100, %ecx
    269                
     269
    270270                /* Test if VGA compatible registers are present */
    271271                bt $5, %ax
    272272                jnc vga_compat
    273                
     273
    274274                        /* Use VESA routine to set the palette */
    275                        
     275
    276276                        mov $VESA_SET_PALETTE, %ax
    277277                        xor %bl, %bl
    278278                        xor %dx, %dx
    279279                        int $0x10
    280                        
     280
    281281                        cmp $0x00, %ah
    282282                        je vga_not_compat
    283                
     283
    284284                vga_compat:
    285                        
     285
    286286                        /* Use VGA registers to set the palette */
    287                        
     287
    288288                        movw $0x3c6, %dx  /* set palette mask */
    289289                        movb $0xff, %al
    290290                        outb %al, %dx
    291                        
     291
    292292                        movw $0x3c8, %dx  /* first index to set */
    293293                        xor %al, %al
    294294                        outb %al, %dx
    295                        
     295
    296296                        movw $0x3c9, %dx  /* data port */
    297                        
     297
    298298                        vga_loop:
    299299                                movb %es:2(%di), %al
    300300                                outb %al, %dx
    301                                
     301
    302302                                movb %es:1(%di), %al
    303303                                outb %al, %dx
    304                                
     304
    305305                                movb %es:(%di), %al
    306306                                outb %al, %dx
    307                                
     307
    308308                                addw $4, %di
    309309                        loop vga_loop
    310                
     310
    311311                vga_not_compat:
    312                
     312
    313313                        pop %di
    314                
     314
    315315                vga_not_set:
    316                
     316
    317317                /*
    318318                 * Store mode parameters:
     
    323323                 *  edi = linear frame buffer
    324324                 */
    325                
     325
    326326                mov VESA_MODE_BPP_OFFSET(%di), %al
    327327                xor %ah, %ah
    328328                shl $16, %eax
    329329                mov VESA_MODE_SCANLINE_OFFSET(%di), %ax
    330                
     330
    331331                mov VESA_MODE_WIDTH_OFFSET(%di), %bx
    332332                shl $16, %ebx
    333333                mov VESA_MODE_HEIGHT_OFFSET(%di), %bx
    334                
     334
    335335                mov VESA_MODE_BLUE_MASK_OFFSET(%di), %dl
    336336                shl $8, %edx
    337337                mov VESA_MODE_BLUE_POS_OFFSET(%di), %dl
    338338                mov %edx, %esi
    339                
     339
    340340                mov VESA_MODE_RED_MASK_OFFSET(%di), %dl
    341341                shl $8, %edx
    342342                mov VESA_MODE_RED_POS_OFFSET(%di), %dl
    343                
     343
    344344                shl $8, %edx
    345345                mov VESA_MODE_GREEN_MASK_OFFSET(%di), %dl
    346346                shl $8, %edx
    347347                mov VESA_MODE_GREEN_POS_OFFSET(%di), %dl
    348                
     348
    349349                mov VESA_MODE_PHADDR_OFFSET(%di), %edi
    350                
     350
    351351                vesa_leave_real:
    352                
     352
    353353                        mov %cr0, %ecx
    354354                        or $CR0_PE, %ecx
    355355                        mov %ecx, %cr0
    356                        
     356
    357357                        jmp vesa_leave_real2
    358                        
     358
    359359                vesa_leave_real2:
    360                
     360
    361361                        ljmpl $GDT_SELECTOR(KTEXT32_DES), $(vesa_init_protected - vesa_init + VESA_INIT_SEGMENT << 4)
    362        
     362
    363363        no_mode:
    364                
     364
    365365                /* No prefered mode found */
    366                
     366
    367367                mov $0x111, %cx
    368368                push %di
     
    370370                mov $VESA_GET_MODE_INFO, %ax
    371371                int $0x10
    372                
     372
    373373                pop %cx
    374374                pop %di
     
    376376                jnz text_mode
    377377                jz set_mode  /* force relative jump */
    378        
     378
    379379        text_mode:
    380                
     380
    381381                /* Reset to EGA text mode (because of problems with VESA) */
    382                
     382
    383383                mov $0x0003, %ax
    384384                int $0x10
    385                
     385
    386386                xor %eax, %eax
    387387                xor %ebx, %ebx
    388388                xor %edx, %edx
    389389                xor %edi, %edi
    390                
     390
    391391                jz vesa_leave_real  /* force relative jump */
    392392
  • kernel/arch/ia32/src/boot/vesa_ret.inc

    r3061bc1 r8565a42  
    33        cli
    44        cld
    5        
     5
    66        /* Initialize stack pointer */
    77        movl $START_STACK, %esp
    8        
     8
    99        /* Kernel data + stack */
    1010        movw $GDT_SELECTOR(KDATA_DES), %cx
     
    1414        movw %cx, %ds
    1515        movw %cx, %ss
    16        
     16
    1717        jmpl $GDT_SELECTOR(KTEXT_DES), $vesa_meeting_point
Note: See TracChangeset for help on using the changeset viewer.