From 7fd1f1eb0aab4d52852fc4f5e83eafc991f9a627 Mon Sep 17 00:00:00 2001 From: Robert Morris Date: Fri, 31 May 2019 12:43:20 -0400 Subject: exec compiles but argstr() doesn't work yet --- sysfile.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'sysfile.c') 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); } -- cgit v1.2.3