mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-23 08:00:20 +00:00
be90e51355
Nobody was using this API to request anythign about `PAGE_SIZE` alignment, so let's get rid of it for now. We can reimplement it if we end up needing it. Also note that it wasn't actually used anywhere.
44 lines
1.1 KiB
C++
44 lines
1.1 KiB
C++
/*
|
|
* Copyright (c) 2020, Liav A. <liavalb@hotmail.co.il>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <Kernel/VM/ContiguousVMObject.h>
|
|
#include <Kernel/VM/MemoryManager.h>
|
|
#include <Kernel/VM/PhysicalPage.h>
|
|
|
|
namespace Kernel {
|
|
|
|
RefPtr<ContiguousVMObject> ContiguousVMObject::try_create_with_size(size_t size)
|
|
{
|
|
auto contiguous_physical_pages = MM.allocate_contiguous_supervisor_physical_pages(size);
|
|
if (contiguous_physical_pages.is_empty())
|
|
return {};
|
|
return adopt_ref_if_nonnull(new (nothrow) ContiguousVMObject(size, contiguous_physical_pages));
|
|
}
|
|
|
|
ContiguousVMObject::ContiguousVMObject(size_t size, NonnullRefPtrVector<PhysicalPage>& contiguous_physical_pages)
|
|
: VMObject(size)
|
|
{
|
|
for (size_t i = 0; i < page_count(); i++) {
|
|
physical_pages()[i] = contiguous_physical_pages[i];
|
|
dbgln_if(CONTIGUOUS_VMOBJECT_DEBUG, "Contiguous page[{}]: {}", i, physical_pages()[i]->paddr());
|
|
}
|
|
}
|
|
|
|
ContiguousVMObject::ContiguousVMObject(const ContiguousVMObject& other)
|
|
: VMObject(other)
|
|
{
|
|
}
|
|
|
|
ContiguousVMObject::~ContiguousVMObject()
|
|
{
|
|
}
|
|
|
|
RefPtr<VMObject> ContiguousVMObject::try_clone()
|
|
{
|
|
VERIFY_NOT_REACHED();
|
|
}
|
|
|
|
}
|