xiaoxiang781216 commented on code in PR #19774:
URL: https://github.com/apache/nuttx/pull/19774#discussion_r4343715883
##########
arch/Kconfig:
##########
@@ -85,6 +85,7 @@ config ARCH_RENESAS
config ARCH_RISCV
bool "RISC-V"
+ select ARCH_HAVE_FORK if BUILD_KERNEL && ARCH_ADDRENV &&
!ARCH_STACK_DYNAMIC
Review Comment:
move to the first patch
##########
arch/risc-v/src/common/riscv_addrenv.c:
##########
@@ -497,6 +524,172 @@ int up_addrenv_create(size_t textsize, size_t datasize,
size_t heapsize,
return ret;
}
+#ifdef CONFIG_ARCH_HAVE_FORK
+/****************************************************************************
+ * Name: up_addrenv_fork
+ *
+ * Description:
+ * Duplicate an address environment for POSIX fork(). The destination gets
+ * its own page tables and its own physical pages, holding a copy of the
+ * source's contents and mapped at the same virtual addresses.
+ *
+ * The walk mirrors up_addrenv_destroy(): every final level page table the
+ * source has under its static tables is visited, and every page it maps is
+ * duplicated. So the cost is the size of the process, not the size of its
+ * address space -- but it is an eager copy, with no copy-on-write, so
+ * forking needs as much free page memory as the parent occupies.
+ *
+ * Input Parameters:
+ * src - The address environment to be duplicated.
+ * dest - The location to receive the duplicate.
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+int up_addrenv_fork(const arch_addrenv_t *src, arch_addrenv_t *dest)
Review Comment:
swap the order too
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]