[PATCH v2 06/13] score: Add CPU_THREAD_LOCAL_STORAGE_VARIANT

Sebastian Huber sebastian.huber at embedded-brains.de
Fri Oct 7 04:23:50 UTC 2022


On 07.10.22 05:44, Chris Johns wrote:
> On 6/10/2022 7:23 pm, Sebastian Huber wrote:
>> +#if CPU_THREAD_LOCAL_STORAGE_VARIANT == 10
>> +  tls_data = (void *)
>> +    RTEMS_ALIGN_UP( (uintptr_t) tls_area + sizeof( *tcb ), alignment );
>> +  tcb = (TLS_Thread_control_block *) ((char *) tls_data - sizeof( *tcb ));
>> +  return_value = tls_data;
>> +#elif CPU_THREAD_LOCAL_STORAGE_VARIANT == 11
>> +  tcb_size = RTEMS_ALIGN_UP( sizeof( *tcb ), alignment );
>> +  tls_data = (void *)
>> +    RTEMS_ALIGN_UP( (uintptr_t) tls_area + tcb_size, alignment );
>> +  tcb = (TLS_Thread_control_block *) ((char *) tls_data - tcb_size);
>> +  return_value = tcb;
>> +#elif CPU_THREAD_LOCAL_STORAGE_VARIANT == 20
>> +  alignment_2 = RTEMS_ALIGN_UP( alignment, CPU_SIZEOF_POINTER );
>> +  tls_area = (void *) RTEMS_ALIGN_UP( (uintptr_t) tls_area, alignment_2 );
>> +  size = _TLS_Get_size();
>> +  tcb = (TLS_Thread_control_block *)
>> +    ((char *) tls_area + RTEMS_ALIGN_UP( size, alignment_2 ));
>> +  tls_data = (char *) tcb - RTEMS_ALIGN_UP( size, alignment );
>> +  return_value = tcb;
>> +#else
>> +#error "unexpected CPU_THREAD_LOCAL_STORAGE_VARIANT value"
> What are the expected values? I can see 10, 11, 20.
> 
> Can this please be changed to something readable? For example:
> 
> #if CPU_THREAD_LOCAL_STORAGE_VARIANT == CPU_THREAD_LOCAL_STORAGE_BLAH
> 
> #elif CPU_THREAD_LOCAL_STORAGE_VARIANT == CPU_THREAD_LOCAL_STORAGE_BLAH_BLAH

This is documented in the no_cpu/cpuimpl.h. I think the numbers are all 
right if you know the TLS variants. Otherwise we would have to add an 
extra header file just for the CPU_THREAD_LOCAL_STORAGE_* defines.

-- 
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.huber at embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/


More information about the devel mailing list