mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 10:57:35 +00:00
Kernel: Introduce the MemoryDevice
This is a character device that is being used by the dmidecode utility. We only allow to map the BIOS ROM area to userspace with this device.
This commit is contained in:
parent
df59b80e23
commit
5ab1864497
6 changed files with 235 additions and 0 deletions
|
@ -85,6 +85,26 @@ struct UsedMemoryRange {
|
|||
PhysicalAddress end;
|
||||
};
|
||||
|
||||
struct ContiguousReservedMemoryRange {
|
||||
PhysicalAddress start;
|
||||
size_t length;
|
||||
};
|
||||
|
||||
enum class PhysicalMemoryRangeType {
|
||||
Usable = 0,
|
||||
Reserved,
|
||||
ACPI_Reclaimable,
|
||||
ACPI_NVS,
|
||||
BadMemory,
|
||||
Unknown
|
||||
};
|
||||
|
||||
struct PhysicalMemoryRange {
|
||||
PhysicalMemoryRangeType type;
|
||||
PhysicalAddress start;
|
||||
size_t length;
|
||||
};
|
||||
|
||||
const LogStream& operator<<(const LogStream& stream, const UsedMemoryRange& value);
|
||||
|
||||
#define MM Kernel::MemoryManager::the()
|
||||
|
@ -187,11 +207,14 @@ public:
|
|||
PageDirectory& kernel_page_directory() { return *m_kernel_page_directory; }
|
||||
|
||||
const Vector<UsedMemoryRange>& used_memory_ranges() { return m_used_memory_ranges; }
|
||||
bool is_allowed_to_mmap_to_userspace(PhysicalAddress, const Range&) const;
|
||||
|
||||
private:
|
||||
MemoryManager();
|
||||
~MemoryManager();
|
||||
|
||||
void register_reserved_ranges();
|
||||
|
||||
enum class AccessSpace { Kernel,
|
||||
User };
|
||||
enum class AccessType { Read,
|
||||
|
@ -245,6 +268,8 @@ private:
|
|||
InlineLinkedList<Region> m_user_regions;
|
||||
InlineLinkedList<Region> m_kernel_regions;
|
||||
Vector<UsedMemoryRange> m_used_memory_ranges;
|
||||
Vector<PhysicalMemoryRange> m_physical_memory_ranges;
|
||||
Vector<ContiguousReservedMemoryRange> m_reserved_memory_ranges;
|
||||
|
||||
InlineLinkedList<VMObject> m_vmobjects;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue