aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/src/memory
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86_64/src/memory')
-rw-r--r--arch/x86_64/src/memory/multiboot.cpp36
-rw-r--r--arch/x86_64/src/memory/paging.cpp7
2 files changed, 7 insertions, 36 deletions
diff --git a/arch/x86_64/src/memory/multiboot.cpp b/arch/x86_64/src/memory/multiboot.cpp
index bd3b00b..b0432a9 100644
--- a/arch/x86_64/src/memory/multiboot.cpp
+++ b/arch/x86_64/src/memory/multiboot.cpp
@@ -2,40 +2,12 @@
namespace teachos::arch::memory
{
- auto elf_section_flags::writable() const -> bool { return is_bit_set(0U); }
-
- auto elf_section_flags::occupies_memory() const -> bool { return is_bit_set(1U); }
-
- auto elf_section_flags::is_executable() const -> bool { return is_bit_set(2U); }
-
- auto elf_section_flags::contains_duplicate_data() const -> bool { return is_bit_set(4U); }
-
- auto elf_section_flags::contains_strings() const -> bool { return is_bit_set(5U); }
-
- auto elf_section_flags::section_header_info_is_section_header_table_index() const -> bool { return is_bit_set(6U); }
-
- auto elf_section_flags::preserve_ordering_after_combination() const -> bool { return is_bit_set(7U); }
-
- auto elf_section_flags::requires_special_os_processing() const -> bool { return is_bit_set(8U); }
-
- auto elf_section_flags::is_section_group_member() const -> bool { return is_bit_set(9U); }
-
- auto elf_section_flags::holds_thread_local_data() const -> bool { return is_bit_set(10U); }
-
- auto elf_section_flags::is_compressed() const -> bool { return is_bit_set(11U); }
-
- auto elf_section_flags::has_special_ordering_requirements() const -> bool { return is_bit_set(30U); }
-
- auto elf_section_flags::is_excluded_unless_referenced_or_allocated() const -> bool { return is_bit_set(31U); }
-
- auto elf_section_flags::operator==(elf_section_flags const & other) const -> bool { return flags == other.flags; }
-
- auto elf_section_flags::is_bit_set(uint8_t index) const -> bool { return flags[index] == 1U; }
+ auto elf_section_flags::contains_flags(std::bitset<64U> b) const -> bool { return (flags & b) == b; }
auto elf_section_header::is_null() const -> bool
{
- return name_table_index == 0U && type == elf_section_type::INACTIVE &&
- flags == teachos::arch::memory::elf_section_flags{0U} && virtual_address == 0U && file_offset == 0U &&
- additional_information == 0U && address_alignment == 0U && fixed_table_entry_size == 0U;
+ return name_table_index == 0U && type == elf_section_type::INACTIVE && flags == elf_section_flags(0U) &&
+ virtual_address == 0U && file_offset == 0U && additional_information == 0U && address_alignment == 0U &&
+ fixed_table_entry_size == 0U;
}
} // namespace teachos::arch::memory
diff --git a/arch/x86_64/src/memory/paging.cpp b/arch/x86_64/src/memory/paging.cpp
index 58a2b99..6fef339 100644
--- a/arch/x86_64/src/memory/paging.cpp
+++ b/arch/x86_64/src/memory/paging.cpp
@@ -31,15 +31,15 @@ namespace teachos::arch::memory
return value;
}
- auto entry::set(physical_frame frame) -> void
+ auto entry::contains_flags(std::bitset<64U> b) const -> bool { return (flags & b) == b; }
+
+ auto entry::set_address(physical_frame frame) -> void
{
arch::exception_handling::assert((frame.start_address() & ~0x000fffff'fffff000) == 0,
"Start address is not aligned with Page");
flags = std::bitset<64U>(frame.start_address()) | flags;
}
- auto entry::contains_flags(std::bitset<64U> b) const -> bool { return (flags & b) == b; }
-
auto page_table::zero_entries() -> void
{
auto begin = &entries[0];
@@ -50,5 +50,4 @@ namespace teachos::arch::memory
entry->set_unused();
}
}
-
} // namespace teachos::arch::memory