kernel: enumerate internal kexts during boot

This commit is contained in:
2023-04-08 09:27:21 +01:00
parent a1f54fd156
commit 9b75ca8b8c
6 changed files with 151 additions and 4 deletions

36
kxld/internal.c Normal file
View File

@@ -0,0 +1,36 @@
#include <socks/kext.h>
#include <socks/printk.h>
#include <socks/vm.h>
#include <socks/libc/stdio.h>
static vm_cache_t kext_cache = { .c_obj_size = sizeof(struct kext) };
static struct kext *self = NULL;
extern char __kexts_start[];
extern char __kexts_end[];
kern_status_t scan_internal_kexts(void)
{
vm_cache_init(&kext_cache);
self = vm_cache_alloc(&kext_cache, 0);
snprintf(self->k_ident, sizeof self->k_ident, "%s", KERNEL_KEXT_ID);
self->k_flags = KEXT_INTERNAL | KEXT_ONLINE;
self->k_nr_dependencies = 0;
self->k_dependencies = NULL;
struct kext_info *cur = (struct kext_info *)__kexts_start;
struct kext_info *end = (struct kext_info *)__kexts_end;
while (cur < end) {
printk("kext: found internal kext '%s'", cur->k_ident);
cur++;
}
return KERN_OK;
}
kern_status_t bring_internal_kexts_online(void)
{
return KERN_OK;
}