OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-7.1/] [sim/] [testsuite/] [sim/] [cris/] [c/] [settls1.c] - Blame information for rev 834

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 227 jeremybenn
/* Check that the syscall set_thread_area is supported and does the right thing.
2
#notarget: cris*-*-elf
3
*/
4
 
5
#include <unistd.h>
6
#include <sys/syscall.h>
7
#include <stdio.h>
8
#include <errno.h>
9
#include <stdlib.h>
10
 
11
#ifndef SYS_set_thread_area
12
#define SYS_set_thread_area 243
13
#endif
14
 
15
int main (void)
16
{
17
  int ret;
18
 
19
  /* Check the error check that the low 8 bits must be 0.  */
20
  ret = syscall (SYS_set_thread_area, 0xfeeb1ff0);
21
  if (ret != -1 || errno != EINVAL)
22
    {
23
      perror ("tls1");
24
      abort ();
25
    }
26
 
27
  ret = syscall (SYS_set_thread_area, 0xcafebe00);
28
  if (ret != 0)
29
    {
30
      perror ("tls2");
31
      abort ();
32
    }
33
 
34
  /* Check that we got the right result.  */
35
#ifdef __arch_v32
36
  asm ("move $pid,%0\n\tclear.b %0" : "=rm" (ret));
37
#else
38
  asm ("move $brp,%0" : "=rm" (ret));
39
#endif
40
 
41
  if (ret != 0xcafebe00)
42
    {
43
      perror ("tls2");
44
      abort ();
45
    }
46
 
47
  printf ("pass\n");
48
  exit (0);
49
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.