1 |
/* ia32-cmain.c - Startup code for the ia32. |
/* ia32-cmain.c - Startup code for the ia32. |
2 |
Copyright (C) 2003, 2004 Free Software Foundation, Inc. |
Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. |
3 |
Written by Marcus Brinkmann. |
Written by Marcus Brinkmann. |
4 |
|
|
5 |
This file is part of the GNU Hurd. |
This file is part of the GNU Hurd. |
34 |
|
|
35 |
#include <hurd/wortel.h> |
#include <hurd/wortel.h> |
36 |
#include <hurd/startup.h> |
#include <hurd/startup.h> |
37 |
|
#include <hurd/mm.h> |
38 |
|
|
39 |
|
|
40 |
/* Initialized by the machine-specific startup-code. */ |
/* Initialized by the machine-specific startup-code. */ |
45 |
l4_thread_id_t wortel_thread_id; |
l4_thread_id_t wortel_thread_id; |
46 |
wortel_cap_id_t wortel_cap_id; |
wortel_cap_id_t wortel_cap_id; |
47 |
|
|
48 |
|
/* Pager thread. */ |
49 |
|
l4_thread_id_t pager_tid; |
50 |
|
|
51 |
|
|
52 |
/* Initialize libl4, setup the argument vector, and pass control over |
/* Initialize libl4, setup the argument vector, and pass control over |
53 |
to the main function. */ |
to the main function. */ |
54 |
void |
void |
55 |
cmain (void) |
cmain (void) |
56 |
{ |
{ |
57 |
|
error_t err; |
58 |
int argc = 0; |
int argc = 0; |
59 |
char **argv = 0; |
char **argv = 0; |
60 |
|
|
61 |
l4_init (); |
l4_init (); |
62 |
l4_init_stubs (); |
l4_init_stubs (); |
63 |
|
err = task_thread_alloc (__hurd_startup_data->task.server, |
64 |
|
__hurd_startup_data->task.cap_handle, |
65 |
|
/* We are the second thread. */ |
66 |
|
(void *) |
67 |
|
(l4_address (__hurd_startup_data->utcb_area) |
68 |
|
+ l4_utcb_size ()), |
69 |
|
&pager_tid); |
70 |
|
if (err) |
71 |
|
{ |
72 |
|
printf ("Unable to allocate a thread for the pager thread.\n"); |
73 |
|
return; |
74 |
|
} |
75 |
|
|
76 |
|
|
77 |
|
hurd_mm_init (pager_tid); |
78 |
|
|
79 |
|
l4_set_pager (pager_tid); |
80 |
|
|
81 |
wortel_thread_id = __hurd_startup_data->wortel.server; |
wortel_thread_id = __hurd_startup_data->wortel.server; |
82 |
wortel_cap_id = __hurd_startup_data->wortel.cap_handle; |
wortel_cap_id = __hurd_startup_data->wortel.cap_handle; |