Statistics
| Branch: | Revision:

root / tests / cris / check_settls1.c @ ef96779b

History | View | Annotate | Download (723 Bytes)

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
{
14
    unsigned long tp;
15
    int ret;
16

    
17
    ret = syscall (SYS_set_thread_area, 0xf0);
18
    if (ret != -1 || errno != EINVAL) {
19
        perror ("Invalid thread area accepted:");
20
        abort();
21
    }
22

    
23
    ret = syscall (SYS_set_thread_area, 0xeddeed00);
24
    if (ret != 0) {
25
        perror ("Valid thread area not accepted: ");
26
        abort ();
27
    }
28

    
29
    asm ("move $pid,%0" : "=r" (tp));
30
    tp &= ~0xff;
31

    
32
    if (tp != 0xeddeed00) {
33
        perror ("tls2");
34
        abort ();
35
    }
36

    
37
    printf ("pass\n");
38
    return EXIT_SUCCESS;
39
}