diff options
| author | Amlal <amlal@el-mahrouss-logic.com> | 2024-09-24 06:57:42 +0200 |
|---|---|---|
| committer | Amlal <amlal@el-mahrouss-logic.com> | 2024-09-24 06:58:12 +0200 |
| commit | 4b4fe020a328e991ffd15ae475ad7a5d38f097a5 (patch) | |
| tree | 990a0f03c13bb0878c00e8ec1d6f9c259ecb64a0 /dev/zka | |
| parent | 107b2b9cad2b2502c3eebc0a77013edde2551257 (diff) | |
IMP: Working on Paging API...
FIX: Fixed the path of filesystem's ESP.
Signed-off-by: Amlal <amlal@el-mahrouss-logic.com>
Diffstat (limited to 'dev/zka')
| -rw-r--r-- | dev/zka/HALKit/AMD64/HalCPU.cxx (renamed from dev/zka/HALKit/AMD64/HalCommAPI.cxx) | 19 | ||||
| -rw-r--r-- | dev/zka/HALKit/AMD64/HalPaging.cxx | 75 | ||||
| -rw-r--r-- | dev/zka/KernelKit/Heap.hxx | 2 |
3 files changed, 78 insertions, 18 deletions
diff --git a/dev/zka/HALKit/AMD64/HalCommAPI.cxx b/dev/zka/HALKit/AMD64/HalCPU.cxx index 11c442b4..0af8a921 100644 --- a/dev/zka/HALKit/AMD64/HalCommAPI.cxx +++ b/dev/zka/HALKit/AMD64/HalCPU.cxx @@ -2,7 +2,7 @@ Copyright ZKA Technologies. - File: HalProcessor.cxx + File: HalCPU.cxx Purpose: Platform processor routines. ------------------------------------------- */ @@ -11,27 +11,12 @@ #include <HALKit/AMD64/Processor.hxx> /** - * @file HalCommAPI.cxx + * @file HalCPU.cxx * @brief CPU Common API. */ -#define PhysShift36(ADDR) ((UInt64)ADDR >> 12) - namespace Kernel::HAL { - /// @brief Maps or allocates a page from virt_addr. - /// @param virt_addr a valid virtual address. - /// @param phys_addr point to physical address. - /// @param flags the flags to put on the page. - /// @return Status code of page manip. - EXTERN_C Int32 mm_map_page(VoidPtr virt_addr, UInt32 flags) - { - ZKA_UNUSED(virt_addr); - ZKA_UNUSED(flags); - - return 0; - } - Void Out8(UInt16 port, UInt8 value) { asm volatile("outb %%al, %1" diff --git a/dev/zka/HALKit/AMD64/HalPaging.cxx b/dev/zka/HALKit/AMD64/HalPaging.cxx new file mode 100644 index 00000000..ac8b1a73 --- /dev/null +++ b/dev/zka/HALKit/AMD64/HalPaging.cxx @@ -0,0 +1,75 @@ +/* ------------------------------------------- + + Copyright ZKA Technologies. + + File: HalProcessor.cxx + Purpose: Platform processor routines. + +------------------------------------------- */ + +#include <HALKit/AMD64/Paging.hxx> +#include <HALKit/AMD64/Processor.hxx> + +namespace Kernel::HAL +{ + STATIC Void mm_map_page_status(PTE* pte) + { + if (!pte) + return; + + kcout << (pte->Present ? "Present" : "Not Present") << endl; + kcout << (pte->Wr ? "W/R" : "Not W/R") << endl; + kcout << (pte->User ? "User" : "Not User") << endl; + } + + /// @brief Maps or allocates a page from virt_addr. + /// @internal + /// @param virt_addr a valid virtual address. + /// @param phys_addr point to physical address. + /// @param flags the flags to put on the page. + /// @return Status code of page manipulation process. + EXTERN_C Int32 mm_map_page(VoidPtr virt_addr, UInt32 flags) + { + return 0; + } + + /// @brief Maps or allocates a page from virt_addr. + /// @internal + /// @param virt_addr a valid virtual address. + /// @param phys_addr point to physical address. + /// @param flags the flags to put on the page. + /// @return Status code of page manipulation process. + EXTERN_C Int32 _mm_map_page(VoidPtr virt_addr, UInt32 flags, ZKA_PDE* pde, SizeT pte) + { + if (!virt_addr || !pde || !pte) + return -1; + + if (pde->fEntries[pte]->Present) + { + rt_cli(); + + if (flags & ~eFlagsPresent) + pde->fEntries[pte]->Present = false; + else if (flags & eFlagsPresent) + pde->fEntries[pte]->Present = true; + + if (flags & eFlagsRw) + pde->fEntries[pte]->Wr = true; + else if (flags & ~eFlagsRw) + pde->fEntries[pte]->Wr = false; + + if (flags & eFlagsUser) + pde->fEntries[pte]->User = true; + else if (flags & ~eFlagsUser) + pde->fEntries[pte]->User = false; + + mm_map_page_status(pde->fEntries[pte]); + + rt_sti(); + + return 0; + } + + return -2; + } +} // namespace Kernel::HAL diff --git a/dev/zka/KernelKit/Heap.hxx b/dev/zka/KernelKit/Heap.hxx index cb8da37d..53eec98e 100644 --- a/dev/zka/KernelKit/Heap.hxx +++ b/dev/zka/KernelKit/Heap.hxx @@ -53,7 +53,7 @@ namespace Kernel T* cls = (T*)mm_new_heap(sizeof(T), No, No); MUST_PASS(cls); - *cls = T(move(args)...); + *cls = T(move(args)...); return cls; } |
