|
1 | | -global __sd_gc_push_registers |
| 1 | +.intel_syntax noprefix |
| 2 | +.global __sd_gc_push_registers |
2 | 3 |
|
3 | | -section .text |
| 4 | +.section .text |
4 | 5 | __sd_gc_push_registers: |
5 | | -; For some reason, clang seems to use rbp, but gcc rbx (?) so we will do it |
6 | | -; the clang way and push rbx to the stack as a parameter. |
| 6 | +# For some reason, clang seems to use rbp, but gcc rbx (?) so we will do it |
| 7 | +# the clang way and push rbx to the stack as a parameter. |
7 | 8 | push rbp |
8 | 9 | mov rbp, rsp |
9 | | -; Not using push to make sure we do not mess up with stack alignement. |
10 | | -; Also sub + mov is usually faster than push (not that it matter much here). |
| 10 | +# Not using push to make sure we do not mess up with stack alignement. |
| 11 | +# Also sub + mov is usually faster than push (not that it matter much here). |
11 | 12 | sub rsp, 48 |
12 | | -; Register r12 to r15 are callee saved so can have live values. |
13 | | -; Other registers are trash or already saved on the stack. |
| 13 | +# Register r12 to r15 are callee saved so can have live values. |
| 14 | +# Other registers are trash or already saved on the stack. |
14 | 15 | mov [rbp - 8], rbx |
15 | 16 | mov [rbp - 16], r12 |
16 | 17 | mov [rbp - 24], r13 |
17 | 18 | mov [rbp - 32], r14 |
18 | 19 | mov [rbp - 40], r15 |
19 | | -; While not strictly necessary, it avoids false pointers and make for easier debug. |
| 20 | +# While not strictly necessary, it avoids false pointers and make for easier debug. |
20 | 21 | mov [rbp - 48], rsp |
21 | | -; This method is passed a delegate. rdi contains the context as a first argument |
22 | | -; and rsi, the second argument is the function pointer. rdi do not need any special |
23 | | -; threatement as it is also the first argument when calling the delegate. |
| 22 | +# This method is passed a delegate. rdi contains the context as a first argument |
| 23 | +# and rsi, the second argument is the function pointer. rdi do not need any special |
| 24 | +# threatement as it is also the first argument when calling the delegate. |
24 | 25 | call rsi |
25 | | -; rsp and rbp are the only callee saved register we modified, no need to restore others. |
| 26 | +# rsp and rbp are the only callee saved register we modified, no need to restore others. |
26 | 27 | mov rsp, rbp |
27 | 28 | pop rbp |
28 | 29 | ret |
0 commit comments