aboutsummaryrefslogtreecommitdiff
path: root/src/boot/boot.S
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2021-04-08 13:07:17 +0200
committerLoic Guegan <manzerbredes@mailbox.org>2021-04-08 13:07:17 +0200
commit958e2dae042ca9e28f23e509d541730f30fa8502 (patch)
tree8911572335763866ed39cc7ec7855131929a0994 /src/boot/boot.S
parentdb553d05824ae463752c8b528feac963e41d9f1c (diff)
Switch to multiboot2 and improve interrupt management
Diffstat (limited to 'src/boot/boot.S')
-rw-r--r--src/boot/boot.S67
1 files changed, 44 insertions, 23 deletions
diff --git a/src/boot/boot.S b/src/boot/boot.S
index e3830eb..469cc82 100644
--- a/src/boot/boot.S
+++ b/src/boot/boot.S
@@ -1,29 +1,50 @@
+.globl _start
+.globl MB_INFO
.extern bringelle
.extern gdt_memcpy
-.globl _start
-.text
-
-.set MB_MAGIC, 0x1BADB002
-.set MB_FLAGS, 0x00010000
-.set MB_CHECKSUM, -(MB_MAGIC+MB_FLAGS)
-.set MB_HEADER_ADDR, mb_header
-.set MB_LOAD_ADDR, mb_header
-.set MB_LOAD_END_ADDR, 0x0
-.set MB_BSS_END_ADDR, 0x0
-.set MB_ENTRY_ADDR, _start
-
-mb_header:
-.align 4
-.long MB_MAGIC
-.long MB_FLAGS
-.long MB_CHECKSUM
-.long MB_HEADER_ADDR
-.long MB_LOAD_ADDR
-.long MB_LOAD_END_ADDR
-.long MB_BSS_END_ADDR
-.long MB_ENTRY_ADDR
+.extern mb_load_fb_tag
+
+.section .multiboot
+
+.set MB_MAGIC, 0xE85250D6
+.set MB_ARCH, 0x00000000
+.set MB_HEADER_LENGTH, (mb_header_end-mb_header_start)
+.set MB_CHECKSUM, -(MB_MAGIC+MB_ARCH+MB_HEADER_LENGTH)
+
+mb_header_start:
+.align 8
+.int MB_MAGIC
+.int MB_ARCH
+.int MB_HEADER_LENGTH
+.int MB_CHECKSUM
+# ----------- Address tag
+.align 8
+.short 2
+.short 0 # Not optional
+.int 24 # Size
+.int mb_header_start # header_addr
+.int mb_header_start # load_addr
+.int 0x0 # load_end_addr
+.int 0x0 # bss_end_addr
+# ----------- Addr tag
+.align 8
+.short 0x3
+.short 0
+.int 12
+.int _start
+# ----------- End tag
+.align 8
+.int 0x0
+.int 0x8
+mb_header_end:
+
+.section .text
+
+MB_INFO:
+ .int 0xABCDEF # Will contains the Multiboot2 information data structure address
_start:
+mov %ebx, (MB_INFO)
# Copy GDT into memory then load its register
call gdt_memcpy
@@ -44,7 +65,7 @@ cs_new:
# Update stack segment
movw $0x18, %ax
movw %ax, %ss
-movl $0x20000,%esp
+movl $0x50000,%esp
# Start kernel main function
call bringelle