aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64
diff options
context:
space:
mode:
authorMatteo Gmür <matteo.gmuer1@ost.ch>2024-10-14 12:42:54 +0000
committerMatteo Gmür <matteo.gmuer1@ost.ch>2024-10-14 12:42:54 +0000
commit563a3dcbc1f2d26adcd6761358c45d635738f3c5 (patch)
treef4edcffe27cff74c4c3877bcfff7ccb1b7785af2 /arch/x86_64
parente9dd8ea4343b943032f2af87fbae9f46fe1f9328 (diff)
downloadteachos-563a3dcbc1f2d26adcd6761358c45d635738f3c5.tar.xz
teachos-563a3dcbc1f2d26adcd6761358c45d635738f3c5.zip
Add more info on which elf flag means which objdump flag
Diffstat (limited to 'arch/x86_64')
-rw-r--r--arch/x86_64/include/arch/memory/multiboot.hpp8
-rw-r--r--arch/x86_64/src/kernel/main.cpp23
2 files changed, 28 insertions, 3 deletions
diff --git a/arch/x86_64/include/arch/memory/multiboot.hpp b/arch/x86_64/include/arch/memory/multiboot.hpp
index 3aee7fc..35b483e 100644
--- a/arch/x86_64/include/arch/memory/multiboot.hpp
+++ b/arch/x86_64/include/arch/memory/multiboot.hpp
@@ -147,7 +147,7 @@ namespace teachos::arch::memory
/**
* @brief (SHF_WRITE) Wether the current section is writable at runtime or not. If it isn't then the section is
- * assumed to be READONLY and only that behaviour is shown in the objdump -h of the kernel file. Read from bit index
+ * assumed to be READONLY and only that flag is shown in the objdump -h of the kernel file. Read from bit index
* 0.
*
* @return Current section is writable.
@@ -155,14 +155,16 @@ namespace teachos::arch::memory
auto writeable() const -> bool;
/**
- * @brief (SHF_ALLOC) Whether the current section occupies memory during execution or not. Read from bit index 1.
+ * @brief (SHF_ALLOC) Whether the current section occupies memory during execution or not. ALLOC flag is shown in
+ * the objdump -h of the kernel file. Read from bit index 1.
*
* @return Current section occupies memory during execution.
*/
auto occupies_memory() const -> bool;
/**
- * @brief (SHF_EXECINSTR) Whether the current section is executable or not. Read from bit index 2.
+ * @brief (SHF_EXECINSTR) Whether the current section is executable or not. CODE flag is shown in the object dump.
+ * Read from bit index 2.
*
* @return Current section is executable.
*/
diff --git a/arch/x86_64/src/kernel/main.cpp b/arch/x86_64/src/kernel/main.cpp
index 106ca2a..bdf530c 100644
--- a/arch/x86_64/src/kernel/main.cpp
+++ b/arch/x86_64/src/kernel/main.cpp
@@ -63,6 +63,29 @@ namespace teachos::arch::kernel
for (auto section = begin; section != end; ++section)
{
+ bool const writeable = section->flags.writeable();
+ bool const occupies_memory = section->flags.occupies_memory();
+ bool const is_executable = section->flags.is_executable();
+ bool const contains_duplicate_data = section->flags.contains_duplicate_data();
+ bool const contains_strings = section->flags.contains_strings();
+ bool const section_header_info_is_section_header_table_index =
+ section->flags.section_header_info_is_section_header_table_index();
+ bool const preserve_ordering_after_combination = section->flags.preserve_ordering_after_combination();
+ bool const requires_special_os_processing = section->flags.requires_special_os_processing();
+ bool const is_section_group_member = section->flags.is_section_group_member();
+ bool const holds_thread_local_data = section->flags.holds_thread_local_data();
+ bool const is_compressed = section->flags.is_compressed();
+ bool const has_special_ordering_requirements = section->flags.has_special_ordering_requirements();
+ bool const is_excluded_unless_referenced_or_allocated =
+ section->flags.is_excluded_unless_referenced_or_allocated();
+
+ if (writeable && occupies_memory && is_executable && contains_duplicate_data && contains_strings &&
+ section_header_info_is_section_header_table_index && preserve_ordering_after_combination &&
+ requires_special_os_processing && is_section_group_member && holds_thread_local_data && is_compressed &&
+ has_special_ordering_requirements && is_excluded_unless_referenced_or_allocated)
+ {
+ }
+
switch (section->type)
{
case arch::memory::elf_section_type::PROGRAMM: {