limine: Add compressed internal modules support. Closes #324

This commit is contained in:
mintsuki 2024-01-07 01:45:26 +01:00
parent 2cb61f4744
commit cc579a8da2
3 changed files with 8 additions and 1 deletions

View File

@ -1164,6 +1164,7 @@ ID:
Request:
```c
#define LIMINE_INTERNAL_MODULE_REQUIRED (1 << 0)
#define LIMINE_INTERNAL_MODULE_COMPRESSED (1 << 1)
struct limine_internal_module {
const char *path;
@ -1195,6 +1196,7 @@ the kernel.
* `cmdline` - Command line for the given module.
* `flags` - Flags changing module loading behaviour:
- `LIMINE_INTERNAL_MODULE_REQUIRED`: Fail if the requested module is not found.
- `LIMINE_INTERNAL_MODULE_COMPRESSED`: The module is GZ-compressed and should be decompressed by the bootloader. This is honoured if the response is revision 2 or greater.
Internal Limine modules are guaranteed to be loaded *before* user-specified
(configuration) modules, and thus they are guaranteed to appear before user-specified

View File

@ -717,7 +717,7 @@ FEAT_START
struct limine_module_response *module_response =
ext_mem_alloc(sizeof(struct limine_module_response));
module_response->revision = 1;
module_response->revision = 2;
struct limine_file *modules = ext_mem_alloc(module_count * sizeof(struct limine_file));
@ -737,6 +737,10 @@ FEAT_START
char *module_path_abs = ext_mem_alloc(1024);
char *module_path_abs_p = module_path_abs;
if (internal_module->flags & LIMINE_INTERNAL_MODULE_COMPRESSED) {
strcpy(module_path_abs_p, "$");
module_path_abs_p += 1;
}
strcpy(module_path_abs_p, k_resource);
module_path_abs_p += strlen(k_resource);
strcpy(module_path_abs_p, "://");

View File

@ -438,6 +438,7 @@ struct limine_kernel_file_request {
#define LIMINE_MODULE_REQUEST { LIMINE_COMMON_MAGIC, 0x3e7e279702be32af, 0xca1c4f3bd1280cee }
#define LIMINE_INTERNAL_MODULE_REQUIRED (1 << 0)
#define LIMINE_INTERNAL_MODULE_COMPRESSED (1 << 1)
struct limine_internal_module {
LIMINE_PTR(const char *) path;