diff options
author | Frans Kaashoek <[email protected]> | 2022-08-23 11:01:06 -0400 |
---|---|---|
committer | Frans Kaashoek <[email protected]> | 2022-08-23 11:01:06 -0400 |
commit | ccb7bd14c7303a77f8f99928e2297ddd815674b1 (patch) | |
tree | ac9fc9f6773c87d5adc8ded3bc8bc3a0145e85cd /kernel/syscall.c | |
parent | 4cd4d194b8827af4971a81ad28968499925f884f (diff) | |
parent | 8621be8f3d105cd73ffbc681f9810d04b083b0ae (diff) | |
download | xv6-labs-ccb7bd14c7303a77f8f99928e2297ddd815674b1.tar.gz xv6-labs-ccb7bd14c7303a77f8f99928e2297ddd815674b1.tar.bz2 xv6-labs-ccb7bd14c7303a77f8f99928e2297ddd815674b1.zip |
Merge branch 'riscv' into uvm-perm
Diffstat (limited to 'kernel/syscall.c')
-rw-r--r-- | kernel/syscall.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/kernel/syscall.c b/kernel/syscall.c index 95b9f70..ee94696 100644 --- a/kernel/syscall.c +++ b/kernel/syscall.c @@ -12,7 +12,7 @@ int fetchaddr(uint64 addr, uint64 *ip) { struct proc *p = myproc(); - if(addr >= p->sz || addr+sizeof(uint64) > p->sz) + if(addr >= p->sz || addr+sizeof(uint64) > p->sz) // both tests needed, in case of overflow return -1; if(copyin(p->pagetable, (char *)ip, addr, sizeof(*ip)) != 0) return -1; @@ -25,9 +25,8 @@ int fetchstr(uint64 addr, char *buf, int max) { struct proc *p = myproc(); - int err = copyinstr(p->pagetable, buf, addr, max); - if(err < 0) - return err; + if(copyinstr(p->pagetable, buf, addr, max) < 0) + return -1; return strlen(buf); } @@ -54,21 +53,19 @@ argraw(int n) } // Fetch the nth 32-bit system call argument. -int +void argint(int n, int *ip) { *ip = argraw(n); - return 0; } // Retrieve an argument as a pointer. // Doesn't check for legality, since // copyin/copyout will do that. -int +void argaddr(int n, uint64 *ip) { *ip = argraw(n); - return 0; } // Fetch the nth word-sized system call argument as a null-terminated string. @@ -78,8 +75,7 @@ int argstr(int n, char *buf, int max) { uint64 addr; - if(argaddr(n, &addr) < 0) - return -1; + argaddr(n, &addr); return fetchstr(addr, buf, max); } |