mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:37:36 +00:00
Kernel: Move PhysicalAddress.h into VM/
This commit is contained in:
parent
eca5c2bdf8
commit
149fd7e045
7 changed files with 4 additions and 6 deletions
34
Kernel/VM/PhysicalAddress.h
Normal file
34
Kernel/VM/PhysicalAddress.h
Normal file
|
@ -0,0 +1,34 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/Types.h>
|
||||
|
||||
class PhysicalAddress {
|
||||
public:
|
||||
PhysicalAddress() {}
|
||||
explicit PhysicalAddress(u32 address)
|
||||
: m_address(address)
|
||||
{
|
||||
}
|
||||
|
||||
PhysicalAddress offset(u32 o) const { return PhysicalAddress(m_address + o); }
|
||||
u32 get() const { return m_address; }
|
||||
void set(u32 address) { m_address = address; }
|
||||
void mask(u32 m) { m_address &= m; }
|
||||
|
||||
bool is_null() const { return m_address == 0; }
|
||||
|
||||
u8* as_ptr() { return reinterpret_cast<u8*>(m_address); }
|
||||
const u8* as_ptr() const { return reinterpret_cast<const u8*>(m_address); }
|
||||
|
||||
u32 page_base() const { return m_address & 0xfffff000; }
|
||||
|
||||
bool operator==(const PhysicalAddress& other) const { return m_address == other.m_address; }
|
||||
bool operator!=(const PhysicalAddress& other) const { return m_address != other.m_address; }
|
||||
bool operator>(const PhysicalAddress& other) const { return m_address > other.m_address; }
|
||||
bool operator>=(const PhysicalAddress& other) const { return m_address >= other.m_address; }
|
||||
bool operator<(const PhysicalAddress& other) const { return m_address < other.m_address; }
|
||||
bool operator<=(const PhysicalAddress& other) const { return m_address <= other.m_address; }
|
||||
|
||||
private:
|
||||
u32 m_address { 0 };
|
||||
};
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
#include <AK/NonnullRefPtr.h>
|
||||
#include <Kernel/Assertions.h>
|
||||
#include <Kernel/PhysicalAddress.h>
|
||||
#include <Kernel/VM/PhysicalAddress.h>
|
||||
|
||||
class PhysicalPage {
|
||||
friend class MemoryManager;
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#include <AK/NonnullRefPtr.h>
|
||||
#include <AK/RefPtr.h>
|
||||
#include <Kernel/Assertions.h>
|
||||
#include <Kernel/PhysicalAddress.h>
|
||||
#include <Kernel/VM/PhysicalPage.h>
|
||||
#include <Kernel/VM/PhysicalRegion.h>
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
#include <AK/Bitmap.h>
|
||||
#include <AK/RefCounted.h>
|
||||
#include <AK/NonnullRefPtr.h>
|
||||
#include <Kernel/PhysicalAddress.h>
|
||||
#include <Kernel/VM/PhysicalPage.h>
|
||||
|
||||
class PhysicalRegion : public RefCounted<PhysicalRegion> {
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
#include <AK/Vector.h>
|
||||
#include <AK/Weakable.h>
|
||||
#include <Kernel/Lock.h>
|
||||
#include <Kernel/PhysicalAddress.h>
|
||||
#include <Kernel/UnixTypes.h>
|
||||
#include <Kernel/VM/PhysicalAddress.h>
|
||||
|
||||
class Inode;
|
||||
class PhysicalPage;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue