diff options
author | Jon Santmyer <jon@jonsantmyer.com> | 2025-08-17 14:16:55 -0400 |
---|---|---|
committer | Jon Santmyer <jon@jonsantmyer.com> | 2025-08-17 14:16:55 -0400 |
commit | 7ee9347560768641096df68c545ac085a20233e4 (patch) | |
tree | 5b567f2e98cd9e6aeee33eeecd7fbf6f2fafdeab /syscall/invoke_objdir.c | |
parent | f466364b8a3858e7b3f19258d142851cb4a7e6d6 (diff) | |
download | jove-kernel-7ee9347560768641096df68c545ac085a20233e4.tar.gz jove-kernel-7ee9347560768641096df68c545ac085a20233e4.tar.bz2 jove-kernel-7ee9347560768641096df68c545ac085a20233e4.zip |
working usermode pager. fix usermode interrupts
Diffstat (limited to 'syscall/invoke_objdir.c')
-rw-r--r-- | syscall/invoke_objdir.c | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/syscall/invoke_objdir.c b/syscall/invoke_objdir.c index 97dd126..0cc5a44 100644 --- a/syscall/invoke_objdir.c +++ b/syscall/invoke_objdir.c @@ -2,6 +2,7 @@ #include "syscall.h" #include "error.h" #include "lock.h" +#include "string.h" #include "print.h" static int @@ -40,15 +41,50 @@ s_handle_invoke_objdir_lastmemb( uint8_t lastfull = 0; for(int i = 1; i < 256; i++) { if(target_dir->entries[i].type != KO_NONE) lastfull = i; - } +} +#ifdef DBG_SYSCALL + klogf("%i\n", lastfull); +#endif *dest = lastfull; return 0; } +static int +s_handle_invoke_objdir_move( + objdir_t *root_dir, + objdir_t *target_dir, + uint8_t *payload, + size_t payload_at + ) +{ + uint8_t target_memb; + size_t dest_pathw; + objdir_entry_t *dest_entry; + + SYSCALL_PAYLOAD_TAKEL(payload, payload_at, target_memb, uint8_t); + SYSCALL_PAYLOAD_TAKEOBJ(payload, payload_at, dest_pathw, dest_entry); + + if(target_memb == 0) return KE_OOB; + if(dest_entry->type != KO_NONE) return KE_FULL; + + objdir_entry_t *move_entry = &target_dir->entries[target_memb]; + if(move_entry->type == KO_NONE) return KE_BADOBJ; + +#ifdef DBG_SYSCALL + klogf("move %p -> %p\n", move_entry, dest_entry); +#endif + + memcpy(dest_entry, move_entry, sizeof(objdir_entry_t)); + memset(move_entry, 0, sizeof(objdir_entry_t)); + + return KE_OK; +} + static int (*s_invoke_handles[])(objdir_t*, objdir_t*, uint8_t*, size_t) = { [INVOKE_OBJDIR_GETMEMB] = s_handle_invoke_objdir_getmemb, - [INVOKE_OBJDIR_LASTMEMB] = s_handle_invoke_objdir_lastmemb + [INVOKE_OBJDIR_LASTMEMB] = s_handle_invoke_objdir_lastmemb, + [INVOKE_OBJDIR_MOVE] = s_handle_invoke_objdir_move, }; static size_t s_invoke_handles_count = sizeof(s_invoke_handles) / sizeof(void*); |