Banos is a stable WIP C driver API that is supposed to provide a simple interface to interact with the kernel and load the modules dynamically. It is WIP and atm this just implements module loading with a custom banos_install syscall. Banos will not try to substitute parts of the kernel instead it will just expose kernel functionality via a stable BINARY API. Meaning binaries (should) remain forward and backward compatible on a binary level. Banos modules work similarly to those in linux, you expose symbols via BANOS_EXPORT which allows you to export a name + addr paired symbol. It puts it in the .banos-export section. Drivers provide metadata about themselves in the REQUIRED .banos-driver section. Symbols are resolved at runtime. The kernel exposes the driver functionality via the same .banos-export export mechanism. Banos modules are elf RELOCATABLE files (object files) which have partial linking (only banos symbols should remain). Modules will eventually define dependencies, will export symbols and will allow you to build a complex object hierarchy. This patch adds the banos_install syscall which takes in the driver image to install and may only be executed by super users. The API doesn't validate already loaded modules, as thats something the userspace MAY choose to keep track of. Multi-instance functionality shall be implemented via driver specific behaviuor (exposed in the dev filesystem or some other means). Modules are supposed to allow you to alter kernel behavior and extend it, allowing you to create filesystems, drivers, networking modifications, schedulers, probers, and more (hopefully) whilst remaining binary compatible with any version of the kernel (again, hopefully).
65 lines
1.1 KiB
Plaintext
65 lines
1.1 KiB
Plaintext
ENTRY (_start)
|
|
|
|
KERNEL_OFFSET = 0xFFFFFFFF80000000;
|
|
|
|
SECTIONS
|
|
{
|
|
. = 0x00100000 + KERNEL_OFFSET;
|
|
|
|
g_kernel_start = .;
|
|
.text ALIGN(4K) : AT(ADDR(.text) - KERNEL_OFFSET)
|
|
{
|
|
g_kernel_execute_start = .;
|
|
*(.multiboot)
|
|
*(.multiboot2)
|
|
*(.bananboot)
|
|
*(.text.*)
|
|
}
|
|
.ap_init ALIGN(4K) : AT(ADDR(.ap_init) - KERNEL_OFFSET)
|
|
{
|
|
g_ap_init_addr = .;
|
|
*(.ap_init)
|
|
g_kernel_execute_end = .;
|
|
}
|
|
.userspace ALIGN(4K) : AT(ADDR(.userspace) - KERNEL_OFFSET)
|
|
{
|
|
g_userspace_start = .;
|
|
*(.userspace)
|
|
g_userspace_end = .;
|
|
}
|
|
.rodata ALIGN(4K) : AT(ADDR(.rodata) - KERNEL_OFFSET)
|
|
{
|
|
*(.rodata.*)
|
|
}
|
|
.init_array ALIGN(4K) : AT(ADDR(.init_array) - KERNEL_OFFSET)
|
|
{
|
|
g_init_array_start = .;
|
|
*(.init_array)
|
|
g_init_array_end = .;
|
|
}
|
|
.data ALIGN(4K) : AT(ADDR(.data) - KERNEL_OFFSET)
|
|
{
|
|
g_kernel_writable_start = .;
|
|
*(.data)
|
|
|
|
. = ALIGN(8);
|
|
g_drv_builtin_begin = .;
|
|
KEEP(*(.banos-driver))
|
|
g_drv_builtin_end = .;
|
|
. = ALIGN(8);
|
|
g_banos_export = .;
|
|
KEEP(*(.banos-export))
|
|
g_banos_export_end = .;
|
|
}
|
|
|
|
|
|
.bss ALIGN(4K) : AT(ADDR(.bss) - KERNEL_OFFSET)
|
|
{
|
|
g_kernel_bss_start = .;
|
|
*(COMMON)
|
|
*(.bss)
|
|
g_kernel_writable_end = .;
|
|
}
|
|
g_kernel_end = .;
|
|
}
|