mirror of
https://github.com/justinian/jsix.git
synced 2025-12-09 16:04:32 -08:00
[srv.init] Rework init to use module iterator
Init now uses a module iterator that facilitates filtering on module type.
This commit is contained in:
@@ -1,6 +1,13 @@
|
||||
#include <stdio.h>
|
||||
#include "j6/syscalls.h"
|
||||
#include "init_args.h"
|
||||
|
||||
#include "modules.h"
|
||||
|
||||
using kernel::init::module;
|
||||
using kernel::init::module_type;
|
||||
using kernel::init::module_program;
|
||||
|
||||
extern "C" {
|
||||
int main(int, const char **);
|
||||
}
|
||||
@@ -14,7 +21,15 @@ int
|
||||
main(int argc, const char **argv)
|
||||
{
|
||||
j6_system_log("srv.init starting");
|
||||
modules::load_all(_arg_modules_phys);
|
||||
|
||||
modules mods = modules::load_modules(_arg_modules_phys, handle_system, handle_self);
|
||||
|
||||
char message[100];
|
||||
for (auto &mod : mods.of_type(module_type::program)) {
|
||||
auto &prog = static_cast<const module_program&>(mod);
|
||||
sprintf(message, " program module '%s' at %lx", prog.filename, prog.base_address);
|
||||
j6_system_log(message);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user