[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [PATCH 25/40] arm64: set the stack for the arm_start_thread



When a thread (which is picked by the scheduler) runs at the first time,
it needs a stack to store the data.

This patch set the stack for the arm_start_thread.

Change-Id: I4cfa18b199cb920e9ebe19bbbe2cf508264b0ba8
Jira: ENTOS-247
Signed-off-by: Huang Shijie <shijie.huang@xxxxxxx>
---
 arch/arm/sched.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/sched.c b/arch/arm/sched.c
index 448fd3e..f691d7d 100644
--- a/arch/arm/sched.c
+++ b/arch/arm/sched.c
@@ -32,6 +32,12 @@ struct thread* arch_create_thread(char *name, void 
(*function)(void *),
      * for the initial switch. */
     thread->sp = (unsigned long) sp - sizeof(unsigned long) * 
CALLEE_SAVED_REGISTERS;
 
+    /*
+     * Please refer to the stack layout in the comment for 
__arch_switch_threads.
+     * We need to set the sp register for arm_start_thread when a thread runs
+     * at the first time.
+     */
+    *(--sp) = thread->sp;
     thread->ip = (unsigned long) arm_start_thread;
 
     return thread;
-- 
2.7.4


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/cgi-bin/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.