1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 23:27:43 +00:00

Kernel: Rename LinearAddress => VirtualAddress.

This commit is contained in:
Andreas Kling 2019-06-07 12:56:50 +02:00
parent 0ed89440f1
commit e42c3b4fd7
33 changed files with 272 additions and 272 deletions

View file

@ -1,33 +1,33 @@
#pragma once
#include <AK/Vector.h>
#include <Kernel/LinearAddress.h>
#include <Kernel/VirtualAddress.h>
class Range {
friend class RangeAllocator;
public:
Range() {}
Range(LinearAddress base, size_t size)
Range(VirtualAddress base, size_t size)
: m_base(base)
, m_size(size)
{
}
LinearAddress base() const { return m_base; }
VirtualAddress base() const { return m_base; }
size_t size() const { return m_size; }
bool is_valid() const { return !m_base.is_null(); }
bool contains(LinearAddress laddr) const { return laddr >= base() && laddr < end(); }
bool contains(VirtualAddress vaddr) const { return vaddr >= base() && vaddr < end(); }
LinearAddress end() const { return m_base.offset(m_size); }
VirtualAddress end() const { return m_base.offset(m_size); }
bool operator==(const Range& other) const
{
return m_base == other.m_base && m_size == other.m_size;
}
bool contains(LinearAddress base, size_t size) const
bool contains(VirtualAddress base, size_t size) const
{
return base >= m_base && base.offset(size) <= end();
}
@ -40,18 +40,18 @@ public:
Vector<Range, 2> carve(const Range&);
private:
LinearAddress m_base;
VirtualAddress m_base;
size_t m_size { 0 };
};
class RangeAllocator {
public:
RangeAllocator(LinearAddress, size_t);
RangeAllocator(VirtualAddress, size_t);
RangeAllocator(const RangeAllocator&);
~RangeAllocator();
Range allocate_anywhere(size_t);
Range allocate_specific(LinearAddress, size_t);
Range allocate_specific(VirtualAddress, size_t);
void deallocate(Range);
void dump() const;