summaryrefslogtreecommitdiff
path: root/sysfile.c
diff options
context:
space:
mode:
authorRobert Morris <[email protected]>2019-05-31 12:43:20 -0400
committerRobert Morris <[email protected]>2019-05-31 12:43:20 -0400
commit7fd1f1eb0aab4d52852fc4f5e83eafc991f9a627 (patch)
tree321ae7c509d2b6286240ad181bc28a9dc3436704 /sysfile.c
parent5d34fa2a489940f19ee6c4728e4b11b6d8ffad01 (diff)
downloadxv6-labs-7fd1f1eb0aab4d52852fc4f5e83eafc991f9a627.tar.gz
xv6-labs-7fd1f1eb0aab4d52852fc4f5e83eafc991f9a627.tar.bz2
xv6-labs-7fd1f1eb0aab4d52852fc4f5e83eafc991f9a627.zip
exec compiles but argstr() doesn't work yet
Diffstat (limited to 'sysfile.c')
-rw-r--r--sysfile.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/sysfile.c b/sysfile.c
index 94f6437..5194d35 100644
--- a/sysfile.c
+++ b/sysfile.c
@@ -5,10 +5,10 @@
//
#include "types.h"
+#include "riscv.h"
#include "defs.h"
#include "param.h"
#include "stat.h"
-#include "mmu.h"
#include "proc.h"
#include "fs.h"
#include "spinlock.h"
@@ -401,22 +401,32 @@ sys_exec(void)
int i;
uint64 uargv, uarg;
+ printf("sys_exec\n");
+
if(argstr(0, &path) < 0 || argaddr(1, &uargv) < 0){
+ printf("error 1\n");
return -1;
}
memset(argv, 0, sizeof(argv));
for(i=0;; i++){
- if(i >= NELEM(argv))
+ if(i >= NELEM(argv)){
+ printf("error 2\n");
return -1;
- if(fetchaddr(uargv+sizeof(uint64)*i, (uint64*)&uarg) < 0)
+ }
+ if(fetchaddr(uargv+sizeof(uint64)*i, (uint64*)&uarg) < 0){
+ printf("error 3\n");
return -1;
+ }
if(uarg == 0){
argv[i] = 0;
break;
}
- if(fetchstr(uarg, &argv[i]) < 0)
+ if(fetchstr(uarg, &argv[i]) < 0){
+ printf("error 4\n");
return -1;
+ }
}
+ printf("calling exec\n");
return exec(path, argv);
}