stivale+stivale2: default to file path as the module string if NULL
Signed-off-by: Andy-Python-Programmer <andypythonappdeveloper@gmail.com>
diff --git a/stage23/protos/stivale.c b/stage23/protos/stivale.c
index 585a3501..bc8c2113 100644
--- a/stage23/protos/stivale.c
+++ b/stage23/protos/stivale.c
@@ -202,13 +202,24 @@ void stivale_load(char *config, char *cmdline) {
struct stivale_module *m = ext_mem_alloc(sizeof(struct stivale_module));
char *module_string = config_get_value(config, i, "MODULE_STRING");
+
+ // TODO: perhaps change the module string to to be a pointer.
+ //
+ // NOTE: By default, the module string is the file name.
if (module_string == NULL) {
- m->string[0] = '\0';
+ size_t str_len = strlen(module_path);
+
+ if (str_len > 127)
+ str_len = 127;
+
+ memcpy(m->string, module_path, str_len);
} else {
// TODO perhaps change this to be a pointer
size_t str_len = strlen(module_string);
+
if (str_len > 127)
str_len = 127;
+
memcpy(m->string, module_string, str_len);
}
diff --git a/stage23/protos/stivale2.c b/stage23/protos/stivale2.c
index 2981b1d4..21cd7fba 100644
--- a/stage23/protos/stivale2.c
+++ b/stage23/protos/stivale2.c
@@ -313,13 +313,23 @@ failed_to_load_header_section:
struct stivale2_module *m = &tag->modules[i];
char *module_string = config_get_value(config, i, "MODULE_STRING");
+
+ // TODO: perhaps change the module string to to be a pointer.
+ //
+ // NOTE: By default, the module string is the file name.
if (module_string == NULL) {
- m->string[0] = '\0';
+ size_t str_len = strlen(module_path);
+
+ if (str_len > 127)
+ str_len = 127;
+
+ memcpy(m->string, module_path, str_len);
} else {
- // TODO perhaps change this to be a pointer
size_t str_len = strlen(module_string);
+
if (str_len > 127)
str_len = 127;
+
memcpy(m->string, module_string, str_len);
}
diff --git a/test/limine.cfg b/test/limine.cfg
index 9d74e626..9bd6c21b 100644
--- a/test/limine.cfg
+++ b/test/limine.cfg
@@ -21,6 +21,8 @@ KERNEL_CMDLINE=Woah! Another example!
MODULE_PATH=boot:///boot/bg.bmp
MODULE_STRING=yooooo
+MODULE_PATH=boot:///boot/bg.bmp
+
:EFI Chainloading
COMMENT=Test EFI image chainloading.
