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