mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:07:36 +00:00
Kernel+Userland: Remove loadable kernel moduless
These interfaces are broken for about 9 months, maybe longer than that. At this point, this is just a dead code nobody tests or tries to use, so let's remove it instead of keeping a stale code just for the sake of keeping it and hoping someone will fix it. To better justify this, I read that OpenBSD removed loadable kernel modules in 5.7 release (2014), mainly for the same reason we do - nobody used it so they had no good reason to maintain it. Still, OpenBSD had LKMs being effectively working, which is not the current state in our project for a long time. An arguably better approach to minimize the Kernel image size is to allow dropping drivers and features while compiling a new image.
This commit is contained in:
parent
b92871f7ef
commit
04ba31b8c5
19 changed files with 0 additions and 530 deletions
|
@ -1,65 +0,0 @@
|
|||
## Name
|
||||
|
||||
Kernel Modules - runtime code loading for the kernel
|
||||
|
||||
## Description
|
||||
|
||||
Serenity's kernel supports loading modules at runtime. This functionality can
|
||||
be used to implement optional features (e.g. drivers), and speed up your
|
||||
development cycle.
|
||||
|
||||
## Module format
|
||||
|
||||
A kernel module is a regular ELF object file which must export several
|
||||
symbols. Any symbols it refers to will be resolved when it is loaded.
|
||||
|
||||
### `module_name`
|
||||
|
||||
This should be a string like `const char module_name[]` containing the name of
|
||||
the module. This is used to give the module a name in any informational
|
||||
contexts, but also to ensure that the module is not loaded twice by accident,
|
||||
and also used as a reference to unload the module later.
|
||||
|
||||
### `module_init`
|
||||
|
||||
This should be a function with the following signature: `void module_init()`.
|
||||
It will be called when the module is loaded.
|
||||
|
||||
### `module_fini`
|
||||
|
||||
This is optional, but if defined it should be a function with the following
|
||||
signature: `void module_fini()`. It will be called when the module is
|
||||
unloaded.
|
||||
|
||||
## Example:
|
||||
|
||||
```c++
|
||||
#include <Kernel/kstdio.h>
|
||||
#include <Kernel/Process.h>
|
||||
|
||||
extern "C" const char module_name[] = "ExampleModule";
|
||||
|
||||
extern "C" void module_init()
|
||||
{
|
||||
kprintf("ExampleModule has booted!\n");
|
||||
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
kprintf("i is now %d\n", i);
|
||||
}
|
||||
|
||||
kprintf("current pid: %d\n", current->process().sys$getpid());
|
||||
kprintf("current process name: %s\n", current->process().name().characters());
|
||||
}
|
||||
|
||||
extern "C" void module_fini()
|
||||
{
|
||||
kprintf("ExampleModule is being removed!\n");
|
||||
}
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
* [`modload`(8)](../man8/modload.md)
|
||||
* [`modunload`(8)](../man8/modunload.md)
|
||||
* [`module_load`(2)](../man2/module_load.md)
|
||||
* [`module_unload`(2)](../man2/module_unload.md)
|
Loading…
Add table
Add a link
Reference in a new issue