mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-29 13:48:21 +00:00
kernel: usercopy functions
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user