[libj6] Update how init args are passed and used

Now the init args are a linked list - this also means ld.so can use its
own plus those of the program (eg, SLP and VFS handles). __init_libj6
now adds the head of the list to its global init_args structure, and the
j6_find_init_handle function can be used to find a handle in those args
for a given proto.

This fixes situations like the logger using the wrong mailbox for the
service locator and never finding the uart driver.
This commit is contained in:
Justin C. Miller
2024-02-20 20:51:14 -08:00
parent 9f8e75f680
commit 4e73e933db
10 changed files with 125 additions and 72 deletions

View File

@@ -29,7 +29,7 @@ main(int argc, const char **argv, const char **env)
using bootproto::devices::fb_layout;
const j6_init_args *init = j6_get_init_args();
const uefi_fb *fb = reinterpret_cast<const uefi_fb*>(init->args[0]);
const uefi_fb *fb = reinterpret_cast<const uefi_fb*>(init->argv[0]);
if (!fb || !fb->framebuffer) {
j6::syslog("fb driver didn't find a framebuffer, exiting");
@@ -45,7 +45,7 @@ main(int argc, const char **argv, const char **env)
j6_vm_flag_write_combine |
j6_vm_flag_mmio;
j6_handle_t sys = j6_find_first_handle(j6_object_type_system);
j6_handle_t sys = j6_find_init_handle(0);
if (sys == j6_handle_invalid)
return 1;