From 6507da772d63d4dd0e365b976f2b400d64dcfccb Mon Sep 17 00:00:00 2001
From: Robert Morris <rtm@csail.mit.edu>
Date: Sun, 28 Jul 2019 06:29:37 -0400
Subject: argptr no longer needed, since copyin checks

---
 kernel/syscall.c | 28 +++++++---------------------
 1 file changed, 7 insertions(+), 21 deletions(-)

(limited to 'kernel/syscall.c')

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;
 }
 
-- 
cgit v1.2.3