From 0807aaea2bf106b502219e8749f76c33b81f0b57 Mon Sep 17 00:00:00 2001 From: Max K Date: Thu, 3 May 2018 22:08:30 +0200 Subject: [PATCH] Fix small issues in the stage2 loader (#78) * stage2 loader: Fix loadlist parsing breaking out of the loop too early * stage2 loader: Use bct0 from the loader context --- fusee/fusee-secondary/src/loader.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/fusee/fusee-secondary/src/loader.c b/fusee/fusee-secondary/src/loader.c index 0c72411e4..9671573f5 100644 --- a/fusee/fusee-secondary/src/loader.c +++ b/fusee/fusee-secondary/src/loader.c @@ -54,7 +54,7 @@ void load_list_entry(const char *key) { printk("Loading %s\n", key); - if (ini_parse_string(g_bct0, loadlist_entry_ini_handler, &load_file_ctx) < 0) { + if (ini_parse_string(get_loader_ctx()->bct0, loadlist_entry_ini_handler, &load_file_ctx) < 0) { printk("Error: Failed to parse BCT.ini!\n"); generic_panic(); } @@ -110,20 +110,22 @@ void parse_loadlist(const char *ll) { /* Load the entry. */ load_list_entry(entry); /* Skip to the next delimiter. */ - for (; *p == ' ' || *p == '\t'; p++) { } - if (*p == '\x00') { - break; - } else if (*p != '|') { + for (; *p == ' ' || *p == '\t' || *p == '\x00'; p++) { } + if (*p != '|') { printk("Error: Load list is malformed!\n"); generic_panic(); } else { /* Skip to the next entry. */ - for (; *p == ' ' || *p == '\t'; p++) { } + for (; *p == ' ' || *p == '\t' || *p == '|'; p++) { } entry = p; } } - + p++; + if (*p == '\x00') { + /* We're at the end of the line, load the last entry */ + load_list_entry(entry); + } } }