kern
annotate src/test_proc.S @ 60:39188bbe8638
fixed the comments in test_proc.S
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Wed, 17 Aug 2011 05:37:30 +0300 |
parents | 437360696883 |
children | b45e2d5f0ae1 |
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@60 | 16 /* --- call getpid --- |
nuclear@60 | 17 * we'll use the process id, multiplied by two as a |
nuclear@60 | 18 * sleep interval, to avoid having the two test processes |
nuclear@60 | 19 * sleep for identical amounts of time. |
nuclear@60 | 20 */ |
nuclear@57 | 21 movl $SYS_GETPID, %eax |
nuclear@57 | 22 int $SYSCALL_INT |
nuclear@57 | 23 movl %eax, %ebx |
nuclear@57 | 24 shl $1, %ebx |
nuclear@57 | 25 |
nuclear@60 | 26 /* --- sleep for (pid * 2) seconds --- |
nuclear@60 | 27 * ebx (the argument to sleep) already contains the |
nuclear@60 | 28 * correct value |
nuclear@60 | 29 */ |
nuclear@44 | 30 movl $SYS_SLEEP, %eax |
nuclear@44 | 31 int $SYSCALL_INT |
nuclear@44 | 32 |
nuclear@57 | 33 jmp infloop |
nuclear@44 | 34 |
nuclear@44 | 35 .globl test_proc_end |
nuclear@44 | 36 test_proc_end: |