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.
This commit is contained in:
Sebastian Huber
2018-06-27 08:37:34 +02:00
parent 9510742e7f
commit a49a3c8eed

View File

@@ -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;
}