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
all:
make all -C arch
make all -C arch I=$(shell pwd)/include
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-
AS = $(CCPREFIX)as
@ -14,7 +18,7 @@ kernel: $(OBJS)
$(CC) -T linker.ld -o $@ -ffreestanding -nostdlib -lgcc $(OBJS)
%.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
$(AS) $< -o $@

View File

@ -1,3 +1,5 @@
#include <kernelmq/multiboot.h>
#include "logger.h"
#include "gdt.h"
#include "idt.h"
@ -6,10 +8,10 @@ void main(uint32_t multiboot_magic)
{
logger_initialize();
if (multiboot_magic == 0x2BADB002) {
if (multiboot_magic == KERNELMQ_MULTIBOOT_1_MAGIC) {
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.");
}
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