more kmalloc

This commit is contained in:
2026-09-23 18:48:44 +02:00
parent 70114f6326
commit 8909e3c4ca
2 changed files with 43 additions and 4 deletions
+16 -2
View File
@@ -2,7 +2,9 @@
#include <kmalloc.h>
#include <string.h>
// this file contains SLUB inspired HEAP allocator
void* freelist = NULL;
// TODO this will be an allocated array later when we have APIC MADT
union per_cpu_freelist_cache freelists_all_cpus[1];
void* kcalloc(size_t count, size_t size) {
size_t size_to_alloc;
@@ -32,4 +34,16 @@ void* kzalloc(size_t size) {
return allocated;
}
void* kmalloc(size_t size) {}
void* kmalloc(size_t size) {
uint32_t core_id;
__asm__ volatile(
"rdtscp"
: "=c"(core_id) // Core ID from IA32_TSC_AUX is placed in ECX
:
: "eax", "edx");
// freelists_all_cpus[core_id];
// TODO enable when we actualy know how many CPUs we have
if () {
}
}