This commit is contained in:
nub31
2025-09-03 17:20:00 +02:00
parent ad879af3f9
commit 0b8ee325aa
6 changed files with 10 additions and 5 deletions

View File

@@ -17,13 +17,13 @@ iso: .build/nub-os.iso
clean:
@rm -r .build 2>/dev/null || true
.build/nub-os.iso: .build/kernel grub.cfg
.build/nub-os.iso: .build/kernel/kernel grub.cfg
mkdir -p .build/nub-os/boot/grub
cp grub.cfg .build/nub-os/boot/grub
cp .build/kernel .build/nub-os/boot/
cp .build/kernel/kernel .build/nub-os/boot/
grub-mkrescue -o .build/nub-os.iso .build/nub-os/
.build/kernel: $(OBJS)
.build/kernel/kernel: $(OBJS)
$(LD) $(LDFLAGS) -T linker.ld -o $@ $^
.build/%.o: src/%.c

View File

@@ -1,4 +1,4 @@
#include "../../kernel.h"
#include "../../kernel/kernel.h"
#include "../arch.h"
#include "interrupts/idt.h"
#include "interrupts/irq.h"

View File

@@ -5,5 +5,8 @@
void main()
{
pmm_init();
uint64_t page = pmm_alloc_page();
printf("page: %u\n", page);
printf("Welcome to nub OS :)\n");
}

View File

@@ -1,5 +1,5 @@
#include "pmm.h"
#include "arch/arch.h"
#include "../arch/arch.h"
#include <stddef.h>
#include <stdio.h>
#include <string.h>
@@ -52,6 +52,7 @@ void pmm_init()
}
}
// Returns the address of first free physical page
uint64_t pmm_alloc_page()
{
for (size_t i = 0; i < BITMAP_SIZE; i++)
@@ -73,6 +74,7 @@ uint64_t pmm_alloc_page()
return 0;
}
// Frees the physical page at the specified address
void pmm_free_page(uint64_t addr)
{
uint64_t page = addr / PAGE_SIZE;