Skip to content

Commit 79aa400

Browse files
committed
indent the probestack inline assembly
1 parent 5258981 commit 79aa400

File tree

1 file changed

+98
-98
lines changed

1 file changed

+98
-98
lines changed

library/compiler-builtins/compiler-builtins/src/probestack.rs

Lines changed: 98 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -159,56 +159,56 @@ pub unsafe extern "C" fn __rust_probestack() {
159159

160160
core::arch::naked_asm!(
161161
"
162-
.cfi_startproc
163-
pushq %rbp
164-
.cfi_adjust_cfa_offset 8
165-
.cfi_offset %rbp, -16
166-
movq %rsp, %rbp
167-
.cfi_def_cfa_register %rbp
162+
.cfi_startproc
163+
pushq %rbp
164+
.cfi_adjust_cfa_offset 8
165+
.cfi_offset %rbp, -16
166+
movq %rsp, %rbp
167+
.cfi_def_cfa_register %rbp
168168
169-
mov %rax,%r11 // duplicate %rax as we're clobbering %r11
169+
mov %rax,%r11 // duplicate %rax as we're clobbering %r11
170170
171-
// Main loop, taken in one page increments. We're decrementing rsp by
172-
// a page each time until there's less than a page remaining. We're
173-
// guaranteed that this function isn't called unless there's more than a
174-
// page needed.
175-
//
176-
// Note that we're also testing against `8(%rsp)` to account for the 8
177-
// bytes pushed on the stack orginally with our return address. Using
178-
// `8(%rsp)` simulates us testing the stack pointer in the caller's
179-
// context.
171+
// Main loop, taken in one page increments. We're decrementing rsp by
172+
// a page each time until there's less than a page remaining. We're
173+
// guaranteed that this function isn't called unless there's more than a
174+
// page needed.
175+
//
176+
// Note that we're also testing against `8(%rsp)` to account for the 8
177+
// bytes pushed on the stack orginally with our return address. Using
178+
// `8(%rsp)` simulates us testing the stack pointer in the caller's
179+
// context.
180180
181-
// It's usually called when %rax >= 0x1000, but that's not always true.
182-
// Dynamic stack allocation, which is needed to implement unsized
183-
// rvalues, triggers stackprobe even if %rax < 0x1000.
184-
// Thus we have to check %r11 first to avoid segfault.
185-
cmp $0x1000,%r11
186-
jna 3f
187-
2:
188-
sub $0x1000,%rsp
189-
test %rsp,8(%rsp)
190-
sub $0x1000,%r11
191-
cmp $0x1000,%r11
192-
ja 2b
181+
// It's usually called when %rax >= 0x1000, but that's not always true.
182+
// Dynamic stack allocation, which is needed to implement unsized
183+
// rvalues, triggers stackprobe even if %rax < 0x1000.
184+
// Thus we have to check %r11 first to avoid segfault.
185+
cmp $0x1000,%r11
186+
jna 3f
187+
2:
188+
sub $0x1000,%rsp
189+
test %rsp,8(%rsp)
190+
sub $0x1000,%r11
191+
cmp $0x1000,%r11
192+
ja 2b
193193
194-
3:
195-
// Finish up the last remaining stack space requested, getting the last
196-
// bits out of r11
197-
sub %r11,%rsp
198-
test %rsp,8(%rsp)
194+
3:
195+
// Finish up the last remaining stack space requested, getting the last
196+
// bits out of r11
197+
sub %r11,%rsp
198+
test %rsp,8(%rsp)
199199
200-
// Restore the stack pointer to what it previously was when entering
201-
// this function. The caller will readjust the stack pointer after we
202-
// return.
203-
add %rax,%rsp
200+
// Restore the stack pointer to what it previously was when entering
201+
// this function. The caller will readjust the stack pointer after we
202+
// return.
203+
add %rax,%rsp
204204
205-
leave
206-
.cfi_def_cfa_register %rsp
207-
.cfi_adjust_cfa_offset -8
205+
leave
206+
.cfi_def_cfa_register %rsp
207+
.cfi_adjust_cfa_offset -8
208208
",
209209
ret!(),
210210
"
211-
.cfi_endproc
211+
.cfi_endproc
212212
",
213213
options(att_syntax)
214214
)
@@ -227,35 +227,35 @@ pub unsafe extern "C" fn __rust_probestack() {
227227
pub unsafe extern "C" fn __rust_probestack() {
228228
core::arch::naked_asm!(
229229
"
230-
.cfi_startproc
231-
push %ebp
232-
.cfi_adjust_cfa_offset 4
233-
.cfi_offset %ebp, -8
234-
mov %esp, %ebp
235-
.cfi_def_cfa_register %ebp
236-
push %ecx
237-
mov %eax,%ecx
230+
.cfi_startproc
231+
push %ebp
232+
.cfi_adjust_cfa_offset 4
233+
.cfi_offset %ebp, -8
234+
mov %esp, %ebp
235+
.cfi_def_cfa_register %ebp
236+
push %ecx
237+
mov %eax,%ecx
238238
239-
cmp $0x1000,%ecx
240-
jna 3f
241-
2:
242-
sub $0x1000,%esp
243-
test %esp,8(%esp)
244-
sub $0x1000,%ecx
245-
cmp $0x1000,%ecx
246-
ja 2b
239+
cmp $0x1000,%ecx
240+
jna 3f
241+
2:
242+
sub $0x1000,%esp
243+
test %esp,8(%esp)
244+
sub $0x1000,%ecx
245+
cmp $0x1000,%ecx
246+
ja 2b
247247
248-
3:
249-
sub %ecx,%esp
250-
test %esp,8(%esp)
248+
3:
249+
sub %ecx,%esp
250+
test %esp,8(%esp)
251251
252-
add %eax,%esp
253-
pop %ecx
254-
leave
255-
.cfi_def_cfa_register %esp
256-
.cfi_adjust_cfa_offset -4
257-
ret
258-
.cfi_endproc
252+
add %eax,%esp
253+
pop %ecx
254+
leave
255+
.cfi_def_cfa_register %esp
256+
.cfi_adjust_cfa_offset -4
257+
ret
258+
.cfi_endproc
259259
",
260260
options(att_syntax)
261261
)
@@ -279,40 +279,40 @@ pub unsafe extern "C" fn __rust_probestack() {
279279
pub unsafe extern "C" fn __rust_probestack() {
280280
core::arch::naked_asm!(
281281
"
282-
.cfi_startproc
283-
push %ebp
284-
.cfi_adjust_cfa_offset 4
285-
.cfi_offset %ebp, -8
286-
mov %esp, %ebp
287-
.cfi_def_cfa_register %ebp
288-
push %ecx
289-
push %edx
290-
mov %eax,%ecx
282+
.cfi_startproc
283+
push %ebp
284+
.cfi_adjust_cfa_offset 4
285+
.cfi_offset %ebp, -8
286+
mov %esp, %ebp
287+
.cfi_def_cfa_register %ebp
288+
push %ecx
289+
push %edx
290+
mov %eax,%ecx
291291
292-
cmp $0x1000,%ecx
293-
jna 3f
294-
2:
295-
sub $0x1000,%esp
296-
test %esp,8(%esp)
297-
sub $0x1000,%ecx
298-
cmp $0x1000,%ecx
299-
ja 2b
292+
cmp $0x1000,%ecx
293+
jna 3f
294+
2:
295+
sub $0x1000,%esp
296+
test %esp,8(%esp)
297+
sub $0x1000,%ecx
298+
cmp $0x1000,%ecx
299+
ja 2b
300300
301-
3:
302-
sub %ecx,%esp
303-
test %esp,8(%esp)
304-
mov 4(%ebp),%edx
305-
mov %edx, 12(%esp)
306-
add %eax,%esp
307-
pop %edx
308-
pop %ecx
309-
leave
301+
3:
302+
sub %ecx,%esp
303+
test %esp,8(%esp)
304+
mov 4(%ebp),%edx
305+
mov %edx, 12(%esp)
306+
add %eax,%esp
307+
pop %edx
308+
pop %ecx
309+
leave
310310
311-
sub %eax, %esp
312-
.cfi_def_cfa_register %esp
313-
.cfi_adjust_cfa_offset -4
314-
ret
315-
.cfi_endproc
311+
sub %eax, %esp
312+
.cfi_def_cfa_register %esp
313+
.cfi_adjust_cfa_offset -4
314+
ret
315+
.cfi_endproc
316316
",
317317
options(att_syntax)
318318
)

0 commit comments

Comments
 (0)