Changeset de6b301 in mainline for generic/src/main/kinit.c
- Timestamp:
- 2006-03-12T18:27:33Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f972b89
- Parents:
- a82500ce
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
generic/src/main/kinit.c
ra82500ce rde6b301 47 47 #include <interrupt.h> 48 48 #include <console/kconsole.h> 49 #include <elf.h> 49 50 50 51 #ifdef CONFIG_SMP … … 72 73 as_t *as; 73 74 as_area_t *a; 74 __address frame; 75 count_t frames; 76 int i; 75 int rc; 77 76 task_t *u; 78 77 … … 151 150 if (!as) 152 151 panic("as_create\n"); 153 u = task_create(as); 154 if (!u) 155 panic("task_create\n"); 156 t = thread_create(uinit, NULL, u, THREAD_USER_STACK); 157 if (!t) 158 panic("thread_create\n"); 152 153 rc = elf_load((elf_header_t *) config.init_addr, as); 154 if (rc != EE_OK) { 155 printf("elf_load failed: %s\n", elf_error(rc)); 156 } else { 157 u = task_create(as); 158 if (!u) 159 panic("task_create\n"); 160 t = thread_create(uinit, (void *)((elf_header_t *) config.init_addr)->e_entry, u, THREAD_USER_STACK); 161 if (!t) 162 panic("thread_create\n"); 159 163 160 /* 161 * Create the text as_area and initialize its mapping. 162 */ 163 164 frame = config.init_addr; 165 if (IS_KA(frame)) 166 frame = KA2PA(frame); 164 /* 165 * Create the data as_area. 166 */ 167 a = as_area_create(as, AS_AREA_STACK, 1, USTACK_ADDRESS); 168 if (!a) 169 panic("as_area_create: stack\n"); 167 170 168 frames = SIZE2FRAMES(config.init_size); 169 170 a = as_area_create(as, AS_AREA_TEXT, frames, UTEXT_ADDRESS); 171 if (!a) 172 panic("as_area_create: text\n"); 173 174 for (i = 0; i < frames; i++) 175 as_set_mapping(as, UTEXT_ADDRESS + i * PAGE_SIZE, frame + i * FRAME_SIZE); 176 177 /* 178 * Create the data as_area. 179 */ 180 a = as_area_create(as, AS_AREA_STACK, 1, USTACK_ADDRESS); 181 if (!a) 182 panic("as_area_create: stack\n"); 183 184 thread_ready(t); 171 thread_ready(t); 172 } 185 173 } 186 174
Note:
See TracChangeset
for help on using the changeset viewer.