[rtems commit] riscv: Do not clear thread context

Sebastian Huber sebh at rtems.org
Fri Jun 29 09:59:07 UTC 2018


Module:    rtems
Branch:    master
Commit:    a49a3c8eed0663bfc4de8b854dcede1573daf246
Changeset: http://git.rtems.org/rtems/commit/?id=a49a3c8eed0663bfc4de8b854dcede1573daf246

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Wed Jun 27 08:37:34 2018 +0200

riscv: Do not clear thread context

Do not clear the complete thread context.  Initialize only the necessary
members.  The Context_Control::is_executing member must be preserved
across _CPU_Context_Initialize() calls.

Update #3433.

---

 cpukit/score/cpu/riscv/riscv-context-initialize.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/cpukit/score/cpu/riscv/riscv-context-initialize.c b/cpukit/score/cpu/riscv/riscv-context-initialize.c
index 619c691..f558fbd 100644
--- a/cpukit/score/cpu/riscv/riscv-context-initialize.c
+++ b/cpukit/score/cpu/riscv/riscv-context-initialize.c
@@ -32,11 +32,8 @@
 #include "config.h"
 #endif
 
-#include <string.h>
-
 #include <rtems/score/cpu.h>
 #include <rtems/score/riscv-utility.h>
-#include <rtems/score/interr.h>
 
 void _CPU_Context_Initialize(
   Context_Control *context,
@@ -52,8 +49,6 @@ void _CPU_Context_Initialize(
 
   uintptr_t stack_high = stack + stack_area_size;
 
-  memset(context, 0, sizeof(*context));
-
   /* Stack Pointer - sp/x2 */
   context->x[2] = stack_high;
   /* Frame Pointer - fp/x8 */
@@ -61,6 +56,8 @@ void _CPU_Context_Initialize(
   /* Return Address - ra/x1 */
   context->x[1] = (uintptr_t) entry_point;
 
+  context->isr_dispatch_disable = 0;
+
   /* Enable interrupts and FP */
   context->mstatus = MSTATUS_FS | MSTATUS_MIE;
 }




More information about the vc mailing list