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,%rcx # load counter
15 dec %rcx # repeat count times
19 #####################################################
21 #####################################################
23 mov $56,%rax # 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),%rsi # new stack
47 mov $0,%rdx # args (none)
51 cmp $0,%rax # are we in new thread?
52 jz thread2 # if so, jump to thrad2
55 ###############################################
57 ###############################################
61 mov $499997,%rcx # load counter
63 dec %rcx # repeat count times
66 xor %rdi,%rdi # we return 0
70 mov $999997,%rcx # load counter
72 dec %rcx # repeat count times
75 mov $5,%rdi # we return 5
78 #================================
80 #================================
83 # count an additional 500 million
85 mov $250000,%rcx # load counter
87 dec %rcx # repeat count times
91 mov $60,%rax # put exit syscall number (60) in rax