Bug 475652 - Missing suppression for __wcsncpy_avx2 (strncpy-avx2.S:308)?
[valgrind.git] / exp-bbv / tests / amd64-linux / clone_test.S
blob10a2df3f6c868091a1e4dc98fb621c7d2079fb2d
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
4              
5         .globl _start   
6 _start: 
8         #################################################
9         # 1000 cycles in initial thread                 #
10         #################################################
11         
12         xor     %rax,%rax
13         mov     $499,%rcx               # load counter
14 initial_loop:   
15         dec     %rcx                    # repeat count times
16         jnz     initial_loop
19         #####################################################
20         # Spawn a thread!                                   #
21         #####################################################
22 clone:
23         mov    $56,%rax                 # clone syscall
24         
25         # Note, clone syscall is different than the glibc implementation
26         
27 #       int clone (flags, stack_pointer,parent_tidptr,child_tidptr,tls)
30                                         # Flags in 
31                                         #/usr/include/bits/sched.h
32                                         # CLONE_THREAD 0x10000
33                                         # CLONE_SIGHAND 0x800
34                                         # CLONE_VM      0x100
35                                         # above must be called together
36                                         # Below required for Valgrind
37                                         # CLONE_FS       0x200
38                                         # CLONE_FILES    0x400
40         mov    $0x10f00,%rdi            
41         
43         mov    $(new_stack+4096),%rsi                   # new stack
45         
47         mov    $0,%rdx          # args (none)
49         syscall
50         
51         cmp   $0,%rax           # are we in new thread?
52         jz    thread2           # if so, jump to thrad2
55         ###############################################
56         # thread1                                     #
57         ###############################################
59 thread1:
61         mov     $499997,%rcx            # load counter
62 thread1_loop:   
63         dec     %rcx                    # repeat count times
64         jnz     thread1_loop
66         xor     %rdi,%rdi               # we return 0
67         jmp    exit
68         
69 thread2:        
70         mov     $999997,%rcx            # load counter
71 thread2_loop:   
72         dec     %rcx                    # repeat count times
73         jnz     thread2_loop    
74         
75         mov    $5,%rdi                  # we return 5
76         
77         
78         #================================
79         # Exit
80         #================================
81 exit:
83         # count an additional 500 million
85         mov     $250000,%rcx            # load counter
86 exit_loop:      
87         dec     %rcx                    # repeat count times
88         jnz     exit_loop       
90 actual_exit:
91         mov     $60,%rax                # put exit syscall number (60) in rax
92         syscall
94 .bss
95 .lcomm  new_stack,4096