diff options
| author | Amlal El Mahrouss <amlalelmahrouss@icloud.com> | 2024-02-08 19:50:36 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlalelmahrouss@icloud.com> | 2024-02-08 19:51:18 +0100 |
| commit | d0252ab0b32c55b08749e94545e17d389b1081c9 (patch) | |
| tree | 20af91e0b6ac2d7f4f61c3547d3bf97e49a747c2 /Private/Source | |
| parent | fe44d10437a3508f62ac21e03cd712aba0c1683b (diff) | |
HCR-15: See below.
Boot: Fixed dependance on old os.epm file.
Kernel: Will get it running this weekend.
Signed-off-by: Amlal El Mahrouss <amlalelmahrouss@icloud.com>
Diffstat (limited to 'Private/Source')
| -rw-r--r-- | Private/Source/NewFS+FileManager.cxx (renamed from Private/Source/NewFS.cxx) | 0 | ||||
| -rw-r--r-- | Private/Source/NewFS+IO.cxx | 6 | ||||
| -rw-r--r-- | Private/Source/PageManager.cxx | 13 | ||||
| -rw-r--r-- | Private/Source/SMPManager.cxx | 17 |
4 files changed, 29 insertions, 7 deletions
diff --git a/Private/Source/NewFS.cxx b/Private/Source/NewFS+FileManager.cxx index b0ba37c6..b0ba37c6 100644 --- a/Private/Source/NewFS.cxx +++ b/Private/Source/NewFS+FileManager.cxx diff --git a/Private/Source/NewFS+IO.cxx b/Private/Source/NewFS+IO.cxx index e90ed1a4..1a9ac1ad 100644 --- a/Private/Source/NewFS+IO.cxx +++ b/Private/Source/NewFS+IO.cxx @@ -10,6 +10,12 @@ #include <KernelKit/DriveManager.hpp> #include <KernelKit/FileManager.hpp> +/** --------------------------------------------------- + + * THIS FILE CONTAINS CODE FOR THE HCFS I/O DEVICES. + +------------------------------------------------------- */ + #ifdef __USE_NEWFS__ /// @brief This implements NewFS with Device Abstraction in mind. diff --git a/Private/Source/PageManager.cxx b/Private/Source/PageManager.cxx index 7dec0343..b4d9ed8e 100644 --- a/Private/Source/PageManager.cxx +++ b/Private/Source/PageManager.cxx @@ -10,6 +10,10 @@ #include <KernelKit/DebugOutput.hpp> #include <NewKit/PageManager.hpp> +#ifdef __x86_64__ +#include <HALKit/AMD64/HalPageAlloc.hpp> +#endif // ifdef __x86_64__ + //! null deref will throw (Page Zero detected, aborting program!) #define kProtectedRegionEnd 512 @@ -37,9 +41,7 @@ PTEWrapper::PTEWrapper(Boolean Rw, Boolean User, Boolean ExecDisable, PTEWrapper::~PTEWrapper() { PTE *raw = reinterpret_cast<PTE *>(m_VirtAddr); - MUST_PASS(raw); - MUST_PASS(!raw->Accessed); if (raw->Present) raw->Present = false; } @@ -107,10 +109,13 @@ bool PTEWrapper::Shareable() { auto raw = reinterpret_cast<PTE *>(m_VirtAddr); if (raw->Present) { - m_Shareable = raw->Shared; + m_Shareable = raw->Rw; + kcout << m_Shareable ? "[PTEWrapper::Shareable] page is sharable!\n" + : "[PTEWrapper::Shareable] page is not sharable!\n"; + return m_Shareable; } else { - kcout << "[PTEWrapper::Shareable] page is not present!"; + kcout << "[PTEWrapper::Shareable] page is not present!\n"; return false; } } diff --git a/Private/Source/SMPManager.cxx b/Private/Source/SMPManager.cxx index 487eda51..0b3e1550 100644 --- a/Private/Source/SMPManager.cxx +++ b/Private/Source/SMPManager.cxx @@ -109,13 +109,24 @@ bool SMPManager::Switch(HAL::StackFrame* stack) { m_ThreadList[idx].Leak().Leak().IsBusy()) continue; + // to avoid any null deref. + if (!stack, m_ThreadList[idx].Leak().Leak().m_Stack) continue; + + m_ThreadList[idx].Leak().Leak().Busy(true); + m_ThreadList[idx].Leak().Leak().m_ID = idx; - m_ThreadList[idx].Leak().Leak().m_Stack = stack; - m_ThreadList[idx].Leak().Leak().m_PID = ProcessHelper::GetCurrentPID(); m_ThreadList[idx].Leak().Leak().Busy(true); - rt_do_context_switch(stack); + /// I figured out this: + /// Allocate stack + /// Set APIC base to stack + /// Do stuff and relocate stack based on this code. + /// - Amlel + rt_copy_memory(stack, m_ThreadList[idx].Leak().Leak().m_Stack, + sizeof(HAL::StackFrame)); + + m_ThreadList[idx].Leak().Leak().m_PID = ProcessHelper::GetCurrentPID(); m_ThreadList[idx].Leak().Leak().Busy(false); |
