From b6ce3a41fb53eabc6fde12c13f598d228435642a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matteo=20Gm=C3=BCr?= Date: Sat, 19 Oct 2024 11:25:08 +0000 Subject: Adjust memory_area structure to grub2 code --- arch/x86_64/include/arch/memory/multiboot.hpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/arch/x86_64/include/arch/memory/multiboot.hpp b/arch/x86_64/include/arch/memory/multiboot.hpp index 9cca8bc..8ecb1b5 100644 --- a/arch/x86_64/include/arch/memory/multiboot.hpp +++ b/arch/x86_64/include/arch/memory/multiboot.hpp @@ -81,14 +81,24 @@ namespace teachos::arch::memory }; /** - * @brief Defines an entry in the entries array of the memory_map struct. + * @brief Defines an entry in the entries array of the memory_map struct. Has to have all padding stripped between the + * individual values, because the size of the entry needs to be exactly 24 bytes and not one byte more. See + * https://www.gnu.org/software/c-intro-and-ref/manual/html_node/Packed-Structures.html for more information on the + * used attribute. */ - struct memory_area + struct __attribute__((packed)) memory_area { + uint32_t size; ///< TODO: Not clear what exactly the size signifies uint64_t base_address; ///< Base address the memory region starts at uint64_t area_length; ///< Size of the memory region, added to base_address results in the final address - alignas(8) memory_area_type type; ///< Specific type of memory the region can contain + memory_area_type type; ///< Specific type of memory the region can contain }; + /*struct memory_area + { + uint64_t base_address; ///< Base address the memory region starts at + uint64_t area_length; ///< Size of the memory region, added to base_address results in the final address + memory_area_type type; ///< Specific type of memory the region can contain + };*/ /** * @brief Defines an entry in the multi_boot_tag array of the multi_boot_info struct, of type -- cgit v1.2.3