aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86_64')
-rw-r--r--arch/x86_64/include/arch/memory/paging/page_entry.hpp2
-rw-r--r--arch/x86_64/src/memory/paging/page_entry.cpp11
2 files changed, 10 insertions, 3 deletions
diff --git a/arch/x86_64/include/arch/memory/paging/page_entry.hpp b/arch/x86_64/include/arch/memory/paging/page_entry.hpp
index 1de31b5..ef4fe61 100644
--- a/arch/x86_64/include/arch/memory/paging/page_entry.hpp
+++ b/arch/x86_64/include/arch/memory/paging/page_entry.hpp
@@ -22,7 +22,7 @@ namespace teachos::arch::memory::paging
PRESENT = 1UL << 0UL, ///< Page is in memory and therefore present.
///< is assumed to be READONLY and only that flag is shown in the objdump.
WRITABLE = 1UL << 1UL, ///< It is possible to write to the page.
- USER_ACCESIBLE = 1UL << 2UL, ///< Page can be accessed in user mode instead of only in kernel mode code.
+ USER_ACCESSIBLE = 1UL << 2UL, ///< Page can be accessed in user mode instead of only in kernel mode code.
WRITE_THROUGH_CACHING = 1UL << 3UL, ///< Write to the page go directly to memory instead of the cache.
DISABLED_CACHING = 1UL << 4UL, ///< Page uses caching.
ACCESSED = 1UL << 5UL, ///< Page is currently in use.
diff --git a/arch/x86_64/src/memory/paging/page_entry.cpp b/arch/x86_64/src/memory/paging/page_entry.cpp
index 5aa0982..3a0f03f 100644
--- a/arch/x86_64/src/memory/paging/page_entry.cpp
+++ b/arch/x86_64/src/memory/paging/page_entry.cpp
@@ -10,7 +10,7 @@ namespace teachos::arch::memory::paging
} // namespace
entry::entry(uint64_t flags)
- : flags(flags)
+ : flags(flags | entry::USER_ACCESSIBLE) // TODO: Temporarily make all entries user accessible
{
// Nothing to do.
}
@@ -21,14 +21,19 @@ namespace teachos::arch::memory::paging
{
flags |= entry::PRESENT;
}
+
if (elf_flags.contains_flags(multiboot::elf_section_flags::WRITABLE))
{
flags |= entry::WRITABLE;
}
+
if (!elf_flags.contains_flags(multiboot::elf_section_flags::EXECUTABLE_CODE))
{
flags |= entry::EXECUTING_CODE_FORBIDDEN;
}
+
+ // TODO: Temporarily make all entries user accessible
+ flags |= entry::USER_ACCESSIBLE;
}
auto entry::is_unused() const -> bool { return flags == 0U; }
@@ -51,7 +56,9 @@ namespace teachos::arch::memory::paging
{
exception_handling::assert((frame.start_address() & ~PHYSICAL_ADDRESS_MASK) == 0,
"[Paging Entry] Start address is not aligned with page");
- flags = frame.start_address() | additional_flags.to_ulong();
+
+ // TODO: Temporarily make all entries user accessible
+ flags = frame.start_address() | additional_flags.to_ulong() | entry::USER_ACCESSIBLE;
}
auto entry::get_flags() const -> std::bitset<64U> { return flags.to_ulong() & ~PHYSICAL_ADDRESS_MASK; }