2 * Minimal user-environment for testing BTI.
4 * Normal libc is not (yet) built with BTI support enabled,
5 * and so could generate a BTI TRAP before ever reaching main.
11 #include <asm/unistd.h>
22 register int x0
__asm__("x0") = ret
;
23 register int x8
__asm__("x8") = __NR_exit
;
25 asm volatile("svc #0" : : "r"(x0
), "r"(x8
));
26 __builtin_unreachable();
30 * Irritatingly, the user API struct sigaction does not match the
31 * kernel API struct sigaction. So for simplicity, isolate the
32 * kernel ABI here, and make this act like signal.
34 void signal_info(int sig
, void (*fn
)(int, siginfo_t
*, ucontext_t
*))
36 struct kernel_sigaction
{
37 void (*handler
)(int, siginfo_t
*, ucontext_t
*);
39 unsigned long restorer
;
41 } sa
= { fn
, SA_SIGINFO
, 0, 0 };
43 register int x0
__asm__("x0") = sig
;
44 register void *x1
__asm__("x1") = &sa
;
45 register void *x2
__asm__("x2") = 0;
46 register int x3
__asm__("x3") = sizeof(unsigned long);
47 register int x8
__asm__("x8") = __NR_rt_sigaction
;
50 : : "r"(x0
), "r"(x1
), "r"(x2
), "r"(x3
), "r"(x8
) : "memory");