Mercurial > hg > Members > tobaru > CbC_xv6
changeset 93:7d0ec88cdd22
fix read interface
author | anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 19 Oct 2019 18:44:57 +0900 |
parents | bc5bcfd2f6d6 |
children | 0956648d24e5 |
files | src/sysfile.cbc |
diffstat | 1 files changed, 18 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/src/sysfile.cbc Sat Oct 19 16:44:24 2019 +0900 +++ b/src/sysfile.cbc Sat Oct 19 18:44:57 2019 +0900 @@ -15,14 +15,15 @@ #include "fcntl.h" #include "arm.h" +#include "syscall.h" #interface "CbCSysFile.h" -extern int SYS_exec; #define __ncode __code struct CbCSysFile* create_cbc_sys_file(struct Context* cbc_context) { struct CbCSysFile* cbc_file = new CbCSysFile(); cbc_file->read = C_cbc_fileread; + cbc_file->cbc_file_ret = C_cbc_file_ret; return cbc_file; } @@ -100,31 +101,27 @@ return fd; } -__ncode cbc_read(__code (*next)(int ret)){ +__code cbc_read(struct CbCSysFile* cbc_file){ + //struct CbCSysFile* cbc_file = create_cbc_sys_file(cbc_context); + goto cbc_fileread(); +} + +__code cbc_read_stub(struct Context* cbc_context){ struct file *f; int n; char *p; - + + CbCSysFile* cbc_sys_file = (CbCSysFile*)Gearef(cbc_context,CbCSysFile); if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0) { - goto next(-1); + //__code cbc_file_ret(struct CbCSysFile* cbc_sys_file, struct UInteger* ret){ + UInteger* ret = (UInteger*)Gearef(cbc_context,UInteger); + ret->value = -1; + goto cbc_file_ret(cbc_context, cbc_sys_file, ret); } - goto cbc_fileread(f, p, n, next); -} - - -__code file_read(struct file *f, char *p, int n, __code next(...)){ - goto cbc_fileread(f, p, n, next); -} - -__code file_read_stub(struct Context* cbc_context, __code next(...)){ - struct CbCSysfile* cbc_file = create_cbc_sys_file(cbc_context); - struct file *f; - int n; - char *p; - if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0) { - goto next(-1); - } - goto file_read(cbc_context,f, p, n, next); + cbc_sys_file->f = f; + cbc_sys_file->n = n; + cbc_sys_file->p = p; + goto cbc_read(cbc_context,cbc_sys_file); } int sys_read(void)