Subversion Repositories HelenOS

Rev

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

Rev 2479 Rev 2482
Line 35... Line 35...
35
#include <thread.h>
35
#include <thread.h>
36
#include <libc.h>
36
#include <libc.h>
37
#include <stdlib.h>
37
#include <stdlib.h>
38
#include <libarch/faddr.h>
38
#include <libarch/faddr.h>
39
#include <kernel/proc/uarg.h>
39
#include <kernel/proc/uarg.h>
40
#include <psthread.h>
40
#include <fibril.h>
41
#include <string.h>
41
#include <string.h>
42
#include <async.h>
42
#include <async.h>
43
 
43
 
44
#include <stdio.h>
44
#include <stdio.h>
45
 
45
 
Line 98... Line 98...
98
 *
98
 *
99
 * @param uarg Pointer to userspace argument structure.
99
 * @param uarg Pointer to userspace argument structure.
100
 */
100
 */
101
void __thread_main(uspace_arg_t *uarg)
101
void __thread_main(uspace_arg_t *uarg)
102
{
102
{
103
    psthread_data_t *pt;
103
    fibril_t *f;
104
 
104
 
105
    pt = psthread_setup();
105
    f = fibril_setup();
106
    __tcb_set(pt->tcb);
106
    __tcb_set(f->tcb);
107
   
107
   
108
    uarg->uspace_thread_function(uarg->uspace_thread_arg);
108
    uarg->uspace_thread_function(uarg->uspace_thread_arg);
109
    /* XXX: we cannot free the userspace stack while running on it */
109
    /* XXX: we cannot free the userspace stack while running on it */
110
//  free(uarg->uspace_stack);
110
//  free(uarg->uspace_stack);
111
//  free(uarg);
111
//  free(uarg);
112
 
112
 
113
    /* If there is a manager, destroy it */
113
    /* If there is a manager, destroy it */
114
    async_destroy_manager();
114
    async_destroy_manager();
115
    psthread_teardown(pt);
115
    fibril_teardown(f);
116
 
116
 
117
    thread_exit(0);
117
    thread_exit(0);
118
}
118
}
119
 
119
 
120
/** Create userspace thread.
120
/** Create userspace thread.