1 # count for ~1 million instructions thread 1
2 # count for ~2 million instructions thread 2
3 # count for additional 500 million each before exit
8 #################################################
9 # 1000 cycles in initial thread #
10 #################################################
13 mov $499,%ecx # load counter
15 dec %ecx # repeat count times
19 #####################################################
21 #####################################################
23 mov $120,%eax # clone syscall
25 # Note, clone syscall is different than the glibc implementation
27 # int clone (flags, stack_pointer,parent_tidptr,child_tidptr,tls)
31 #/usr/include/bits/sched.h
32 # CLONE_THREAD 0x10000
35 # above must be called together
36 # Below required for Valgrind
43 mov $(new_stack+4096),%ecx # new stack
47 mov $0,%edx # args (none)
51 cmp $0,%eax # are we in new thread?
52 jz thread2 # if so, jump to thrad2
55 ###############################################
57 ###############################################
61 mov $499997,%ecx # load counter
63 dec %ecx # repeat count times
66 xor %ebx,%ebx # we return 0
70 mov $999997,%ecx # load counter
72 dec %ecx # repeat count times
75 mov $5,%ebx # we return 5
78 #================================
80 #================================
83 # count an additional 500 million
85 mov $250000,%ecx # load counter
87 dec %ecx # repeat count times
91 mov $1,%eax # put exit syscall number (60) in rax