aboutsummaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorMatteo Gmür <matteo.gmuer1@ost.ch>2024-10-15 08:51:32 +0000
committerMatteo Gmür <matteo.gmuer1@ost.ch>2024-10-15 08:51:32 +0000
commit8524564b240d9859655603d1fb3717faf3cf558c (patch)
treea15f594721c12c84cadc9ed9ee27bed414f3c40a /arch
parent11f9c91e602bd0231e6bc402418dedf445e47402 (diff)
downloadteachos-8524564b240d9859655603d1fb3717faf3cf558c.tar.xz
teachos-8524564b240d9859655603d1fb3717faf3cf558c.zip
Fix problems with calculations inside enum (uses int32_t by default)
Diffstat (limited to 'arch')
-rw-r--r--arch/x86_64/include/arch/memory/multiboot.hpp39
-rw-r--r--arch/x86_64/include/arch/memory/paging.hpp26
2 files changed, 33 insertions, 32 deletions
diff --git a/arch/x86_64/include/arch/memory/multiboot.hpp b/arch/x86_64/include/arch/memory/multiboot.hpp
index 6fc10df..c070e85 100644
--- a/arch/x86_64/include/arch/memory/multiboot.hpp
+++ b/arch/x86_64/include/arch/memory/multiboot.hpp
@@ -138,28 +138,29 @@ namespace teachos::arch::memory
*/
enum bitset : uint32_t
{
- WRITABLE = 1 << 0, ///< (SHF_WRITE) Section is writable at runtime. If it isn't then the section
- ///< is assumed to be READONLY and only that flag is shown in the objdump.
- OCCUPIES_MEMORY = 1 << 1, ///< (SHF_ALLOC) Section occupies memory during execution.
- ///< ALLOC flag is shown in the objdump.
- EXECUTABLE_CODE = 1 << 2, ///< (SHF_EXECINSTR) Section is executable. CODE flag is shown in the object dump.
- DUPLICATE_DATA = 1 << 4, ///< (SHF_MERGE) Section might be merged with another section.
- CONTAINS_STRING = 1 << 5, ///< (SHF_STRINGS) Section contains null-terminated strings.
+ WRITABLE = 1U << 0U, ///< (SHF_WRITE) Section is writable at runtime. If it isn't then the section
+ ///< is assumed to be READONLY and only that flag is shown in the objdump.
+ OCCUPIES_MEMORY = 1U << 1U, ///< (SHF_ALLOC) Section occupies memory during execution.
+ ///< ALLOC flag is shown in the objdump.
+ EXECUTABLE_CODE = 1U << 2U, ///< (SHF_EXECINSTR) Section is executable. CODE flag is shown in the object dump.
+ DUPLICATE_DATA = 1U << 4U, ///< (SHF_MERGE) Section might be merged with another section.
+ CONTAINS_STRING = 1U << 5U, ///< (SHF_STRINGS) Section contains null-terminated strings.
SECTION_HEADER_INFO_IS_SECTION_HEADER_TABLE_INDEX =
- 1 << 6, ///< (SHF_INFO_LINK) Section contains the section header table index in the (sh_info)
- ///< additional_information variable.
+ 1U << 6U, ///< (SHF_INFO_LINK) Section contains the section header table index in the (sh_info)
+ ///< additional_information variable.
PRESERVE_ORDERING_AFTER_COMBINATION =
- 1 << 7, ///< (SHF_LINK_ORDER) Section preserves order after combining with another section.
+ 1U << 7U, ///< (SHF_LINK_ORDER) Section preserves order after combining with another section.
REQUIRES_SPECIAL_OS_PROCESSING =
- 1 << 8, ///< (SHF_OS_NONCONFORMING) Section requires non-standard OS specific handling of its code or
- ///< data, which does not confirm to standard ELF specifications.
- SECTION_GROUP_MEMBER = 1 << 9, ///< (SHF_GROUP) Section is a member of a section group.
- HOLDS_THREAD_LOCAL_DATA = 1 << 10, ///< (SHF_TLS) Section holds thread-local data.
- COMPRESSED = 1 << 11, ///< (SHF_COMPRESSED) Section contains compressed data.
- SPECIAL_ORDERING_REQUIREMENTS = 1 << 30, ///< (SHF_ORDERED) Section has special ordering requirements, meaning it
- ///< should be ordered in relation to other sections of the same type
- EXCLUDED_UNLESS_REFERENCED_OR_ALLOCATED = 1 << 31, ///< (SHF_EXCLUDE)Section is excluded unless referenced or
- ///< allocated, used for LTO (Link-Time Optimizations)
+ 1U << 8U, ///< (SHF_OS_NONCONFORMING) Section requires non-standard OS specific handling of its code or
+ ///< data, which does not confirm to standard ELF specifications.
+ SECTION_GROUP_MEMBER = 1U << 9U, ///< (SHF_GROUP) Section is a member of a section group.
+ HOLDS_THREAD_LOCAL_DATA = 1U << 10U, ///< (SHF_TLS) Section holds thread-local data.
+ COMPRESSED = 1U << 11U, ///< (SHF_COMPRESSED) Section contains compressed data.
+ SPECIAL_ORDERING_REQUIREMENTS =
+ 1U << 30U, ///< (SHF_ORDERED) Section has special ordering requirements, meaning it
+ ///< should be ordered in relation to other sections of the same type
+ EXCLUDED_UNLESS_REFERENCED_OR_ALLOCATED = 1U << 31U, ///< (SHF_EXCLUDE)Section is excluded unless referenced or
+ ///< allocated, used for LTO (Link-Time Optimizations)
};
/**
diff --git a/arch/x86_64/include/arch/memory/paging.hpp b/arch/x86_64/include/arch/memory/paging.hpp
index aa20da7..25246f6 100644
--- a/arch/x86_64/include/arch/memory/paging.hpp
+++ b/arch/x86_64/include/arch/memory/paging.hpp
@@ -35,20 +35,20 @@ namespace teachos::arch::memory
*/
enum bitset : uint64_t
{
- PRESENT = 1 << 0, ///< Page is in memory and therefore present.
- ///< is assumed to be READONLY and only that flag is shown in the objdump.
- WRITABLE = 1 << 1, ///< It is possible to write to the page.
- USER_ACCESIBLE = 1 << 2, ///< Page can be accessed in user mode instead of only in kernel mode code.
- WRITE_THROUGH_CACHING = 1 << 3, ///< Write to the page go directly to memory instead of the cache.
- DISABLED_CACHING = 1 << 4, ///< Page uses caching.
- ACCESSED = 1 << 5, ///< Page is currently in use.
- DIRTY = 1 << 6, ///< Page has been writen too.
- HUGE_PAGE = 1 << 7, ///< Page is huge (2 MiB page size in P2 page table and 1 GiB in P3 page table,
- ///< instead of 4 KiB). Has to be false for P1 and P4 page tables.
- GLOBAL = 1 << 8, ///< Page is not flushed from caches on address space switches (PGE bit of CR4 register
- ///< has to be set)
+ 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.
+ 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.
+ DIRTY = 1UL << 6UL, ///< Page has been writen too.
+ HUGE_PAGE = 1UL << 7UL, ///< Page is huge (2 MiB page size in P2 page table and 1 GiB in P3 page table,
+ ///< instead of 4 KiB). Has to be false for P1 and P4 page tables.
+ GLOBAL = 1UL << 8UL, ///< Page is not flushed from caches on address space switches (PGE bit of CR4 register
+ ///< has to be set)
EXECUTING_CODE_FORBIDDEN =
- 1 << 63, ///< Page is forbidden from executing code (NXE bit in the EFER register has to be set)
+ 1UL << 63UL, ///< Page is forbidden from executing code (NXE bit in the EFER register has to be set)
};
/**