mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 03:37:45 +00:00
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. :^)
This commit is contained in:
parent
4f4af24b9d
commit
48f7c28a5c
37 changed files with 257 additions and 252 deletions
|
@ -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));
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue