27 |
/* From version.c */ |
/* From version.c */ |
28 |
extern char version_string []; |
extern char version_string []; |
29 |
|
|
|
/* Function for dumping statistics. */ |
|
30 |
#if DIAGNOSTICS |
#if DIAGNOSTICS |
31 |
|
/* Function for dumping statistics. */ |
32 |
static void |
static void |
33 |
dump_stats (void *arg) |
dump_stats (void *arg) |
34 |
{ |
{ |
37 |
trace_printf ("stack handoffs: %d", trace_stats.stack_handoffs); |
trace_printf ("stack handoffs: %d", trace_stats.stack_handoffs); |
38 |
trace_printf ("cpu switch hits: %d", trace_stats.cpu_switch_hits); |
trace_printf ("cpu switch hits: %d", trace_stats.cpu_switch_hits); |
39 |
trace_printf ("# threads: %d", trace_stats.n_threads); |
trace_printf ("# threads: %d", trace_stats.n_threads); |
40 |
|
|
41 |
|
trace_printf ("# pages %d", trace_stats.n_vm_pages); |
42 |
|
trace_printf ("# active pages %d", trace_stats.n_vm_active_pages); |
43 |
|
trace_printf ("# free pages %d", trace_stats.n_vm_free_pages); |
44 |
timeout (10 * 1000, dump_stats, 0); |
timeout (10 * 1000, dump_stats, 0); |
45 |
} |
} |
46 |
|
|
47 |
/* Function for dumping CPU information. */ |
/* Function for dumping CPU information. */ |
|
|
|
48 |
static void |
static void |
49 |
dump_cpus (void *arg) |
dump_cpus (void *arg) |
50 |
{ |
{ |
72 |
|
|
73 |
/* Thread function for launching the rest of the system. |
/* Thread function for launching the rest of the system. |
74 |
This thread goes on and becomes the reaper daemon when it's done. */ |
This thread goes on and becomes the reaper daemon when it's done. */ |
|
|
|
75 |
static void |
static void |
76 |
launch_the_system (void *arg) |
launch_the_system (void *arg) |
77 |
{ |
{ |
87 |
#endif |
#endif |
88 |
|
|
89 |
/* Initialize bootstrap. */ |
/* Initialize bootstrap. */ |
|
|
|
90 |
bootstrap_init (); |
bootstrap_init (); |
91 |
|
|
|
trace_printf ("done with launch"); |
|
|
|
|
92 |
/* Become reaper daemon thread. */ |
/* Become reaper daemon thread. */ |
|
|
|
93 |
thread_block (reaper_continuation); |
thread_block (reaper_continuation); |
94 |
/* NOTREACHED */ |
/* NOTREACHED */ |
95 |
} |
} |
96 |
|
|
97 |
/* Copyright string. */ |
/* Copyright string. */ |
|
|
|
98 |
static char copyright_string [] = |
static char copyright_string [] = |
99 |
"Copyright 1999-2002 Johan Rydberg, jrydberg@rtmk.org\n" |
"Copyright 1999-2002 Johan Rydberg, jrydberg@rtmk.org\n" |
100 |
"rtmk is free software, covered by the GNU General Public License, and you are\n" |
"rtmk is free software, covered by the GNU General Public License, and you are\n" |
101 |
"welcome to change it and/or distribute copies of it under certain conditions.\n\n"; |
"welcome to change it and/or distribute copies of it under certain conditions.\n\n"; |
102 |
|
|
103 |
/* ... */ |
/* ... */ |
|
|
|
104 |
void |
void |
105 |
init_main (void) |
init_main (void) |
106 |
{ |
{ |
108 |
int err; |
int err; |
109 |
|
|
110 |
/* Print version information and copyright string. */ |
/* Print version information and copyright string. */ |
|
|
|
111 |
printf ("\nrtmk %s\n", version_string); |
printf ("\nrtmk %s\n", version_string); |
112 |
printf (copyright_string); |
printf (copyright_string); |
113 |
|
|
116 |
eventcnt_init (); |
eventcnt_init (); |
117 |
|
|
118 |
/* Create the launch thread and start it. */ |
/* Create the launch thread and start it. */ |
|
|
|
119 |
err = thread_create (TASK_KERNEL (), &launch_thread); |
err = thread_create (TASK_KERNEL (), &launch_thread); |
120 |
assert (err == KERN_SUCCESS); |
assert (err == KERN_SUCCESS); |
121 |
thread_start (launch_thread, launch_the_system, 0); |
thread_start (launch_thread, launch_the_system, 0); |