Guest debugging support for KVM (Jan Kiszka)
[sniper_test.git] / tests / cris / check_settls1.c
blob0ed99cf4c14a62cab225e05d30863af761080ef5
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <errno.h>
4 #include <unistd.h>
6 #include <sys/syscall.h>
8 #ifndef SYS_set_thread_area
9 #define SYS_set_thread_area 243
10 #endif
12 int main (void)
14 unsigned long tp;
15 int ret;
17 ret = syscall (SYS_set_thread_area, 0xf0);
18 if (ret != -1 || errno != EINVAL) {
19 perror ("Invalid thread area accepted:");
20 abort();
23 ret = syscall (SYS_set_thread_area, 0xeddeed00);
24 if (ret != 0) {
25 perror ("Valid thread area not accepted: ");
26 abort ();
29 asm ("move $pid,%0" : "=r" (tp));
30 tp &= ~0xff;
32 if (tp != 0xeddeed00) {
33 perror ("tls2");
34 abort ();
37 printf ("pass\n");
38 return EXIT_SUCCESS;