Subversion Repositories HelenOS

Rev

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

Rev 2087 Rev 2446
Line 43... Line 43...
43
#include <main/uinit.h>
43
#include <main/uinit.h>
44
#include <arch/types.h>
44
#include <arch/types.h>
45
#include <proc/thread.h>
45
#include <proc/thread.h>
46
#include <userspace.h>
46
#include <userspace.h>
47
#include <mm/slab.h>
47
#include <mm/slab.h>
-
 
48
#include <arch.h>
48
 
49
 
49
/** Thread used to bring up userspace thread.
50
/** Thread used to bring up userspace thread.
50
 *
51
 *
51
 * @param arg Pointer to structure containing userspace entry and stack
52
 * @param arg Pointer to structure containing userspace entry and stack
52
 *     addresses.
53
 *     addresses.
53
 */
54
 */
54
void uinit(void *arg)
55
void uinit(void *arg)
55
{
56
{
56
    uspace_arg_t uarg;
57
    uspace_arg_t uarg;
-
 
58
 
-
 
59
    /*
-
 
60
     * So far, we don't have a use for joining userspace threads so we
-
 
61
     * immediately detach each uinit thread. If joining of userspace threads
-
 
62
     * is required, some userspace API based on the kernel mechanism will
-
 
63
     * have to be implemented. Moreover, garbage collecting of threads that
-
 
64
     * didn't detach themselves and nobody else joined them will have to be
-
 
65
     * deployed for the event of forceful task termination.
-
 
66
     */
-
 
67
    thread_detach(THREAD);
57
   
68
   
58
    uarg.uspace_entry = ((uspace_arg_t *) arg)->uspace_entry;
69
    uarg.uspace_entry = ((uspace_arg_t *) arg)->uspace_entry;
59
    uarg.uspace_stack = ((uspace_arg_t *) arg)->uspace_stack;
70
    uarg.uspace_stack = ((uspace_arg_t *) arg)->uspace_stack;
60
    uarg.uspace_uarg = ((uspace_arg_t *) arg)->uspace_uarg;
71
    uarg.uspace_uarg = ((uspace_arg_t *) arg)->uspace_uarg;
61
    uarg.uspace_thread_function = NULL;
72
    uarg.uspace_thread_function = NULL; uarg.uspace_thread_arg = NULL;
62
    uarg.uspace_thread_arg = NULL;
-
 
63
 
73
 
64
    free((uspace_arg_t *) arg);
74
    free((uspace_arg_t *) arg);
65
    userspace(&uarg);
75
    userspace(&uarg);
66
}
76
}
67
 
77