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 |
|
l4_thread_id_t pager_tid; |
49 |
|
|
50 |
|
|
51 |
/* Initialize libl4, setup the argument vector, and pass control over |
/* Initialize libl4, setup the argument vector, and pass control over |
52 |
to the main function. */ |
to the main function. */ |
53 |
void |
void |
54 |
cmain (void) |
cmain (void) |
55 |
{ |
{ |
56 |
|
error_t err; |
57 |
int argc = 0; |
int argc = 0; |
58 |
char **argv = 0; |
char **argv = 0; |
59 |
|
|
63 |
wortel_thread_id = __hurd_startup_data->wortel.server; |
wortel_thread_id = __hurd_startup_data->wortel.server; |
64 |
wortel_cap_id = __hurd_startup_data->wortel.cap_handle; |
wortel_cap_id = __hurd_startup_data->wortel.cap_handle; |
65 |
|
|
66 |
|
pager_tid = l4_global_id (l4_thread_no (l4_my_global_id ()) + 1, |
67 |
|
l4_version (l4_my_global_id ())); |
68 |
|
|
69 |
|
err = wortel_thread_control (pager_tid, l4_my_global_id (), |
70 |
|
l4_myself (), pager_tid, |
71 |
|
(void *) |
72 |
|
(l4_address (__hurd_startup_data->utcb_area) |
73 |
|
+ l4_utcb_size ())); |
74 |
|
if (err) |
75 |
|
{ |
76 |
|
printf ("Unable to allocate a thread for the pager thread.\n"); |
77 |
|
for (;;) |
78 |
|
; |
79 |
|
} |
80 |
|
|
81 |
|
|
82 |
|
hurd_mm_init (pager_tid); |
83 |
|
|
84 |
|
l4_set_pager (pager_tid); |
85 |
|
|
86 |
argc = 1; |
argc = 1; |
87 |
argv = alloca (sizeof (char *) * 2); |
argv = alloca (sizeof (char *) * 2); |
88 |
argv[0] = program_name; |
argv[0] = program_name; |