mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-11-01 15:08:21 +00:00
kernel: rework init
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#include <kernel/slab.h>
|
||||
#include <logging.h>
|
||||
#include <string.h>
|
||||
#include <kernel/init.h>
|
||||
|
||||
// each allocation has the following structure:
|
||||
// ptr: data capacity (allocsizes size)
|
||||
@@ -96,3 +97,5 @@ void alloc_init() {
|
||||
for (int i = 0; i < 5; ++i)
|
||||
caches[i] = caches[5];
|
||||
}
|
||||
|
||||
INIT_ROUTINE_DEFINE(alloc, INIT_ROUTINE_FLAGS_NONE, alloc_init, vmm);
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <mutex.h>
|
||||
#include <util.h>
|
||||
#include <kernel/vmmcache.h>
|
||||
#include <kernel/init.h>
|
||||
|
||||
uintptr_t hhdmbase;
|
||||
static size_t memorysize;
|
||||
@@ -266,6 +267,11 @@ void pmm_init() {
|
||||
MUTEX_INIT(&freelistmutex);
|
||||
}
|
||||
|
||||
INIT_ROUTINE_DEFINE(pmm,
|
||||
INIT_ROUTINE_FLAGS_NONE,
|
||||
pmm_init,
|
||||
arch_early);
|
||||
|
||||
// XXX pmm_alloc won't be able to take pages from the page cache when the allocation size is over 1 page
|
||||
|
||||
void *pmm_alloc(size_t size, int section) {
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <string.h>
|
||||
#include <kernel/slab.h>
|
||||
#include <kernel/vmmcache.h>
|
||||
#include <kernel/init.h>
|
||||
|
||||
#define RANGE_TOP(x) (void *)((uintptr_t)x->start + x->size)
|
||||
|
||||
@@ -962,6 +963,8 @@ void vmm_init() {
|
||||
printspace(&kernelspace);
|
||||
}
|
||||
|
||||
INIT_ROUTINE_DEFINE(vmm, INIT_ROUTINE_FLAGS_NONE, vmm_init, mmu);
|
||||
|
||||
void vmm_apinit() {
|
||||
vmm_switchcontext(&vmm_kernelctx);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <logging.h>
|
||||
#include <kernel/timekeeper.h>
|
||||
#include <kernel/event.h>
|
||||
#include <kernel/init.h>
|
||||
|
||||
#define TABLE_SIZE 4096
|
||||
#define WRITER_TICK_SECONDS 15
|
||||
@@ -475,3 +476,5 @@ void vmmcache_init() {
|
||||
EVENT_INITHEADER(&syncevent);
|
||||
EVENT_INITHEADER(&pagereadyevent);
|
||||
}
|
||||
|
||||
INIT_ROUTINE_DEFINE(vmm_cache, INIT_ROUTINE_FLAGS_NONE, vmmcache_init, scheduler);
|
||||
|
||||
Reference in New Issue
Block a user