Summary:
- In case of BUILD_KERNEL, NuttX uses USR mode sp and SVC mode sp.
- The kernel runs on SVC mode sp.
- While the kernel is running, up_getsp() cannot get the TLS address.
- The kernel requires tls_get_info() function.
- For the user land, up_getsp() can be used.
- tls_getinfo.c is always compiled and tls_get_info() function is
filtered by macros in the tls_getinfo.c.
Impact:
BUILD_KERNEL
Testing:
test program on custom Cortex-A9 board (BUILD_KERNEL)
ostest on sabre-6quad:smp (QEMU, BUILD_FLAT)
Signed-off-by: Oki Minabe <minabe.oki@gmail.com>
arch: Allocate the space from the beginning in up_stack_frame
and modify the affected portion:
1.Correct the stack dump and check
2.Allocate tls_info_s by up_stack_frame too
3.Move the stack fork allocation from arch to sched
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
1. Move pthread-specific data files from sched/pthread/ to libs/libc/pthread.
2. Remove pthread-specific data functions from syscalls.
3. Implement tls_alloc() and tls_free() with system calls.
4. Reimplement pthread_key_create() and pthread_key_free() using tls_alloc() and tls_free().
5. Reimplement pthread_set_specific() and pthread_get_specicif() using tls_set_value() and tls_get_value()
- Remove per-thread errno from the TCB structure (pterrno)
- Remove get_errno() and set_errno() as functions. The macros are still available as stubs and will be needed in the future if we need to access the errno from a different address environment (KERNEL mode).
- Add errno value to the tls_info_s structure definitions
- Move sched/errno to libs/libc/errno. Replace old TCB access to the errno with TLS access to the errno.
Move the logic to get TLS information from an inline function to a normal function. For the unaligned case, it is probably too large to be inlined.
Also fixes some minor things from review of previous commits.
Squashed commit of the following:
libs/libxx: Fix some confusing in naming. If the directory is called libxx, then the library must be libxx.a (unless perhaps LIBCXX is selected).
libs/: Fix paths in moved library directories.
libs: Brute force move of libc, libnx, and libxx to libs. Cannot yet build it in that configuration.