syscalls: fix handle_syscall function performing more that 1 syscall at a time
This commit is contained in:
+23
-29
@@ -239,38 +239,32 @@ void handle_syscall(TrapFrame *tf)
|
||||
debug_log("EDX: %X\n", tf->edx);
|
||||
*/
|
||||
|
||||
if(tf->eax == 1)//exit
|
||||
switch(tf->eax)
|
||||
{
|
||||
int r = sys_exit(tf);
|
||||
tf->eax = r;
|
||||
}
|
||||
case 1://exit
|
||||
tf->eax = sys_exit(tf);
|
||||
break;
|
||||
|
||||
if(tf->eax == 2)//fork
|
||||
{
|
||||
int r = sys_fork(tf);
|
||||
debug_log("RRRRRRRR = %X\n", r);
|
||||
tf->eax = r;
|
||||
}
|
||||
case 2://fork
|
||||
tf->eax = sys_fork(tf);
|
||||
break;
|
||||
|
||||
if(tf->eax == 3)//read
|
||||
{
|
||||
int r = sys_read(tf);
|
||||
tf->eax = r;
|
||||
}
|
||||
case 3://read
|
||||
tf->eax = sys_read(tf);
|
||||
break;
|
||||
|
||||
if(tf->eax == 4)//write
|
||||
{
|
||||
int r = sys_write(tf);
|
||||
tf->eax = r;
|
||||
}
|
||||
if(tf->eax == 5)//open
|
||||
{
|
||||
int r = sys_open(tf);
|
||||
tf->eax = r;
|
||||
}
|
||||
if(tf->eax == 6)//close
|
||||
{
|
||||
int r = sys_close(tf);
|
||||
tf->eax = r;
|
||||
case 4://write
|
||||
tf->eax = sys_write(tf);
|
||||
break;
|
||||
case 5://open
|
||||
tf->eax = sys_open(tf);
|
||||
break;
|
||||
case 6://close
|
||||
tf->eax = sys_close(tf);
|
||||
break;
|
||||
default:
|
||||
debug_log("unknown syscall: %X\n", tf->eax);
|
||||
tf->eax = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user