1
0
Fork 0
mirror of https://github.com/tailix/kernel.git synced 2024-11-20 11:16:10 -05:00

Add include <kernelmq/multiboot.h>

This commit is contained in:
Braiden Vasco 2017-11-01 08:37:39 +00:00
parent 68c0958bee
commit 5b23dead92
4 changed files with 26 additions and 5 deletions

View file

@ -2,7 +2,7 @@ run: all
qemu-system-i386 -kernel arch/kernel -d guest_errors qemu-system-i386 -kernel arch/kernel -d guest_errors
all: all:
make all -C arch make all -C arch I=$(shell pwd)/include
clean: clean:
make clean -C arch make clean -C arch I=$(shell pwd)/include

View file

@ -1,3 +1,7 @@
ifneq (ok, $(shell test -d '$(I)' && echo 'ok'))
$(error 'Include directory "$(I)" does not exist')
endif
CCPREFIX = i686-elf- CCPREFIX = i686-elf-
AS = $(CCPREFIX)as AS = $(CCPREFIX)as
@ -14,7 +18,7 @@ kernel: $(OBJS)
$(CC) -T linker.ld -o $@ -ffreestanding -nostdlib -lgcc $(OBJS) $(CC) -T linker.ld -o $@ -ffreestanding -nostdlib -lgcc $(OBJS)
%.c.o: %.c %.c.o: %.c
$(CC) -c $< -o $@ -std=gnu99 -ffreestanding -fno-builtin -fno-stack-protector -Wall -Wextra $(CC) -c $< -o $@ -std=gnu99 -ffreestanding -fno-builtin -fno-stack-protector -Wall -Wextra -I$(I)
%.s.o: %.s %.s.o: %.s
$(AS) $< -o $@ $(AS) $< -o $@

View file

@ -1,3 +1,5 @@
#include <kernelmq/multiboot.h>
#include "logger.h" #include "logger.h"
#include "gdt.h" #include "gdt.h"
#include "idt.h" #include "idt.h"
@ -6,10 +8,10 @@ void main(uint32_t multiboot_magic)
{ {
logger_initialize(); logger_initialize();
if (multiboot_magic == 0x2BADB002) { if (multiboot_magic == KERNELMQ_MULTIBOOT_1_MAGIC) {
logger_info("Loaded with Multiboot-compliant bootloader, specification version 1."); logger_info("Loaded with Multiboot-compliant bootloader, specification version 1.");
} }
else if (multiboot_magic == 0x36d76289) { else if (multiboot_magic == KERNELMQ_MULTIBOOT_2_MAGIC) {
logger_info("Loaded with Multiboot-compliant bootloader, specification version 2."); logger_info("Loaded with Multiboot-compliant bootloader, specification version 2.");
} }
else { else {

View file

@ -0,0 +1,15 @@
#ifndef KERNELMQ_INCLUDED_MULTIBOOT
#define KERNELMQ_INCLUDED_MULTIBOOT 1
#ifdef __cplusplus
extern "C" {
#endif
#define KERNELMQ_MULTIBOOT_1_MAGIC 0x2BADB002
#define KERNELMQ_MULTIBOOT_2_MAGIC 0x36d76289
#ifdef __cplusplus
}
#endif
#endif