# HG changeset patch # User mir3636 # Date 1547722530 -32400 # Node ID 1a64b5645cddac67624b985959db8fdba8a5fafe # Parent a146855e16eb6930051db0c2bf0c9bcb12983d59 fix diff -r a146855e16eb -r 1a64b5645cdd src/console.c --- a/src/console.c Thu Jan 17 19:43:22 2019 +0900 +++ b/src/console.c Thu Jan 17 19:55:30 2019 +0900 @@ -356,7 +356,7 @@ devsw[CONSOLE].write = consolewrite; devsw[CONSOLE].read = consoleread; - cbc_devsw[CONSOLE].write = cbc_consolewrite; + //cbc_devsw[CONSOLE].write = cbc_consolewrite; cbc_devsw[CONSOLE].read = cbc_consoleread; cons.locking = 1; diff -r a146855e16eb -r 1a64b5645cdd src/defs.h --- a/src/defs.h Thu Jan 17 19:43:22 2019 +0900 +++ b/src/defs.h Thu Jan 17 19:55:30 2019 +0900 @@ -131,6 +131,7 @@ void procdump(void); void scheduler(void) __attribute__((noreturn)); void sched(void); +__code cbc_sleep(void*, struct spinlock*, __code(*next1)()); void sleep(void*, struct spinlock*); void userinit(void); int wait(void); diff -r a146855e16eb -r 1a64b5645cdd src/file.c --- a/src/file.c Thu Jan 17 19:43:22 2019 +0900 +++ b/src/file.c Thu Jan 17 19:55:30 2019 +0900 @@ -10,6 +10,8 @@ #include "spinlock.h" struct devsw devsw[NDEV]; +struct cbc_devsw cbc_devsw[NDEV]; + struct { struct spinlock lock; struct file file[NFILE]; diff -r a146855e16eb -r 1a64b5645cdd src/file.h --- a/src/file.h Thu Jan 17 19:43:22 2019 +0900 +++ b/src/file.h Thu Jan 17 19:55:30 2019 +0900 @@ -33,6 +33,12 @@ int (*write)(struct inode*, char*, int); }; +struct cbc_devsw { + int (*read) (struct inode*, char*, int, __code (*)(int)); + //int (*write)(struct inode*, char*, int, __code (*)(int)); +}; + extern struct devsw devsw[]; +extern struct cbc_devsw cbc_devsw[]; #define CONSOLE 1 diff -r a146855e16eb -r 1a64b5645cdd src/fs.c --- a/src/fs.c Thu Jan 17 19:43:22 2019 +0900 +++ b/src/fs.c Thu Jan 17 19:55:30 2019 +0900 @@ -459,11 +459,11 @@ struct buf *bp; if (ip->type == T_DEV) { - if (ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].read) { + if (ip->major < 0 || ip->major >= NDEV || !cbc_devsw[ip->major].read) { goto next(-1); } - goto cbc_devsw[ip->major].read(ip, dst, n); + goto cbc_devsw[ip->major].read(ip, dst, n, next); } if (off > ip->size || off + n < off) { diff -r a146855e16eb -r 1a64b5645cdd src/proc.h --- a/src/proc.h Thu Jan 17 19:43:22 2019 +0900 +++ b/src/proc.h Thu Jan 17 19:55:30 2019 +0900 @@ -78,7 +78,7 @@ } cbc_console_arg; } cbc_arg; __code (*cbc_next)(); - struct spinlock *lk + struct spinlock *lk; }; // Process memory is laid out contiguously, low addresses first: