You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #include "stdint.h"
  2. #include "stddef.h"
  3. #include "registers.h"
  4. #include "string.h"
  5. #include "init.h"
  6. #include "main.h"
  7. #include "etherboot.h"
  8. #include "hooks.h"
  9. /* Symbols defined by the linker */
  10. extern char _bss[], _ebss[];
  11. /*
  12. * This file provides the basic entry points from assembly code. See
  13. * README.i386 for a description of the entry code path.
  14. *
  15. */
  16. /*
  17. * arch_initialise(): perform any required initialisation such as
  18. * setting up the console device and relocating to high memory.
  19. *
  20. */
  21. void arch_initialise ( struct i386_all_regs *regs __unused ) {
  22. /* Zero the BSS */
  23. memset ( _bss, 0, _ebss - _bss );
  24. /* Call all registered initialisation functions.
  25. */
  26. call_init_fns ();
  27. }
  28. /*
  29. * arch_main() : call main() and then exit via whatever exit mechanism
  30. * the prefix requested.
  31. *
  32. */
  33. void arch_main ( struct i386_all_regs *regs ) {
  34. void (*exit_path) ( struct i386_all_regs *regs );
  35. /* Determine exit path requested by prefix */
  36. exit_path = ( typeof ( exit_path ) ) regs->eax;
  37. /* Call to main() */
  38. regs->eax = main();
  39. /* Call registered per-object exit functions */
  40. call_exit_fns ();
  41. if ( exit_path ) {
  42. /* Prefix requested that we use a particular function
  43. * as the exit path, so we call this function, which
  44. * must not return.
  45. */
  46. exit_path ( regs );
  47. }
  48. }