This is an automated email from the ASF dual-hosted git repository.

ligd pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new e28c0b4ef1 arm64: Initialize sctrl_el1 when running fork
e28c0b4ef1 is described below

commit e28c0b4ef17eea9ad2e093ecdb06894a5ae7f03c
Author: wangmingrong1 <wangmingro...@xiaomi.com>
AuthorDate: Tue Feb 18 11:18:43 2025 +0800

    arm64: Initialize sctrl_el1 when running fork
    
    Signed-off-by: wangmingrong1 <wangmingro...@xiaomi.com>
---
 arch/arm64/src/common/arm64_fork.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/arm64/src/common/arm64_fork.c 
b/arch/arm64/src/common/arm64_fork.c
index bc91bcc5f5..9cd23b5554 100644
--- a/arch/arm64/src/common/arm64_fork.c
+++ b/arch/arm64/src/common/arm64_fork.c
@@ -225,6 +225,11 @@ pid_t arm64_fork(const struct fork_s *context)
 
   child->cmn.xcp.regs[REG_ELR]    = (uint64_t)context->lr;
 
+  child->cmn.xcp.regs[REG_SCTLR_EL1]  = read_sysreg(sctlr_el1);
+#ifdef CONFIG_ARM64_MTE
+  child->cmn.xcp.regs[REG_SCTLR_EL1] |= SCTLR_TCF1_BIT;
+#endif
+
   child->cmn.xcp.regs[REG_EXE_DEPTH] = 0;
   child->cmn.xcp.regs[REG_SP_ELX]    = newsp - XCPTCONTEXT_SIZE;
 #ifdef CONFIG_ARCH_KERNEL_STACK

Reply via email to