aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/include
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86_64/include')
-rw-r--r--arch/x86_64/include/arch/memory/multiboot.hpp46
1 files changed, 31 insertions, 15 deletions
diff --git a/arch/x86_64/include/arch/memory/multiboot.hpp b/arch/x86_64/include/arch/memory/multiboot.hpp
index 37b10f0..f6ff480 100644
--- a/arch/x86_64/include/arch/memory/multiboot.hpp
+++ b/arch/x86_64/include/arch/memory/multiboot.hpp
@@ -124,40 +124,43 @@ namespace teachos::arch::memory
// Nothing to do
}
- auto writeable() -> bool { return is_bit_set(0); }
+ auto writeable() const -> bool { return is_bit_set(0); }
- auto occupies_memory() -> bool { return is_bit_set(1); }
+ auto occupies_memory() const -> bool { return is_bit_set(1); }
- auto is_executable() -> bool { return is_bit_set(2); }
+ auto is_executable() const -> bool { return is_bit_set(2); }
- auto contains_duplicate_data() -> bool { return is_bit_set(4); }
+ auto contains_duplicate_data() const -> bool { return is_bit_set(4); }
- auto contains_strings() -> bool { return is_bit_set(5); }
+ auto contains_strings() const -> bool { return is_bit_set(5); }
- auto section_header_info_is_section_header_table_index() -> bool { return is_bit_set(6); }
+ auto section_header_info_is_section_header_table_index() const -> bool { return is_bit_set(6); }
- auto preserve_ordering_after_combination() -> bool { return is_bit_set(7); }
+ auto preserve_ordering_after_combination() const -> bool { return is_bit_set(7); }
- auto requires_special_os_processing() -> bool { return is_bit_set(8); }
+ auto requires_special_os_processing() const -> bool { return is_bit_set(8); }
- auto is_section_group_member() -> bool { return is_bit_set(9); }
+ auto is_section_group_member() const -> bool { return is_bit_set(9); }
- auto holds_thread_local_data() -> bool { return is_bit_set(10); }
+ auto holds_thread_local_data() const -> bool { return is_bit_set(10); }
- auto is_compressed() -> bool { return is_bit_set(11); }
+ auto is_compressed() const -> bool { return is_bit_set(11); }
- auto has_special_ordering_requirements() -> bool { return is_bit_set(30); }
+ auto has_special_ordering_requirements() const -> bool { return is_bit_set(30); }
- auto is_excluded_unless_referenced_or_allocated() -> bool { return is_bit_set(31); }
+ auto is_excluded_unless_referenced_or_allocated() const -> bool { return is_bit_set(31); }
+
+ auto operator==(elf_section_flags const & other) const -> bool { return flags == other.flags; }
private:
- auto is_bit_set(uint8_t index) -> bool { return flags[index] == 1; }
+ auto is_bit_set(uint8_t index) const -> bool { return flags[index] == 1; }
std::bitset<64U> flags;
};
/**
- * https://docs.oracle.com/cd/E19455-01/806-3773/elf-2/index.html
+ * @brief Defines the data included in a section header, where each section has exactly one section header.
+ * See https://refspecs.linuxbase.org/elf/gabi4+/ch4.sheader.html for more information
*/
struct elf_section_header
{
@@ -171,6 +174,19 @@ namespace teachos::arch::memory
uint32_t additional_information;
uint64_t address_alignment;
uint64_t fixed_table_entry_size;
+
+ /**
+ * @brief Detect whether e section header is inactive or not, should always be the case for the first entry in the
+ * sections table
+ * @return Whether the current section header is actually null or not, requires all fields besides section_size and
+ * other_section to actually contain 0
+ */
+ auto is_null() const -> bool
+ {
+ return name_table_index == 0U && type == elf_section_type::UNSPECIFIED && flags == 0U && virtual_address == 0U &&
+ file_offset == 0U && additional_information == 0U && address_alignment == 0U &&
+ fixed_table_entry_size == 0U;
+ }
};
/**