comparison src/syscall.c @ 32:96af12a50fdb

fix cbc_read
author mir3636
date Tue, 22 Jan 2019 15:48:35 +0900
parents 96a5833d0d82
children a7144583914c
comparison
equal deleted inserted replaced
31:96a5833d0d82 32:96af12a50fdb
148 __code cbc_trap_return(){ 148 __code cbc_trap_return(){
149 return; 149 return;
150 } 150 }
151 151
152 __code cbc_ret(int ret){ 152 __code cbc_ret(int ret){
153 proc->tf->r0 = ret; 153 int num = proc->cbc_arg.cbc_console_arg.num;
154 if (num != SYS_exec) {
155 proc->tf->r0 = ret;
156 }
154 goto cbc_trap_return(); 157 goto cbc_trap_return();
155 } 158 }
156 159
157 void syscall(void) 160 void syscall(void)
158 { 161 {
164 if (num == 5) 167 if (num == 5)
165 num = 22; 168 num = 22;
166 //cprintf ("syscall(%d) from %s(%d)\n", num, proc->name, proc->pid); 169 //cprintf ("syscall(%d) from %s(%d)\n", num, proc->name, proc->pid);
167 170
168 if((num >= NELEM(syscalls)) && (num <= NELEM(cbccodes)) && cbccodes[num]) { 171 if((num >= NELEM(syscalls)) && (num <= NELEM(cbccodes)) && cbccodes[num]) {
169 172 proc->cbc_arg.cbc_console_arg.num = num;
170 goto (cbccodes[num])(cbc_ret); 173 goto (cbccodes[num])(cbc_ret);
171 } 174 }
172 175
173 176
174 if((num > 0) && (num <= NELEM(syscalls)) && syscalls[num]) { 177 if((num > 0) && (num <= NELEM(syscalls)) && syscalls[num]) {