summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/tlsallocsize.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2020-09-10 16:35:09 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2020-09-17 17:42:25 +0200
commitc312f3110ebd6b38c3971910fe034b6c97ebb28c (patch)
treedcc82c92d7088b1d9c2e12e1ece1f6b705f49a05 /cpukit/score/src/tlsallocsize.c
parentrtems: Add RTEMS_ALIGN_UP() (diff)
downloadrtems-c312f3110ebd6b38c3971910fe034b6c97ebb28c.tar.bz2
CONFIGURE_MAXIMUM_THREAD_LOCAL_STORAGE_SIZE
Add this application configuration option. This configuration option can be used to reserve space for the dynamic linking of modules with thread-local storage objects. Add RTEMS_TASK_STORAGE_ALIGNMENT to define the minium alignment of a thread-local storage size. Update #4074.
Diffstat (limited to 'cpukit/score/src/tlsallocsize.c')
-rw-r--r--cpukit/score/src/tlsallocsize.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/cpukit/score/src/tlsallocsize.c b/cpukit/score/src/tlsallocsize.c
index 8fa5600602..a9f0c0cd23 100644
--- a/cpukit/score/src/tlsallocsize.c
+++ b/cpukit/score/src/tlsallocsize.c
@@ -1,7 +1,7 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
/*
- * SPDX-License-Identifier: BSD-2-Clause
- *
- * Copyright (C) 2014, 2019 embedded brains GmbH
+ * Copyright (C) 2014, 2020 embedded brains GmbH (http://www.embedded-brains.de)
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -30,6 +30,8 @@
#endif
#include <rtems/score/tls.h>
+#include <rtems/score/interr.h>
+#include <rtems/score/thread.h>
static uintptr_t _TLS_Allocation_size;
@@ -65,6 +67,14 @@ uintptr_t _TLS_Get_allocation_size( void )
allocation_size += sizeof(TLS_Dynamic_thread_vector);
#endif
+ if ( _Thread_Maximum_TLS_size != 0 ) {
+ if ( allocation_size <= _Thread_Maximum_TLS_size ) {
+ allocation_size = _Thread_Maximum_TLS_size;
+ } else {
+ _Internal_error( INTERNAL_ERROR_TOO_LARGE_TLS_SIZE );
+ }
+ }
+
_TLS_Allocation_size = allocation_size;
}