kern
annotate src/test_proc.S @ 57:437360696883
I think we're done for now. two processes seem to be scheduled and switched just fine, fork seems to work (NO CoW YET!)
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Tue, 16 Aug 2011 03:26:53 +0300 |
parents | 0be4615594df |
children | 39188bbe8638 |
rev | line source |
---|---|
nuclear@51 | 1 #define ASM |
nuclear@51 | 2 #include <syscall.h> |
nuclear@44 | 3 |
nuclear@44 | 4 .text |
nuclear@44 | 5 .globl test_proc |
nuclear@44 | 6 test_proc: |
nuclear@57 | 7 /* fork another process */ |
nuclear@57 | 8 movl $SYS_FORK, %eax |
nuclear@57 | 9 int $SYSCALL_INT |
nuclear@57 | 10 |
nuclear@57 | 11 infloop: |
nuclear@44 | 12 /* --- print a message --- */ |
nuclear@44 | 13 movl $SYS_HELLO, %eax |
nuclear@44 | 14 int $SYSCALL_INT |
nuclear@44 | 15 |
nuclear@57 | 16 /* --- call getpid --- */ |
nuclear@57 | 17 movl $SYS_GETPID, %eax |
nuclear@57 | 18 int $SYSCALL_INT |
nuclear@57 | 19 /* copy the pid to ebx to use as a sleep interval */ |
nuclear@57 | 20 movl %eax, %ebx |
nuclear@57 | 21 shl $1, %ebx |
nuclear@57 | 22 |
nuclear@44 | 23 /* --- sleep for 5 seconds --- */ |
nuclear@44 | 24 movl $SYS_SLEEP, %eax |
nuclear@57 | 25 /*movl $3, %ebx*/ |
nuclear@44 | 26 int $SYSCALL_INT |
nuclear@44 | 27 |
nuclear@57 | 28 jmp infloop |
nuclear@44 | 29 |
nuclear@44 | 30 .globl test_proc_end |
nuclear@44 | 31 test_proc_end: |