2
0
mirror of https://github.com/xcat2/xNBA.git synced 2024-12-14 15:21:32 +00:00

arch_initialise() is now sufficiently generic that we may as well just

call it initialise() and place it in main.c.  :)
This commit is contained in:
Michael Brown 2005-04-10 18:30:34 +00:00
parent 997b51c1e6
commit 87508aa0b2
5 changed files with 30 additions and 31 deletions

View File

@ -1,8 +1,4 @@
#include "stdint.h"
#include "stddef.h"
#include "registers.h"
#include "string.h"
#include "init.h"
#include "main.h"
#include "etherboot.h"
#include "hooks.h"
@ -16,20 +12,6 @@ extern char _bss[], _ebss[];
*
*/
/*
* 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.
@ -44,9 +26,6 @@ void arch_main ( struct i386_all_regs *regs ) {
/* 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

View File

@ -40,7 +40,7 @@
#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 */
@ -53,7 +53,7 @@
.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 */
@ -78,7 +78,7 @@ setup16:
#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
@ -142,11 +142,11 @@ setup:
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 */

View File

@ -1,7 +1,6 @@
#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 */

View File

@ -126,16 +126,16 @@ INIT_FN ( INIT_LIBRM, librm_init, NULL, uninstall_librm );
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).

View File

@ -138,6 +138,23 @@ static int exit_status;
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
**************************************************************************/
@ -164,6 +181,10 @@ int main ( void ) {
state = main_loop(state);
}
/* arch_on_exit(exit_status) */
/* Call registered per-object exit functions */
call_exit_fns ();
return exit_status;
}