fix event fallout in sh_serial.c
[qemu/aliguori.git] / tests / cris / check_settls1.c
blob69d202652ae2a6801bd421edcc68d307afaf4377
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, old_tp;
15 int ret;
17 asm volatile ("move $pid,%0" : "=r" (old_tp));
18 old_tp &= ~0xff;
20 ret = syscall (SYS_set_thread_area, 0xf0);
21 if (ret != -1 || errno != EINVAL) {
22 syscall (SYS_set_thread_area, old_tp);
23 perror ("Invalid thread area accepted:");
24 abort();
27 ret = syscall (SYS_set_thread_area, 0xeddeed00);
28 if (ret != 0) {
29 perror ("Valid thread area not accepted: ");
30 abort ();
33 asm volatile ("move $pid,%0" : "=r" (tp));
34 tp &= ~0xff;
35 syscall (SYS_set_thread_area, old_tp);
37 if (tp != 0xeddeed00) {
38 * (volatile int *) 0 = 0;
39 perror ("tls2");
40 abort ();
43 printf ("pass\n");
44 return EXIT_SUCCESS;