2017-02-10 16:32:55 +01:00
|
|
|
#
|
|
|
|
# For a description of the syntax of this configuration file,
|
|
|
|
# see the file kconfig-language.txt in the NuttX tools repository.
|
|
|
|
#
|
|
|
|
|
2017-02-10 17:04:56 +01:00
|
|
|
menu "Thread Local Storage (TLS)"
|
2017-02-10 16:32:55 +01:00
|
|
|
|
2020-05-05 15:28:04 +02:00
|
|
|
config TLS_ALIGNED
|
|
|
|
bool "Require stack alignment"
|
2023-07-15 19:04:21 +02:00
|
|
|
default BUILD_KERNEL
|
2017-02-10 16:32:55 +01:00
|
|
|
---help---
|
2020-05-05 17:18:25 +02:00
|
|
|
Aligned TLS works by fetching thread information from the beginning
|
2017-02-10 16:32:55 +01:00
|
|
|
of the stack memory allocation. In order to do this, the memory
|
|
|
|
must be aligned in such a way that the executing logic can simply
|
2020-05-05 15:28:04 +02:00
|
|
|
mask the current stack pointer to get the beginning of the stack
|
2017-02-10 16:32:55 +01:00
|
|
|
allocation.
|
|
|
|
|
2020-05-05 15:28:04 +02:00
|
|
|
The advantage of using an aligned stack is no OS interface need
|
2020-05-05 17:18:25 +02:00
|
|
|
be called to get the beginning of the stack. It is simply an
|
2020-05-05 15:28:04 +02:00
|
|
|
AND operation on the current stack pointer. The disadvantages
|
2020-05-05 17:18:25 +02:00
|
|
|
are that the alignment (1) causes memory fragmentation which can
|
2020-05-05 15:28:04 +02:00
|
|
|
be a serious problem for memory limited systems, and (2) limits
|
|
|
|
the maximum size of the stack. Any mask places a limit on the
|
|
|
|
maximum size of the stack; stack sizes about that would map to
|
|
|
|
an incorrect address.
|
|
|
|
|
|
|
|
In general, CONFIG_TLS_ALIGNED is preferred for the KERNEL
|
2020-05-05 17:18:25 +02:00
|
|
|
build where the virtualized stack address can be aligned with
|
2020-05-05 15:28:04 +02:00
|
|
|
no implications to physical memory. In other builds, the
|
|
|
|
unaligned stack implementation is usually superior.
|
|
|
|
|
|
|
|
config TLS_LOG2_MAXSTACK
|
|
|
|
int "Maximum stack size (log2)"
|
|
|
|
default 13
|
|
|
|
range 11 24
|
|
|
|
depends on TLS_ALIGNED
|
|
|
|
---help---
|
2017-02-10 16:32:55 +01:00
|
|
|
This setting specifies the alignment of the stack as a power of 2:
|
|
|
|
11=2KB, 12=4KB, 13=8KB, etc. The exact alignment is not so critical
|
|
|
|
except that (1) a very large value can cause you to run out of
|
|
|
|
alignable memory (and fail memory allocations), and (2) smaller
|
|
|
|
values will limit the maximum size of the stack (hence the naming
|
|
|
|
of this configuration value).
|
|
|
|
|
|
|
|
config TLS_NELEM
|
|
|
|
int "Number of TLS elements"
|
2023-08-21 04:26:41 +02:00
|
|
|
depends on !DISABLE_PTHREAD
|
2023-07-15 18:26:06 +02:00
|
|
|
default 0
|
2023-07-11 04:52:32 +02:00
|
|
|
range 0 255
|
2017-02-10 16:32:55 +01:00
|
|
|
---help---
|
|
|
|
The number of unique TLS elements. These can be accessed with
|
2020-05-08 15:23:26 +02:00
|
|
|
the user library functions tls_get_value() and tls_set_value()
|
|
|
|
and the OS interfaces tls_alloc() and tls_free().
|
2017-02-10 16:32:55 +01:00
|
|
|
|
2020-05-07 22:15:09 +02:00
|
|
|
NOTE that the special value of CONFIG_TLS_NELEM disables these
|
|
|
|
TLS interfaces.
|
|
|
|
|
2021-07-20 12:59:09 +02:00
|
|
|
config TLS_TASK_NELEM
|
|
|
|
int "Number of Task Local Storage elements"
|
2023-08-21 04:26:41 +02:00
|
|
|
depends on !BUILD_KERNEL
|
2021-07-20 12:59:09 +02:00
|
|
|
default 0
|
2023-07-11 04:52:32 +02:00
|
|
|
range 0 255
|
2021-07-20 12:59:09 +02:00
|
|
|
---help---
|
|
|
|
The number of unique Task Local Storage elements similar with
|
|
|
|
Thread Local Storage.
|
|
|
|
These can be accessed with task_tls_alloc/task_tls_get_value/task_tls_set_value.
|
2022-05-27 04:05:43 +02:00
|
|
|
NOTE that the 0 value of CONFIG_SCHED_TLS_NELEM disables these
|
|
|
|
TLS interfaces.
|
2021-07-20 12:59:09 +02:00
|
|
|
|
2017-02-10 17:04:56 +01:00
|
|
|
endmenu # Thread Local Storage (TLS)
|