1 /* FIXME: this works locally but not on appveyor??!? */
4 /* NOTE: fastcall calling convention used on all x86 targets */
8 .def @rust_psm_stack_direction@0
12 .globl @rust_psm_stack_direction@0
14 @rust_psm_stack_direction@0:
15 /* extern "fastcall" fn() -> u8 (%al) */
17 movb $STACK_DIRECTION_DESCENDING, %al # always descending on x86_64
22 .def @rust_psm_stack_pointer@0
26 .globl @rust_psm_stack_pointer@0
28 @rust_psm_stack_pointer@0:
29 /* extern "fastcall" fn() -> *mut u8 (%rax) */
36 .def @rust_psm_replace_stack@16
40 .globl @rust_psm_replace_stack@16
42 @rust_psm_replace_stack@16:
43 /* extern "fastcall" fn(%ecx: usize, %edx: extern "fastcall" fn(usize), 4(%esp): *mut u8) */
46 All we gotta do is set the stack pointer to 4(%esp) & tail-call the callback in %edx
48 Note, that the callee expects the stack to be offset by 4 bytes (normally, a return address
49 would be store there) off the required stack alignment on entry. To offset the stack in such a
50 way we use the `calll` instruction, however it would also be possible to to use plain `jmpl` but
51 would require to adjust the stack manually, which cannot be easily done, because the stack
52 pointer argument is already stored in memory.
63 .def @rust_psm_on_stack@16
67 .globl @rust_psm_on_stack@16
69 @rust_psm_on_stack@20:
70 /* extern "fastcall" fn(%ecx: usize, %edx: usize, 4(%esp): extern "fastcall" fn(usize, usize), 8(%esp): *mut u8) */
80 .cfi_def_cfa_register %ebp