mirror of
https://github.com/tailix/kernel.git
synced 2024-11-20 11:16:10 -05:00
Use new Multiboot 2 header builder from libkernaux
This commit is contained in:
parent
cab5b78b12
commit
c9b3f89913
4 changed files with 38 additions and 19 deletions
|
@ -33,6 +33,7 @@ OBJS += paging.c.o
|
|||
# Architecture-independent
|
||||
OBJS += info.c.o
|
||||
|
||||
OBJS += multiboot2.c.o
|
||||
OBJS += protected.c.o
|
||||
OBJS += interrupts.c.o interrupts.asm.cpp.o
|
||||
OBJS += heap.c.o
|
||||
|
|
|
@ -14,7 +14,7 @@ SECTIONS
|
|||
|
||||
.text BLOCK(4K) : ALIGN(4K)
|
||||
{
|
||||
*(.multiboot)
|
||||
*(.multiboot2)
|
||||
*(.text)
|
||||
}
|
||||
|
||||
|
|
36
src/multiboot2.c
Normal file
36
src/multiboot2.c
Normal file
|
@ -0,0 +1,36 @@
|
|||
#include <kernaux/multiboot2.h>
|
||||
|
||||
#include <kernaux/macro/packing_start.run>
|
||||
|
||||
__attribute__((
|
||||
section(".multiboot2"),
|
||||
aligned(KERNAUX_MULTIBOOT2_HEADER_ALIGN),
|
||||
used
|
||||
))
|
||||
const struct {
|
||||
struct KernAux_Multiboot2_Header header;
|
||||
KERNAUX_MULTIBOOT2_HFIELDS_COMMON(tag_none, None)
|
||||
}
|
||||
KERNAUX_PACKED
|
||||
multiboot2_header = {
|
||||
.header = {
|
||||
.magic = KERNAUX_MULTIBOOT2_HEADER_MAGIC,
|
||||
.arch = KERNAUX_MULTIBOOT2_HEADER_ARCH_I386,
|
||||
.total_size = sizeof(multiboot2_header),
|
||||
.checksum = KERNAUX_MULTIBOOT2_HEADER_CHECKSUM(
|
||||
KERNAUX_MULTIBOOT2_HEADER_ARCH_I386,
|
||||
sizeof(multiboot2_header)
|
||||
),
|
||||
},
|
||||
.tag_none = {
|
||||
.tag = {
|
||||
.base = {
|
||||
.type = KERNAUX_MULTIBOOT2_HTAG_NONE,
|
||||
.flags = 0,
|
||||
.size = sizeof(multiboot2_header.tag_none),
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
#include <kernaux/macro/packing_end.run>
|
18
src/start.s
18
src/start.s
|
@ -1,21 +1,3 @@
|
|||
.set MULTIBOOT_MAGIC, 0xE85250D6
|
||||
.set MULTIBOOT_ARCH, 0
|
||||
.set MULTIBOOT_LENGTH, 16 + 8
|
||||
.set MULTIBOOT_CHECKSUM, -(MULTIBOOT_MAGIC + MULTIBOOT_ARCH + MULTIBOOT_LENGTH)
|
||||
|
||||
|
||||
|
||||
.section .multiboot
|
||||
.align 4
|
||||
.long MULTIBOOT_MAGIC
|
||||
.long MULTIBOOT_ARCH
|
||||
.long MULTIBOOT_LENGTH
|
||||
.long MULTIBOOT_CHECKSUM
|
||||
.long 0
|
||||
.long 8
|
||||
|
||||
|
||||
|
||||
.section .bss
|
||||
|
||||
.global _kernel_stack_start
|
||||
|
|
Loading…
Reference in a new issue