kernel: usercopy functions

This commit is contained in:
Matheus
2024-06-09 19:31:26 -03:00
parent 429f56aced
commit 50b4b45d00
53 changed files with 712 additions and 260 deletions
+8 -4
View File
@@ -7,13 +7,17 @@ syscallret_t syscall_sigaltstack(context_t *, stack_t *new, stack_t *old) {
};
stack_t newtmp, oldtmp;
if (new)
newtmp = *new;
if (new && usercopy_fromuser(&newtmp, new, sizeof(stack_t))) {
ret.errno = EFAULT;
return ret;
}
signal_altstack(_cpu()->thread, new ? &newtmp : NULL, old ? &oldtmp : NULL);
if (old)
*old = oldtmp;
if (old && usercopy_touser(old, &oldtmp, sizeof(stack_t))) {
ret.errno = EFAULT;
return ret;
}
ret.errno = 0;
ret.ret = 0;