Add riscv context_switch
This commit is contained in:
@@ -211,6 +211,7 @@ static void _dealloc_task_cb(struct Thread* task)
|
||||
extern void trap_return(void);
|
||||
__attribute__((optimize("O0"))) void task_prepare_enter()
|
||||
{
|
||||
DEBUG_PRINTF("task_prepare_enter\n");
|
||||
xizi_leave_kernel();
|
||||
trap_return();
|
||||
}
|
||||
@@ -259,7 +260,11 @@ static struct Thread* _new_task_cb(struct MemSpace* pmemspace)
|
||||
/// 2. context into stack
|
||||
sp -= sizeof(*task->thread_context.context);
|
||||
task->thread_context.context = (struct context*)sp;
|
||||
#ifndef __riscv
|
||||
arch_init_context(task->thread_context.context);
|
||||
#else
|
||||
arch_init_context(task->thread_context.context, task->thread_context.kern_stack_addr);
|
||||
#endif
|
||||
|
||||
return task;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user