gettid syscall, fix issues with vmm and mmap syscall

This commit is contained in:
Matheus
2022-08-18 22:12:51 -03:00
parent da99da2b36
commit 4de0ff2556
9 changed files with 50 additions and 10 deletions
+9
View File
@@ -0,0 +1,9 @@
#include <kernel/syscalls.h>
#include <arch/cls.h>
syscallret syscall_gettid(){
syscallret retv;
retv.errno = 0;
retv.ret = arch_getcls()->thread->tid;
return retv;
}
+3 -2
View File
@@ -45,6 +45,7 @@
#define MFD_ALLOW_SEALING 2U
syscallret syscall_mmap(void* hint, size_t len, int prot, int flags, int fd, off_t offset){
syscallret retv;
retv.ret = -1;
@@ -79,10 +80,10 @@ syscallret syscall_mmap(void* hint, size_t len, int prot, int flags, int fd, off
void* ret = NULL;
if(hint)
ret = vmm_allocnowat(hint, mmuflags, plen) ? hint : NULL; // TODO demand page
ret = vmm_allocnowat(hint, mmuflags, len) ? hint : NULL; // TODO demand page
if(!ret && !(flags & MAP_FIXED))
ret = vmm_allocfrom(USER_ALLOC_START, mmuflags, len);
ret = vmm_allocfrom(USER_ALLOC_START, mmuflags, plen);
if(!ret){
retv.errno = ENOMEM;