Separated out initialisation functions from startup/shutdown functions.

This commit is contained in:
Michael Brown
2007-07-03 23:09:56 +01:00
parent a5f33ea283
commit 89349d7fad
23 changed files with 241 additions and 196 deletions

View File

@@ -1,5 +1,5 @@
/**************************************************************************
Etherboot - Network Bootstrap Program
gPXE - Network Bootstrap Program
Literature dealing with the network protocols:
ARP - RFC826
@@ -14,42 +14,11 @@ Literature dealing with the network protocols:
**************************************************************************/
#include <gpxe/heap.h>
#include <gpxe/init.h>
#include <gpxe/process.h>
#include <gpxe/device.h>
#include <gpxe/shell.h>
#include <gpxe/shell_banner.h>
#include <gpxe/shutdown.h>
#include <gpxe/hidemem.h>
#include <usr/autoboot.h>
/**
* Start up Etherboot
*
* Call this function only once, before doing (almost) anything else.
*/
static void startup ( void ) {
init_heap();
init_processes();
hide_etherboot();
call_init_fns();
probe_devices();
}
/**
* Shut down Etherboot
*
* Call this function only once, before either exiting main() or
* starting up a non-returnable image.
*/
void shutdown ( void ) {
remove_devices();
call_exit_fns();
unhide_etherboot();
}
/**
* Main entry point
*
@@ -57,6 +26,7 @@ void shutdown ( void ) {
*/
int main ( void ) {
initialise();
startup();
/* Try autobooting if we're not going straight to the shell */