diff options
Diffstat (limited to 'src/boot/boot.S')
| -rw-r--r-- | src/boot/boot.S | 53 |
1 files changed, 28 insertions, 25 deletions
diff --git a/src/boot/boot.S b/src/boot/boot.S index 7f12eed..73ee637 100644 --- a/src/boot/boot.S +++ b/src/boot/boot.S @@ -2,9 +2,7 @@ .globl MB_INFO .extern _bss_start .extern _bss_end -.extern boucane - -.set STACK_LOCATION, 0x1FFFFF +.extern higherhalf .section .multiboot @@ -37,7 +35,7 @@ mb_header_start: # ----------- End tag # ----------- Ask framebuffer tag .align 8 -.short 5 +.short 6 .short 1 .int 20 .int 0 @@ -57,16 +55,6 @@ MB_INFO: # Will contains the Multiboot2 information data structure address _start: mov %ebx, (MB_INFO) -# Zeroing the .bss section -mov $_bss_start, %eax -mov $_bss_end, %ebx -start_zeroing: - movb $0x0, (%eax) - cmp %eax, %ebx - je end_zeroing - inc %eax - jmp start_zeroing -end_zeroing: # ----- Setup PAE Paging (identity on the first 10MB) mov $8192, %ecx # 8*4096/4 (8 tables of 4096 byte each divide by 4 because of movl) mov $0, %eax @@ -117,7 +105,7 @@ mov %eax, %cr0 # Now we are in Compatibility mode # Now we need to set CS.L=1 (setting up a 64 bit GDT) -lgdt (gdtr) +lgdt (boot_gdtr) ljmp $0x08, $new_cs new_cs: @@ -132,27 +120,42 @@ mov %ax, %es mov %ax, %fs mov %ax, %gs mov %ax, %ss -mov $STACK_LOCATION, %esp +mov $__stack_pma, %esp + +# Setup +call trampoline +mov $__kernel_vma, %rsp + +# Zeroing the .bss section +mov $__bss_start, %rax +mov $__bss_end, %rbx +start_zeroing: + movb $0x0, (%rax) + cmp %rax, %rbx + je end_zeroing + inc %rax + jmp start_zeroing +end_zeroing: -# Run boucane -jmp boucane +# Launch kernel +call boucane # GDT -gdt64: - gdt64_null: +boot_gdt64: + boot_gdt64_null: .long 0 .long 0 - gdt64_cs: + boot_gdt64_cs: .long 0 .byte 0 .byte 0b10011100 .byte 0b00100000 .byte 0 - gdt64_ds: + boot_gdt64_ds: .long 0 .byte 0 .byte 0b10010010 .word 0 -gdtr: - .word . - gdt64 - 1 - .quad gdt64 +boot_gdtr: + .word . - boot_gdt64 - 1 + .quad boot_gdt64 |
