]> begriffs open source - freertos/commit
Add support for newlib dynamic reentrancy (#496)
authorDarian <32921628+Dazza0@users.noreply.github.com>
Tue, 31 May 2022 23:11:02 +0000 (07:11 +0800)
committerGitHub <noreply@github.com>
Tue, 31 May 2022 23:11:02 +0000 (16:11 -0700)
commit34b8e24d7ccdbe25af8ad96dfd3154aeb302a8d6
tree29183cfe6adccf47346302fb7950b914aee29c63
parenta97741a08d36ac08d913b8bc86abf128df627e85
Add support for newlib dynamic reentrancy (#496)

Previously, newlib's _impure_ptr was updated on every context switch
to point to the current task's _reent structure.

However, this behavior is no longer valid on multi-core systems due
to the fact that multiple cores can switch contexts at the same time,
thus leading to the corruption of the _impure_ptr.

However, Newlib can be compiled with __DYNAMIC_REENT__ enabled which
will cause newlib functions to call __getreent() instead in order to
obtain the required reent struct.

This commit adds dynamic reentrancy support to FreeRTOS:

- Added a configNEWLIB_REENTRANT_IS_DYNAMIC to enable dynamic reentrancy support
- _impure_ptr is no longer updated with reentrancy is dynamic
- Port must provide their own __getreent() that returns the current task's reent struct
include/FreeRTOS.h
tasks.c