Newer
Older
#include "types.h"
#include "param.h"
#include "mmu.h"
#include "proc.h"
#include "defs.h"
#include "x86.h"
#include "traps.h"
#include "syscall.h"
/*
* User code makes a system call with INT T_SYSCALL.
* System call number in %eax.
* Arguments on the stack.
*
* Return value? Error indication? Errno?
*/
void
sys_fork()
{
newproc();
}
void
sys_exit()
{
// wake up parent
for(p = proc; p < &proc[NPROC]; p++)
wakeup(p);
// abandon children
for(p = proc; p < &proc[NPROC]; p++)
while(1){
any = 0;
for(p = proc; p < &proc[NPROC]; p++){
kfree(p->mem, p->sz);
kfree(p->kstack, KSTACKSIZE);
p->state = UNUSED;
struct proc *cp = curproc[cpu()];
int num = cp->tf->tf_regs.reg_eax;
switch(num){
case SYS_fork:
sys_fork();
break;
case SYS_exit:
sys_exit();
break;