nuttx/arch/x86
Marco Casaroli 2b5509e48a
Some checks failed
MemBrowse Memory Report / changes-filter (push) Has been cancelled
MemBrowse Memory Report / load-targets (push) Has been cancelled
MemBrowse Memory Report / identical (push) Has been cancelled
MemBrowse Memory Report / analyze (push) Has been cancelled
arch/x86: Provide vfork().
x86 selected neither fork primitive, so vfork() was not available on this
architecture at all.

fork.S takes the register snapshot and hands it to x86_fork(), which allocates
the child, copies the used part of the caller's stack, and starts it.  There is
one entry point for both primitives, because the snapshot is the same for
either.

Unlike the register-passing architectures, cdecl puts the flag on the stack, so
up_fork() loads it from 4(%esp).  That slot is also the stack pointer the
caller had:  it pushed the argument, then `call' pushed the return address.  So
the low end of the region that x86_fork() copies is unchanged.

POSIX fork() is not provided.  It needs an address environment that can be
duplicated and this architecture has none, so CONFIG_ARCH_HAVE_FORK is never
set here.  x86_fork.c makes that a build error rather than a silent omission.

Verified under QEMU with qemu-i486:nsh.  ostest runs to the end and reports
"Child 5 ran and exited before the parent resumed", with fork() correctly
absent.

Assisted-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
2026-08-15 09:00:20 -03:00
..
include arch: rename STACK_ALIGNMENT to STACKFRAME_ALIGN across all architectures 2026-01-22 15:37:24 +08:00
src arch/x86: Provide vfork(). 2026-08-15 09:00:20 -03:00
Kconfig arch/x86: Fix the Kconfig warning 2022-06-07 12:43:11 +09:00