[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Minios-devel] [PATCH 25/40] arm64: set the stack for the arm_start_thread
Hi Shijie,
On 03/11/17 03:12, Huang Shijie wrote:
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;
But this is common code between Arm64 and Arm32. How come you don't
update arm32?
Why do you need to save sp on Arm64 and not Arm32?
thread->ip = (unsigned long) arm_start_thread;
return thread;
Cheers,
--
Julien Grall
_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/cgi-bin/mailman/listinfo/minios-devel
|