Rev 3042 | Rev 3425 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 3042 | Rev 3424 | ||
|---|---|---|---|
| Line 151... | Line 151... | ||
| 151 | thread_ready(t); |
151 | thread_ready(t); |
| 152 | else |
152 | else |
| 153 | panic("thread_create/kconsole\n"); |
153 | panic("thread_create/kconsole\n"); |
| 154 | 154 | ||
| 155 | interrupts_enable(); |
155 | interrupts_enable(); |
| 156 | 156 | ||
| - | 157 | /* |
|
| - | 158 | * Create user tasks, load RAM disk images. |
|
| - | 159 | */ |
|
| 157 | count_t i; |
160 | count_t i; |
| - | 161 | thread_t *threads[CONFIG_INIT_TASKS]; |
|
| - | 162 | ||
| 158 | for (i = 0; i < init.cnt; i++) { |
163 | for (i = 0; i < init.cnt; i++) { |
| 159 | /* |
- | |
| 160 | * Run user tasks, load RAM disk images. |
- | |
| 161 | */ |
- | |
| 162 | - | ||
| 163 | if (init.tasks[i].addr % FRAME_SIZE) { |
164 | if (init.tasks[i].addr % FRAME_SIZE) { |
| 164 | printf("init[%d].addr is not frame aligned", i); |
165 | printf("init[%" PRIc "].addr is not frame aligned", i); |
| 165 | continue; |
166 | continue; |
| 166 | } |
167 | } |
| 167 | 168 | ||
| 168 | task_t *utask = task_run_program((void *) init.tasks[i].addr, |
169 | threads[i] = thread_create_program( |
| 169 | "uspace"); |
170 | (void *) init.tasks[i].addr, "uspace"); |
| 170 | 171 | ||
| 171 | if (utask) { |
172 | if (threads[i] != NULL) { |
| 172 | /* |
173 | /* |
| 173 | * Set capabilities to init userspace tasks. |
174 | * Set capabilities to init userspace tasks. |
| 174 | */ |
175 | */ |
| 175 | cap_set(utask, CAP_CAP | CAP_MEM_MANAGER | |
176 | cap_set(threads[i]->task, CAP_CAP | CAP_MEM_MANAGER | |
| 176 | CAP_IO_MANAGER | CAP_PREEMPT_CONTROL | CAP_IRQ_REG); |
177 | CAP_IO_MANAGER | CAP_PREEMPT_CONTROL | CAP_IRQ_REG); |
| 177 | 178 | ||
| 178 | if (!ipc_phone_0) |
179 | if (!ipc_phone_0) |
| 179 | ipc_phone_0 = &utask->answerbox; |
180 | ipc_phone_0 = &threads[i]->task->answerbox; |
| 180 | } else { |
181 | } else { |
| 181 | int rd = init_rd((rd_header_t *) init.tasks[i].addr, |
182 | int rd = init_rd((rd_header_t *) init.tasks[i].addr, |
| 182 | init.tasks[i].size); |
183 | init.tasks[i].size); |
| 183 | 184 | ||
| 184 | if (rd != RE_OK) |
185 | if (rd != RE_OK) |
| 185 | printf("Init binary %zd not used, error code %d.\n", i, rd); |
186 | printf("Init binary %" PRIc " not used, error code %d.\n", i, rd); |
| - | 187 | } |
|
| - | 188 | } |
|
| - | 189 | ||
| - | 190 | /* |
|
| - | 191 | * Run user tasks with reasonable delays |
|
| - | 192 | */ |
|
| - | 193 | for (i = 0; i < init.cnt; i++) { |
|
| - | 194 | if (threads[i] != NULL) { |
|
| - | 195 | thread_usleep(50000); |
|
| - | 196 | thread_ready(threads[i]); |
|
| 186 | } |
197 | } |
| 187 | } |
198 | } |
| 188 | - | ||
| 189 | 199 | ||
| 190 | if (!stdin) { |
200 | if (!stdin) { |
| 191 | while (1) { |
201 | while (1) { |
| 192 | thread_sleep(1); |
202 | thread_sleep(1); |
| 193 | printf("kinit... "); |
203 | printf("kinit... "); |