Rev 135 | Rev 170 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 135 | Rev 167 | ||
---|---|---|---|
Line 116... | Line 116... | ||
116 | 116 | ||
117 | #ifdef __USERSPACE__ |
117 | #ifdef __USERSPACE__ |
118 | /* |
118 | /* |
119 | * Create the first user task. |
119 | * Create the first user task. |
120 | */ |
120 | */ |
121 | m = vm_create(); |
121 | m = vm_create(NULL); |
122 | if (!m) panic("vm_create"); |
122 | if (!m) panic("vm_create"); |
123 | u = task_create(m); |
123 | u = task_create(m); |
124 | if (!u) panic("task_create"); |
124 | if (!u) panic("task_create"); |
125 | t = thread_create(uinit, NULL, u, THREAD_USER_STACK); |
125 | t = thread_create(uinit, NULL, u, THREAD_USER_STACK); |
126 | if (!t) panic("thread_create"); |
126 | if (!t) panic("thread_create"); |
Line 128... | Line 128... | ||
128 | /* |
128 | /* |
129 | * Create the text vm_area and copy the userspace code there. |
129 | * Create the text vm_area and copy the userspace code there. |
130 | */ |
130 | */ |
131 | a = vm_area_create(m, VMA_TEXT, 1, UTEXT_ADDRESS); |
131 | a = vm_area_create(m, VMA_TEXT, 1, UTEXT_ADDRESS); |
132 | if (!a) panic("vm_area_create: vm_text"); |
132 | if (!a) panic("vm_area_create: vm_text"); |
- | 133 | vm_area_map(a, m); |
|
133 | memcopy((__address) utext, PA2KA(a->mapping[0]), utext_size < PAGE_SIZE ? utext_size : PAGE_SIZE); |
134 | memcopy((__address) utext, PA2KA(a->mapping[0]), utext_size < PAGE_SIZE ? utext_size : PAGE_SIZE); |
134 | 135 | ||
135 | /* |
136 | /* |
136 | * Create the data vm_area. |
137 | * Create the data vm_area. |
137 | */ |
138 | */ |
138 | a = vm_area_create(m, VMA_STACK, 1, USTACK_ADDRESS); |
139 | a = vm_area_create(m, VMA_STACK, 1, USTACK_ADDRESS); |
139 | if (!a) panic("vm_area_create: vm_stack"); |
140 | if (!a) panic("vm_area_create: vm_stack"); |
- | 141 | vm_area_map(a, m); |
|
140 | 142 | ||
141 | thread_ready(t); |
143 | thread_ready(t); |
142 | #endif /* __USERSPACE__ */ |
144 | #endif /* __USERSPACE__ */ |
143 | 145 | ||
144 | #ifdef __TEST__ |
146 | #ifdef __TEST__ |