nuttx/arch/xtensa
Marco Casaroli 1bc7cfeeb1 arch/xtensa: Provide POSIX fork() on the ESP32-S3.
up_addrenv_fork() duplicates an address environment into freshly allocated
pages mapped at the same virtual addresses.  The text, data and heap regions
of the source are walked one page at a time and copied into fresh pages hung
off the child's own directory, using the two kmap slots that
CONFIG_ARCH_KMAP_NPAGES reserves for exactly this.

xtensa_fork.c already took both paths:  a child that keeps the parent's stack
addresses needs no relocation, which is what a duplicated address environment
gives it.  Only the hook and the Kconfig default were missing.

fork() is offered on a kernel build, which is the only mode with per-process
address environments.

Verified on an ESP32-S3-WROOM-2 with esp32s3-devkit:kernel_oct.  ostest
reports "Parent and child had independent memory" and exits with status 0.

Assisted-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
2026-09-26 11:13:57 -03:00
..
include xtensa/esp32s3: Implement per-process address environments. 2026-09-26 11:13:57 -03:00
src arch/xtensa: Provide POSIX fork() on the ESP32-S3. 2026-09-26 11:13:57 -03:00
CMakeLists.txt cmake:implement CMake build of xtensa arch 2024-11-02 18:08:38 +08:00
Kconfig xtensa/esp32s3: Wire the chip into the kernel build. 2026-09-26 11:13:57 -03:00