xref: /openbmc/qemu/tests/tcg/x86_64/test-1648.c (revision 7d87775f)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /* See https://gitlab.com/qemu-project/qemu/-/issues/1648 */
3 
4 #include <signal.h>
5 
6 __attribute__((noinline))
7 void bar(void)
8 {
9     /* Success! Continue through sigreturn. */
10 }
11 
12 /*
13  * Because of the change of ABI between foo and bar, the compiler is
14  * required to save XMM6-XMM15.  The compiler will use MOVAPS or MOVDQA,
15  * which will trap if the stack frame is not 16 byte aligned.
16  */
17 __attribute__((noinline, ms_abi))
18 void foo(void)
19 {
20     bar();
21 }
22 
23 void sighandler(int num)
24 {
25     foo();
26 }
27 
28 int main(void)
29 {
30     signal(SIGUSR1, sighandler);
31     raise(SIGUSR1);
32     return 0;
33 }
34