Revision ef96779b

b/linux-user/syscall.c
5912 5912
      ((CPUMIPSState *) cpu_env)->tls_value = arg1;
5913 5913
      ret = 0;
5914 5914
      break;
5915
#elif defined(TARGET_CRIS)
5916
      if (arg1 & 0xff)
5917
          ret = -TARGET_EINVAL;
5918
      else {
5919
          ((CPUCRISState *) cpu_env)->pregs[PR_PID] = arg1;
5920
          ret = 0;
5921
      }
5922
      break;
5915 5923
#elif defined(TARGET_I386) && defined(TARGET_ABI32)
5916 5924
      ret = do_set_thread_area(cpu_env, arg1);
5917 5925
      break;
b/target-cris/cpu.h
225 225
}
226 226
#endif
227 227

  
228
static inline void cpu_set_tls(CPUCRISState *env, target_ulong newtls)
229
{
230
	env->pregs[PR_PID] = (env->pregs[PR_PID] & 0xff) | newtls;
231
}
232

  
228 233
/* Support function regs.  */
229 234
#define SFR_RW_GC_CFG      0][0
230 235
#define SFR_RW_MM_CFG      env->pregs[PR_SRS]][0
b/tests/cris/Makefile
117 117
TESTCASES += check_sigalrm.ctst
118 118
TESTCASES += check_time1.ctst
119 119
TESTCASES += check_time2.ctst
120

  
120
TESTCASES += check_settls1.ctst
121 121

  
122 122
TESTCASES += check_gcctorture_pr28634-1.ctst
123 123
#TESTCASES += check_gcctorture_pr28634.ctst
b/tests/cris/check_settls1.c
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
}

Also available in: Unified diff