Mercurial > hg > Members > menikon > CbC_xv6
diff src/sysfile.cbc @ 113:ef44d384ad9d
rollback rev 52
author | anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 02 Dec 2019 11:17:04 +0900 |
parents | 7d0ec88cdd22 |
children | 8c12438a9827 |
line wrap: on
line diff
--- a/src/sysfile.cbc Thu Nov 28 16:58:04 2019 +0900 +++ b/src/sysfile.cbc Mon Dec 02 11:17:04 2019 +0900 @@ -14,33 +14,8 @@ #include "file.h" #include "fcntl.h" -#include "arm.h" -#include "syscall.h" -#interface "CbCSysFile.h" - #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; -} - -__code cbc_file_trap_return(){ - return; -} - -__code cbc_file_ret(struct CbCSysFile* cbc_sys_file, struct UInteger* ret){ - int num = cbc_sys_file->num->value; - uint return_value = ret->value; - //int num = proc->cbc_arg.cbc_console_arg.num; - if (num != SYS_exec) { - proc->tf->r0 = return_value; - } - goto cbc_file_trap_return(); -} - // Fetch the nth word-sized system call argument as a file descriptor // and return both the descriptor and the corresponding struct file. static int argfd(int n, int *pfd, struct file **pf) @@ -101,27 +76,15 @@ return fd; } -__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){ +__ncode cbc_read(__code (*next)(int ret)){ 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) { - //__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 next(-1); } - cbc_sys_file->f = f; - cbc_sys_file->n = n; - cbc_sys_file->p = p; - goto cbc_read(cbc_context,cbc_sys_file); + goto cbc_fileread(f, p, n, next); } int sys_read(void)