Changeset 76fca31 in mainline for kernel/generic/src/main/kinit.c
- Timestamp:
- 2008-12-16T19:02:07Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5ae4443
- Parents:
- 8fe5980
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/main/kinit.c
r8fe5980 r76fca31 83 83 void kinit(void *arg) 84 84 { 85 thread_t *t; 85 86 #if defined(CONFIG_SMP) || defined(CONFIG_KCONSOLE) 87 thread_t *thread; 88 #endif 86 89 87 90 /* … … 101 104 * Just a beautification. 102 105 */ 103 if ((t = thread_create(kmp, NULL, TASK, THREAD_FLAG_WIRED,104 "kmp", true))) {105 spinlock_lock(&t ->lock);106 t ->cpu = &cpus[0];107 spinlock_unlock(&t ->lock);108 thread_ready(t );106 thread = thread_create(kmp, NULL, TASK, THREAD_FLAG_WIRED, "kmp", true); 107 if (thread != NULL) { 108 spinlock_lock(&thread->lock); 109 thread->cpu = &cpus[0]; 110 spinlock_unlock(&thread->lock); 111 thread_ready(thread); 109 112 } else 110 panic(" thread_create/kmp\n");111 thread_join(t );112 thread_detach(t );113 panic("Unable to create kmp thread\n"); 114 thread_join(thread); 115 thread_detach(thread); 113 116 } 114 117 #endif /* CONFIG_SMP */ 115 /* 116 * Now that all CPUs are up, we can report what we've found. 117 */ 118 cpu_list(); 119 118 120 119 #ifdef CONFIG_SMP 121 120 if (config.cpu_count > 1) { … … 126 125 */ 127 126 for (i = 0; i < config.cpu_count; i++) { 128 129 if ((t = thread_create(kcpulb, NULL, TASK, 130 THREAD_FLAG_WIRED, "kcpulb", true))) { 131 spinlock_lock(&t->lock); 132 t->cpu = &cpus[i]; 133 spinlock_unlock(&t->lock); 134 thread_ready(t); 127 thread = thread_create(kcpulb, NULL, TASK, THREAD_FLAG_WIRED, "kcpulb", true); 128 if (thread != NULL) { 129 spinlock_lock(&thread->lock); 130 thread->cpu = &cpus[i]; 131 spinlock_unlock(&thread->lock); 132 thread_ready(thread); 135 133 } else 136 p anic("thread_create/kcpulb\n");134 printf("Unable to create kcpulb thread for cpu" PRIc "\n", i); 137 135 138 136 } 139 137 } 140 138 #endif /* CONFIG_SMP */ 141 139 142 140 /* 143 141 * At this point SMP, if present, is configured. … … 145 143 arch_post_smp_init(); 146 144 147 /* 148 * Create kernel console. 149 */ 150 t = thread_create(kconsole, (void *) "kconsole", TASK, 0, "kconsole", 151 false); 152 if (t) 153 thread_ready(t); 154 else 155 panic("thread_create/kconsole\n"); 156 145 #ifdef CONFIG_KCONSOLE 146 if (stdin) { 147 /* 148 * Create kernel console. 149 */ 150 thread = thread_create(kconsole_thread, NULL, TASK, 0, "kconsole", false); 151 if (thread != NULL) 152 thread_ready(thread); 153 else 154 printf("Unable to create kconsole thread\n"); 155 } 156 #endif /* CONFIG_KCONSOLE */ 157 157 158 interrupts_enable(); 158 159 … … 165 166 for (i = 0; i < init.cnt; i++) { 166 167 if (init.tasks[i].addr % FRAME_SIZE) { 167 printf("init[%" PRIc "].addr is not frame aligned ", i);168 printf("init[%" PRIc "].addr is not frame aligned\n", i); 168 169 continue; 169 170 } 170 171 171 172 int rc = program_create_from_image((void *) init.tasks[i].addr, 172 173 "init-bin", &programs[i]); 173 174 if ( rc == 0 && programs[i].task != NULL) {174 175 if ((rc == 0) && (programs[i].task != NULL)) { 175 176 /* 176 177 * Set capabilities to init userspace tasks. … … 185 186 } else { 186 187 /* RAM disk image */ 187 int rd = init_rd((rd_header_t *) init.tasks[i].addr, 188 init.tasks[i].size); 188 int rd = init_rd((rd_header_t *) init.tasks[i].addr, init.tasks[i].size); 189 189 190 190 if (rd != RE_OK) 191 printf("Init binary %" PRIc " not used, error " 192 "code %d.\n", i, rd); 191 printf("Init binary %" PRIc " not used (error %d)\n", i, rd); 193 192 } 194 193 } … … 204 203 } 205 204 205 #ifdef CONFIG_KCONSOLE 206 206 if (!stdin) { 207 printf("kinit: No stdin\nKernel alive: "); 208 209 uint64_t i = 0; 207 210 while (1) { 211 printf(PRIu64 " ", i); 208 212 thread_sleep(1); 209 printf("kinit... "); 210 } 211 } 213 i++; 214 } 215 } 216 #endif /* CONFIG_KCONSOLE */ 212 217 } 213 218
Note:
See TracChangeset
for help on using the changeset viewer.