[freenos] r394 committed - Implemented an idle process....

  • From: freenos@xxxxxxxxxxxxxx
  • To: freenos@xxxxxxxxxxxxx
  • Date: Mon, 18 Oct 2010 23:27:20 +0000

Revision: 394
Author: nieklinnenbank
Date: Mon Oct 18 16:26:59 2010
Log: Implemented an idle process.
This process should only be executed when no other program
is ready to run. The current code does a busy loop, and should
be replaced by a kernel call to invoke e.g. 'hlt' on x86.

http://code.google.com/p/freenos/source/detail?r=394

Added:
 /branches/scratch/server/idle
 /branches/scratch/server/idle/SConscript
 /branches/scratch/server/idle/main.c
Modified:
 /branches/scratch/server/SConscript
 /branches/scratch/system/x86/pc/config/boot_image.conf

=======================================
--- /dev/null
+++ /branches/scratch/server/idle/SConscript    Mon Oct 18 16:26:59 2010
@@ -0,0 +1,23 @@
+#
+# Copyright (C) 2010 Niek Linnenbank
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+
+Import('build_env')
+
+env = build_env.Clone()
+env.UseLibraries([ 'libposix', 'libcrt', 'libc' ])
+env.Program('run', 'main.c')
+
=======================================
--- /dev/null
+++ /branches/scratch/server/idle/main.c        Mon Oct 18 16:26:59 2010
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2010 Niek Linnenbank
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <string.h>
+#include <unistd.h>
+
+int main(void)
+{
+    for (;;);
+    return 0;
+}
=======================================
--- /branches/scratch/server/SConscript Sun Oct 10 16:06:55 2010
+++ /branches/scratch/server/SConscript Mon Oct 18 16:26:59 2010
@@ -15,5 +15,5 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #

-SConscript(dirs = 'serial')
-
+SConscript(dirs = [ 'idle', 'serial' ])
+
=======================================
--- /branches/scratch/system/x86/pc/config/boot_image.conf Sun Oct 10 16:06:55 2010 +++ /branches/scratch/system/x86/pc/config/boot_image.conf Mon Oct 18 16:26:59 2010
@@ -14,6 +14,25 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
+
+#
+# First user process, which runs /etc/init.rc from the rootfs.
+#
+bin/init
+{
+    cmd = /bin/init
+    uid = 0
+}
+
+#
+# Idle process. Must be created for each CPU on the system.
+#
+server/idle/run
+{
+    cmd    = /server/idle/run
+    uid    = 1
+    isidle = true
+}

 #
 # i8250 serial UART ==> /dev/ttyS0-4 and /dev/console
@@ -25,15 +44,6 @@
     irq = 3:4
     uid = 1
 }
-
-#
-# First user process, which runs /etc/init.rc from the rootfs.
-#
-bin/init
-{
-    cmd = /bin/init
-    uid = 0
-}

 #server/memory
 #server/monitor

Other related posts:

  • » [freenos] r394 committed - Implemented an idle process.... - freenos