[zion] Link against glacier as a POC

This commit is contained in:
Drew Galbraith 2023-06-21 14:42:37 -07:00
parent 859fbf66da
commit f3443cf4de
2 changed files with 9 additions and 2 deletions

View File

@ -45,6 +45,9 @@ target_include_directories(zion
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
) )
target_link_libraries(zion
glacier)
# -c -- Don't run the linker (only necessary for the assembler) # -c -- Don't run the linker (only necessary for the assembler)
# -ffreestanding # -ffreestanding
# -fno-rtti -- No runtime type information (might mess with polymorphism?) # -fno-rtti -- No runtime type information (might mess with polymorphism?)

View File

@ -1,5 +1,7 @@
#include "loader/init_loader.h" #include "loader/init_loader.h"
#include <glacier/string/string.h>
#include "boot/boot_info.h" #include "boot/boot_info.h"
#include "debug/debug.h" #include "debug/debug.h"
#include "include/zcall.h" #include "include/zcall.h"
@ -103,11 +105,13 @@ void DumpModules() {
#endif #endif
} }
const limine_file& GetInitProgram(const char* path) { const limine_file& GetInitProgram(glcr::String path) {
const limine_module_response& resp = boot::GetModules(); const limine_module_response& resp = boot::GetModules();
for (uint64_t i = 0; i < resp.module_count; i++) { for (uint64_t i = 0; i < resp.module_count; i++) {
const limine_file& file = *resp.modules[i]; const limine_file& file = *resp.modules[i];
if (streq(file.path, path)) return file; if (path == file.path) {
return file;
}
} }
panic("Program not found: %s", path); panic("Program not found: %s", path);
} }