kern

annotate src/test_proc.S @ 69:b45e2d5f0ae1

ok I *think* i've fixed it now
author John Tsiombikas <nuclear@member.fsf.org>
date Wed, 12 Oct 2011 14:39:40 +0300
parents 39188bbe8638
children c7bd6ec7b946
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@69 11 push %eax
nuclear@69 12
nuclear@57 13 infloop:
nuclear@44 14 /* --- print a message --- */
nuclear@44 15 movl $SYS_HELLO, %eax
nuclear@44 16 int $SYSCALL_INT
nuclear@44 17
nuclear@60 18 /* --- call getpid ---
nuclear@60 19 * we'll use the process id, multiplied by two as a
nuclear@60 20 * sleep interval, to avoid having the two test processes
nuclear@60 21 * sleep for identical amounts of time.
nuclear@60 22 */
nuclear@57 23 movl $SYS_GETPID, %eax
nuclear@57 24 int $SYSCALL_INT
nuclear@57 25 movl %eax, %ebx
nuclear@57 26 shl $1, %ebx
nuclear@57 27
nuclear@60 28 /* --- sleep for (pid * 2) seconds ---
nuclear@60 29 * ebx (the argument to sleep) already contains the
nuclear@60 30 * correct value
nuclear@60 31 */
nuclear@44 32 movl $SYS_SLEEP, %eax
nuclear@44 33 int $SYSCALL_INT
nuclear@44 34
nuclear@57 35 jmp infloop
nuclear@44 36
nuclear@44 37 .globl test_proc_end
nuclear@44 38 test_proc_end: