changeset 34:a7144583914c

fix
author mir3636
date Thu, 14 Feb 2019 23:33:57 +0900
parents 7a63dacab7f8
children ad1d3b268e2d
files src/console.c src/syscall.c
diffstat 2 files changed, 6 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/src/console.c	Tue Jan 22 17:32:06 2019 +0900
+++ b/src/console.c	Thu Feb 14 23:33:57 2019 +0900
@@ -289,15 +289,7 @@
     release(&input.lock);
     ilock(ip);
 
-    //int r = target - n;
-
-    //if (r > 0)
-    //    f->off += r;
-    //iunlock(f->ip);
-
     goto next(target - n);
-
-    //goto next(r);
 }
 
 __code cbc_consoleread (struct inode *ip, char *dst, int n, __code(*next)(int ret))
@@ -312,20 +304,12 @@
     if (n > 0) {
         proc->cbc_arg.cbc_console_arg.n = n;
         proc->cbc_arg.cbc_console_arg.target = target;
-	proc->cbc_arg.cbc_console_arg.dst = dst;
-	proc->cbc_arg.cbc_console_arg.ip = ip;
-	proc->cbc_arg.cbc_console_arg.next = next;
-        if (input.r == input.w) {
-            if (proc->killed) {
-                release(&input.lock);
-                ilock(ip);
-                goto next(-1);
-            }
-
-            goto cbc_sleep(&input.r, &input.lock, cbc_consoleread2);
-        }
+    	proc->cbc_arg.cbc_console_arg.dst = dst;
+	    proc->cbc_arg.cbc_console_arg.ip = ip;
+	    proc->cbc_arg.cbc_console_arg.next = next;
+        goto cbc_consoleread2();    
+    }
 	goto cbc_consoleread1();
-    }
 }
 
 int consoleread (struct inode *ip, char *dst, int n)
--- a/src/syscall.c	Tue Jan 22 17:32:06 2019 +0900
+++ b/src/syscall.c	Thu Feb 14 23:33:57 2019 +0900
@@ -174,7 +174,7 @@
     }
 
 
-    if((num > 0) && (num <= NELEM(syscalls)) && syscalls[num]) {
+    if((num > 0) && (num < NELEM(syscalls)) && syscalls[num]) {
         ret = syscalls[num]();
 
         // in ARM, parameters to main (argc, argv) are passed in r0 and r1