# HG changeset patch # User John Tsiombikas # Date 1318655229 -10800 # Node ID 8b21fe04ba2c4d48007d77d41b6e1a3f3897daf7 # Parent d3601789d638ac3dde6c17fbf1cb2435abf8e1ac testing of the exit syscall diff -r d3601789d638 -r 8b21fe04ba2c src/proc.c --- a/src/proc.c Sat Oct 15 08:06:58 2011 +0300 +++ b/src/proc.c Sat Oct 15 08:07:09 2011 +0300 @@ -215,6 +215,8 @@ p = get_current_proc(); + printf("process %d exit(%d)\n", p->id, status); + /* TODO deliver SIGCHLD to the parent */ /* find any child processes and make init adopt them */ diff -r d3601789d638 -r 8b21fe04ba2c src/test_proc.S --- a/src/test_proc.S Sat Oct 15 08:06:58 2011 +0300 +++ b/src/test_proc.S Sat Oct 15 08:07:09 2011 +0300 @@ -16,6 +16,9 @@ int $SYSCALL_INT push %eax + /* this will count the iterations */ + xor %ecx, %ecx + infloop: /* --- print a message --- */ movl $SYS_HELLO, %eax @@ -32,7 +35,24 @@ movl $SYS_SLEEP, %eax int $SYSCALL_INT + inc %ecx + + /* let process 2 quit after 2 iterations */ + cmpl $2, (%esp) + jne 1f + cmpl $2, %ecx + je exit_proc + +1: jmp infloop +exit_proc: + movl $SYS_EXIT, %eax + movl $0, %ebx + int $SYSCALL_INT + + /* shouldn't reach this, trap otherwise */ + int $3 + .globl test_proc_end test_proc_end: