Mercurial > hg > CbC > CbC_xv6
diff src/syscall.c @ 24:36bd61f5c847
rewrite sys_read cbc
author | mir3636 |
---|---|
date | Thu, 17 Jan 2019 19:11:19 +0900 |
parents | 397e74cbf14e |
children | a672d603ccb2 |
line wrap: on
line diff
--- a/src/syscall.c Mon Dec 17 16:55:22 2018 +0900 +++ b/src/syscall.c Thu Jan 17 19:11:19 2019 +0900 @@ -139,6 +139,15 @@ [SYS_close] =sys_close, }; +static __code (*cbccodes[])(void) = { + [SYS_cbc_read] = cbc_read, +}; + +__code cbc_ret(int ret){ + proc->tf->r0 = ret; + goto cbc_trap_return(); +} + void syscall(void) { int num; @@ -148,6 +157,12 @@ //cprintf ("syscall(%d) from %s(%d)\n", num, proc->name, proc->pid); + if((num > 0) && (num > NELEM(syscalls)) && cbccodes[num]) { + + goto (cbccodes[num])(cbc_ret); + } + + if((num > 0) && (num <= NELEM(syscalls)) && syscalls[num]) { ret = syscalls[num]();