summaryrefslogtreecommitdiff
path: root/kernel/syscall.c
diff options
context:
space:
mode:
authorRobert Morris <[email protected]>2019-07-28 06:29:37 -0400
committerRobert Morris <[email protected]>2019-07-28 06:29:37 -0400
commit6507da772d63d4dd0e365b976f2b400d64dcfccb (patch)
tree134216f9de126a30e58ff7dc9aea90d07d5bfba2 /kernel/syscall.c
parent629faafa36325bf36e153605d6bd233f3f417a69 (diff)
downloadxv6-labs-6507da772d63d4dd0e365b976f2b400d64dcfccb.tar.gz
xv6-labs-6507da772d63d4dd0e365b976f2b400d64dcfccb.tar.bz2
xv6-labs-6507da772d63d4dd0e365b976f2b400d64dcfccb.zip
argptr no longer needed, since copyin checks
Diffstat (limited to 'kernel/syscall.c')
-rw-r--r--kernel/syscall.c28
1 files changed, 7 insertions, 21 deletions
diff --git a/kernel/syscall.c b/kernel/syscall.c
index 117e78e..197bca1 100644
--- a/kernel/syscall.c
+++ b/kernel/syscall.c
@@ -33,7 +33,7 @@ fetchstr(uint64 addr, char *buf, int max)
}
static uint64
-fetcharg(int n)
+argraw(int n)
{
struct proc *p = myproc();
switch (n) {
@@ -50,7 +50,7 @@ fetcharg(int n)
case 5:
return p->tf->a5;
}
- panic("fetcharg");
+ panic("argraw");
return -1;
}
@@ -58,31 +58,17 @@ fetcharg(int n)
int
argint(int n, int *ip)
{
- *ip = fetcharg(n);
+ *ip = argraw(n);
return 0;
}
+// Retrieve an argument as a pointer.
+// Doesn't check for legality, since
+// copyin/copyout will do that.
int
argaddr(int n, uint64 *ip)
{
- *ip = fetcharg(n);
- return 0;
-}
-
-// Fetch the nth word-sized system call argument as a pointer
-// to a block of memory of size bytes. Check that the pointer
-// lies within the process address space.
-int
-argptr(int n, uint64 *pp, int size)
-{
- uint64 i;
- struct proc *p = myproc();
-
- if(argaddr(n, &i) < 0)
- return -1;
- if(size < 0 || (uint)i >= p->sz || (uint)i+size > p->sz)
- return -1;
- *pp = i;
+ *ip = argraw(n);
return 0;
}