protos/limine: Introduce API revision 3; rename cmdline to string in file struct
diff --git a/CONFIG.md b/CONFIG.md
index e578bf7e..3df57d99 100644
--- a/CONFIG.md
+++ b/CONFIG.md
@@ -133,7 +133,8 @@ Note: `uefi` and `efi_chainload` are aliases of the `efi` protocol option. `bios
* `path` - The path of the executable.
* `kernel_path` - Alias of `path`.
* `module_path` - The path to a module. This option can be specified multiple times to specify multiple modules.
- * `module_cmdline` - A command line to be passed to a module. This option can also be specified multiple times. It applies to the module described by the last module option specified.
+ * `module_string` - A string to be associated with a module. This option can also be specified multiple times. It applies to the module described by the last module option specified.
+ * `module_cmdline` - Alias of `module_string`.
* `resolution` - The resolution to be used. This setting takes the form of `<width>x<height>x<bpp>`. If the resolution is not available, Limine will pick another one automatically. Omitting `<bpp>` will default to 32.
* `kaslr` - For relocatable executables, if set to `no`, disable kernel address space layout randomisation. KASLR is enabled by default.
* `randomise_hhdm_base` - If set to `yes`, randomise the base address of the higher half direct map. If set to `no`, do not. By default it is `yes` if KASLR is supported and enabled, else it is `no`.
diff --git a/common/common.mk b/common/common.mk
index d6ad5f32..6ff3ad6d 100644
--- a/common/common.mk
+++ b/common/common.mk
@@ -51,7 +51,7 @@ override CPPFLAGS_FOR_TARGET := \
$(CPPFLAGS_FOR_TARGET) \
-DCOM_OUTPUT=$(COM_OUTPUT) \
-DE9_OUTPUT=$(E9_OUTPUT) \
- -DLIMINE_API_REVISION=2 \
+ -DLIMINE_API_REVISION=3 \
-MMD \
-MP
diff --git a/common/protos/limine.c b/common/protos/limine.c
index 7c870881..173eb306 100644
--- a/common/protos/limine.c
+++ b/common/protos/limine.c
@@ -393,7 +393,7 @@ static struct limine_file get_file(struct file_handle *file, char *cmdline, bool
ret.size = file->size;
- ret.cmdline = reported_addr(cmdline);
+ ret.string = reported_addr(cmdline);
return ret;
}
@@ -1137,7 +1137,7 @@ FEAT_START
struct limine_internal_module *internal_module = (void *)get_phys_addr(internal_modules[i]);
module_path = (char *)get_phys_addr(internal_module->path);
- module_cmdline = (char *)get_phys_addr(internal_module->cmdline);
+ module_cmdline = (char *)get_phys_addr(internal_module->string);
char *module_path_abs = ext_mem_alloc(1024);
char *module_path_abs_p = module_path_abs;
@@ -1160,11 +1160,15 @@ FEAT_START
module_required = internal_module->flags & LIMINE_INTERNAL_MODULE_REQUIRED;
} else {
struct conf_tuple conf_tuple =
+ config_get_tuple(config, i - (module_request->revision >= 1 ? module_request->internal_module_count : 0),
+ "MODULE_PATH", "MODULE_STRING");
+
+ struct conf_tuple conf_tuple1 =
config_get_tuple(config, i - (module_request->revision >= 1 ? module_request->internal_module_count : 0),
"MODULE_PATH", "MODULE_CMDLINE");
module_path = conf_tuple.value1;
- module_cmdline = conf_tuple.value2;
+ module_cmdline = conf_tuple.value2 ?: conf_tuple1.value2;
}
if (module_cmdline == NULL) {
diff --git a/limine.h b/limine.h
index e8e93e08..d6ef458b 100644
--- a/limine.h
+++ b/limine.h
@@ -35,7 +35,7 @@ extern "C" {
# define LIMINE_API_REVISION 0
#endif
-#if LIMINE_API_REVISION > 2
+#if LIMINE_API_REVISION > 3
# error "limine.h API revision unsupported"
#endif
@@ -86,7 +86,11 @@ struct limine_file {
LIMINE_PTR(void *) address;
uint64_t size;
LIMINE_PTR(char *) path;
+#if LIMINE_API_REVISION >= 3
+ LIMINE_PTR(char *) string;
+#else
LIMINE_PTR(char *) cmdline;
+#endif
uint32_t media_type;
uint32_t unused;
uint32_t tftp_ip;
@@ -530,7 +534,11 @@ struct limine_kernel_file_request {
struct limine_internal_module {
LIMINE_PTR(const char *) path;
+#if LIMINE_API_REVISION >= 3
+ LIMINE_PTR(const char *) string;
+#else
LIMINE_PTR(const char *) cmdline;
+#endif
uint64_t flags;
};
diff --git a/test/limine.c b/test/limine.c
index 362f2cf6..653b97c3 100644
--- a/test/limine.c
+++ b/test/limine.c
@@ -60,17 +60,17 @@ static volatile struct limine_executable_file_request exec_file_request = {
struct limine_internal_module internal_module1 = {
.path = "/boot/test.elf",
- .cmdline = "First internal module"
+ .string = "First internal module"
};
struct limine_internal_module internal_module2 = {
.path = "test.elf",
- .cmdline = "Second internal module"
+ .string = "Second internal module"
};
struct limine_internal_module internal_module3 = {
.path = "./limine.conf",
- .cmdline = "Third internal module"
+ .string = "Third internal module"
};
struct limine_internal_module *internal_modules[] = {
@@ -204,7 +204,7 @@ static void print_file(struct limine_file *file) {
e9_printf("File->Address: %x", file->address);
e9_printf("File->Size: %x", file->size);
e9_printf("File->Path: %s", file->path);
- e9_printf("File->CmdLine: %s", file->cmdline);
+ e9_printf("File->String: %s", file->string);
e9_printf("File->MediaType: %d", file->media_type);
e9_printf("File->PartIndex: %d", file->partition_index);
e9_printf("File->TFTPIP: %d.%d.%d.%d",
diff --git a/test/limine.conf b/test/limine.conf
index b73558f0..c2bc08fc 100644
--- a/test/limine.conf
+++ b/test/limine.conf
@@ -18,7 +18,7 @@ backdrop: 008080
cmdline: This is an example command line.
module_path: ${WALLPAPER_PATH}
- module_cmdline: This is the first module.
+ module_string: This is the first module.
module_path: boot():/boot/bg.jpg
dtb_path: boot():/boot/device_tree.dtb
diff --git a/test/test.mk b/test/test.mk
index 87b2dfdc..618888c9 100644
--- a/test/test.mk
+++ b/test/test.mk
@@ -61,7 +61,7 @@ override CFLAGS += \
-I../freestnd-c-hdrs-0bsd \
-I. \
-D_LIMINE_PROTO \
- -DLIMINE_API_REVISION=2
+ -DLIMINE_API_REVISION=3
ifneq ($(findstring x86_64,$(shell $(CC_FOR_TARGET) -dumpmachine)),)
override CFLAGS += \
