diff options
Diffstat (limited to 'Private/Source')
| -rw-r--r-- | Private/Source/KernelHeap.cxx | 3 | ||||
| -rw-r--r-- | Private/Source/NewFS+FileManager.cxx | 12 | ||||
| -rw-r--r-- | Private/Source/PageManager.cxx | 40 |
3 files changed, 21 insertions, 34 deletions
diff --git a/Private/Source/KernelHeap.cxx b/Private/Source/KernelHeap.cxx index 208a7223..3acb3d79 100644 --- a/Private/Source/KernelHeap.cxx +++ b/Private/Source/KernelHeap.cxx @@ -60,6 +60,9 @@ VoidPtr ke_new_ke_heap(SizeT sz, const bool rw, const bool user) { Ref<PTEWrapper *> wrapper = kPageManager.Request(user, rw, false); + Ref<PageManager> refMan(kPageManager); + wrapper->FlushTLB(refMan); + kLastWrapper = wrapper; Detail::HeapInformationBlockPtr heapInfo = diff --git a/Private/Source/NewFS+FileManager.cxx b/Private/Source/NewFS+FileManager.cxx index e03cc471..5924385d 100644 --- a/Private/Source/NewFS+FileManager.cxx +++ b/Private/Source/NewFS+FileManager.cxx @@ -26,22 +26,22 @@ bool NewFilesystemManager::Remove(const char* node_name) { } NodePtr NewFilesystemManager::Create(const char* path) { - return node_cast(fImpl->CreateCatalog(path, 0, kCatalogKindFile)); + return node_cast(fImpl->CreateCatalog(path, 0, kNewFSCatalogKindFile)); } NodePtr NewFilesystemManager::CreateDirectory(const char* path) { - return node_cast(fImpl->CreateCatalog(path, 0, kCatalogKindDir)); + return node_cast(fImpl->CreateCatalog(path, 0, kNewFSCatalogKindDir)); } NodePtr NewFilesystemManager::CreateAlias(const char* path) { - return node_cast(fImpl->CreateCatalog(path, 0, kCatalogKindAlias)); + return node_cast(fImpl->CreateCatalog(path, 0, kNewFSCatalogKindAlias)); } -const char* NewFilesystemHelper::Root() { return kFilesystemRoot; } +const char* NewFilesystemHelper::Root() { return kNewFSRoot; } -const char* NewFilesystemHelper::UpDir() { return kFilesystemUpDir; } +const char* NewFilesystemHelper::UpDir() { return kNewFSUpDir; } -const char NewFilesystemHelper::Separator() { return kFilesystemSeparator; } +const char NewFilesystemHelper::Separator() { return kNewFSSeparator; } } // namespace HCore #endif // ifdef __FSKIT_NEWFS__ diff --git a/Private/Source/PageManager.cxx b/Private/Source/PageManager.cxx index 1b535e43..572effae 100644 --- a/Private/Source/PageManager.cxx +++ b/Private/Source/PageManager.cxx @@ -44,14 +44,14 @@ PTEWrapper::~PTEWrapper() { } void PTEWrapper::FlushTLB(Ref<PageManager> &pm) { - volatile PTE *virtAddr = static_cast<volatile PTE *>(virtAddr); - - virtAddr->Present = this->m_Present; - virtAddr->ExecDisable = this->m_ExecDisable; - virtAddr->Rw = this->m_Rw; - virtAddr->User = this->m_User; - - pm.Leak().FlushTLB(this->m_VirtAddr); + PTE* ptIndex = (PTE*)((m_VirtAddr >> 12) & 0x1FF); + ptIndex->Wt = m_Wt; + ptIndex->Rw = m_Rw; + ptIndex->Cache = m_Cache; + ptIndex->Present = m_Present; + ptIndex->ExecDisable = m_ExecDisable; + + pm.Leak().FlushTLB((UIntPtr)ptIndex); } void PageManager::FlushTLB(UIntPtr VirtAddr) { @@ -71,8 +71,9 @@ bool PTEWrapper::Reclaim() { PTEWrapper *PageManager::Request(Boolean Rw, Boolean User, Boolean ExecDisable) { + // Store PTE wrapper right after PTE. PTEWrapper *PageTableEntry = reinterpret_cast<PTEWrapper *>( - HCore::HAL::hal_alloc_page(sizeof(PTEWrapper), Rw, User)); + HCore::HAL::hal_alloc_page(sizeof(PTEWrapper), Rw, User) + sizeof(PTE)); PageTableEntry->NoExecute(ExecDisable); @@ -92,19 +93,7 @@ bool PageManager::Free(Ref<PTEWrapper *> &wrapper) { return false; } -//////////////////////////// - -// VIRTUAL ADDRESS GETTER (SKIP PTE) - -//////////////////////////// - -const UIntPtr PTEWrapper::VirtualAddress() { return (m_VirtAddr + sizeof(PTE)); } - -//////////////////////////// - -// PAGE GETTERS - -//////////////////////////// +const UIntPtr PTEWrapper::VirtualAddress() { return (m_VirtAddr + sizeof(PTE) + sizeof(PTEWrapper)); } bool PTEWrapper::Shareable() { return m_Shareable; } @@ -112,12 +101,7 @@ bool PTEWrapper::Present() { return m_Present; } bool PTEWrapper::Access() { return m_Accessed; } -//////////////////////////// - -// NO EXECUTE PROTECTION - -//////////////////////////// - void PTEWrapper::NoExecute(const bool enable) { this->m_ExecDisable = enable; } + const bool &PTEWrapper::NoExecute() { return this->m_ExecDisable; } } // namespace HCore |
