diff options
author | Andreas Kling <kling@serenityos.org> | 2020-02-17 15:04:27 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-02-17 15:04:27 +0100 |
commit | 48f7c28a5cee78398c64d94f7dc3c6bf5a66ce77 (patch) | |
tree | c072ef54fa2e311ac8119e2f2f1ed69c5a22a061 /Kernel/VM | |
parent | 4f4af24b9d489634a66d818260a7f87964faf421 (diff) | |
download | serenity-48f7c28a5cee78398c64d94f7dc3c6bf5a66ce77.zip |
Kernel: Replace "current" with Thread::current and Process::current
Suggested by Sergey. The currently running Thread and Process are now
Thread::current and Process::current respectively. :^)
Diffstat (limited to 'Kernel/VM')
-rw-r--r-- | Kernel/VM/InodeVMObject.cpp | 1 | ||||
-rw-r--r-- | Kernel/VM/MemoryManager.cpp | 10 | ||||
-rw-r--r-- | Kernel/VM/Region.cpp | 22 |
3 files changed, 16 insertions, 17 deletions
diff --git a/Kernel/VM/InodeVMObject.cpp b/Kernel/VM/InodeVMObject.cpp index 226675bd47..8d14b4d3c0 100644 --- a/Kernel/VM/InodeVMObject.cpp +++ b/Kernel/VM/InodeVMObject.cpp @@ -34,7 +34,6 @@ namespace Kernel { NonnullRefPtr<InodeVMObject> InodeVMObject::create_with_inode(Inode& inode) { size_t size = inode.size(); - InterruptDisabler disabler; if (inode.vmobject()) return *inode.vmobject(); auto vmobject = adopt(*new InodeVMObject(inode, size)); diff --git a/Kernel/VM/MemoryManager.cpp b/Kernel/VM/MemoryManager.cpp index 16424c40fc..5d9c8430a8 100644 --- a/Kernel/VM/MemoryManager.cpp +++ b/Kernel/VM/MemoryManager.cpp @@ -280,7 +280,7 @@ Region* MemoryManager::region_from_vaddr(VirtualAddress vaddr) PageFaultResponse MemoryManager::handle_page_fault(const PageFault& fault) { ASSERT_INTERRUPTS_DISABLED(); - ASSERT(current); + ASSERT(Thread::current); #ifdef PAGE_FAULT_DEBUG dbgprintf("MM: handle_page_fault(%w) at V%p\n", fault.code(), fault.vaddr().get()); #endif @@ -475,10 +475,10 @@ RefPtr<PhysicalPage> MemoryManager::allocate_supervisor_physical_page() void MemoryManager::enter_process_paging_scope(Process& process) { - ASSERT(current); + ASSERT(Thread::current); InterruptDisabler disabler; - current->tss().cr3 = process.page_directory().cr3(); + Thread::current->tss().cr3 = process.page_directory().cr3(); write_cr3(process.page_directory().cr3()); } @@ -675,7 +675,7 @@ void MemoryManager::dump_kernel_regions() ProcessPagingScope::ProcessPagingScope(Process& process) { - ASSERT(current); + ASSERT(Thread::current); m_previous_cr3 = read_cr3(); MM.enter_process_paging_scope(process); } @@ -683,7 +683,7 @@ ProcessPagingScope::ProcessPagingScope(Process& process) ProcessPagingScope::~ProcessPagingScope() { InterruptDisabler disabler; - current->tss().cr3 = m_previous_cr3; + Thread::current->tss().cr3 = m_previous_cr3; write_cr3(m_previous_cr3); } diff --git a/Kernel/VM/Region.cpp b/Kernel/VM/Region.cpp index ff7afe381c..1db032ec74 100644 --- a/Kernel/VM/Region.cpp +++ b/Kernel/VM/Region.cpp @@ -84,15 +84,15 @@ Region::~Region() NonnullOwnPtr<Region> Region::clone() { - ASSERT(current); + ASSERT(Process::current); // FIXME: What should we do for privately mapped InodeVMObjects? if (m_shared || vmobject().is_inode()) { ASSERT(!m_stack); #ifdef MM_DEBUG dbgprintf("%s<%u> Region::clone(): sharing %s (V%p)\n", - current->process().name().characters(), - current->pid(), + Process::current->name().characters(), + Process::current->pid(), m_name.characters(), vaddr().get()); #endif @@ -105,8 +105,8 @@ NonnullOwnPtr<Region> Region::clone() #ifdef MM_DEBUG dbgprintf("%s<%u> Region::clone(): cowing %s (V%p)\n", - current->process().name().characters(), - current->pid(), + Process::current->name().characters(), + Process::current->pid(), m_name.characters(), vaddr().get()); #endif @@ -392,8 +392,8 @@ PageFaultResponse Region::handle_zero_fault(size_t page_index_in_region) return PageFaultResponse::Continue; } - if (current) - current->did_zero_fault(); + if (Thread::current) + Thread::current->did_zero_fault(); auto physical_page = MM.allocate_user_physical_page(MemoryManager::ShouldZeroFill::Yes); if (physical_page.is_null()) { @@ -422,8 +422,8 @@ PageFaultResponse Region::handle_cow_fault(size_t page_index_in_region) return PageFaultResponse::Continue; } - if (current) - current->did_cow_fault(); + if (Thread::current) + Thread::current->did_cow_fault(); #ifdef PAGE_FAULT_DEBUG dbgprintf(" >> It's a COW page and it's time to COW!\n"); @@ -471,8 +471,8 @@ PageFaultResponse Region::handle_inode_fault(size_t page_index_in_region) return PageFaultResponse::Continue; } - if (current) - current->did_inode_fault(); + if (Thread::current) + Thread::current->did_inode_fault(); #ifdef MM_DEBUG dbgprintf("MM: page_in_from_inode ready to read from inode\n"); |