CHECK_FLAG macro and makefile rm fix

This commit is contained in:
rami 2024-06-30 21:27:33 -04:00
parent 1f4195225e
commit 35d6c90194
3 changed files with 8 additions and 7 deletions

View File

@ -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

View File

@ -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;

View File

@ -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: