From ef15019757681d34cb2de906973956f28aeb05a8 Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Sat, 9 Apr 2016 13:30:18 -0400 Subject: [PATCH] Move StartupInformation struct to its own file --- src/Kernel.hh | 15 +------------ src/SConscript | 1 + src/StartupInformation.cc | 24 +++++++++++++++++++++ src/StartupInformation.hh | 45 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 71 insertions(+), 14 deletions(-) create mode 100644 src/StartupInformation.cc create mode 100644 src/StartupInformation.hh diff --git a/src/Kernel.hh b/src/Kernel.hh index 08d6f87..d28df14 100644 --- a/src/Kernel.hh +++ b/src/Kernel.hh @@ -12,26 +12,13 @@ #include "Attributes.hh" #include "Console.hh" #include "Multiboot.hh" +#include "StartupInformation.hh" #include "kstd/Types.hh" #include "memory/Memory.hh" namespace kernel { -/** Collection of useful tidbits for setting up the system. */ -struct StartupInformation -{ - /** Starting address of the kernel. */ - u32 kernelStart; - /** Ending address (the first address *after* the last) of the kernel. */ - u32 kernelEnd; - /** Multiboot's magic value. This should be verified. */ - u32 multibootMagic; - /** Pointer to the multiboot information struct. */ - multiboot::Information* multibootInformation; -}; - - /** The kernel itself. */ struct Kernel { diff --git a/src/SConscript b/src/SConscript index e6f9c09..4717c72 100644 --- a/src/SConscript +++ b/src/SConscript @@ -15,6 +15,7 @@ files = [ 'Interrupts.cc', 'Kernel.cc', 'Multiboot.cc', + 'StartupInformation.cc', 'PIC.cc', 'cxa.cc', 'isr.S', diff --git a/src/StartupInformation.cc b/src/StartupInformation.cc new file mode 100644 index 0000000..5357f36 --- /dev/null +++ b/src/StartupInformation.cc @@ -0,0 +1,24 @@ +/* StartupInformation.cc + * vim: set tw=80: + * Eryn Wells + */ +/** + * Definition of the StartupInformation struct. + */ + +#include "StartupInformation.hh" + +namespace kernel { + +/* + * Public + */ + +u32 +StartupInformation::kernelSize() + const +{ + return kernelEnd - kernelStart; +} + +} /* namespace kernel */ diff --git a/src/StartupInformation.hh b/src/StartupInformation.hh new file mode 100644 index 0000000..77ea7af --- /dev/null +++ b/src/StartupInformation.hh @@ -0,0 +1,45 @@ +/* StartupInformation.hh + * vim: set tw=80: + * Eryn Wells + */ +/** + * Declaration of the StartupInformation struct. + */ + +#ifndef __STARTUPINFORMATION_HH__ +#define __STARTUPINFORMATION_HH__ + +#include "Multiboot.hh" +#include "kstd/Types.hh" + + +namespace kernel { + +/** Collection of useful tidbits for setting up the system. */ +struct StartupInformation +{ + /** Starting address of the kernel. 4K aligned. */ + u32 kernelStart; + /** Ending address (the first valid address *after* the last) of the kernel. 4K aligned. */ + u32 kernelEnd; + + /** + * @defgroup Memory + * @{ + */ + /** System page size in bytes. */ + u32 pageSize; + /** @} */ + + /** Multiboot's magic value. This should be verified. */ + u32 multibootMagic; + /** Pointer to the multiboot information struct. */ + multiboot::Information* multibootInformation; + + /** Size of the kernel image in bytes. */ + u32 kernelSize() const; +}; + +} /* namespace kernel */ + +#endif /* __STARTUPINFORMATION_HH__ */