mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 17:22:43 +00:00 
			
		
		
		
	 b67200dfea
			
		
	
	
		b67200dfea
		
	
	
	
	
		
			
			This makes VMObject 8 bytes smaller since we can use the array size as the page count. The size() is now also computed from the page count instead of being a separate value. This makes sizes always be a multiple of PAGE_SIZE, which is sane.
		
			
				
	
	
		
			39 lines
		
	
	
	
		
			994 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			39 lines
		
	
	
	
		
			994 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| #include <Kernel/VM/AnonymousVMObject.h>
 | |
| #include <Kernel/VM/PhysicalPage.h>
 | |
| 
 | |
| NonnullRefPtr<AnonymousVMObject> AnonymousVMObject::create_with_size(size_t size)
 | |
| {
 | |
|     return adopt(*new AnonymousVMObject(size));
 | |
| }
 | |
| 
 | |
| NonnullRefPtr<AnonymousVMObject> AnonymousVMObject::create_for_physical_range(PhysicalAddress paddr, size_t size)
 | |
| {
 | |
|     return adopt(*new AnonymousVMObject(paddr, size));
 | |
| }
 | |
| 
 | |
| AnonymousVMObject::AnonymousVMObject(size_t size)
 | |
|     : VMObject(size)
 | |
| {
 | |
| }
 | |
| 
 | |
| AnonymousVMObject::AnonymousVMObject(PhysicalAddress paddr, size_t size)
 | |
|     : VMObject(size)
 | |
| {
 | |
|     ASSERT(paddr.page_base() == paddr.get());
 | |
|     for (size_t i = 0; i < page_count(); ++i)
 | |
|         physical_pages()[i] = PhysicalPage::create(paddr.offset(i * PAGE_SIZE), false, false);
 | |
| }
 | |
| 
 | |
| AnonymousVMObject::AnonymousVMObject(const AnonymousVMObject& other)
 | |
|     : VMObject(other)
 | |
| {
 | |
| }
 | |
| 
 | |
| AnonymousVMObject::~AnonymousVMObject()
 | |
| {
 | |
| }
 | |
| 
 | |
| NonnullRefPtr<VMObject> AnonymousVMObject::clone()
 | |
| {
 | |
|     return adopt(*new AnonymousVMObject(*this));
 | |
| }
 |