Ignore:
File:
1 edited

Legend:

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

    r4bf0926e rf66c203d  
    2929 */
    3030
    31 #include <abi/asmtool.h>
    3231#include <arch/boot/boot.h>
    3332#include <arch/mm/page.h>
     
    6564
    6665.align 4
     66.global multiboot_image_start
    6767multiboot_header:
    6868        .long MULTIBOOT_HEADER_MAGIC
     
    7575        .long multiboot_image_start
    7676
    77 SYMBOL(multiboot_image_start)
     77multiboot_image_start:
    7878        cli
    7979        cld
     
    168168       
    169169        movl %cr4, %eax
    170         orl $CR4_PAE, %eax
     170        btsl $5, %eax
    171171        movl %eax, %cr4
    172172       
     
    176176       
    177177        /* Enable long mode */
    178         movl $AMD_MSR_EFER, %ecx
     178        movl $EFER_MSR_NUM, %ecx
    179179        rdmsr                     /* read EFER */
    180         orl $AMD_LME, %eax        /* set LME = 1 */
     180        btsl $AMD_LME_FLAG, %eax  /* set LME = 1 */
    181181        wrmsr
    182182       
    183183        /* Enable paging to activate long mode (set CR0.PG = 1) */
    184184        movl %cr0, %eax
    185         orl $CR0_PG, %eax
     185        btsl $31, %eax
    186186        movl %eax, %cr0
    187187       
     
    427427        long_status $status_long
    428428       
    429         /* Call amd64_pre_main(multiboot_eax, multiboot_ebx) */
     429        /* Call arch_pre_main(multiboot_eax, multiboot_ebx) */
     430        xorq %rdi, %rdi
    430431        movl multiboot_eax, %edi
     432        xorq %rsi, %rsi
    431433        movl multiboot_ebx, %esi
    432434       
    433 #ifdef MEMORY_MODEL_large
    434         movabsq $amd64_pre_main, %rax
     435        movabsq $arch_pre_main, %rax
    435436        callq *%rax
    436 #else
    437         callq amd64_pre_main
    438 #endif
    439437       
    440438        long_status $status_main
    441439       
    442440        /* Call main_bsp() */
    443 #ifdef MEMORY_MODEL_large
    444441        movabsq $main_bsp, %rax
    445         callq *%rax
    446 #else
    447         callq main_bsp
    448 #endif
     442        call *%rax
    449443       
    450444        /* Not reached */
     
    633627        ptl2gen 512 7
    634628
    635 #ifdef MEMORY_MODEL_kernel
    636 .align 4096
    637 ptl_1:
    638         /* Identity mapping for [0; 8G) */
    639         .quad ptl_2_0g + (PTL_WRITABLE | PTL_PRESENT)
    640         .quad ptl_2_1g + (PTL_WRITABLE | PTL_PRESENT)
    641         .quad ptl_2_2g + (PTL_WRITABLE | PTL_PRESENT)
    642         .quad ptl_2_3g + (PTL_WRITABLE | PTL_PRESENT)
    643         .quad ptl_2_4g + (PTL_WRITABLE | PTL_PRESENT)
    644         .quad ptl_2_5g + (PTL_WRITABLE | PTL_PRESENT)
    645         .quad ptl_2_6g + (PTL_WRITABLE | PTL_PRESENT)
    646         .quad ptl_2_7g + (PTL_WRITABLE | PTL_PRESENT)
    647         .fill 502, 8, 0
    648         /* Mapping of [0; 2G) at -2G */
    649         .quad ptl_2_0g + (PTL_WRITABLE | PTL_PRESENT)
    650         .quad ptl_2_1g + (PTL_WRITABLE | PTL_PRESENT)
    651 
    652 .align 4096
    653 SYMBOL(ptl_0)
    654         .quad ptl_1 + (PTL_WRITABLE | PTL_PRESENT)
    655         .fill 510, 8, 0
    656         .quad ptl_1 + (PTL_WRITABLE | PTL_PRESENT)
    657 #endif
    658 
    659 #ifdef MEMORY_MODEL_large
    660629.align 4096
    661630ptl_1:
     
    672641
    673642.align 4096
    674 SYMBOL(ptl_0)
     643.global ptl_0
     644ptl_0:
    675645        .quad ptl_1 + (PTL_WRITABLE | PTL_PRESENT)
    676646        .fill 255, 8, 0
    677647        .quad ptl_1 + (PTL_WRITABLE | PTL_PRESENT)
    678648        .fill 255, 8, 0
    679 #endif
    680649
    681650.section K_DATA_START, "aw", @progbits
    682651
    683 SYMBOL(bootstrap_idtr)
     652.global bootstrap_idtr
     653bootstrap_idtr:
    684654        .word 0
    685655        .long 0
    686656
    687 SYMBOL(bootstrap_gdtr)
     657.global bootstrap_gdtr
     658bootstrap_gdtr:
    688659        .word GDT_SELECTOR(GDT_ITEMS)
    689660        .long KA2PA(gdt)
    690661
    691 SYMBOL(multiboot_eax)
     662.global multiboot_eax
     663multiboot_eax:
    692664        .long 0
    693665
    694 SYMBOL(multiboot_ebx)
     666.global multiboot_ebx
     667multiboot_ebx:
    695668        .long 0
    696669
Note: See TracChangeset for help on using the changeset viewer.