nuclear@51: #define ASM nuclear@51: #include nuclear@44: nuclear@44: .text nuclear@44: .globl test_proc nuclear@44: test_proc: nuclear@57: /* fork another process */ nuclear@57: movl $SYS_FORK, %eax nuclear@57: int $SYSCALL_INT nuclear@57: nuclear@71: /* test copy-on-write by pushing the pid to the stack nuclear@71: * then use this value from the stack times 2 as a sleep nuclear@71: * interval in the loop. nuclear@71: */ nuclear@71: movl $SYS_GETPID, %eax nuclear@71: int $SYSCALL_INT nuclear@69: push %eax nuclear@69: nuclear@57: infloop: nuclear@44: /* --- print a message --- */ nuclear@44: movl $SYS_HELLO, %eax nuclear@44: int $SYSCALL_INT nuclear@44: nuclear@57: nuclear@60: /* --- sleep for (pid * 2) seconds --- nuclear@71: * grab the pid from the stack and shift it left to nuclear@71: * multiply the pid by 2. Then use that as a sleep interval nuclear@71: * in seconds. nuclear@60: */ nuclear@71: movl (%esp), %ebx nuclear@71: shl $1, %ebx nuclear@44: movl $SYS_SLEEP, %eax nuclear@44: int $SYSCALL_INT nuclear@44: nuclear@57: jmp infloop nuclear@44: nuclear@44: .globl test_proc_end nuclear@44: test_proc_end: