Ignore:
File:
1 edited

Legend:

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

    r17af882 r4bf0926e  
    2929 */
    3030
     31#include <abi/asmtool.h>
    3132#include <arch/boot/boot.h>
    3233#include <arch/mm/page.h>
     
    6465
    6566.align 4
    66 .global multiboot_image_start
    6767multiboot_header:
    6868        .long MULTIBOOT_HEADER_MAGIC
     
    7575        .long multiboot_image_start
    7676
    77 multiboot_image_start:
     77SYMBOL(multiboot_image_start)
    7878        cli
    7979        cld
     
    168168       
    169169        movl %cr4, %eax
    170         btsl $5, %eax
     170        orl $CR4_PAE, %eax
    171171        movl %eax, %cr4
    172172       
     
    176176       
    177177        /* Enable long mode */
    178         movl $EFER_MSR_NUM, %ecx
     178        movl $AMD_MSR_EFER, %ecx
    179179        rdmsr                     /* read EFER */
    180         btsl $AMD_LME_FLAG, %eax  /* set LME = 1 */
     180        orl $AMD_LME, %eax        /* set LME = 1 */
    181181        wrmsr
    182182       
    183183        /* Enable paging to activate long mode (set CR0.PG = 1) */
    184184        movl %cr0, %eax
    185         btsl $31, %eax
     185        orl $CR0_PG, %eax
    186186        movl %eax, %cr0
    187187       
     
    427427        long_status $status_long
    428428       
    429         /* Call arch_pre_main(multiboot_eax, multiboot_ebx) */
     429        /* Call amd64_pre_main(multiboot_eax, multiboot_ebx) */
    430430        movl multiboot_eax, %edi
    431431        movl multiboot_ebx, %esi
    432         callq arch_pre_main
    433 
     432       
     433#ifdef MEMORY_MODEL_large
     434        movabsq $amd64_pre_main, %rax
     435        callq *%rax
     436#else
     437        callq amd64_pre_main
     438#endif
     439       
    434440        long_status $status_main
    435441       
    436442        /* Call main_bsp() */
    437         callq main_bsp
     443#ifdef MEMORY_MODEL_large
     444        movabsq $main_bsp, %rax
     445        callq *%rax
     446#else
     447        callq main_bsp
     448#endif
    438449       
    439450        /* Not reached */
     
    622633        ptl2gen 512 7
    623634
     635#ifdef MEMORY_MODEL_kernel
    624636.align 4096
    625637ptl_1:
     
    638650        .quad ptl_2_1g + (PTL_WRITABLE | PTL_PRESENT)
    639651
    640 
    641 .align 4096
    642 .global ptl_0
    643 ptl_0:
     652.align 4096
     653SYMBOL(ptl_0)
    644654        .quad ptl_1 + (PTL_WRITABLE | PTL_PRESENT)
    645655        .fill 510, 8, 0
    646656        .quad ptl_1 + (PTL_WRITABLE | PTL_PRESENT)
     657#endif
     658
     659#ifdef MEMORY_MODEL_large
     660.align 4096
     661ptl_1:
     662        /* Identity mapping for [0; 8G) */
     663        .quad ptl_2_0g + (PTL_WRITABLE | PTL_PRESENT)
     664        .quad ptl_2_1g + (PTL_WRITABLE | PTL_PRESENT)
     665        .quad ptl_2_2g + (PTL_WRITABLE | PTL_PRESENT)
     666        .quad ptl_2_3g + (PTL_WRITABLE | PTL_PRESENT)
     667        .quad ptl_2_4g + (PTL_WRITABLE | PTL_PRESENT)
     668        .quad ptl_2_5g + (PTL_WRITABLE | PTL_PRESENT)
     669        .quad ptl_2_6g + (PTL_WRITABLE | PTL_PRESENT)
     670        .quad ptl_2_7g + (PTL_WRITABLE | PTL_PRESENT)
     671        .fill 504, 8, 0
     672
     673.align 4096
     674SYMBOL(ptl_0)
     675        .quad ptl_1 + (PTL_WRITABLE | PTL_PRESENT)
     676        .fill 255, 8, 0
     677        .quad ptl_1 + (PTL_WRITABLE | PTL_PRESENT)
     678        .fill 255, 8, 0
     679#endif
    647680
    648681.section K_DATA_START, "aw", @progbits
    649682
    650 .global bootstrap_idtr
    651 bootstrap_idtr:
     683SYMBOL(bootstrap_idtr)
    652684        .word 0
    653685        .long 0
    654686
    655 .global bootstrap_gdtr
    656 bootstrap_gdtr:
     687SYMBOL(bootstrap_gdtr)
    657688        .word GDT_SELECTOR(GDT_ITEMS)
    658689        .long KA2PA(gdt)
    659690
    660 .global multiboot_eax
    661 multiboot_eax:
     691SYMBOL(multiboot_eax)
    662692        .long 0
    663693
    664 .global multiboot_ebx
    665 multiboot_ebx:
     694SYMBOL(multiboot_ebx)
    666695        .long 0
    667696
Note: See TracChangeset for help on using the changeset viewer.