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 1
36 static const char *const kernel_warn_config_string;
37 enum User_memory_access_type
39 No_access_user_mem = 0,
40 Access_user_mem_direct,
41 Must_access_user_mem_direct
51 static void init_arch();
53 // global kernel configuration
56 Kernel_version_id = 0x87004444 | (FIASCO_KERNEL_SUBVERSION << 16), // "DD....."
57 // kernel (idle) thread prio
62 Warn_level = CONFIG_WARN_LEVEL,
66 One_shot_min_interval_us = 200,
67 One_shot_max_interval_us = 10000,
70 #ifdef CONFIG_FINE_GRAINED_CPUTIME
71 Fine_grained_cputime = true,
73 Fine_grained_cputime = false,
76 #ifdef CONFIG_STACK_DEPTH
81 #ifdef CONFIG_NO_FRAME_PTR
87 #ifdef CONFIG_DEBUG_KERNEL_PAGE_FAULTS
88 Log_kernel_page_faults = 1,
90 Log_kernel_page_faults = 0,
97 #ifdef CONFIG_JDB_LOGGING
102 #ifdef CONFIG_JDB_ACCOUNTING
108 Max_num_cpus = CONFIG_MP_MAX_CPUS,
114 static bool getchar_does_hlt_works_ok;
115 static bool esc_hack;
116 static unsigned tbuf_entries;
117 static unsigned num_ap_cpus asm("config_num_ap_cpus");
120 #define GREETING_COLOR_ANSI_TITLE "\033[1;32m"
121 #define GREETING_COLOR_ANSI_INFO "\033[0;32m"
124 #define ARCH_NAME "ia32"
125 #define TARGET_NAME CONFIG_IA32_TARGET
128 #define ARCH_NAME "arm"
131 #define ARCH_NAME "amd64"
132 #define TARGET_NAME CONFIG_IA32_TARGET
135 #define ARCH_NAME "ppc32"
138 #define ARCH_NAME "sparc"
139 #define TARGET_NAME ""
142 #define CONFIG_KERNEL_VERSION_STRING \
143 GREETING_COLOR_ANSI_TITLE "Welcome to Fiasco.OC (" CONFIG_XARCH ")!\\n" \
144 GREETING_COLOR_ANSI_INFO "L4/Fiasco.OC " ARCH_NAME " " \
145 "microkernel (C) 1998-2012 TU Dresden\\n" \
146 "Rev: " CODE_VERSION " compiled with gcc " COMPILER \
147 " for " TARGET_NAME " [" CONFIG_LABEL "]\\n" \
148 "Build: #" BUILD_NR " " BUILD_DATE "\\n" \
149 GREETING_COLOR_ANSI_OFF
152 //---------------------------------------------------------------------------
155 EXTENSION class Config
158 // 32MB RAM => 2.5MB kmem, 128MB RAM => 16MB kmem, >=512MB RAM => 64MB kmem
159 static const unsigned kernel_mem_per_cent = 8;
162 kernel_mem_max = 64 << 20
166 //---------------------------------------------------------------------------
169 EXTENSION class Config
172 // 32MB RAM => 2.5MB kmem, 128MB RAM => 16MB kmem, >=512MB RAM => 60MB kmem
173 static const unsigned kernel_mem_per_cent = 8;
176 kernel_mem_max = 60 << 20
180 //---------------------------------------------------------------------------
183 EXTENSION class Config
186 static int serial_esc;
189 //---------------------------------------------------------------------------
192 EXTENSION class Config
195 static const int serial_esc = 0;
198 //---------------------------------------------------------------------------
204 #include "initcalls.h"
205 #include "koptions.h"
208 KIP_KERNEL_ABI_VERSION(STRINGIFY(FIASCO_KERNEL_SUBVERSION));
211 bool Config::esc_hack = false;
213 int Config::serial_esc = Config::SERIAL_NO_ESC;
216 unsigned Config::tbuf_entries = 0x20000 / sizeof(Mword); //1024;
217 bool Config::getchar_does_hlt_works_ok = false;
218 unsigned Config::num_ap_cpus;
220 #ifdef CONFIG_FINE_GRAINED_CPUTIME
221 KIP_KERNEL_FEATURE("fi_gr_cputime");
224 //-----------------------------------------------------------------------------
227 IMPLEMENT FIASCO_INIT
232 if (Koptions::o()->opt(Koptions::F_esc))
236 if ( Koptions::o()->opt(Koptions::F_serial_esc)
237 && !Koptions::o()->opt(Koptions::F_noserial)
239 && Koptions::o()->opt(Koptions::F_nokdb)
241 && !Koptions::o()->opt(Koptions::F_nojdb))
243 serial_esc = SERIAL_ESC_IRQ;