]> rtime.felk.cvut.cz Git - l4.git/blobdiff - kernel/fiasco/src/kern/config.cpp
update
[l4.git] / kernel / fiasco / src / kern / config.cpp
index dca91d052385ab9f52c82b16ccfee5ed67efeb15..aa61013fb44570560b3694f79c41727fbb308152 100644 (file)
@@ -27,7 +27,7 @@ INTERFACE:
 
 #define GREETING_COLOR_ANSI_OFF    "\033[0m"
 
-#define FIASCO_KERNEL_SUBVERSION 0
+#define FIASCO_KERNEL_SUBVERSION 2
 
 class Config
 {
@@ -51,55 +51,32 @@ public:
   static void init_arch();
 
   // global kernel configuration
-  static const unsigned kernel_version_id
-     = 0x87004444 | (FIASCO_KERNEL_SUBVERSION << 16); // "DD....."
-
-  static const Mword thread_block_size = THREAD_BLOCK_SIZE;
+  enum
+  {
+    Kernel_version_id = 0x87004444 | (FIASCO_KERNEL_SUBVERSION << 16), // "DD....."
+    // kernel (idle) thread prio
+    Kernel_prio = 0,
+    // default prio
+    Default_prio = 1,
 
-  static const bool conservative = false;
+    Warn_level = CONFIG_WARN_LEVEL,
 
-#ifdef CONFIG_FINE_GRAINED_CPUTIME
-  static const bool fine_grained_cputime = true;
-#else
-  static const bool fine_grained_cputime = false;
-#endif
+    Kip_syscalls = 1,
 
-  static bool irq_ack_in_kernel;
-  static bool esc_hack;
+    One_shot_min_interval_us =   200,
+    One_shot_max_interval_us = 10000,
 
-  static unsigned tbuf_entries;
 
-#ifdef CONFIG_PROFILE
-  static bool profiling;
-#else
-  static const bool profiling = false;
-#endif
-#ifdef CONFIG_STACK_DEPTH
-  static const bool stack_depth = true;
+#ifdef CONFIG_FINE_GRAINED_CPUTIME
+    Fine_grained_cputime = true,
 #else
-  static const bool stack_depth = false;
+    Fine_grained_cputime = false,
 #endif
-  static const int profiling_rate = 100;
-  static const int profile_irq = 0;
-
-  // kernel (idle) thread prio
-  static const unsigned kernel_prio = 0;
-
-  // default prio
-  static const unsigned default_prio = 1;
-
-  static const int warn_level = CONFIG_WARN_LEVEL;
-
-  enum {
-    Kip_syscalls = 1,
 
-    One_shot_min_interval_us =   200,
-    One_shot_max_interval_us = 10000,
-
-#ifdef CONFIG_ASSEMBLER_IPC_SHORTCUT
-    Assembler_ipc_shortcut = 1,
+#ifdef CONFIG_STACK_DEPTH
+    Stack_depth = true,
 #else
-    Assembler_ipc_shortcut = 0,
+    Stack_depth = false,
 #endif
 #ifdef CONFIG_NO_FRAME_PTR
     Have_frame_ptr = 0,
@@ -112,7 +89,6 @@ public:
 #else
     Log_kernel_page_faults = 0,
 #endif
-
 #ifdef CONFIG_JDB
     Jdb = 1,
 #else
@@ -134,6 +110,13 @@ public:
     Max_num_cpus = 1,
 #endif
   };
+
+  static Cpu_number max_num_cpus() { return Cpu_number(Max_num_cpus); }
+
+  static bool getchar_does_hlt_works_ok;
+  static bool esc_hack;
+  static unsigned tbuf_entries;
+  static unsigned num_ap_cpus asm("config_num_ap_cpus");
 };
 
 #define GREETING_COLOR_ANSI_TITLE  "\033[1;32m"
@@ -153,11 +136,15 @@ INTERFACE[amd64]:
 INTERFACE[ppc32]:
 #define ARCH_NAME "ppc32"
 
+INTERFACE[sparc]:
+#define ARCH_NAME "sparc"
+#define TARGET_NAME ""
+
 INTERFACE:
 #define CONFIG_KERNEL_VERSION_STRING \
-  GREETING_COLOR_ANSI_TITLE "Welcome to Fiasco.OC ("CONFIG_XARCH")!\\n"            \
+  GREETING_COLOR_ANSI_TITLE "Welcome to Fiasco.OC (" CONFIG_XARCH ")!\\n"            \
   GREETING_COLOR_ANSI_INFO "L4/Fiasco.OC " ARCH_NAME " "                \
-                           "microkernel (C) 1998-2011 TU Dresden\\n"           \
+                           "microkernel (C) 1998-2013 TU Dresden\\n"           \
                            "Rev: " CODE_VERSION " compiled with gcc " COMPILER \
                             " for " TARGET_NAME "    [" CONFIG_LABEL "]\\n"    \
                            "Build: #" BUILD_NR " " BUILD_DATE "\\n"            \
@@ -210,14 +197,25 @@ public:
   static const int serial_esc = 0;
 };
 
+
+//---------------------------------------------------------------------------
+INTERFACE [!virtual_space_iface]:
+
+#define FIASCO_SPACE_VIRTUAL
+
+//---------------------------------------------------------------------------
+INTERFACE [virtual_space_iface]:
+
+#define FIASCO_SPACE_VIRTUAL virtual
+
 //---------------------------------------------------------------------------
 IMPLEMENTATION:
 
 #include <cstring>
 #include <cstdlib>
-#include "cmdline.h"
 #include "feature.h"
 #include "initcalls.h"
+#include "koptions.h"
 #include "panic.h"
 
 KIP_KERNEL_ABI_VERSION(STRINGIFY(FIASCO_KERNEL_SUBVERSION));
@@ -227,62 +225,36 @@ bool Config::esc_hack = false;
 #ifdef CONFIG_SERIAL
 int  Config::serial_esc = Config::SERIAL_NO_ESC;
 #endif
-bool Config::irq_ack_in_kernel = false;
-
-#ifdef CONFIG_PROFILE
-bool Config::profiling = false;
-#endif
 
 unsigned Config::tbuf_entries = 0x20000 / sizeof(Mword); //1024;
+bool Config::getchar_does_hlt_works_ok = false;
+unsigned Config::num_ap_cpus;
+
+#ifdef CONFIG_FINE_GRAINED_CPUTIME
+KIP_KERNEL_FEATURE("fi_gr_cputime");
+#endif
 
 //-----------------------------------------------------------------------------
-IMPLEMENTATION [!arm && !ppc32]:
+IMPLEMENTATION:
 
 IMPLEMENT FIASCO_INIT
 void Config::init()
 {
-  char const *cmdline = Cmdline::cmdline();
-
   init_arch();
 
-  if (strstr(cmdline, " -esc"))
+  if (Koptions::o()->opt(Koptions::F_esc))
     esc_hack = true;
 
-#ifdef CONFIG_PROFILE
-  if (strstr(cmdline, " -profile"))
-    profiling = true;
-#endif
-
-  if (strstr(cmdline, " -always_irqack"))
-    irq_ack_in_kernel = true;
-
 #ifdef CONFIG_SERIAL
-  if (    strstr(cmdline, " -serial_esc")
-      && !strstr(cmdline, " -noserial")
+  if (    Koptions::o()->opt(Koptions::F_serial_esc)
+      && !Koptions::o()->opt(Koptions::F_noserial)
 # ifdef CONFIG_KDB
-      &&  strstr(cmdline, " -nokdb")
+      &&  Koptions::o()->opt(Koptions::F_nokdb)
 # endif
-      && !strstr(cmdline, " -nojdb"))
+      && !Koptions::o()->opt(Koptions::F_nojdb))
     {
       serial_esc = SERIAL_ESC_IRQ;
     }
 #endif
 }
 
-
-//----------------------------------------------------------------------------
-IMPLEMENTATION[rotext]:
-
-PUBLIC static
-bool
-Config::rotext()
-{ return strstr(Cmdline::cmdline()," -rotext"); }
-
-//----------------------------------------------------------------------------
-IMPLEMENTATION[!rotext]:
-
-PUBLIC static inline
-bool
-Config::rotext()
-{ return false; }
-