9#include <kernel/version.h>
144typedef struct module_info
160#define MODULE_INFO_SECTION "._module_info"
200#define MODULE_INFO(_name, _author, _description, _version, _licence, _deviceTypes) \
201 const char _moduleInfo[] __attribute__((section(MODULE_INFO_SECTION), used)) = \
202 _name ";" _author ";" _description ";" _version ";" _licence ";" OS_VERSION ";" _deviceTypes "\0"
209#define MODULE_RESERVED_PREFIX "_mod"
225#define MODULE_DIR "/kernel/modules/" OS_VERSION "/:directory"
231typedef enum module_event_type
266typedef struct module_event
295typedef struct module_device
307typedef struct module_device_handler
320typedef enum module_flags
#define MAX_PATH
Maximum length of filepaths.
uint64_t symbol_group_id_t
Symbol group identifier type.
module_event_type_t
Module event types.
module_flags_t
Module flags.
bool module_device_types_contains(const char *deviceTypes, const char *type)
Check if a list of device types contains a specific device type.
void module_device_detach(const char *name)
Notify the module system of a device being detached.
module_load_flags_t
Module load flags.
uint64_t(* module_procedure_t)(const module_event_t *event)
Module procedure and entry point.
module_string_size_t
Sizes for module strings.
void module_init_fake_kernel_module()
Initialize a fake module representing the kernel itself.
module_reserved_prefix_length_t
Length of MODULE_RESERVED_PREFIX.
uint64_t module_device_attach(const char *type, const char *name, module_load_flags_t flags)
Notify the module system of a device being attached.
@ MODULE_EVENT_DEVICE_ATTACH
@ MODULE_EVENT_DEVICE_DETACH
@ MODULE_FLAG_LOADED
If set, the module has received the MODULE_EVENT_LOAD event.
@ MODULE_FLAG_GC_REACHABLE
Used by the GC to mark reachable modules.
@ MODULE_FLAG_GC_PINNED
If set, the module will never be collected by the GC, used for the fake kernel module.
@ MODULE_LOAD_ONE
If set, will load only the first module matching the device type.
@ MODULE_LOAD_ALL
If set, will load all modules matching the device type.
@ MODULE_MAX_DEVICE_STRING
@ MODULE_RESERVED_PREFIX_LENGTH
static const path_flag_t flags[]
A entry in a doubly linked list.
Module device cache entry structure.
Module device cache entry structure.
list_t entries
List of module_cached_device_entry_t.
Module symbol cache entry structure.
char * modulePath
Path to the module defining the symbol.
module_t *module_device_t * device
list_t handlers
List of module_device_handler_t representing modules handling this device.
uint64_t dataSize
Size of the data field.
char * deviceTypes
Null-terminated semicolon-separated list of device type strings.
list_t deviceHandlers
List of module_device_handler_t representing devices this module handles.
map_entry_t mapEntry
Entry for the global module map.
uint64_t size
The size of the modules loaded image in memory.
list_t dependencies
List of module_dependency_t representing modules this module depends on.
list_entry_t gcEntry
Entry used for garbage collection.
list_entry_t listEntry
Entry for the global module list.
void * baseAddr
The address where the modules image is loaded in memory.
symbol_group_id_t symbolGroupId
The symbol group ID for the module's symbols.
module_procedure_t procedure
The module's procedure function and entry point.
map_entry_t providerEntry
Entry for the module provider map.
list_entry_t loadEntry
Entry used while loading modules.