PMM and liballoc port
This commit is contained in:
@@ -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
6
kernel/amd64/mm.h
Normal 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
5
kernel/amd64/spin_lock.c
Normal file
@@ -0,0 +1,5 @@
|
||||
#include <sys/spin_lock.h>
|
||||
|
||||
void spin_lock_relax(void) {
|
||||
__asm__ volatile("pause");
|
||||
}
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user