summaryrefslogtreecommitdiffstats
path: root/nuttx/sched/os_start.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2010-08-15 15:02:45 +0000
committerpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2010-08-15 15:02:45 +0000
commit886304a277f3f19b8ffbac8563f87c7bedb894f1 (patch)
treedbdb17f72fa9a8f1d9fb9d1bac959c4277720f97 /nuttx/sched/os_start.c
parenta96c74df57893f9c238fd2bed5c350a60ab7dbb7 (diff)
Completes demand paging core implementation
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@2853 7fd9a85b-ad96-42d3-883c-3090e2eb8679
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 ac52c4d664..9e299a9467 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