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