mirror of
https://github.com/RGBCube/serenity
synced 2025-05-24 11:05:08 +00:00

It's now possible to load a .o file into the kernel via a syscall. The kernel will perform all the necessary ELF relocations, and then call the "module_init" symbol in the loaded module.
19 lines
396 B
C++
19 lines
396 B
C++
#include <Kernel/Syscall.h>
|
|
#include <errno.h>
|
|
#include <serenity.h>
|
|
|
|
extern "C" {
|
|
|
|
int module_load(const char* path, size_t path_length)
|
|
{
|
|
int rc = syscall(SC_module_load, path, path_length);
|
|
__RETURN_WITH_ERRNO(rc, rc, -1);
|
|
}
|
|
|
|
int module_unload(const char* name, size_t name_length)
|
|
{
|
|
int rc = syscall(SC_module_unload, name, name_length);
|
|
__RETURN_WITH_ERRNO(rc, rc, -1);
|
|
}
|
|
|
|
}
|