2 * Global kernel configuration
7 #include <globalconfig.h>
8 #include "config_tcbsize.h"
11 // special magic to allow old compilers to inline constants
13 #define STRINGIFY_(x) #x
14 #define STRINGIFY(x) STRINGIFY_(x)
17 # if defined(__GNUC_PATCHLEVEL__)
18 # define COMPILER STRINGIFY(__GNUC__) "." STRINGIFY(__GNUC_MINOR__) "." STRINGIFY(__GNUC_PATCHLEVEL__)
20 # define COMPILER STRINGIFY(__GNUC__) "." STRINGIFY(__GNUC_MINOR__)
22 # define GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)
24 # define COMPILER "Non-GCC"
25 # define GCC_VERSION 0
28 #define GREETING_COLOR_ANSI_OFF "\033[0m"
30 #define FIASCO_KERNEL_SUBVERSION 0
36 static const char *const kernel_warn_config_string;
45 static void init_arch();
47 // global kernel configuration
48 static const unsigned kernel_version_id
49 = 0x87004444 | (FIASCO_KERNEL_SUBVERSION << 16); // "DD....."
51 static const Mword thread_block_size = THREAD_BLOCK_SIZE;
53 static const bool conservative = false;
55 #ifdef CONFIG_FINE_GRAINED_CPUTIME
56 static const bool fine_grained_cputime = true;
58 static const bool fine_grained_cputime = false;
61 static bool irq_ack_in_kernel;
64 static unsigned tbuf_entries;
67 static bool profiling;
69 static const bool profiling = false;
71 #ifdef CONFIG_STACK_DEPTH
72 static const bool stack_depth = true;
74 static const bool stack_depth = false;
76 static const int profiling_rate = 100;
77 static const int profile_irq = 0;
79 // kernel (idle) thread prio
80 static const unsigned kernel_prio = 0;
83 static const unsigned default_prio = 1;
85 static const int warn_level = CONFIG_WARN_LEVEL;
90 One_shot_min_interval_us = 200,
91 One_shot_max_interval_us = 10000,
93 #ifdef CONFIG_ASSEMBLER_IPC_SHORTCUT
94 Assembler_ipc_shortcut = 1,
96 Assembler_ipc_shortcut = 0,
98 #ifdef CONFIG_NO_FRAME_PTR
104 #ifdef CONFIG_DEBUG_KERNEL_PAGE_FAULTS
105 Log_kernel_page_faults = 1,
107 Log_kernel_page_faults = 0,
115 #ifdef CONFIG_JDB_LOGGING
120 #ifdef CONFIG_JDB_ACCOUNTING
126 Max_num_cpus = CONFIG_MP_MAX_CPUS,
133 #define GREETING_COLOR_ANSI_TITLE "\033[1;32m"
134 #define GREETING_COLOR_ANSI_INFO "\033[0;32m"
137 #define ARCH_NAME "ia32"
138 #define TARGET_NAME CONFIG_IA32_TARGET
141 #define ARCH_NAME "arm"
144 #define ARCH_NAME "amd64"
145 #define TARGET_NAME CONFIG_IA32_TARGET
148 #define ARCH_NAME "ppc32"
151 #define CONFIG_KERNEL_VERSION_STRING \
152 GREETING_COLOR_ANSI_TITLE "Welcome to Fiasco.OC ("CONFIG_XARCH")!\\n" \
153 GREETING_COLOR_ANSI_INFO "L4/Fiasco.OC " ARCH_NAME " " \
154 "microkernel (C) 1998-2010 TU Dresden\\n" \
155 "Rev: " CODE_VERSION " compiled with gcc " COMPILER \
156 " for " TARGET_NAME " [" CONFIG_LABEL "]\\n" \
157 "Build: #" BUILD_NR " " BUILD_DATE "\\n" \
158 GREETING_COLOR_ANSI_OFF
161 //---------------------------------------------------------------------------
164 EXTENSION class Config
167 // 32MB RAM => 2.5MB kmem, 128MB RAM => 16MB kmem, >=512MB RAM => 64MB kmem
168 static const unsigned kernel_mem_per_cent = 8;
171 kernel_mem_max = 64 << 20
175 //---------------------------------------------------------------------------
178 EXTENSION class Config
181 // 32MB RAM => 2.5MB kmem, 128MB RAM => 16MB kmem, >=512MB RAM => 60MB kmem
182 static const unsigned kernel_mem_per_cent = 8;
185 kernel_mem_max = 60 << 20
189 //---------------------------------------------------------------------------
192 EXTENSION class Config
195 static int serial_esc;
198 //---------------------------------------------------------------------------
201 EXTENSION class Config
204 static const int serial_esc = 0;
207 //---------------------------------------------------------------------------
214 #include "initcalls.h"
217 KIP_KERNEL_ABI_VERSION(STRINGIFY(FIASCO_KERNEL_SUBVERSION));
220 bool Config::esc_hack = false;
222 int Config::serial_esc = Config::SERIAL_NO_ESC;
224 bool Config::irq_ack_in_kernel = false;
226 #ifdef CONFIG_PROFILE
227 bool Config::profiling = false;
230 unsigned Config::tbuf_entries = 0x20000 / sizeof(Mword); //1024;
232 //-----------------------------------------------------------------------------
233 IMPLEMENTATION [!arm && !ppc32]:
235 IMPLEMENT FIASCO_INIT
238 char const *cmdline = Cmdline::cmdline();
242 if (strstr(cmdline, " -esc"))
245 #ifdef CONFIG_PROFILE
246 if (strstr(cmdline, " -profile"))
250 if (strstr(cmdline, " -always_irqack"))
251 irq_ack_in_kernel = true;
254 if ( strstr(cmdline, " -serial_esc")
255 && !strstr(cmdline, " -noserial")
257 && strstr(cmdline, " -nokdb")
259 && !strstr(cmdline, " -nojdb"))
261 serial_esc = SERIAL_ESC_IRQ;
267 //----------------------------------------------------------------------------
268 IMPLEMENTATION[rotext]:
273 { return strstr(Cmdline::cmdline()," -rotext"); }
275 //----------------------------------------------------------------------------
276 IMPLEMENTATION[!rotext]: