PMM and liballoc port

This commit is contained in:
2025-12-17 22:42:48 +01:00
parent 13fee12f59
commit f60d8d6861
32 changed files with 1202 additions and 12 deletions

View File

@@ -1,11 +1,18 @@
#include <limine/limine.h>
#include <amd64/init.h>
#include <sys/debug.h>
#include <mm/pmm.h>
#include <mm/liballoc.h>
void bootmain(void) {
amd64_init();
DEBUG("Hello from amd64!\n");
pmm_init();
int *a = malloc(sizeof(int));
*a = 6969;
DEBUG("a=%p, *a=%d\n", a, *a);
for (;;);
}

6
kernel/amd64/mm.h Normal file
View File

@@ -0,0 +1,6 @@
#ifndef _KERNEL_AMD64_MM_H
#define _KERNEL_AMD64_MM_H
#define PAGE_SIZE 4096
#endif // _KERNEL_AMD64_MM_H

5
kernel/amd64/spin_lock.c Normal file
View File

@@ -0,0 +1,5 @@
#include <sys/spin_lock.h>
void spin_lock_relax(void) {
__asm__ volatile("pause");
}

View File

@@ -2,10 +2,12 @@ c += amd64/bootmain.c \
amd64/init.c \
amd64/tss.c \
amd64/io.c \
amd64/debug.c
amd64/debug.c \
amd64/spin_lock.c
o += amd64/bootmain.o \
amd64/init.o \
amd64/tss.o \
amd64/io.o \
amd64/debug.o
amd64/debug.o \
amd64/spin_lock.o