# HG changeset patch # User John Tsiombikas # Date 1318472555 -10800 # Node ID c7bd6ec7b946aa232bd13566bc2844306892996d # Parent 219974492c7d966b7b6c13e3e89d7815d448d4b7 changed test_proc to modify memory after the fork in order to try out copy-on-write, by pushing the result of getpid on the stack. diff -r 219974492c7d -r c7bd6ec7b946 src/test_proc.S --- a/src/test_proc.S Wed Oct 12 14:46:00 2011 +0300 +++ b/src/test_proc.S Thu Oct 13 05:22:35 2011 +0300 @@ -8,6 +8,12 @@ movl $SYS_FORK, %eax int $SYSCALL_INT + /* test copy-on-write by pushing the pid to the stack + * then use this value from the stack times 2 as a sleep + * interval in the loop. + */ + movl $SYS_GETPID, %eax + int $SYSCALL_INT push %eax infloop: @@ -15,20 +21,14 @@ movl $SYS_HELLO, %eax int $SYSCALL_INT - /* --- call getpid --- - * we'll use the process id, multiplied by two as a - * sleep interval, to avoid having the two test processes - * sleep for identical amounts of time. - */ - movl $SYS_GETPID, %eax - int $SYSCALL_INT - movl %eax, %ebx - shl $1, %ebx /* --- sleep for (pid * 2) seconds --- - * ebx (the argument to sleep) already contains the - * correct value + * grab the pid from the stack and shift it left to + * multiply the pid by 2. Then use that as a sleep interval + * in seconds. */ + movl (%esp), %ebx + shl $1, %ebx movl $SYS_SLEEP, %eax int $SYSCALL_INT