changeset 30:6a7ab1d7001c

fix
author mir3636
date Fri, 18 Jan 2019 11:50:48 +0900
parents a672d603ccb2
children 96a5833d0d82
files src/console.c src/defs.h src/file.c src/syscall.c
diffstat 4 files changed, 25 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/console.c	Fri Jan 18 10:04:37 2019 +0900
+++ b/src/console.c	Fri Jan 18 11:50:48 2019 +0900
@@ -118,6 +118,21 @@
     }
 }
 
+__code cbc_panic (char *s)
+{
+    cli();
+
+    cons.locking = 0;
+
+    cprintf("cpu%d: panic: ", cpu->id);
+
+    show_callstk(s);
+    panicked = 1; // freeze other CPU
+
+    while (1)
+        ;
+}
+
 void panic (char *s)
 {
     cli();
--- a/src/defs.h	Fri Jan 18 10:04:37 2019 +0900
+++ b/src/defs.h	Fri Jan 18 11:50:48 2019 +0900
@@ -59,6 +59,7 @@
 void            consoleinit(void);
 void            cprintf(char*, ...);
 void            consoleintr(int(*)(void));
+__code          cbc_panic(char*) __attribute__((noreturn));
 void            panic(char*) __attribute__((noreturn));
 
 // exec.c
@@ -69,6 +70,7 @@
 void            fileclose(struct file*);
 struct file*    filedup(struct file*);
 void            fileinit(void);
+__code 		cbc_fileread (struct file*, char*, int, __code (*)(int));
 int             fileread(struct file*, char*, int n);
 int             filestat(struct file*, struct stat*);
 int             filewrite(struct file*, char*, int n);
@@ -88,6 +90,7 @@
 int             namecmp(const char*, const char*);
 struct inode*   namei(char*);
 struct inode*   nameiparent(char*, char*);
+__code 		cbc_readi (struct inode*, char*, uint, uint, __code (*)(int));
 int             readi(struct inode*, char*, uint, uint);
 void            stati(struct inode*, struct stat*);
 int             writei(struct inode*, char*, uint, uint);
--- a/src/file.c	Fri Jan 18 10:04:37 2019 +0900
+++ b/src/file.c	Fri Jan 18 11:50:48 2019 +0900
@@ -117,13 +117,14 @@
     }
 
     if (f->type == FD_PIPE) {
-        goto cbc_piperead(f->pipe, addr, n, next);
+        //goto cbc_piperead(f->pipe, addr, n, next);
+        goto next(-1);
     }
 
     if (f->type == FD_INODE) {
         ilock(f->ip);
 
-        goto cbc_readi(f->ip, addr, f->off, n);
+        goto cbc_readi(f->ip, addr, f->off, n, next);
     }
 
     goto cbc_panic("fileread");
--- a/src/syscall.c	Fri Jan 18 10:04:37 2019 +0900
+++ b/src/syscall.c	Fri Jan 18 11:50:48 2019 +0900
@@ -145,6 +145,10 @@
 	[SYS_cbc_read]	= cbc_read, 
 };
 
+__code cbc_trap_return(){
+    goto trap_swi();
+}
+
 __code cbc_ret(int ret){
     proc->tf->r0 = ret;
     goto cbc_trap_return();