You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2024/08/08 01:42:35 UTC
(nuttx) branch master updated (5df3f5d4f7 -> 77cfbf8914)
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
from 5df3f5d4f7 Added the documentation about the iic slave driver
new 3f021d5429 riscv/fork: fix fp/s0 field position
new 77cfbf8914 riscv/fork: fix gp register handling
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
arch/risc-v/src/common/fork.S | 4 ++++
arch/risc-v/src/common/riscv_fork.c | 2 +-
arch/risc-v/src/common/riscv_fork.h | 10 +++++-----
3 files changed, 10 insertions(+), 6 deletions(-)
(nuttx) 01/02: riscv/fork: fix fp/s0 field position
Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 3f021d5429da49a1919da90fa746c19d8817d770
Author: Yanfeng Liu <yf...@qq.com>
AuthorDate: Thu Aug 8 06:18:26 2024 +0800
riscv/fork: fix fp/s0 field position
The fp/s0 field position shall be in line with the macro
FORK_FP_OFFSET/FORK_S0_OFFSET.
Signed-off-by: Yanfeng Liu <yf...@qq.com>
---
arch/risc-v/src/common/riscv_fork.h | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/arch/risc-v/src/common/riscv_fork.h b/arch/risc-v/src/common/riscv_fork.h
index 26a2ec5925..bfb2560f1f 100644
--- a/arch/risc-v/src/common/riscv_fork.h
+++ b/arch/risc-v/src/common/riscv_fork.h
@@ -119,6 +119,11 @@ struct fork_s
{
/* CPU registers */
+#ifdef CONFIG_RISCV_FRAMEPOINTER
+ uintreg_t fp; /* Frame pointer */
+#else
+ uintreg_t s0; /* Saved register s0 */
+#endif
uintreg_t s1; /* Saved register s1 */
uintreg_t s2; /* Saved register s2 */
uintreg_t s3; /* Saved register s3 */
@@ -130,11 +135,6 @@ struct fork_s
uintreg_t s9; /* Saved register s9 */
uintreg_t s10; /* Saved register s10 */
uintreg_t s11; /* Saved register s11 */
-#ifdef CONFIG_RISCV_FRAMEPOINTER
- uintreg_t fp; /* Frame pointer */
-#else
- uintreg_t s0; /* Saved register s0 */
-#endif
uintreg_t sp; /* Stack pointer */
uintreg_t ra; /* Return address */
#ifdef RISCV_SAVE_GP
(nuttx) 02/02: riscv/fork: fix gp register handling
Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 77cfbf8914935c2b81329840c001fc1036fd9bf8
Author: Yanfeng Liu <yf...@qq.com>
AuthorDate: Thu Aug 8 06:25:58 2024 +0800
riscv/fork: fix gp register handling
This fixes the handling of gp register in fork.
Signed-off-by: Yanfeng Liu <yf...@qq.com>
---
arch/risc-v/src/common/fork.S | 4 ++++
arch/risc-v/src/common/riscv_fork.c | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/arch/risc-v/src/common/fork.S b/arch/risc-v/src/common/fork.S
index 9134266fec..a7ca257f05 100644
--- a/arch/risc-v/src/common/fork.S
+++ b/arch/risc-v/src/common/fork.S
@@ -123,6 +123,10 @@ up_fork:
REGSTORE s0, FORK_S0_OFFSET(sp)
#endif
+#ifdef RISCV_SAVE_GP
+ REGSTORE gp, FORK_GP_OFFSET(sp)
+#endif
+
addi a0, sp, FORK_SIZEOF
REGSTORE a0, FORK_SP_OFFSET(sp) /* original SP */
REGSTORE x1, FORK_RA_OFFSET(sp) /* return address */
diff --git a/arch/risc-v/src/common/riscv_fork.c b/arch/risc-v/src/common/riscv_fork.c
index 9187cc6ab5..40e463b2ae 100644
--- a/arch/risc-v/src/common/riscv_fork.c
+++ b/arch/risc-v/src/common/riscv_fork.c
@@ -308,7 +308,7 @@ pid_t riscv_fork(const struct fork_s *context)
#endif
child->cmn.xcp.regs[REG_SP] = newsp; /* Stack pointer */
#ifdef RISCV_SAVE_GP
- child->cmn.xcp.regs[REG_GP] = newsp; /* Global pointer */
+ child->cmn.xcp.regs[REG_GP] = context->gp; /* Global pointer */
#endif
#ifdef CONFIG_ARCH_FPU
fregs = riscv_fpuregs(&child->cmn);