summaryrefslogtreecommitdiffstats
path: root/src/core/init.c
diff options
context:
space:
mode:
authorMichael Brown2005-04-08 17:01:17 +0200
committerMichael Brown2005-04-08 17:01:17 +0200
commit0ff80b477dcff0726ebdbed95e8a93971e59e82b (patch)
tree860b7150212a07c24a9529ea072f3fb12700974c /src/core/init.c
parentMerged this file into HEAD (diff)
downloadipxe-0ff80b477dcff0726ebdbed95e8a93971e59e82b.tar.gz
ipxe-0ff80b477dcff0726ebdbed95e8a93971e59e82b.tar.xz
ipxe-0ff80b477dcff0726ebdbed95e8a93971e59e82b.zip
Merged mcb30-realmode-redesign back to HEAD
Diffstat (limited to 'src/core/init.c')
-rw-r--r--src/core/init.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/core/init.c b/src/core/init.c
new file mode 100644
index 00000000..3dc87691
--- /dev/null
+++ b/src/core/init.c
@@ -0,0 +1,44 @@
+/**************************************************************************
+ * call_{init,reset,exit}_fns ()
+ *
+ * Call the various initialisation and exit functions. We use a
+ * function table so that we don't end up dragging in an object just
+ * because we call its initialisation function.
+ **************************************************************************
+ */
+
+#include "init.h"
+
+extern struct init_fn init_fns[];
+extern struct init_fn init_fns_end[];
+
+void call_init_fns ( void ) {
+ struct init_fn *init_fn;
+
+ for ( init_fn = init_fns; init_fn < init_fns_end ; init_fn++ ) {
+ if ( init_fn->init )
+ init_fn->init ();
+ }
+}
+
+void call_reset_fns ( void ) {
+ struct init_fn *init_fn;
+
+ for ( init_fn = init_fns; init_fn < init_fns_end ; init_fn++ ) {
+ if ( init_fn->reset )
+ init_fn->reset ();
+ }
+}
+
+void call_exit_fns ( void ) {
+ struct init_fn *init_fn;
+
+ /*
+ * Exit functions are called in reverse order to
+ * initialisation functions.
+ */
+ for ( init_fn = init_fns_end - 1; init_fn >= init_fns ; init_fn-- ) {
+ if ( init_fn->exit )
+ init_fn->exit ();
+ }
+}