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/incubator-nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 00efcd3  arch/risc-v: Merge riscv_getnewintctx into common
00efcd3 is described below

commit 00efcd33082192bc33d0b1d0c12ad9b47e7ecd0a
Author: Huang Qi <huang...@xiaomi.com>
AuthorDate: Fri Mar 18 12:20:15 2022 +0800

    arch/risc-v: Merge riscv_getnewintctx into common
    
    And also mask the bits which should be preserved (from ISA spec)
    
    Signed-off-by: Huang Qi <huang...@xiaomi.com>
---
 arch/risc-v/include/csr.h                   |  8 ++++
 arch/risc-v/src/bl602/Make.defs             |  2 +-
 arch/risc-v/src/bl602/bl602_irq.c           | 23 ----------
 arch/risc-v/src/c906/Make.defs              |  2 +-
 arch/risc-v/src/c906/c906_irq.c             | 27 -----------
 arch/risc-v/src/common/riscv_getnewintctx.c | 71 +++++++++++++++++++++++++++++
 arch/risc-v/src/esp32c3/Make.defs           |  2 +-
 arch/risc-v/src/esp32c3/esp32c3_irq.c       | 19 --------
 arch/risc-v/src/fe310/Make.defs             |  2 +-
 arch/risc-v/src/fe310/fe310_irq.c           | 19 --------
 arch/risc-v/src/k210/Make.defs              |  2 +-
 arch/risc-v/src/k210/k210_irq.c             | 23 ----------
 arch/risc-v/src/litex/Make.defs             |  2 +-
 arch/risc-v/src/litex/litex_irq.c           | 19 --------
 arch/risc-v/src/mpfs/Make.defs              |  2 +-
 arch/risc-v/src/mpfs/mpfs_irq.c             | 27 -----------
 arch/risc-v/src/qemu-rv/Make.defs           |  2 +-
 arch/risc-v/src/qemu-rv/qemu_rv_irq.c       | 24 ----------
 arch/risc-v/src/rv32m1/Make.defs            |  2 +-
 arch/risc-v/src/rv32m1/rv32m1_irq.c         | 19 --------
 20 files changed, 88 insertions(+), 209 deletions(-)

diff --git a/arch/risc-v/include/csr.h b/arch/risc-v/include/csr.h
index 16c3d9b..a5cb948 100644
--- a/arch/risc-v/include/csr.h
+++ b/arch/risc-v/include/csr.h
@@ -307,6 +307,14 @@
 #define MSTATUS_FS_CLEAN  (0x2 << 13)
 #define MSTATUS_FS_DIRTY  (0x3 << 13)
 
+/* Mask of preserved bits for mstatus */
+
+#ifdef CONFIG_ARCH_RV32
+#define MSTATUS_WPRI      (0xff << 23 | 0x15)
+#else
+#define MSTATUS_WPRI      (UINT64_C(0x1ffffff) << 38 | UINT64_C(0x1ff) << 23 | 
0x15)
+#endif
+
 /* In mie (machine interrupt enable) register */
 
 #define MIE_MSIE      (0x1 << 3)  /* Machine Software Interrupt Enable */
diff --git a/arch/risc-v/src/bl602/Make.defs b/arch/risc-v/src/bl602/Make.defs
index ece57c5..251f198 100644
--- a/arch/risc-v/src/bl602/Make.defs
+++ b/arch/risc-v/src/bl602/Make.defs
@@ -33,7 +33,7 @@ CMN_CSRCS += riscv_interruptcontext.c riscv_modifyreg32.c 
riscv_puts.c riscv_mde
 CMN_CSRCS += riscv_releasepending.c riscv_reprioritizertr.c 
riscv_copyfullstate.c
 CMN_CSRCS += riscv_releasestack.c riscv_stackframe.c riscv_schedulesigaction.c
 CMN_CSRCS += riscv_sigdeliver.c riscv_udelay.c riscv_unblocktask.c 
riscv_usestack.c
-CMN_CSRCS += riscv_idle.c riscv_tcbinfo.c
+CMN_CSRCS += riscv_idle.c riscv_tcbinfo.c riscv_getnewintctx.c
 
 ifeq ($(CONFIG_SCHED_BACKTRACE),y)
 CMN_CSRCS += riscv_backtrace.c
diff --git a/arch/risc-v/src/bl602/bl602_irq.c 
b/arch/risc-v/src/bl602/bl602_irq.c
index 0a0a7e3..9540f79 100644
--- a/arch/risc-v/src/bl602/bl602_irq.c
+++ b/arch/risc-v/src/bl602/bl602_irq.c
@@ -164,29 +164,6 @@ void up_enable_irq(int irq)
 }
 
 /****************************************************************************
- * Name: riscv_get_newintctx
- *
- * Description:
- *   Return initial mstatus when a task is created.
- *
- ****************************************************************************/
-
-uintptr_t riscv_get_newintctx(void)
-{
-  /* Set machine previous privilege mode to machine mode.
-   * Also set machine previous interrupt enable
-   */
-
-  uintptr_t mstatus = READ_CSR(mstatus);
-
-#ifdef CONFIG_ARCH_FPU
-  return (mstatus | MSTATUS_FS_INIT | MSTATUS_MPPM | MSTATUS_MPIE);
-#else
-  return (mstatus | MSTATUS_MPPM | MSTATUS_MPIE);
-#endif
-}
-
-/****************************************************************************
  * Name: riscv_ack_irq
  *
  * Description:
diff --git a/arch/risc-v/src/c906/Make.defs b/arch/risc-v/src/c906/Make.defs
index 53447d8..75c6cdd 100644
--- a/arch/risc-v/src/c906/Make.defs
+++ b/arch/risc-v/src/c906/Make.defs
@@ -34,7 +34,7 @@ CMN_CSRCS += riscv_releasepending.c riscv_reprioritizertr.c
 CMN_CSRCS += riscv_releasestack.c riscv_stackframe.c riscv_schedulesigaction.c
 CMN_CSRCS += riscv_sigdeliver.c riscv_unblocktask.c riscv_usestack.c
 CMN_CSRCS += riscv_mdelay.c riscv_copyfullstate.c riscv_idle.c
-CMN_CSRCS += riscv_tcbinfo.c
+CMN_CSRCS += riscv_tcbinfo.c riscv_getnewintctx.c
 
 ifeq ($(CONFIG_SCHED_BACKTRACE),y)
 CMN_CSRCS += riscv_backtrace.c
diff --git a/arch/risc-v/src/c906/c906_irq.c b/arch/risc-v/src/c906/c906_irq.c
index feb9168..e315b74 100644
--- a/arch/risc-v/src/c906/c906_irq.c
+++ b/arch/risc-v/src/c906/c906_irq.c
@@ -195,33 +195,6 @@ void up_enable_irq(int irq)
 }
 
 /****************************************************************************
- * Name: riscv_get_newintctx
- *
- * Description:
- *   Return initial mstatus when a task is created.
- *
- ****************************************************************************/
-
-uintptr_t riscv_get_newintctx(void)
-{
-  /* Set machine previous privilege mode to machine mode. Reegardless of
-   * how NuttX is configured and of what kind of thread is being started.
-   * That is because all threads, even user-mode threads will start in
-   * kernel trampoline at nxtask_start() or pthread_start().
-   * The thread's privileges will be dropped before transitioning to
-   * user code. Also set machine previous interrupt enable.
-   */
-
-  uintptr_t mstatus = READ_CSR(mstatus);
-
-#ifdef CONFIG_ARCH_FPU
-  return (mstatus | MSTATUS_FS_INIT | MSTATUS_MPPM | MSTATUS_MPIE);
-#else
-  return (mstatus | MSTATUS_MPPM | MSTATUS_MPIE);
-#endif
-}
-
-/****************************************************************************
  * Name: riscv_ack_irq
  *
  * Description:
diff --git a/arch/risc-v/src/common/riscv_getnewintctx.c 
b/arch/risc-v/src/common/riscv_getnewintctx.c
new file mode 100644
index 0000000..04180f7
--- /dev/null
+++ b/arch/risc-v/src/common/riscv_getnewintctx.c
@@ -0,0 +1,71 @@
+/****************************************************************************
+ * arch/risc-v/src/common/riscv_getnewintctx.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdio.h>
+#include <assert.h>
+#include <debug.h>
+
+#include <nuttx/arch.h>
+#include <arch/irq.h>
+#include <arch/csr.h>
+
+#include "riscv_internal.h"
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: riscv_get_newintctx
+ *
+ * Description:
+ *   Return initial mstatus when a task is created.
+ *
+ ****************************************************************************/
+
+uintptr_t riscv_get_newintctx(void)
+{
+  /* Set machine previous privilege mode to machine mode. Reegardless of
+   * how NuttX is configured and of what kind of thread is being started.
+   * That is because all threads, even user-mode threads will start in
+   * kernel trampoline at nxtask_start() or pthread_start().
+   * The thread's privileges will be dropped before transitioning to
+   * user code. Also set machine previous interrupt enable.
+   *
+   * Mask the bits which should be preserved (from ISA spec)
+   */
+
+  uintptr_t mstatus = READ_CSR(mstatus);
+
+  mstatus &= MSTATUS_WPRI;
+
+  return (mstatus | MSTATUS_MPPM | MSTATUS_MPIE
+#ifdef CONFIG_ARCH_FPU
+                  | MSTATUS_FS_INIT
+#endif
+  );
+}
diff --git a/arch/risc-v/src/esp32c3/Make.defs 
b/arch/risc-v/src/esp32c3/Make.defs
index 318ed80..bfa54a7 100644
--- a/arch/risc-v/src/esp32c3/Make.defs
+++ b/arch/risc-v/src/esp32c3/Make.defs
@@ -36,7 +36,7 @@ CMN_CSRCS += riscv_interruptcontext.c riscv_modifyreg32.c 
riscv_puts.c riscv_mde
 CMN_CSRCS += riscv_releasepending.c riscv_reprioritizertr.c 
riscv_copyfullstate.c
 CMN_CSRCS += riscv_releasestack.c riscv_stackframe.c riscv_schedulesigaction.c
 CMN_CSRCS += riscv_sigdeliver.c riscv_udelay.c riscv_unblocktask.c 
riscv_usestack.c
-CMN_CSRCS += riscv_tcbinfo.c
+CMN_CSRCS += riscv_tcbinfo.c riscv_getnewintctx.c
 
 ifeq ($(CONFIG_SCHED_BACKTRACE),y)
 CMN_CSRCS += riscv_backtrace.c
diff --git a/arch/risc-v/src/esp32c3/esp32c3_irq.c 
b/arch/risc-v/src/esp32c3/esp32c3_irq.c
index 27a8e56..ad247d0 100644
--- a/arch/risc-v/src/esp32c3/esp32c3_irq.c
+++ b/arch/risc-v/src/esp32c3/esp32c3_irq.c
@@ -135,25 +135,6 @@ void up_irqinitialize(void)
 }
 
 /****************************************************************************
- * Name: riscv_get_newintctx
- *
- * Description:
- *   Return initial mstatus when a task is created.
- *
- ****************************************************************************/
-
-uintptr_t riscv_get_newintctx(void)
-{
-  /* Set machine previous privilege mode to machine mode.
-   * Also set machine previous interrupt enable
-   */
-
-  uintptr_t mstatus = READ_CSR(mstatus);
-
-  return (mstatus | MSTATUS_MPPM | MSTATUS_MPIE);
-}
-
-/****************************************************************************
  * Name: up_enable_irq
  *
  * Description:
diff --git a/arch/risc-v/src/fe310/Make.defs b/arch/risc-v/src/fe310/Make.defs
index e8e6252..dcb6338 100644
--- a/arch/risc-v/src/fe310/Make.defs
+++ b/arch/risc-v/src/fe310/Make.defs
@@ -33,7 +33,7 @@ CMN_CSRCS += riscv_interruptcontext.c riscv_modifyreg32.c 
riscv_puts.c riscv_mde
 CMN_CSRCS += riscv_releasepending.c riscv_reprioritizertr.c 
riscv_copyfullstate.c
 CMN_CSRCS += riscv_releasestack.c riscv_stackframe.c riscv_schedulesigaction.c
 CMN_CSRCS += riscv_sigdeliver.c riscv_udelay.c riscv_unblocktask.c 
riscv_usestack.c
-CMN_CSRCS += riscv_idle.c riscv_tcbinfo.c
+CMN_CSRCS += riscv_idle.c riscv_tcbinfo.c riscv_getnewintctx.c
 
 ifeq ($(CONFIG_SCHED_BACKTRACE),y)
 CMN_CSRCS += riscv_backtrace.c
diff --git a/arch/risc-v/src/fe310/fe310_irq.c 
b/arch/risc-v/src/fe310/fe310_irq.c
index 7397a57..9e0e17a 100644
--- a/arch/risc-v/src/fe310/fe310_irq.c
+++ b/arch/risc-v/src/fe310/fe310_irq.c
@@ -166,25 +166,6 @@ void up_enable_irq(int irq)
 }
 
 /****************************************************************************
- * Name: riscv_get_newintctx
- *
- * Description:
- *   Return initial mstatus when a task is created.
- *
- ****************************************************************************/
-
-uintptr_t riscv_get_newintctx(void)
-{
-  /* Set machine previous privilege mode to machine mode.
-   * Also set machine previous interrupt enable
-   */
-
-  uintptr_t mstatus = READ_CSR(mstatus);
-
-  return (mstatus | MSTATUS_MPPM | MSTATUS_MPIE);
-}
-
-/****************************************************************************
  * Name: riscv_ack_irq
  *
  * Description:
diff --git a/arch/risc-v/src/k210/Make.defs b/arch/risc-v/src/k210/Make.defs
index 20e8d43..38ac64f 100644
--- a/arch/risc-v/src/k210/Make.defs
+++ b/arch/risc-v/src/k210/Make.defs
@@ -34,7 +34,7 @@ CMN_CSRCS += riscv_releasepending.c riscv_reprioritizertr.c
 CMN_CSRCS += riscv_releasestack.c riscv_stackframe.c riscv_schedulesigaction.c
 CMN_CSRCS += riscv_sigdeliver.c riscv_unblocktask.c riscv_usestack.c
 CMN_CSRCS += riscv_mdelay.c riscv_copyfullstate.c riscv_idle.c
-CMN_CSRCS += riscv_tcbinfo.c riscv_cpuidlestack.c
+CMN_CSRCS += riscv_tcbinfo.c riscv_cpuidlestack.c riscv_getnewintctx.c
 
 ifeq ($(CONFIG_SMP), y)
 CMN_CSRCS += riscv_cpuindex.c riscv_cpupause.c riscv_cpustart.c
diff --git a/arch/risc-v/src/k210/k210_irq.c b/arch/risc-v/src/k210/k210_irq.c
index b6143e5..983c6c8 100644
--- a/arch/risc-v/src/k210/k210_irq.c
+++ b/arch/risc-v/src/k210/k210_irq.c
@@ -211,29 +211,6 @@ void up_enable_irq(int irq)
 }
 
 /****************************************************************************
- * Name: riscv_get_newintctx
- *
- * Description:
- *   Return initial mstatus when a task is created.
- *
- ****************************************************************************/
-
-uintptr_t riscv_get_newintctx(void)
-{
-  /* Set machine previous privilege mode to machine mode. Reegardless of
-   * how NuttX is configured and of what kind of thread is being started.
-   * That is because all threads, even user-mode threads will start in
-   * kernel trampoline at nxtask_start() or pthread_start().
-   * The thread's privileges will be dropped before transitioning to
-   * user code. Also set machine previous interrupt enable.
-   */
-
-  uintptr_t mstatus = READ_CSR(mstatus);
-
-  return (mstatus | MSTATUS_MPPM | MSTATUS_MPIE);
-}
-
-/****************************************************************************
  * Name: riscv_ack_irq
  *
  * Description:
diff --git a/arch/risc-v/src/litex/Make.defs b/arch/risc-v/src/litex/Make.defs
index d33fd8f..f992c6b 100644
--- a/arch/risc-v/src/litex/Make.defs
+++ b/arch/risc-v/src/litex/Make.defs
@@ -33,7 +33,7 @@ CMN_CSRCS += riscv_interruptcontext.c riscv_modifyreg32.c 
riscv_puts.c riscv_mde
 CMN_CSRCS += riscv_releasepending.c riscv_reprioritizertr.c 
riscv_copyfullstate.c
 CMN_CSRCS += riscv_releasestack.c riscv_stackframe.c riscv_schedulesigaction.c
 CMN_CSRCS += riscv_sigdeliver.c riscv_udelay.c riscv_unblocktask.c 
riscv_usestack.c
-CMN_CSRCS += riscv_idle.c riscv_tcbinfo.c
+CMN_CSRCS += riscv_idle.c riscv_tcbinfo.c riscv_getnewintctx.c
 
 ifeq ($(CONFIG_SCHED_BACKTRACE),y)
 CMN_CSRCS += riscv_backtrace.c
diff --git a/arch/risc-v/src/litex/litex_irq.c 
b/arch/risc-v/src/litex/litex_irq.c
index fa12ac0..e1df1d3 100644
--- a/arch/risc-v/src/litex/litex_irq.c
+++ b/arch/risc-v/src/litex/litex_irq.c
@@ -172,25 +172,6 @@ void up_enable_irq(int irq)
 }
 
 /****************************************************************************
- * Name: riscv_get_newintctx
- *
- * Description:
- *   Return initial mstatus when a task is created.
- *
- ****************************************************************************/
-
-uintptr_t riscv_get_newintctx(void)
-{
-  /* Set machine previous privilege mode to machine mode.
-   * Also set machine previous interrupt enable
-   */
-
-  uintptr_t mstatus = READ_CSR(mstatus);
-
-  return (mstatus | MSTATUS_MPPM | MSTATUS_MPIE);
-}
-
-/****************************************************************************
  * Name: riscv_ack_irq
  *
  * Description:
diff --git a/arch/risc-v/src/mpfs/Make.defs b/arch/risc-v/src/mpfs/Make.defs
index 460d5c7..e46bf5e 100755
--- a/arch/risc-v/src/mpfs/Make.defs
+++ b/arch/risc-v/src/mpfs/Make.defs
@@ -31,7 +31,7 @@ CMN_CSRCS += riscv_releasepending.c riscv_reprioritizertr.c
 CMN_CSRCS += riscv_releasestack.c riscv_stackframe.c riscv_schedulesigaction.c
 CMN_CSRCS += riscv_sigdeliver.c riscv_unblocktask.c riscv_usestack.c
 CMN_CSRCS += riscv_mdelay.c riscv_udelay.c riscv_copyfullstate.c
-CMN_CSRCS += riscv_idle.c riscv_tcbinfo.c
+CMN_CSRCS += riscv_idle.c riscv_tcbinfo.c riscv_getnewintctx.c
 CMN_CSRCS += riscv_cpuindex.c
 
 ifeq ($(CONFIG_SCHED_BACKTRACE),y)
diff --git a/arch/risc-v/src/mpfs/mpfs_irq.c b/arch/risc-v/src/mpfs/mpfs_irq.c
index f7bf10a..c99574a 100755
--- a/arch/risc-v/src/mpfs/mpfs_irq.c
+++ b/arch/risc-v/src/mpfs/mpfs_irq.c
@@ -206,33 +206,6 @@ void up_enable_irq(int irq)
 }
 
 /****************************************************************************
- * Name: riscv_get_newintctx
- *
- * Description:
- *   Return initial mstatus when a task is created.
- *
- ****************************************************************************/
-
-uintptr_t riscv_get_newintctx(void)
-{
-  /* Set machine previous privilege mode to machine mode. Reegardless of
-   * how NuttX is configured and of what kind of thread is being started.
-   * That is because all threads, even user-mode threads will start in
-   * kernel trampoline at nxtask_start() or pthread_start().
-   * The thread's privileges will be dropped before transitioning to
-   * user code. Also set machine previous interrupt enable.
-   */
-
-  uintptr_t mstatus = READ_CSR(mstatus);
-
-#ifdef CONFIG_ARCH_FPU
-  return (mstatus | MSTATUS_FS_INIT | MSTATUS_MPPM | MSTATUS_MPIE);
-#else
-  return (mstatus | MSTATUS_MPPM | MSTATUS_MPIE);
-#endif
-}
-
-/****************************************************************************
  * Name: riscv_ack_irq
  *
  * Description:
diff --git a/arch/risc-v/src/qemu-rv/Make.defs 
b/arch/risc-v/src/qemu-rv/Make.defs
index f45d036..a867002 100644
--- a/arch/risc-v/src/qemu-rv/Make.defs
+++ b/arch/risc-v/src/qemu-rv/Make.defs
@@ -34,7 +34,7 @@ CMN_CSRCS += riscv_releasepending.c riscv_reprioritizertr.c 
riscv_copyfullstate.
 CMN_CSRCS += riscv_releasestack.c riscv_stackframe.c riscv_schedulesigaction.c
 CMN_CSRCS += riscv_sigdeliver.c riscv_unblocktask.c riscv_usestack.c
 CMN_CSRCS += riscv_idle.c riscv_tcbinfo.c riscv_cpuidlestack.c
-CMN_CSRCS += riscv_fault.c
+CMN_CSRCS += riscv_fault.c riscv_getnewintctx.c
 
 ifeq ($(CONFIG_SMP), y)
 CMN_CSRCS += riscv_cpuindex.c riscv_cpupause.c riscv_cpustart.c
diff --git a/arch/risc-v/src/qemu-rv/qemu_rv_irq.c 
b/arch/risc-v/src/qemu-rv/qemu_rv_irq.c
index 55cdfc1..a309cf8 100644
--- a/arch/risc-v/src/qemu-rv/qemu_rv_irq.c
+++ b/arch/risc-v/src/qemu-rv/qemu_rv_irq.c
@@ -205,27 +205,3 @@ irqstate_t up_irq_enable(void)
   oldstat = READ_AND_SET_CSR(mstatus, MSTATUS_MIE);
   return oldstat;
 }
-
-/****************************************************************************
- * Name: riscv_get_newintctx
- *
- * Description:
- *   Return initial mstatus when a task is created.
- *
- ****************************************************************************/
-
-uintptr_t riscv_get_newintctx(void)
-{
-  /* Set machine previous privilege mode to machine mode.
-   * Also set machine previous interrupt enable
-   * Note: In qemu, FPU is always exist even if don't use F|D ISA extension
-   */
-
-  uintptr_t mstatus = READ_CSR(mstatus);
-
-#ifdef CONFIG_ARCH_FPU
-  return (mstatus | MSTATUS_MPPM | MSTATUS_MPIE | MSTATUS_FS_INIT);
-#else
-  return (mstatus | MSTATUS_MPPM | MSTATUS_MPIE);
-#endif
-}
diff --git a/arch/risc-v/src/rv32m1/Make.defs b/arch/risc-v/src/rv32m1/Make.defs
index e360cf2..f44ea46 100644
--- a/arch/risc-v/src/rv32m1/Make.defs
+++ b/arch/risc-v/src/rv32m1/Make.defs
@@ -33,7 +33,7 @@ CMN_CSRCS += riscv_interruptcontext.c riscv_modifyreg32.c 
riscv_puts.c
 CMN_CSRCS += riscv_releasepending.c riscv_reprioritizertr.c 
riscv_copyfullstate.c
 CMN_CSRCS += riscv_releasestack.c riscv_stackframe.c riscv_schedulesigaction.c
 CMN_CSRCS += riscv_sigdeliver.c riscv_unblocktask.c riscv_usestack.c
-CMN_CSRCS += riscv_idle.c riscv_tcbinfo.c
+CMN_CSRCS += riscv_idle.c riscv_tcbinfo.c riscv_getnewintctx.c
 
 ifeq ($(CONFIG_SCHED_BACKTRACE),y)
 CMN_CSRCS += riscv_backtrace.c
diff --git a/arch/risc-v/src/rv32m1/rv32m1_irq.c 
b/arch/risc-v/src/rv32m1/rv32m1_irq.c
index 2b410d7..7692a0b 100644
--- a/arch/risc-v/src/rv32m1/rv32m1_irq.c
+++ b/arch/risc-v/src/rv32m1/rv32m1_irq.c
@@ -214,25 +214,6 @@ void up_enable_irq(int irq)
 }
 
 /****************************************************************************
- * Name: riscv_get_newintctx
- *
- * Description:
- *   Return initial mstatus when a task is created.
- *
- ****************************************************************************/
-
-uintptr_t riscv_get_newintctx(void)
-{
-  /* Set machine previous privilege mode to machine mode.
-   * Also set machine previous interrupt enable
-   */
-
-  uintptr_t mstatus = READ_CSR(mstatus);
-
-  return (mstatus | MSTATUS_MPPM | MSTATUS_MPIE);
-}
-
-/****************************************************************************
  * Name: riscv_ack_irq
  *
  * Description:

Reply via email to