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

This commit is contained in:
mintsuki 2020-11-10 11:12:56 +01:00
parent e3519a6cfa
commit 352f74daef
5 changed files with 12 additions and 1 deletions

Binary file not shown.

Binary file not shown.

View File

@ -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

View File

@ -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) ?

View File

@ -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