diff options
Diffstat (limited to 'syscall/invoke-untyped.c')
-rw-r--r-- | syscall/invoke-untyped.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/syscall/invoke-untyped.c b/syscall/invoke-untyped.c index fe34ce9..a89306e 100644 --- a/syscall/invoke-untyped.c +++ b/syscall/invoke-untyped.c @@ -1,4 +1,5 @@ #include "handles.h" +#include "object.h" #include "syscall.h" #include "error.h" #include "memory.h" @@ -69,7 +70,7 @@ s_handle_invoke_untyped_split( }; size_t *split = ko_entry_data(dest_entry); - *untyped -= dest_bytes; +*untyped -= dest_bytes; *split = dest_bytes; #ifdef DBG_SYSCALL @@ -80,11 +81,29 @@ s_handle_invoke_untyped_split( return 0; } +static int +s_handle_invoke_untyped_retype( + objdir_t *root_dir, + objdir_entry_t *target, + uint8_t *payload, + size_t payload_at + ) +{ + obj_type_t retype; + SYSCALL_PAYLOAD_TAKEL(payload, payload_at, retype, obj_type_t); + + switch(retype) { + case KO_OBJECT_DIRECTORY: + return ko_untyped_retype_objdir(target); + default: return KE_BADTYPE; + } +} + static int (*s_invoke_handles[])(objdir_t*, objdir_entry_t*, uint8_t*, size_t) = { [INVOKE_UNTYPED_SIZE] = s_handle_invoke_untyped_size, [INVOKE_UNTYPED_SPLIT] = s_handle_invoke_untyped_split, - - [INVOKE_UNTYPED_ALIGNMENT] = s_handle_invoke_untyped_alignment + [INVOKE_UNTYPED_ALIGNMENT] = s_handle_invoke_untyped_alignment, + [INVOKE_UNTYPED_RETYPE] = s_handle_invoke_untyped_retype, }; static size_t s_invoke_handles_count = sizeof(s_invoke_handles) / sizeof(void*); |