From 6bde1e54dc6b1f15f659b8c0b90392feb8960672 Mon Sep 17 00:00:00 2001 From: winlin Date: Mon, 10 Nov 2014 11:10:27 +0800 Subject: [PATCH] research st, add stack alloc commnets. --- trunk/research/st/sched.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/trunk/research/st/sched.c b/trunk/research/st/sched.c index 0495f69bb..4252ede1a 100644 --- a/trunk/research/st/sched.c +++ b/trunk/research/st/sched.c @@ -546,6 +546,13 @@ _st_thread_t *st_thread_create(void *(*start)(void *arg), void *arg, int joinabl /* Allocate thread object and per-thread data off the stack */ #if defined (MD_STACK_GROWS_DOWN) sp = stack->stk_top; + /* + * The stack segment is split in the middle. The upper half is used + * as backing store for the register stack which grows upward. + * The lower half is used for the traditional memory stack which + * grows downward. Both stacks start in the middle and grow outward + * from each other. + */ sp = sp - (ST_KEYS_MAX * sizeof(void *)); ptds = (void **) sp; sp = sp - sizeof(_st_thread_t);