Subversion Repositories HelenOS

Rev

Rev 430 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 430 Rev 452
Line 120... Line 120...
120
#ifdef __USERSPACE__
120
#ifdef __USERSPACE__
121
    /*
121
    /*
122
     * Create the first user task.
122
     * Create the first user task.
123
     */
123
     */
124
    m = vm_create(NULL);
124
    m = vm_create(NULL);
-
 
125
    if (!m)
125
    if (!m) panic("vm_create");
126
        panic("vm_create");
126
    u = task_create(m);
127
    u = task_create(m);
-
 
128
    if (!u)
127
    if (!u) panic("task_create");
129
        panic("task_create");
128
    t = thread_create(uinit, NULL, u, THREAD_USER_STACK);
130
    t = thread_create(uinit, NULL, u, THREAD_USER_STACK);
-
 
131
    if (!t)
129
    if (!t) panic("thread_create");
132
        panic("thread_create");
130
 
133
 
131
    /*
134
    /*
132
     * Create the text vm_area and copy the userspace code there.
135
     * Create the text vm_area and copy the userspace code there.
133
     */
136
     */
134
    a = vm_area_create(m, VMA_TEXT, 1, UTEXT_ADDRESS);
137
    a = vm_area_create(m, VMA_TEXT, 1, UTEXT_ADDRESS);
-
 
138
    if (!a)
135
    if (!a) panic("vm_area_create: vm_text");
139
        panic("vm_area_create: vm_text");
136
    vm_area_map(a, m);
140
    vm_area_map(a, m);
137
    memcpy((void *) PA2KA(a->mapping[0]), (void *) utext, utext_size < PAGE_SIZE ? utext_size : PAGE_SIZE);
141
    memcpy((void *) PA2KA(a->mapping[0]), (void *) utext, utext_size < PAGE_SIZE ? utext_size : PAGE_SIZE);
138
 
142
 
139
    /*
143
    /*
140
     * Create the data vm_area.
144
     * Create the data vm_area.
141
     */
145
     */
142
    a = vm_area_create(m, VMA_STACK, 1, USTACK_ADDRESS);
146
    a = vm_area_create(m, VMA_STACK, 1, USTACK_ADDRESS);
-
 
147
    if (!a)
143
    if (!a) panic("vm_area_create: vm_stack");
148
        panic("vm_area_create: vm_stack");
144
    vm_area_map(a, m); 
149
    vm_area_map(a, m); 
145
   
150
   
146
    thread_ready(t);
151
    thread_ready(t);
147
#endif /* __USERSPACE__ */
152
#endif /* __USERSPACE__ */
148
 
153