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:
parent
68c0958bee
commit
5b23dead92
4 changed files with 26 additions and 5 deletions
4
Makefile
4
Makefile
|
@ -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
|
||||||
|
|
|
@ -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 $@
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
15
include/kernelmq/multiboot.h
Normal file
15
include/kernelmq/multiboot.h
Normal 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
|
Loading…
Reference in a new issue