Annotation of qemu/tests/cris/check_settls1.c, revision 1.1.1.2

1.1       root        1: #include <stdio.h>
                      2: #include <stdlib.h>
                      3: #include <errno.h>
                      4: #include <unistd.h>
                      5: 
                      6: #include <sys/syscall.h>
                      7: 
                      8: #ifndef SYS_set_thread_area
                      9: #define SYS_set_thread_area 243
                     10: #endif
                     11: 
                     12: int main (void)
                     13: {
1.1.1.2 ! root       14:     unsigned long tp, old_tp;
1.1       root       15:     int ret;
                     16: 
1.1.1.2 ! root       17:     asm volatile ("move $pid,%0" : "=r" (old_tp));
        !            18:     old_tp &= ~0xff;
        !            19: 
1.1       root       20:     ret = syscall (SYS_set_thread_area, 0xf0);
                     21:     if (ret != -1 || errno != EINVAL) {
1.1.1.2 ! root       22:         syscall (SYS_set_thread_area, old_tp);
1.1       root       23:         perror ("Invalid thread area accepted:");
                     24:         abort();
                     25:     }
                     26: 
                     27:     ret = syscall (SYS_set_thread_area, 0xeddeed00);
                     28:     if (ret != 0) {
                     29:         perror ("Valid thread area not accepted: ");
                     30:         abort ();
                     31:     }
                     32: 
1.1.1.2 ! root       33:     asm volatile ("move $pid,%0" : "=r" (tp));
1.1       root       34:     tp &= ~0xff;
1.1.1.2 ! root       35:     syscall (SYS_set_thread_area, old_tp);
1.1       root       36: 
                     37:     if (tp != 0xeddeed00) {
1.1.1.2 ! root       38:        * (volatile int *) 0 = 0;
1.1       root       39:         perror ("tls2");
                     40:         abort ();
                     41:     }
                     42: 
                     43:     printf ("pass\n");
                     44:     return EXIT_SUCCESS;
                     45: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.