-#include "stdint.h"
-#include "stddef.h"
#include "registers.h"
-#include "string.h"
-#include "init.h"
#include "main.h"
#include "etherboot.h"
#include "hooks.h"
*
*/
-/*
- * arch_initialise(): perform any required initialisation such as
- * setting up the console device and relocating to high memory.
- *
- */
-void arch_initialise ( struct i386_all_regs *regs __unused ) {
- /* Zero the BSS */
- memset ( _bss, 0, _ebss - _bss );
-
- /* Call all registered initialisation functions.
- */
- call_init_fns ();
-}
-
/*
* arch_main() : call main() and then exit via whatever exit mechanism
* the prefix requested.
/* Call to main() */
regs->eax = main();
- /* Call registered per-object exit functions */
- call_exit_fns ();
-
if ( exit_path ) {
/* Prefix requested that we use a particular function
* as the exit path, so we call this function, which
#define RETURN_TO_EXTERNAL call kir_to_ext
#define ENTRY_POINT kir_call
#define ENTRY_POINT_REGISTER di
-#define INIT_FUNC arch_initialise
+#define INIT_FUNC initialise
#else /* KEEP_IT_REAL */
.code16
#define ENTRY_POINT _prot_call /* _prot_call = OFFSET ( prot_call ) in librm */
#define ENTRY_POINT_REGISTER di
-#define INIT_FUNC librm_arch_initialise
+#define INIT_FUNC initialise_via_librm
#endif /* KEEP_IT_REAL */
#define RETURN_TO_EXTERNAL call int_to_ext
#define ENTRY_POINT int_call
#define ENTRY_POINT_REGISTER edi
-#define INIT_FUNC arch_initialise
+#define INIT_FUNC initialise
.section ".text"
.code32
pop %es
mov $ENTRY_POINT, %ENTRY_POINT_REGISTER
- /* Far call to arch_initialise via the entry-point function.
- * arch_initialise() (or the entry-point function itself) may
+ /* Far call to initialise via the entry-point function.
+ * initialise() (or the entry-point function itself) may
* update %es:[e]di to point to a new entry-point function for
* subsequent calls. librm will use this facility, since
- * arch_initialise() causes librm to be relocated.
+ * initialise() causes librm to be relocated.
*/
pushl $INIT_FUNC
push %cs /* lcall %es:[x]di == %cs:[x]di */
#ifndef HOOKS_H
#define HOOKS_H
-extern void arch_initialise ( struct i386_all_regs *regs );
extern void arch_main ( struct i386_all_regs *regs );
#endif /* HOOKS_H */
POST_RELOC_FN ( POST_RELOC_LIBRM, librm_post_reloc );
/*
- * Wrapper for arch_initialise() when librm is being used. We have to
+ * Wrapper for initialise() when librm is being used. We have to
* install a copy of librm to allocated base memory and return the
* pointer to this new librm's entry point via es:di.
*
*/
-void librm_arch_initialise ( struct i386_all_regs *regs ) {
+void initialise_via_librm ( struct i386_all_regs *regs ) {
char *new_librm;
/* Hand off to arch_initialise() */
- arch_initialise ( regs );
+ initialise ( regs );
/* Uninstall current librm (i.e. the one that's part of the
* original, pre-relocation Etherboot image).
static int initialized;
+/**************************************************************************
+ * initialise() - perform any C-level initialisation
+ *
+ * This does not include initialising the NIC, but it does include
+ * e.g. getting the memory map, relocating to high memory,
+ * initialising the console, etc.
+ **************************************************************************
+ */
+void initialise ( void ) {
+ /* Zero the BSS */
+ memset ( _bss, 0, _ebss - _bss );
+
+ /* Call all registered initialisation functions.
+ */
+ call_init_fns ();
+}
+
/**************************************************************************
MAIN - Kick off routine
**************************************************************************/
state = main_loop(state);
}
/* arch_on_exit(exit_status) */
+
+ /* Call registered per-object exit functions */
+ call_exit_fns ();
+
return exit_status;
}