kern

view 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
line source
1 #define ASM
2 #include <syscall.h>
4 .text
5 .globl test_proc
6 test_proc:
7 /* fork another process */
8 movl $SYS_FORK, %eax
9 int $SYSCALL_INT
11 push %eax
13 infloop:
14 /* --- print a message --- */
15 movl $SYS_HELLO, %eax
16 int $SYSCALL_INT
18 /* --- call getpid ---
19 * we'll use the process id, multiplied by two as a
20 * sleep interval, to avoid having the two test processes
21 * sleep for identical amounts of time.
22 */
23 movl $SYS_GETPID, %eax
24 int $SYSCALL_INT
25 movl %eax, %ebx
26 shl $1, %ebx
28 /* --- sleep for (pid * 2) seconds ---
29 * ebx (the argument to sleep) already contains the
30 * correct value
31 */
32 movl $SYS_SLEEP, %eax
33 int $SYSCALL_INT
35 jmp infloop
37 .globl test_proc_end
38 test_proc_end: