Changeset c621f4aa in mainline for kernel/generic/src/main
- Timestamp:
- 2010-07-25T10:11:13Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 377cce8
- Parents:
- 24a2517 (diff), a2da43c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- kernel/generic/src/main
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/main/kinit.c
r24a2517 rc621f4aa 66 66 #include <ipc/ipc.h> 67 67 #include <debug.h> 68 #include <string.h> 68 #include <str.h> 69 #include <sysinfo/stats.h> 69 70 70 71 #ifdef CONFIG_SMP … … 94 95 void kinit(void *arg) 95 96 { 96 97 #if defined(CONFIG_SMP) || defined(CONFIG_KCONSOLE)98 97 thread_t *thread; 99 #endif100 98 101 99 /* … … 109 107 if (config.cpu_count > 1) { 110 108 waitq_initialize(&ap_completion_wq); 109 111 110 /* 112 111 * Create the kmp thread and wait for its completion. … … 117 116 thread = thread_create(kmp, NULL, TASK, THREAD_FLAG_WIRED, "kmp", true); 118 117 if (thread != NULL) { 119 spinlock_lock(&thread->lock);118 irq_spinlock_lock(&thread->lock, false); 120 119 thread->cpu = &cpus[0]; 121 spinlock_unlock(&thread->lock);120 irq_spinlock_unlock(&thread->lock, false); 122 121 thread_ready(thread); 123 122 } else 124 123 panic("Unable to create kmp thread."); 124 125 125 thread_join(thread); 126 126 thread_detach(thread); 127 } 128 129 if (config.cpu_count > 1) { 127 128 /* 129 * For each CPU, create its load balancing thread. 130 */ 130 131 size_t i; 131 132 132 /*133 * For each CPU, create its load balancing thread.134 */135 133 for (i = 0; i < config.cpu_count; i++) { 136 134 thread = thread_create(kcpulb, NULL, TASK, THREAD_FLAG_WIRED, "kcpulb", true); 137 135 if (thread != NULL) { 138 spinlock_lock(&thread->lock);136 irq_spinlock_lock(&thread->lock, false); 139 137 thread->cpu = &cpus[i]; 140 spinlock_unlock(&thread->lock);138 irq_spinlock_unlock(&thread->lock, false); 141 139 thread_ready(thread); 142 140 } else … … 150 148 */ 151 149 arch_post_smp_init(); 150 151 /* Start thread computing system load */ 152 thread = thread_create(kload, NULL, TASK, 0, "kload", false); 153 if (thread != NULL) 154 thread_ready(thread); 155 else 156 printf("Unable to create kload thread\n"); 152 157 153 158 #ifdef CONFIG_KCONSOLE … … 175 180 if (init.tasks[i].addr % FRAME_SIZE) { 176 181 printf("init[%" PRIs "].addr is not frame aligned\n", i); 182 programs[i].task = NULL; 177 183 continue; 178 184 } … … 184 190 185 191 char namebuf[TASK_NAME_BUFLEN]; 186 char *name; 187 188 name = init.tasks[i].name; 192 193 const char *name = init.tasks[i].name; 189 194 if (name[0] == 0) 190 195 name = "<unknown>"; … … 194 199 str_cpy(namebuf + INIT_PREFIX_LEN, 195 200 TASK_NAME_BUFLEN - INIT_PREFIX_LEN, name); 196 201 197 202 int rc = program_create_from_image((void *) init.tasks[i].addr, 198 203 namebuf, &programs[i]); -
kernel/generic/src/main/main.c
r24a2517 rc621f4aa 84 84 #include <main/main.h> 85 85 #include <ipc/event.h> 86 #include <sysinfo/sysinfo.h> 87 #include <sysinfo/stats.h> 86 88 87 89 /** Global configuration structure. */ … … 102 104 103 105 /** Lowest safe stack virtual address. */ 104 uintptr_t stack_safe = 0; 106 uintptr_t stack_safe = 0; 105 107 106 108 /* … … 111 113 */ 112 114 static void main_bsp_separated_stack(void); 115 113 116 #ifdef CONFIG_SMP 114 117 static void main_ap_separated_stack(void); 115 118 #endif 116 119 117 #define CONFIG_STACK_SIZE ((1 << STACK_FRAMES) * STACK_SIZE)120 #define CONFIG_STACK_SIZE ((1 << STACK_FRAMES) * STACK_SIZE) 118 121 119 122 /** Main kernel routine for bootstrap CPU. … … 128 131 * 129 132 */ 130 void main_bsp(void)133 NO_TRACE void main_bsp(void) 131 134 { 132 135 config.cpu_count = 1; … … 144 147 size_t i; 145 148 for (i = 0; i < init.cnt; i++) { 146 if (PA_ overlaps(config.stack_base, config.stack_size,149 if (PA_OVERLAPS(config.stack_base, config.stack_size, 147 150 init.tasks[i].addr, init.tasks[i].size)) 148 151 config.stack_base = ALIGN_UP(init.tasks[i].addr + 149 152 init.tasks[i].size, config.stack_size); 150 153 } 151 154 152 155 /* Avoid placing stack on top of boot allocations. */ 153 156 if (ballocs.size) { 154 if (PA_ overlaps(config.stack_base, config.stack_size,157 if (PA_OVERLAPS(config.stack_base, config.stack_size, 155 158 ballocs.base, ballocs.size)) 156 159 config.stack_base = ALIGN_UP(ballocs.base + … … 168 171 } 169 172 170 171 173 /** Main kernel routine for bootstrap CPU using new stack. 172 174 * … … 174 176 * 175 177 */ 176 void main_bsp_separated_stack(void) 178 void main_bsp_separated_stack(void) 177 179 { 178 180 /* Keep this the first thing. */ … … 181 183 version_print(); 182 184 183 LOG("\nconfig.base=% #" PRIp "config.kernel_size=%" PRIs184 "\nconfig.stack_base=% #" PRIp "config.stack_size=%" PRIs,185 LOG("\nconfig.base=%p config.kernel_size=%" PRIs 186 "\nconfig.stack_base=%p config.stack_size=%" PRIs, 185 187 config.base, config.kernel_size, config.stack_base, 186 188 config.stack_size); … … 192 194 * commands. 193 195 */ 194 LOG_EXEC(kconsole_init());196 kconsole_init(); 195 197 #endif 196 198 … … 199 201 * starts adding its own handlers 200 202 */ 201 LOG_EXEC(exc_init());203 exc_init(); 202 204 203 205 /* 204 206 * Memory management subsystems initialization. 205 207 */ 206 LOG_EXEC(arch_pre_mm_init());207 LOG_EXEC(frame_init());208 arch_pre_mm_init(); 209 frame_init(); 208 210 209 211 /* Initialize at least 1 memory segment big enough for slab to work. */ 210 LOG_EXEC(slab_cache_init()); 211 LOG_EXEC(btree_init()); 212 LOG_EXEC(as_init()); 213 LOG_EXEC(page_init()); 214 LOG_EXEC(tlb_init()); 215 LOG_EXEC(ddi_init()); 216 LOG_EXEC(tasklet_init()); 217 LOG_EXEC(arch_post_mm_init()); 218 LOG_EXEC(arch_pre_smp_init()); 219 LOG_EXEC(smp_init()); 212 slab_cache_init(); 213 sysinfo_init(); 214 btree_init(); 215 as_init(); 216 page_init(); 217 tlb_init(); 218 ddi_init(); 219 tasklet_init(); 220 arch_post_mm_init(); 221 arch_pre_smp_init(); 222 smp_init(); 220 223 221 224 /* Slab must be initialized after we know the number of processors. */ 222 LOG_EXEC(slab_enable_cpucache());225 slab_enable_cpucache(); 223 226 224 227 printf("Detected %" PRIs " CPU(s), %" PRIu64" MiB free memory\n", 225 config.cpu_count, SIZE2MB(zone _total_size()));226 227 LOG_EXEC(cpu_init());228 229 LOG_EXEC(calibrate_delay_loop());230 LOG_EXEC(clock_counter_init());231 LOG_EXEC(timeout_init());232 LOG_EXEC(scheduler_init());233 LOG_EXEC(task_init());234 LOG_EXEC(thread_init());235 LOG_EXEC(futex_init());228 config.cpu_count, SIZE2MB(zones_total_size())); 229 230 cpu_init(); 231 232 calibrate_delay_loop(); 233 clock_counter_init(); 234 timeout_init(); 235 scheduler_init(); 236 task_init(); 237 thread_init(); 238 futex_init(); 236 239 237 240 if (init.cnt > 0) { 238 241 size_t i; 239 242 for (i = 0; i < init.cnt; i++) 240 LOG("init[%" PRIs "].addr=% #" PRIp ", init[%" PRIs241 "].size=% #" PRIs, i, init.tasks[i].addr, i,243 LOG("init[%" PRIs "].addr=%p, init[%" PRIs 244 "].size=%" PRIs, i, init.tasks[i].addr, i, 242 245 init.tasks[i].size); 243 246 } else 244 247 printf("No init binaries found.\n"); 245 248 246 LOG_EXEC(ipc_init()); 247 LOG_EXEC(event_init()); 248 LOG_EXEC(klog_init()); 249 ipc_init(); 250 event_init(); 251 klog_init(); 252 stats_init(); 249 253 250 254 /* … … 262 266 if (!kinit_thread) 263 267 panic("Cannot create kinit thread."); 264 LOG_EXEC(thread_ready(kinit_thread));268 thread_ready(kinit_thread); 265 269 266 270 /* … … 272 276 } 273 277 274 275 278 #ifdef CONFIG_SMP 279 276 280 /** Main kernel routine for application CPUs. 277 281 * … … 292 296 */ 293 297 config.cpu_active++; 294 298 295 299 /* 296 300 * The THE structure is well defined because ctx.sp is used as stack. … … 307 311 calibrate_delay_loop(); 308 312 arch_post_cpu_init(); 309 313 310 314 the_copy(THE, (the_t *) CPU->stack); 311 315 312 316 /* 313 317 * If we woke kmp up before we left the kernel stack, we could … … 322 326 } 323 327 324 325 328 /** Main kernel routine for application CPUs using new stack. 326 329 * … … 334 337 */ 335 338 timeout_init(); 336 339 337 340 waitq_wakeup(&ap_completion_wq, WAKEUP_FIRST); 338 341 scheduler(); 339 342 /* not reached */ 340 343 } 344 341 345 #endif /* CONFIG_SMP */ 342 346 -
kernel/generic/src/main/uinit.c
r24a2517 rc621f4aa 42 42 43 43 #include <main/uinit.h> 44 #include < arch/types.h>44 #include <typedefs.h> 45 45 #include <proc/thread.h> 46 46 #include <userspace.h> -
kernel/generic/src/main/version.c
r24a2517 rc621f4aa 37 37 #include <macros.h> 38 38 39 char *project = "SPARTAN kernel";40 char *copyright = "Copyright (c) 2001-2009HelenOS project";41 char *release = STRING(RELEASE);42 char *name = STRING(NAME);43 char *arch = STRING(KARCH);39 static const char *project = "SPARTAN kernel"; 40 static const char *copyright = "Copyright (c) 2001-2010 HelenOS project"; 41 static const char *release = STRING(RELEASE); 42 static const char *name = STRING(NAME); 43 static const char *arch = STRING(KARCH); 44 44 45 45 #ifdef REVISION 46 char *revision = ", revision " STRING(REVISION);46 static const char *revision = ", revision " STRING(REVISION); 47 47 #else 48 char *revision = "";48 static const char *revision = ""; 49 49 #endif 50 50 51 51 #ifdef TIMESTAMP 52 char *timestamp = " on " STRING(TIMESTAMP);52 static const char *timestamp = " on " STRING(TIMESTAMP); 53 53 #else 54 char *timestamp = "";54 static const char *timestamp = ""; 55 55 #endif 56 56 … … 59 59 { 60 60 printf("%s, release %s (%s)%s\nBuilt%s for %s\n%s\n", 61 project, release, name, revision, timestamp, arch, copyright);61 project, release, name, revision, timestamp, arch, copyright); 62 62 } 63 63
Note:
See TracChangeset
for help on using the changeset viewer.
