From 3f2546b2ef55b661fd8dd69682b38992225e86f6 Mon Sep 17 00:00:00 2001 From: fishsoupisgood Date: Mon, 29 Apr 2019 01:17:54 +0100 Subject: Initial import of qemu-2.4.1 --- tests/tcg/cris/check_settls1.c | 45 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 tests/tcg/cris/check_settls1.c (limited to 'tests/tcg/cris/check_settls1.c') diff --git a/tests/tcg/cris/check_settls1.c b/tests/tcg/cris/check_settls1.c new file mode 100644 index 00000000..69d20265 --- /dev/null +++ b/tests/tcg/cris/check_settls1.c @@ -0,0 +1,45 @@ +#include +#include +#include +#include + +#include + +#ifndef SYS_set_thread_area +#define SYS_set_thread_area 243 +#endif + +int main (void) +{ + unsigned long tp, old_tp; + int ret; + + asm volatile ("move $pid,%0" : "=r" (old_tp)); + old_tp &= ~0xff; + + ret = syscall (SYS_set_thread_area, 0xf0); + if (ret != -1 || errno != EINVAL) { + syscall (SYS_set_thread_area, old_tp); + perror ("Invalid thread area accepted:"); + abort(); + } + + ret = syscall (SYS_set_thread_area, 0xeddeed00); + if (ret != 0) { + perror ("Valid thread area not accepted: "); + abort (); + } + + asm volatile ("move $pid,%0" : "=r" (tp)); + tp &= ~0xff; + syscall (SYS_set_thread_area, old_tp); + + if (tp != 0xeddeed00) { + * (volatile int *) 0 = 0; + perror ("tls2"); + abort (); + } + + printf ("pass\n"); + return EXIT_SUCCESS; +} -- cgit v1.2.3