:: commit c15e8527d4347596e6b73888412a13850cb913a5

mintsuki <mintsuki@protonmail.com> — 2020-11-10 10:12

parents: e3519a6cfa

stivale2: Fix bug where uri_open return value is tested wrong; uri: Allocate new buffer on uri_resolve

diff --git a/limine-pxe.bin b/limine-pxe.bin
index 26504629..36ecda00 100644
Binary files a/limine-pxe.bin and b/limine-pxe.bin differ
diff --git a/limine.bin b/limine.bin
index bc9b99cf..e14beb42 100644
Binary files a/limine.bin and b/limine.bin differ
diff --git a/stage2/lib/uri.c b/stage2/lib/uri.c
index c76885c7..3fe3038e 100644
--- a/stage2/lib/uri.c
+++ b/stage2/lib/uri.c
@@ -12,6 +12,11 @@
 // A URI takes the form of: resource://root/path
 // The following function splits up a URI into its componenets
 bool uri_resolve(char *uri, char **resource, char **root, char **path) {
+    size_t length = strlen(uri) + 1;
+    char *buf = conv_mem_alloc(length);
+    memcpy(buf, uri, length);
+    uri = buf;
+
     *resource = *root = *path = NULL;
 
     // Get resource
diff --git a/stage2/protos/stivale2.c b/stage2/protos/stivale2.c
index f76c9bc2..c5a10aed 100644
--- a/stage2/protos/stivale2.c
+++ b/stage2/protos/stivale2.c
@@ -183,7 +183,7 @@ void stivale2_load(char *cmdline) {
         }
 
         struct file_handle f;
-        if (uri_open(&f, module_file))
+        if (!uri_open(&f, module_file))
             panic("Requested module with path \"%s\" not found!\n", module_file);
 
         void *module_addr = (void *)(((uint32_t)top_used_addr & 0xfff) ?
diff --git a/test/limine.cfg b/test/limine.cfg
index c5b7cae1..3d38a940 100644
--- a/test/limine.cfg
+++ b/test/limine.cfg
@@ -15,9 +15,15 @@ PROTOCOL=stivale
 KERNEL_PATH=guid://@GUID@/boot/test.elf
 KERNEL_CMDLINE=Hi! This is an example!
 
+MODULE_PATH=bios://:1/boot/test.elf
+MODULE_STRING=yooooo
+
 :Stivale2 Test
 
 PROTOCOL=stivale2
 RESOLUTION=640x480x16
 KERNEL_PATH=bios://:1/boot/test.elf
 KERNEL_CMDLINE=Woah! Another example!
+
+MODULE_PATH=guid://@GUID@/boot/test.elf
+MODULE_STRING=yooooo
tab: 248 wrap: offon