1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
| /*
| * Copyright (c) 2012, Chris Andrews. All rights reserved.
| */
|
| /*
| * Stub functions containing DTrace tracepoints for probes and
| * is-enabled probes. These functions are copied for each probe
| * dynamically created.
| *
| */
| .text
|
| .align 4, 0x90
| .globl usdt_tracepoint_isenabled
| .globl _usdt_tracepoint_isenabled
| .globl usdt_tracepoint_probe
| .globl _usdt_tracepoint_probe
| .globl usdt_tracepoint_end
| .globl _usdt_tracepoint_end
| .globl usdt_probe_args
| .globl _usdt_probe_args
|
| usdt_tracepoint_isenabled:
| _usdt_tracepoint_isenabled:
| pushq %rbp
| movq %rsp, %rbp
| addq $1, %rax
| xorq %rax, %rax
| nop
| nop
| leave
| ret
| usdt_tracepoint_probe:
| _usdt_tracepoint_probe:
| nop
| nop
| nop
| nop
| nop
| addq %r14,%rsp
| popq %rbx
| popq %r14
| popq %r13
| popq %r12
| leave
| usdt_tracepoint_end:
| _usdt_tracepoint_end:
| ret
|
| /*
| * Probe argument marshalling, x86_64 style
| *
| */
|
| usdt_probe_args:
| _usdt_probe_args:
| pushq %rbp
| movq %rsp,%rbp
| pushq %r12
| pushq %r13
| pushq %r14
| pushq %rbx
|
| movq %rdi,%r12
| movq %rsi,%rbx
| movq %rdx,%r11
| movq $0,%r14
|
| test %rbx,%rbx
| je fire
| movq (%r11),%rdi
| dec %rbx
| test %rbx,%rbx
| je fire
| addq $8,%r11
| movq (%r11),%rsi
| dec %rbx
| test %rbx,%rbx
| je fire
| addq $8,%r11
| movq (%r11),%rdx
| dec %rbx
| test %rbx,%rbx
| je fire
| addq $8,%r11
| movq (%r11),%rcx
| dec %rbx
| test %rbx,%rbx
| je fire
| addq $8,%r11
| movq (%r11),%r8
| dec %rbx
| test %rbx,%rbx
| je fire
| addq $8,%r11
| movq (%r11),%r9
|
| movq %rbx,%r13
| morestack:
| dec %rbx
| test %rbx,%rbx
| je args
| subq $16,%rsp
| addq $16,%r14
| dec %rbx
| test %rbx,%rbx
| je args
| jmp morestack
|
| args:
| movq %r13,%rbx
| movq $0,%r13
| moreargs:
| dec %rbx
| test %rbx,%rbx
| je fire
| addq $8,%r11
| movq (%r11),%rax
| movq %rax,(%rsp,%r13)
| addq $8,%r13
| jmp moreargs
|
| fire: jmp *%r12
|
|