1 /* Check if TLSDESC relocation preserves %rdi, %rsi and %rbx.
2 Copyright (C) 2024 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
21 /* On AVX512 machines, OFFSET == 40 caused _dl_tlsdesc_dynamic_xsavec
22 to clobber %rdi, %rsi and %rbx. On Intel AVX CPUs, the state size
23 is 960 bytes and this test didn't fail. It may be due to the unused
24 last 128 bytes. On AMD AVX CPUs, the state size is 832 bytes and
25 this test might fail without the fix. */
33 .type apply_tls, @function
38 cfi_def_cfa_offset (16)
40 movdqu (%RDI_LP), %xmm0
41 lea tls_var1@TLSDESC(%rip), %RAX_LP
43 cfi_def_cfa_register (6)
44 /* Align stack to 64 bytes. */
48 /* Set %ebx to 0xbadbeef. */
51 movq %rdi, saved_rdi(%rip)
52 movq %rsi, saved_rsi(%rip)
53 call *tls_var1@TLSCALL(%RAX_LP)
54 /* Check if _dl_tlsdesc_dynamic preserves %rdi, %rsi and %rbx. */
55 cmpq saved_rdi(%rip), %rdi
57 cmpq saved_rsi(%rip), %rsi
62 movups %xmm0, 32(%RAX_LP)
63 movdqu 16(%RDI_LP), %xmm1
65 movups %xmm1, 48(%RAX_LP)
66 lea 32(%RBX_LP), %RAX_LP
74 .size apply_tls, .-apply_tls
77 .section .tbss,"awT",@nobits
79 .type tls_var1, @object
87 .section .note.GNU-stack,"",@progbits