| 1 | .intel_syntax noprefix |
| 2 | .text |
| 3 | |
| 4 | .globl _ClobberAndCall |
| 5 | _ClobberAndCall: |
| 6 | .globl ClobberAndCall |
| 7 | ClobberAndCall: |
| 8 | |
| 9 | /* Clobber some significant registers and call the nullary function which is |
| 10 | passed in as the first argument. */ |
| 11 | |
| 12 | /* Pool pointer register. */ |
| 13 | push r15 |
| 14 | mov r15, 1 |
| 15 | |
| 16 | /* Thread register. */ |
| 17 | push r14 |
| 18 | mov r14, 1 |
| 19 | |
| 20 | /* Code register. */ |
| 21 | push r12 |
| 22 | mov r12, 1 |
| 23 | |
| 24 | /* Arguments descriptor register (volatile). */ |
| 25 | mov r10, 1 |
| 26 | |
| 27 | /* Clobber all other volatile registers (except the argument). */ |
| 28 | mov rax, 1 |
| 29 | mov rcx, 1 |
| 30 | mov rdx, 1 |
| 31 | mov rsi, 1 |
| 32 | mov r8, 1 |
| 33 | mov r9, 1 |
| 34 | mov r11, 1 |
| 35 | |
| 36 | /* Stack must be 16-byte aligned before the call. We save three registers above |
| 37 | to ensure this. */ |
| 38 | call rdi |
| 39 | |
| 40 | pop r12 |
| 41 | pop r14 |
| 42 | pop r15 |
| 43 | |
| 44 | ret |
| 45 | |