summaryrefslogtreecommitdiff
path: root/nuttx/sched/os_start.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2010-08-15 15:02:45 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2010-08-15 15:02:45 +0000
commit433550b1b9d8d67650ebfb79048ca442249dac0d (patch)
treedbdb17f72fa9a8f1d9fb9d1bac959c4277720f97 /nuttx/sched/os_start.c
parentcd29825db2f81dd0fd51ea32ad44eb3236877555 (diff)
downloadpx4-nuttx-433550b1b9d8d67650ebfb79048ca442249dac0d.tar.gz
px4-nuttx-433550b1b9d8d67650ebfb79048ca442249dac0d.tar.bz2
px4-nuttx-433550b1b9d8d67650ebfb79048ca442249dac0d.zip
Completes demand paging core implementation
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2853 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/sched/os_start.c')
-rw-r--r--nuttx/sched/os_start.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/nuttx/sched/os_start.c b/nuttx/sched/os_start.c
index ac52c4d66..9e299a946 100644
--- a/nuttx/sched/os_start.c
+++ b/nuttx/sched/os_start.c
@@ -62,6 +62,9 @@
#include "clock_internal.h"
#include "timer_internal.h"
#include "irq_internal.h"
+#ifdef CONFIG_PAGING
+# include "pg_internal.h"
+#endif
#ifdef CONFIG_SCHED_WORKQUEUE
# include "work_internal.h"
#endif
@@ -172,12 +175,6 @@ pidhash_t g_pidhash[CONFIG_MAX_TASKS];
pid_t g_worker;
#endif
-/* The task ID of the page fill worker thread */
-
-#ifdef CONFIG_PAGING
-pid_t g_pgworker;
-#endif
-
/* This is a table of task lists. This table is indexed by
* the task state enumeration type (tstate_t) and provides
* a pointer to the associated static task list (if there
@@ -451,6 +448,23 @@ void os_start(void)
(void)sched_setupidlefiles(&g_idletcb);
+ /* Start the page fill worker thread that will resolve page faults.
+ * This should always be the first thread started because it may
+ * have to resolve page faults in other threads
+ */
+
+#ifdef CONFIG_PAGING
+#ifndef CONFIG_CUSTOM_STACK
+ g_pgworker = task_create("pgfill", CONFIG_PAGING_DEFPRIO,
+ CONFIG_PAGING_STACKSIZE,
+ (main_t)pg_worker, (const char **)NULL);
+#else
+ g_pgworker = task_create("pgfill", CONFIG_PAGING_DEFPRIO,
+ (main_t)pg_worker, (const char **)NULL);
+#endif
+ ASSERT(g_pgworker != ERROR);
+#endif
+
/* Start the worker thread that will perform misc garbage clean-up */
#ifdef CONFIG_SCHED_WORKQUEUE