mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 16:32:45 +00:00 
			
		
		
		
	 1682f0b760
			
		
	
	
		1682f0b760
		
	
	
	
	
		
			
			SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
		
			
				
	
	
		
			42 lines
		
	
	
	
		
			852 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			42 lines
		
	
	
	
		
			852 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #include <Kernel/VM/MemoryManager.h>
 | |
| #include <Kernel/VM/VMObject.h>
 | |
| 
 | |
| namespace Kernel {
 | |
| 
 | |
| VMObject::VMObject(const VMObject& other)
 | |
|     : m_physical_pages(other.m_physical_pages)
 | |
| {
 | |
|     MM.register_vmobject(*this);
 | |
| }
 | |
| 
 | |
| VMObject::VMObject()
 | |
| {
 | |
|     MM.register_vmobject(*this);
 | |
| }
 | |
| 
 | |
| VMObject::VMObject(size_t size)
 | |
| {
 | |
|     m_physical_pages.resize(ceil_div(size, static_cast<size_t>(PAGE_SIZE)));
 | |
|     MM.register_vmobject(*this);
 | |
| }
 | |
| 
 | |
| VMObject::~VMObject()
 | |
| {
 | |
|     {
 | |
|         ScopedSpinLock lock(m_on_deleted_lock);
 | |
|         for (auto& it : m_on_deleted)
 | |
|             it->vmobject_deleted(*this);
 | |
|         m_on_deleted.clear();
 | |
|     }
 | |
| 
 | |
|     MM.unregister_vmobject(*this);
 | |
|     VERIFY(m_regions_count.load(AK::MemoryOrder::memory_order_relaxed) == 0);
 | |
| }
 | |
| 
 | |
| }
 |