1/* 2 * Copyright 2014, NICTA 3 * 4 * This software may be distributed and modified according to the terms of 5 * the BSD 2-Clause license. Note that NO WARRANTY is provided. 6 * See "LICENSE_BSD2.txt" for details. 7 * 8 * @TAG(NICTA_BSD) 9 */ 10 11struct foo { 12 int x, thread_index; 13} glob; 14struct foo* camkes_get_tls(void) 15{ 16 return &glob; 17} 18_Noreturn void abort(void); 19 20static int a1; 21static int a2; 22static int *get(void) __attribute__((__unused__)); 23static int *get(void) { 24 switch (camkes_get_tls()->thread_index) { 25 case 1: 26 return &a1; 27 case 2: 28 return &a2; 29 default: 30 (void)0; 31 abort(); 32 } 33} 34