diff options
Diffstat (limited to 'syscall/invoke-untyped.c')
-rw-r--r-- | syscall/invoke-untyped.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/syscall/invoke-untyped.c b/syscall/invoke-untyped.c index 6b9199f..fe34ce9 100644 --- a/syscall/invoke-untyped.c +++ b/syscall/invoke-untyped.c @@ -56,20 +56,27 @@ s_handle_invoke_untyped_split( SYSCALL_PAYLOAD_TAKEOBJ(payload, payload_at, dest_pathw, dest_entry); if(dest_entry->type != KO_NONE) return -KE_BADOBJ; - size_t *untyped = (size_t*)target->data; + uintptr_t untyped_phys = target->data; + size_t *untyped = ko_entry_data(target); size_t untyped_size = *untyped; SYSCALL_PAYLOAD_TAKEL(payload, payload_at, dest_bytes, size_t); if(untyped_size - sizeof(size_t) <= dest_bytes) return -KE_TOOSMALL; - size_t *split = (size_t*)(((uintptr_t)untyped) + untyped_size - dest_bytes); - *untyped -= dest_bytes; - *split = dest_bytes; - *dest_entry = (objdir_entry_t) { .type = KO_MEMORY_UNTYPED, - .data = (uintptr_t)split + .data = untyped_phys + untyped_size - dest_bytes }; + + size_t *split = ko_entry_data(dest_entry); + *untyped -= dest_bytes; + *split = dest_bytes; + +#ifdef DBG_SYSCALL + klogf("split %p[%p:%i] into %p[%p:%i]\n", + target, target->data, untyped_size, + dest_entry, dest_entry->data, dest_bytes); +#endif return 0; } |