1 /* Verify that changing xmm registers in audit library won't affect
2 function parameter passing/return. */
10 #include <bits/wordsize.h>
11 #include <gnu/lib-names.h>
12 #include <emmintrin.h>
15 la_version (unsigned int v
)
19 printf ("version: %u\n", v
);
22 sprintf (buf
, "%u", v
);
28 la_activity (uintptr_t *cookie
, unsigned int flag
)
30 if (flag
== LA_ACT_CONSISTENT
)
31 printf ("activity: consistent\n");
32 else if (flag
== LA_ACT_ADD
)
33 printf ("activity: add\n");
34 else if (flag
== LA_ACT_DELETE
)
35 printf ("activity: delete\n");
37 printf ("activity: unknown activity %u\n", flag
);
41 la_objsearch (const char *name
, uintptr_t *cookie
, unsigned int flag
)
45 if (flag
== LA_SER_ORIG
)
46 flagstr
= "LA_SET_ORIG";
47 else if (flag
== LA_SER_LIBPATH
)
48 flagstr
= "LA_SER_LIBPATH";
49 else if (flag
== LA_SER_RUNPATH
)
50 flagstr
= "LA_SER_RUNPATH";
51 else if (flag
== LA_SER_CONFIG
)
52 flagstr
= "LA_SER_CONFIG";
53 else if (flag
== LA_SER_DEFAULT
)
54 flagstr
= "LA_SER_DEFAULT";
55 else if (flag
== LA_SER_SECURE
)
56 flagstr
= "LA_SER_SECURE";
59 sprintf (buf
, "unknown flag %d", flag
);
62 printf ("objsearch: %s, %s\n", name
, flagstr
);
68 la_objopen (struct link_map
*l
, Lmid_t lmid
, uintptr_t *cookie
)
70 printf ("objopen: %ld, %s\n", lmid
, l
->l_name
);
76 la_preinit (uintptr_t *cookie
)
82 la_objclose (uintptr_t *cookie
)
84 printf ("objclose\n");
89 la_symbind64 (Elf64_Sym
*sym
, unsigned int ndx
, uintptr_t *refcook
,
90 uintptr_t *defcook
, unsigned int *flags
, const char *symname
)
92 printf ("symbind64: symname=%s, st_value=%#lx, ndx=%u, flags=%u\n",
93 symname
, (long int) sym
->st_value
, ndx
, *flags
);
98 #include <tst-audit.h>
101 pltenter (ElfW(Sym
) *sym
, unsigned int ndx
, uintptr_t *refcook
,
102 uintptr_t *defcook
, La_regs
*regs
, unsigned int *flags
,
103 const char *symname
, long int *framesizep
)
105 printf ("pltenter: symname=%s, st_value=%#lx, ndx=%u, flags=%u\n",
106 symname
, (long int) sym
->st_value
, ndx
, *flags
);
108 __m128i minusone
= _mm_set1_epi32 (-1);
110 if (strcmp (symname
, "audit_test") == 0)
112 __m128i zero
= _mm_setzero_si128 ();
113 if (memcmp (®s
->lr_xmm
[0], &zero
, sizeof (zero
))
114 || memcmp (®s
->lr_xmm
[1], &zero
, sizeof (zero
))
115 || memcmp (®s
->lr_xmm
[2], &zero
, sizeof (zero
))
116 || memcmp (®s
->lr_xmm
[3], &zero
, sizeof (zero
))
117 || memcmp (®s
->lr_xmm
[4], &zero
, sizeof (zero
))
118 || memcmp (®s
->lr_xmm
[5], &zero
, sizeof (zero
))
119 || memcmp (®s
->lr_xmm
[6], &zero
, sizeof (zero
))
120 || memcmp (®s
->lr_xmm
[7], &zero
, sizeof (zero
)))
123 for (int i
= 0; i
< 8; i
++)
124 regs
->lr_xmm
[i
] = (La_x86_64_xmm
) _mm_set1_epi32 (i
+ 1);
129 asm volatile ("movdqa %0, %%xmm0" : : "x" (minusone
) : "xmm0" );
130 asm volatile ("movdqa %0, %%xmm1" : : "x" (minusone
) : "xmm1" );
131 asm volatile ("movdqa %0, %%xmm2" : : "x" (minusone
) : "xmm2" );
132 asm volatile ("movdqa %0, %%xmm3" : : "x" (minusone
) : "xmm3" );
133 asm volatile ("movdqa %0, %%xmm4" : : "x" (minusone
) : "xmm4" );
134 asm volatile ("movdqa %0, %%xmm5" : : "x" (minusone
) : "xmm5" );
135 asm volatile ("movdqa %0, %%xmm6" : : "x" (minusone
) : "xmm6" );
136 asm volatile ("movdqa %0, %%xmm7" : : "x" (minusone
) : "xmm7" );
138 return sym
->st_value
;
142 pltexit (ElfW(Sym
) *sym
, unsigned int ndx
, uintptr_t *refcook
,
143 uintptr_t *defcook
, const La_regs
*inregs
, La_retval
*outregs
,
146 printf ("pltexit: symname=%s, st_value=%#lx, ndx=%u, retval=%tu\n",
147 symname
, (long int) sym
->st_value
, ndx
,
148 (ptrdiff_t) outregs
->int_retval
);
152 if (strcmp (symname
, "audit_test") == 0)
154 __m128i zero
= _mm_setzero_si128 ();
155 if (memcmp (&outregs
->lrv_xmm0
, &zero
, sizeof (zero
)))
158 for (int i
= 0; i
< 8; i
++)
160 xmm
= _mm_set1_epi32 (i
+ 1);
161 if (memcmp (&inregs
->lr_xmm
[i
], &xmm
, sizeof (xmm
)) != 0)
165 outregs
->lrv_xmm0
= (La_x86_64_xmm
) _mm_set1_epi32 (0x12349876);
168 xmm
= _mm_set1_epi32 (-1);
169 asm volatile ("movdqa %0, %%xmm0" : : "x" (xmm
) : "xmm0" );
170 asm volatile ("movdqa %0, %%xmm1" : : "x" (xmm
) : "xmm1" );