Rev 3191 | Rev 3403 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3191 | Rev 3203 | ||
---|---|---|---|
Line 45... | Line 45... | ||
45 | #include <config.h> |
45 | #include <config.h> |
46 | #include <arch.h> |
46 | #include <arch.h> |
47 | #include <proc/scheduler.h> |
47 | #include <proc/scheduler.h> |
48 | #include <proc/task.h> |
48 | #include <proc/task.h> |
49 | #include <proc/thread.h> |
49 | #include <proc/thread.h> |
- | 50 | #include <proc/program.h> |
|
50 | #include <panic.h> |
51 | #include <panic.h> |
51 | #include <func.h> |
52 | #include <func.h> |
52 | #include <cpu.h> |
53 | #include <cpu.h> |
53 | #include <arch/asm.h> |
54 | #include <arch/asm.h> |
54 | #include <mm/page.h> |
55 | #include <mm/page.h> |
Line 157... | Line 158... | ||
157 | 158 | ||
158 | /* |
159 | /* |
159 | * Create user tasks, load RAM disk images. |
160 | * Create user tasks, load RAM disk images. |
160 | */ |
161 | */ |
161 | count_t i; |
162 | count_t i; |
162 | thread_t *threads[CONFIG_INIT_TASKS]; |
163 | program_t programs[CONFIG_INIT_TASKS]; |
163 | 164 | ||
164 | for (i = 0; i < init.cnt; i++) { |
165 | for (i = 0; i < init.cnt; i++) { |
165 | if (init.tasks[i].addr % FRAME_SIZE) { |
166 | if (init.tasks[i].addr % FRAME_SIZE) { |
166 | printf("init[%" PRIc "].addr is not frame aligned", i); |
167 | printf("init[%" PRIc "].addr is not frame aligned", i); |
167 | continue; |
168 | continue; |
168 | } |
169 | } |
169 | 170 | ||
170 | int rc = task_parse_initial((void *) init.tasks[i].addr, |
171 | int rc = program_create_from_image((void *) init.tasks[i].addr, |
171 | "uspace", &threads[i]); |
172 | &programs[i]); |
172 | 173 | ||
173 | if (rc == 0 && threads[i] != NULL) { |
174 | if (rc == 0 && programs[i].task != NULL) { |
174 | /* |
175 | /* |
175 | * Set capabilities to init userspace tasks. |
176 | * Set capabilities to init userspace tasks. |
176 | */ |
177 | */ |
177 | cap_set(threads[i]->task, CAP_CAP | CAP_MEM_MANAGER | |
178 | cap_set(programs[i].task, CAP_CAP | CAP_MEM_MANAGER | |
178 | CAP_IO_MANAGER | CAP_PREEMPT_CONTROL | CAP_IRQ_REG); |
179 | CAP_IO_MANAGER | CAP_PREEMPT_CONTROL | CAP_IRQ_REG); |
179 | 180 | ||
180 | 181 | ||
181 | if (!ipc_phone_0) |
182 | if (!ipc_phone_0) |
182 | ipc_phone_0 = &threads[i]->task->answerbox; |
183 | ipc_phone_0 = &programs[i].task->answerbox; |
183 | } else if (rc == 0) { |
184 | } else if (rc == 0) { |
184 | /* It was the program loader and was registered */ |
185 | /* It was the program loader and was registered */ |
185 | } else { |
186 | } else { |
186 | /* RAM disk image */ |
187 | /* RAM disk image */ |
187 | int rd = init_rd((rd_header_t *) init.tasks[i].addr, |
188 | int rd = init_rd((rd_header_t *) init.tasks[i].addr, |
Line 195... | Line 196... | ||
195 | 196 | ||
196 | /* |
197 | /* |
197 | * Run user tasks with reasonable delays |
198 | * Run user tasks with reasonable delays |
198 | */ |
199 | */ |
199 | for (i = 0; i < init.cnt; i++) { |
200 | for (i = 0; i < init.cnt; i++) { |
200 | if (threads[i] != NULL) { |
201 | if (programs[i].task != NULL) { |
201 | thread_usleep(50000); |
202 | thread_usleep(50000); |
202 | thread_ready(threads[i]); |
203 | program_ready(&programs[i]); |
203 | } |
204 | } |
204 | } |
205 | } |
205 | 206 | ||
206 | if (!stdin) { |
207 | if (!stdin) { |
207 | while (1) { |
208 | while (1) { |