Possible thread stack implementation.
Architecture provides a function for thread stack base, thread code uses it. Build and boot tested on Falco with multitasking on and off. Change-Id: I5016fab47f9954379acf7702ac7965b0a70c88ed Signed-off-by: Ronald G. Minnich <rminnich@gmail.com> Reviewed-on: https://gerrit.chromium.org/gerrit/66578 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Commit-Queue: Ronald G. Minnich <rminnich@chromium.org> Tested-by: Ronald G. Minnich <rminnich@chromium.org> (cherry picked from commit 3c6afef30c1a0ad6fba0fb76acc792184d924247) Signed-off-by: Isaac Christensen <isaac.christensen@se-eng.com> Reviewed-on: http://review.coreboot.org/6513 Tested-by: build bot (Jenkins) Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
This commit is contained in:
parent
0ffa11bdbb
commit
34352d16a9
|
@ -56,3 +56,10 @@ void arch_prepare_thread(struct thread *t,
|
||||||
|
|
||||||
t->stack_current = stack;
|
t->stack_current = stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void *arch_get_thread_stackbase(void)
|
||||||
|
{
|
||||||
|
/* defined in c_start.S */
|
||||||
|
extern u8 thread_stacks[];
|
||||||
|
return &thread_stacks[0];
|
||||||
|
}
|
||||||
|
|
|
@ -38,6 +38,11 @@ struct thread {
|
||||||
};
|
};
|
||||||
|
|
||||||
void threads_initialize(void);
|
void threads_initialize(void);
|
||||||
|
/* Get the base of the thread stacks.
|
||||||
|
* Returns pointer to CONFIG_NUM_THREADS*CONFIG_STACK_SIZE contiguous bytes
|
||||||
|
* aligned to CONFIG_STACK_SIZE, or NULL.
|
||||||
|
*/
|
||||||
|
void *arch_get_thread_stackbase(void);
|
||||||
/* Run func(arrg) on a new thread. Return 0 on successful start of thread, < 0
|
/* Run func(arrg) on a new thread. Return 0 on successful start of thread, < 0
|
||||||
* when thread could not be started. Note that the thread will block the
|
* when thread could not be started. Note that the thread will block the
|
||||||
* current state in the boot state machine until it is complete. */
|
* current state in the boot state machine until it is complete. */
|
||||||
|
|
|
@ -28,7 +28,6 @@ static void idle_thread_init(void);
|
||||||
|
|
||||||
/* There needs to be at least one thread to run the ramstate state machine. */
|
/* There needs to be at least one thread to run the ramstate state machine. */
|
||||||
#define TOTAL_NUM_THREADS (CONFIG_NUM_THREADS + 1)
|
#define TOTAL_NUM_THREADS (CONFIG_NUM_THREADS + 1)
|
||||||
extern char thread_stacks[CONFIG_NUM_THREADS*CONFIG_STACK_SIZE];
|
|
||||||
|
|
||||||
/* Storage space for the thread structs .*/
|
/* Storage space for the thread structs .*/
|
||||||
static struct thread all_threads[TOTAL_NUM_THREADS];
|
static struct thread all_threads[TOTAL_NUM_THREADS];
|
||||||
|
@ -259,8 +258,11 @@ void threads_initialize(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
struct thread *t;
|
struct thread *t;
|
||||||
char *stack_top;
|
u8 *stack_top;
|
||||||
struct cpu_info *ci;
|
struct cpu_info *ci;
|
||||||
|
u8 *thread_stacks;
|
||||||
|
|
||||||
|
thread_stacks = arch_get_thread_stackbase();
|
||||||
|
|
||||||
/* Initialize the BSP thread first. The cpu_info structure is assumed
|
/* Initialize the BSP thread first. The cpu_info structure is assumed
|
||||||
* to be just under the top of the stack. */
|
* to be just under the top of the stack. */
|
||||||
|
|
Loading…
Reference in New Issue