summaryrefslogtreecommitdiffhomepage
path: root/dev/kernel/HALKit/ARM64/Paging.h
diff options
context:
space:
mode:
authorAmlal <amlal@nekernel.org>2025-04-25 13:08:33 +0200
committerAmlal <amlal@nekernel.org>2025-04-25 13:08:33 +0200
commitfb790b07aeba8e22e4190cf3e1834d11ecde6c96 (patch)
tree4cec7d1b321307b1d5935577631dae116a658a37 /dev/kernel/HALKit/ARM64/Paging.h
parent63a2d92c5dfe976175cda024ec01905d11b43738 (diff)
dev: better .clang-format, ran format command.
Signed-off-by: Amlal <amlal@nekernel.org>
Diffstat (limited to 'dev/kernel/HALKit/ARM64/Paging.h')
-rw-r--r--dev/kernel/HALKit/ARM64/Paging.h151
1 files changed, 68 insertions, 83 deletions
diff --git a/dev/kernel/HALKit/ARM64/Paging.h b/dev/kernel/HALKit/ARM64/Paging.h
index 26c277db..e23c0538 100644
--- a/dev/kernel/HALKit/ARM64/Paging.h
+++ b/dev/kernel/HALKit/ARM64/Paging.h
@@ -1,6 +1,6 @@
/* -------------------------------------------
- Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved.
+ Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved.
------------------------------------------- */
@@ -8,7 +8,7 @@
/** ---------------------------------------------------
- * THIS FILE CONTAINS CODE FOR ARMV8 PAGING.
+ * THIS FILE CONTAINS CODE FOR ARMV8 PAGING.
------------------------------------------------------- */
@@ -16,105 +16,90 @@
#ifndef kPageMax
#define kPageMax (0x200)
-#endif //! kPageMax
+#endif //! kPageMax
#ifndef kPageAlign
#define kPageAlign (0x1000)
-#endif //! kPageAlign
+#endif //! kPageAlign
#ifndef kPageSize
#define kPageSize (0x1000)
-#endif // !kPageSize
+#endif // !kPageSize
//! short format address range
#define c16KBPage 0b000
-#define c8KBPage 0b001
-#define c4KBPage 0b010
-#define c2KBPage 0b011
-#define c1KBPage 0b100
+#define c8KBPage 0b001
+#define c4KBPage 0b010
+#define c2KBPage 0b011
+#define c1KBPage 0b100
#define c512BPage 0b101
#define c256BPage 0b110
#define c128BPage 0b111
/// Long format address range
-#define cPageMAll \
- { \
- 0b000, 0b000 \
- }
+#define cPageMAll \
+ { 0b000, 0b000 }
#define cPageMToMax(M) \
- { \
- M, 0b000 \
- }
+ { M, 0b000 }
#define cPageMaxToM(M) \
- { \
- 0b000, M \
- }
+ { 0b000, M }
#define cPageMToN(M, N) \
- { \
- M, N \
- }
-
-namespace Kernel::HAL
-{
- struct PACKED PTE_4KB final
- {
- UInt64 Valid : 1;
- UInt64 Table : 1;
- UInt64 AttrIndex : 3;
- UInt64 NS : 1;
- UInt64 AP : 2;
- UInt64 SH : 2;
- UInt64 AF : 1;
- UInt64 NG : 1;
- UInt64 Reserved1 : 1;
- UInt64 Contiguous : 1;
- UInt64 Dirty : 1;
- UInt64 Reserved : 2;
- UInt64 PhysicalAddress : 36;
- UInt64 Reserved3 : 4;
- UInt64 PXN : 1;
- UInt64 XN : 1;
- UInt64 Reserved4 : 9;
- };
-
- namespace Detail
- {
- enum class ControlRegisterBits
- {
- ProtectedModeEnable = 0,
- MonitorCoProcessor = 1,
- Emulation = 2,
- TaskSwitched = 3,
- ExtensionType = 4,
- NumericError = 5,
- WriteProtect = 16,
- AlignementMask = 18,
- NotWriteThrough = 29,
- CacheDisable = 30,
- PageEnable = 31,
- };
-
- inline UInt8 control_register_cast(ControlRegisterBits reg)
- {
- return static_cast<UInt8>(reg);
- }
- } // namespace Detail
-
- struct PDE_4KB final
- {
- PTE_4KB ALIGN(kPageAlign) fEntries[kPageMax];
- };
-
- auto mm_alloc_bitmap(Boolean wr, Boolean user, SizeT size, Bool is_page) -> VoidPtr;
- auto mm_free_bitmap(VoidPtr page_ptr) -> Bool;
-} // namespace Kernel::HAL
-
-namespace Kernel
-{
- typedef HAL::PTE_4KB PTE;
- typedef HAL::PDE_4KB PDE;
-} // namespace Kernel
+ { M, N }
+
+namespace Kernel::HAL {
+struct PACKED PTE_4KB final {
+ UInt64 Valid : 1;
+ UInt64 Table : 1;
+ UInt64 AttrIndex : 3;
+ UInt64 NS : 1;
+ UInt64 AP : 2;
+ UInt64 SH : 2;
+ UInt64 AF : 1;
+ UInt64 NG : 1;
+ UInt64 Reserved1 : 1;
+ UInt64 Contiguous : 1;
+ UInt64 Dirty : 1;
+ UInt64 Reserved : 2;
+ UInt64 PhysicalAddress : 36;
+ UInt64 Reserved3 : 4;
+ UInt64 PXN : 1;
+ UInt64 XN : 1;
+ UInt64 Reserved4 : 9;
+};
+
+namespace Detail {
+ enum class ControlRegisterBits {
+ ProtectedModeEnable = 0,
+ MonitorCoProcessor = 1,
+ Emulation = 2,
+ TaskSwitched = 3,
+ ExtensionType = 4,
+ NumericError = 5,
+ WriteProtect = 16,
+ AlignementMask = 18,
+ NotWriteThrough = 29,
+ CacheDisable = 30,
+ PageEnable = 31,
+ };
+
+ inline UInt8 control_register_cast(ControlRegisterBits reg) {
+ return static_cast<UInt8>(reg);
+ }
+} // namespace Detail
+
+struct PDE_4KB final {
+ PTE_4KB ALIGN(kPageAlign) fEntries[kPageMax];
+};
+
+auto mm_alloc_bitmap(Boolean wr, Boolean user, SizeT size, Bool is_page) -> VoidPtr;
+auto mm_free_bitmap(VoidPtr page_ptr) -> Bool;
+} // namespace Kernel::HAL
+
+namespace Kernel {
+typedef HAL::PTE_4KB PTE;
+typedef HAL::PDE_4KB PDE;
+} // namespace Kernel
EXTERN_C void hal_flush_tlb();