Skip to content

Commit

Permalink
explicitly allocate mainstack
Browse files Browse the repository at this point in the history
  • Loading branch information
anttikantee committed Jun 23, 2015
1 parent a4b16b6 commit 30ec165
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions include/bmk-core/core.h
Expand Up @@ -40,6 +40,9 @@ int bmk_core_init(unsigned long, unsigned long);
extern unsigned long bmk_stackpageorder, bmk_stacksize;
extern unsigned long bmk_pageshift, bmk_pagesize;

void *bmk_mainstackbase;
unsigned long bmk_mainstacksize;

#define bmk_round_page(_p_) (((_p_) + (bmk_pagesize-1)) & ~(bmk_pagesize-1))
#define bmk_trunc_page(_p_) ((_p_) & ~(bmk_pagesize-1))

Expand Down
6 changes: 5 additions & 1 deletion lib/libbmk_core/sched.c
Expand Up @@ -39,6 +39,9 @@
#include <bmk-core/string.h>
#include <bmk-core/sched.h>

void *bmk_mainstackbase;
unsigned long bmk_mainstacksize;

/*
* sleep for how long if there's absolutely nothing to do
* (default 1s)
Expand Down Expand Up @@ -668,9 +671,10 @@ bmk_sched_startmain(void (*mainfun)(void *), void *arg)

bmk_memset(&initthread, 0, sizeof(initthread));
bmk_strcpy(initthread.bt_name, "init");
stackalloc(&bmk_mainstackbase, &bmk_mainstacksize);

mainthread = bmk_sched_create("main", NULL, 0,
mainfun, arg, NULL, 0);
mainfun, arg, bmk_mainstackbase, bmk_mainstacksize);
if (mainthread == NULL)
bmk_platform_halt("failed to create main thread");

Expand Down

0 comments on commit 30ec165

Please sign in to comment.