1
0
Fork 0
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:
Alex Kotov 2022-12-23 15:46:30 +04:00
parent cab5b78b12
commit c9b3f89913
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08
4 changed files with 38 additions and 19 deletions

View file

@ -33,6 +33,7 @@ OBJS += paging.c.o
# Architecture-independent # Architecture-independent
OBJS += info.c.o OBJS += info.c.o
OBJS += multiboot2.c.o
OBJS += protected.c.o OBJS += protected.c.o
OBJS += interrupts.c.o interrupts.asm.cpp.o OBJS += interrupts.c.o interrupts.asm.cpp.o
OBJS += heap.c.o OBJS += heap.c.o

View file

@ -14,7 +14,7 @@ SECTIONS
.text BLOCK(4K) : ALIGN(4K) .text BLOCK(4K) : ALIGN(4K)
{ {
*(.multiboot) *(.multiboot2)
*(.text) *(.text)
} }

36
src/multiboot2.c Normal file
View 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>

View file

@ -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 .section .bss
.global _kernel_stack_start .global _kernel_stack_start