CHECK_FLAG macro and makefile rm fix
This commit is contained in:
parent
1f4195225e
commit
35d6c90194
7
Makefile
7
Makefile
|
@ -6,8 +6,8 @@ INCLUDEDIR := include
|
|||
|
||||
KSRC := $(wildcard kernel/*.asm kernel/*.c)
|
||||
KOBJ := $(addprefix $(BUILDDIR)/, \
|
||||
$(notdir \
|
||||
$(patsubst %.asm,%.o, $(patsubst %.c,%.o, $(KSRC)))))
|
||||
$(notdir \
|
||||
$(patsubst %.asm,%.o, $(patsubst %.c,%.o, $(KSRC)))))
|
||||
KIMG := kernel.bin
|
||||
|
||||
ISO := Hazel.iso
|
||||
|
@ -27,6 +27,7 @@ $(BUILDDIR)/%.o: */%.c
|
|||
kernel: $(BUILDDIR)/$(KIMG)
|
||||
|
||||
$(BUILDDIR)/$(ISO): kernel
|
||||
rm -f $(BUILDDIR)/$(ISO)
|
||||
cp $(BUILDDIR)/$(KIMG) boot/$(KIMG)
|
||||
grub-mkrescue -o $(BUILDDIR)/$(ISO) .
|
||||
iso: $(BUILDDIR)/$(ISO)
|
||||
|
@ -34,4 +35,4 @@ iso: $(BUILDDIR)/$(ISO)
|
|||
qemu: iso
|
||||
qemu-system-i386 $(QEMUFLAGS)
|
||||
clean:
|
||||
rm build/* boot/*.bin
|
||||
rm -f build/* boot/*.bin
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include <kernel/log.h>
|
||||
|
||||
#define cpu_relax asm volatile ("pause" ::)
|
||||
#define CHECK_FLAG(x, n) (x & (1<<n))
|
||||
|
||||
typedef struct {
|
||||
multiboot_memory_map_t *mem_map;
|
||||
|
|
|
@ -5,13 +5,12 @@
|
|||
kernel_ctx_t ctx = {0};
|
||||
|
||||
void kernel(multiboot_info_t *info) {
|
||||
if (!(info->flags & (1<<6))) goto halt;
|
||||
if (!(info->flags & (1<<12))) goto halt;
|
||||
if (!CHECK_FLAG(info->flags, 6)) goto halt; // Memory map
|
||||
if (!CHECK_FLAG(info->flags, 12)) goto halt; // VBE data
|
||||
ctx.mem_map = (multiboot_memory_map_t *)info->memmapaddress;
|
||||
ctx.mem_map_len = info->memmaplength;
|
||||
|
||||
if (serial_port_init(COM1))
|
||||
ctx.log_method = LOG_COM1;
|
||||
if (serial_port_init(COM1)) ctx.log_method = LOG_COM1;
|
||||
|
||||
LOG("Kernel log being sent to COM1\n");
|
||||
halt:
|
||||
|
|
Loading…
Reference in New Issue
Block a user