From f241e67d911d790376de26698f8bf8ba02550212 Mon Sep 17 00:00:00 2001
From: Frans Kaashoek <kaashoek@mit.edu>
Date: Sun, 7 Oct 2018 18:14:53 -0400
Subject: x

---
 syscall.c | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

(limited to 'syscall.c')

diff --git a/syscall.c b/syscall.c
index 3ffe3d8..481bde8 100644
--- a/syscall.c
+++ b/syscall.c
@@ -25,6 +25,17 @@ fetchint(uint64 addr, int *ip)
   return 0;
 }
 
+// Fetch the uint64 at addr from the current process.
+int
+fetchaddr(uint64 addr, uint64 *ip)
+{
+  struct proc *curproc = myproc();
+  if(addr >= curproc->sz || addr+sizeof(uint64) > curproc->sz)
+    return -1;
+  *ip = *(uint64*)(addr);
+  return 0;
+}
+
 // Fetch the nul-terminated string at addr from the current process.
 // Doesn't actually copy the string - just sets *pp to point at it.
 // Returns length of string, not including nul.
@@ -67,16 +78,6 @@ fetcharg(int n)
   return -1;
 }
 
-int
-fetchaddr(uint64 addr, uint64 *ip)
-{
-  struct proc *curproc = myproc();
-  if(addr >= curproc->sz || addr+sizeof(uint64) > curproc->sz)
-    return -1;
-  *ip = *(uint64*)(addr);
-  return 0;
-}
-
 // Fetch the nth 32-bit system call argument.
 int
 argint(int n, int *ip)
@@ -116,8 +117,8 @@ argptr(int n, char **pp, int size)
 int
 argstr(int n, char **pp)
 {
-  int addr;
-  if(argint(n, &addr) < 0)
+  uint64 addr;
+  if(argaddr(n, &addr) < 0)
     return -1;
   return fetchstr(addr, pp);
 }
-- 
cgit v1.2.3