toaruos/kernel/misc/ksym.c

29 lines
648 B
C

/**
* @file kernel/misc/ksym.c
* @brief Kernel symbol table management.
*
* Essentially some wrappers around a hashmap; allows different
* boot methods to provide symbol tables for use with linking
* kernel modules.
*/
#include <kernel/hashmap.h>
#include <kernel/assert.h>
#include <kernel/ksym.h>
static hashmap_t * ksym_hash = NULL;
void ksym_install(void) {
assert(ksym_hash == NULL);
ksym_hash = hashmap_create(20);
}
void ksym_bind(const char * symname, void * value) {
assert(ksym_hash != NULL);
hashmap_set(ksym_hash, symname, value);
}
void * ksym_lookup(const char * symname) {
return hashmap_get(ksym_hash, symname);
}