mirror of
https://github.com/justinian/jsix.git
synced 2025-12-09 16:04:32 -08:00
[kernel] Add handle_clone syscall
Added the handle_clone syscall which allows for cloning a handle with a subset of the original handle's capabilities. Related changes: - srv.init now calls handle_clone on its system handle, and load_program was changed to allow this second system handle to be passed to loaded programs instead. However, as drv.uart is still a driver AND a log reader, this new handle is not actually passed yet. - The definition parser was using a set for the cap list, which meant the order (and thus values) of caps was not static. - Some code in objects/handle.h was made more explicit about what bits meant what.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <j6/caps.h>
|
||||
#include <j6/errors.h>
|
||||
#include <j6/syscalls.h>
|
||||
#include <j6/types.h>
|
||||
@@ -29,6 +30,12 @@ main(int argc, const char **argv)
|
||||
|
||||
modules mods = modules::load_modules(_arg_modules_phys, __handle_sys, __handle_self);
|
||||
|
||||
j6_handle_t drv_sys_handle = j6_handle_invalid;
|
||||
j6_status_t s = j6_handle_clone(__handle_sys, &drv_sys_handle,
|
||||
j6_cap_system_bind_irq | j6_cap_system_map_phys | j6_cap_system_change_iopl);
|
||||
if (s != j6_status_ok)
|
||||
return s;
|
||||
|
||||
for (auto &mod : mods.of_type(module_type::program)) {
|
||||
auto &prog = static_cast<const module_program&>(mod);
|
||||
|
||||
@@ -36,7 +43,7 @@ main(int argc, const char **argv)
|
||||
sprintf(message, " loading program module '%s' at %lx", prog.filename, prog.base_address);
|
||||
j6_log(message);
|
||||
|
||||
if (!load_program(prog, message)) {
|
||||
if (!load_program(prog, __handle_sys, message)) {
|
||||
j6_log(message);
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user