Xyris  0.5
Loader.cpp
Go to the documentation of this file.
1 /**
2  * @file loader.cpp
3  * @author Keeton Feavel ([email protected])
4  * @brief Bootloader agnostic pre-kernel initialization
5  * @version 0.1
6  * @date 2021-12-15
7  *
8  * @copyright Copyright the Xyris Contributors (c) 2021
9  *
10  */
11 #include <Arch/Arch.hpp>
14 #include <Panic.hpp>
15 #include <Support/sections.hpp>
16 
17 /**
18  * @brief Bootloader agnostic pre-kernel entry initialization. Stage2 should not
19  * access any bootloader information and should only perform bootloader agnostic
20  * tasks before entering the kernel proper.
21  *
22  */
23 extern "C" void stage2Entry(void* info, uint32_t magic)
24 {
25  // Call global constructors
26  _init();
27  // Enter the high-level kernel
28  kernelEntry(info, magic);
29  // Call global destructors
30  _fini();
31  // By this point the kernel should have full execution
32  // So, this should never be called unless the kernel returns
33  panic("Execution returned to stage2!");
34 }
crti.h
C/C++ runtime initialization & teardown. See crti.s and crtn.s for details https://wiki....
kernelEntry
void kernelEntry(void *info, uint32_t magic)
Kernel entry point. Performs all kernel initialization and starts the init process(es)....
Definition: Entry.cpp:82
_init
void _init()
Global constructor.
Loader.hpp
Arch.hpp
Architecture control and initialization.
_fini
void _fini()
Global destructor.
Panic.hpp
Kernel panic management.
sections.hpp
Kernel ELF section definitions.
panic
void panic(const char *msg)
Halt the system and print the provided message on the panic screen.
Definition: Panic.cpp:82
stage2Entry
void stage2Entry(void *info, uint32_t magic)
Bootloader agnostic pre-kernel entry initialization. Stage2 should not access any bootloader informat...
Definition: Loader.cpp:23