@@ -83,56 +83,56 @@ pub unsafe extern "C" fn __rust_probestack() {
83
83
84
84
core:: arch:: naked_asm!(
85
85
"
86
- .cfi_startproc
87
- pushq %rbp
88
- .cfi_adjust_cfa_offset 8
89
- .cfi_offset %rbp, -16
90
- movq %rsp, %rbp
91
- .cfi_def_cfa_register %rbp
92
-
93
- mov %rax,%r11 // duplicate %rax as we're clobbering %r11
94
-
95
- // Main loop, taken in one page increments. We're decrementing rsp by
96
- // a page each time until there's less than a page remaining. We're
97
- // guaranteed that this function isn't called unless there's more than a
98
- // page needed.
99
- //
100
- // Note that we're also testing against `8(%rsp)` to account for the 8
101
- // bytes pushed on the stack orginally with our return address. Using
102
- // `8(%rsp)` simulates us testing the stack pointer in the caller's
103
- // context.
104
-
105
- // It's usually called when %rax >= 0x1000, but that's not always true.
106
- // Dynamic stack allocation, which is needed to implement unsized
107
- // rvalues, triggers stackprobe even if %rax < 0x1000.
108
- // Thus we have to check %r11 first to avoid segfault.
109
- cmp $0x1000,%r11
110
- jna 3f
111
- 2:
112
- sub $0x1000,%rsp
113
- test %rsp,8(%rsp)
114
- sub $0x1000,%r11
115
- cmp $0x1000,%r11
116
- ja 2b
117
-
118
- 3:
119
- // Finish up the last remaining stack space requested, getting the last
120
- // bits out of r11
121
- sub %r11,%rsp
122
- test %rsp,8(%rsp)
123
-
124
- // Restore the stack pointer to what it previously was when entering
125
- // this function. The caller will readjust the stack pointer after we
126
- // return.
127
- add %rax,%rsp
128
-
129
- leave
130
- .cfi_def_cfa_register %rsp
131
- .cfi_adjust_cfa_offset -8
86
+ .cfi_startproc
87
+ pushq %rbp
88
+ .cfi_adjust_cfa_offset 8
89
+ .cfi_offset %rbp, -16
90
+ movq %rsp, %rbp
91
+ .cfi_def_cfa_register %rbp
92
+
93
+ mov %rax,%r11 // duplicate %rax as we're clobbering %r11
94
+
95
+ // Main loop, taken in one page increments. We're decrementing rsp by
96
+ // a page each time until there's less than a page remaining. We're
97
+ // guaranteed that this function isn't called unless there's more than a
98
+ // page needed.
99
+ //
100
+ // Note that we're also testing against `8(%rsp)` to account for the 8
101
+ // bytes pushed on the stack orginally with our return address. Using
102
+ // `8(%rsp)` simulates us testing the stack pointer in the caller's
103
+ // context.
104
+
105
+ // It's usually called when %rax >= 0x1000, but that's not always true.
106
+ // Dynamic stack allocation, which is needed to implement unsized
107
+ // rvalues, triggers stackprobe even if %rax < 0x1000.
108
+ // Thus we have to check %r11 first to avoid segfault.
109
+ cmp $0x1000,%r11
110
+ jna 3f
111
+ 2:
112
+ sub $0x1000,%rsp
113
+ test %rsp,8(%rsp)
114
+ sub $0x1000,%r11
115
+ cmp $0x1000,%r11
116
+ ja 2b
117
+
118
+ 3:
119
+ // Finish up the last remaining stack space requested, getting the last
120
+ // bits out of r11
121
+ sub %r11,%rsp
122
+ test %rsp,8(%rsp)
123
+
124
+ // Restore the stack pointer to what it previously was when entering
125
+ // this function. The caller will readjust the stack pointer after we
126
+ // return.
127
+ add %rax,%rsp
128
+
129
+ leave
130
+ .cfi_def_cfa_register %rsp
131
+ .cfi_adjust_cfa_offset -8
132
132
" ,
133
133
ret!( ) ,
134
134
"
135
- .cfi_endproc
135
+ .cfi_endproc
136
136
" ,
137
137
options( att_syntax)
138
138
)
@@ -151,35 +151,35 @@ pub unsafe extern "C" fn __rust_probestack() {
151
151
pub unsafe extern "C" fn __rust_probestack ( ) {
152
152
core:: arch:: naked_asm!(
153
153
"
154
- .cfi_startproc
155
- push %ebp
156
- .cfi_adjust_cfa_offset 4
157
- .cfi_offset %ebp, -8
158
- mov %esp, %ebp
159
- .cfi_def_cfa_register %ebp
160
- push %ecx
161
- mov %eax,%ecx
162
-
163
- cmp $0x1000,%ecx
164
- jna 3f
165
- 2:
166
- sub $0x1000,%esp
167
- test %esp,8(%esp)
168
- sub $0x1000,%ecx
169
- cmp $0x1000,%ecx
170
- ja 2b
171
-
172
- 3:
173
- sub %ecx,%esp
174
- test %esp,8(%esp)
175
-
176
- add %eax,%esp
177
- pop %ecx
178
- leave
179
- .cfi_def_cfa_register %esp
180
- .cfi_adjust_cfa_offset -4
181
- ret
182
- .cfi_endproc
154
+ .cfi_startproc
155
+ push %ebp
156
+ .cfi_adjust_cfa_offset 4
157
+ .cfi_offset %ebp, -8
158
+ mov %esp, %ebp
159
+ .cfi_def_cfa_register %ebp
160
+ push %ecx
161
+ mov %eax,%ecx
162
+
163
+ cmp $0x1000,%ecx
164
+ jna 3f
165
+ 2:
166
+ sub $0x1000,%esp
167
+ test %esp,8(%esp)
168
+ sub $0x1000,%ecx
169
+ cmp $0x1000,%ecx
170
+ ja 2b
171
+
172
+ 3:
173
+ sub %ecx,%esp
174
+ test %esp,8(%esp)
175
+
176
+ add %eax,%esp
177
+ pop %ecx
178
+ leave
179
+ .cfi_def_cfa_register %esp
180
+ .cfi_adjust_cfa_offset -4
181
+ ret
182
+ .cfi_endproc
183
183
" ,
184
184
options( att_syntax)
185
185
)
@@ -203,40 +203,40 @@ pub unsafe extern "C" fn __rust_probestack() {
203
203
pub unsafe extern "C" fn __rust_probestack ( ) {
204
204
core:: arch:: naked_asm!(
205
205
"
206
- .cfi_startproc
207
- push %ebp
208
- .cfi_adjust_cfa_offset 4
209
- .cfi_offset %ebp, -8
210
- mov %esp, %ebp
211
- .cfi_def_cfa_register %ebp
212
- push %ecx
213
- push %edx
214
- mov %eax,%ecx
215
-
216
- cmp $0x1000,%ecx
217
- jna 3f
218
- 2:
219
- sub $0x1000,%esp
220
- test %esp,8(%esp)
221
- sub $0x1000,%ecx
222
- cmp $0x1000,%ecx
223
- ja 2b
224
-
225
- 3:
226
- sub %ecx,%esp
227
- test %esp,8(%esp)
228
- mov 4(%ebp),%edx
229
- mov %edx, 12(%esp)
230
- add %eax,%esp
231
- pop %edx
232
- pop %ecx
233
- leave
234
-
235
- sub %eax, %esp
236
- .cfi_def_cfa_register %esp
237
- .cfi_adjust_cfa_offset -4
238
- ret
239
- .cfi_endproc
206
+ .cfi_startproc
207
+ push %ebp
208
+ .cfi_adjust_cfa_offset 4
209
+ .cfi_offset %ebp, -8
210
+ mov %esp, %ebp
211
+ .cfi_def_cfa_register %ebp
212
+ push %ecx
213
+ push %edx
214
+ mov %eax,%ecx
215
+
216
+ cmp $0x1000,%ecx
217
+ jna 3f
218
+ 2:
219
+ sub $0x1000,%esp
220
+ test %esp,8(%esp)
221
+ sub $0x1000,%ecx
222
+ cmp $0x1000,%ecx
223
+ ja 2b
224
+
225
+ 3:
226
+ sub %ecx,%esp
227
+ test %esp,8(%esp)
228
+ mov 4(%ebp),%edx
229
+ mov %edx, 12(%esp)
230
+ add %eax,%esp
231
+ pop %edx
232
+ pop %ecx
233
+ leave
234
+
235
+ sub %eax, %esp
236
+ .cfi_def_cfa_register %esp
237
+ .cfi_adjust_cfa_offset -4
238
+ ret
239
+ .cfi_endproc
240
240
" ,
241
241
options( att_syntax)
242
242
)
0 commit comments