2022-12-04 14:45:13 +00:00
|
|
|
#pragma once
|
|
|
|
#include "boot/bootboot.h"
|
|
|
|
#include <luna/Result.h>
|
|
|
|
#include <luna/Types.h>
|
|
|
|
|
|
|
|
struct MemoryMapEntry
|
|
|
|
{
|
|
|
|
u64 ptr;
|
|
|
|
u64 size;
|
|
|
|
bool free;
|
|
|
|
};
|
|
|
|
|
|
|
|
class MemoryMapIterator
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
MemoryMapIterator();
|
|
|
|
|
|
|
|
void rewind();
|
|
|
|
|
|
|
|
Result<MemoryMapEntry> next();
|
|
|
|
|
|
|
|
MemoryMapEntry largest_free();
|
|
|
|
|
|
|
|
MemoryMapEntry highest();
|
|
|
|
|
2022-12-05 12:04:01 +00:00
|
|
|
Result<MemoryMapEntry> at(usize index) const;
|
2022-12-04 14:45:13 +00:00
|
|
|
|
2022-12-05 12:04:01 +00:00
|
|
|
usize entries() const
|
2022-12-04 14:45:13 +00:00
|
|
|
{
|
|
|
|
return m_mmap_entries;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
usize m_mmap_entries;
|
2022-12-05 12:04:01 +00:00
|
|
|
const MMapEnt* m_base_ent;
|
2022-12-04 14:45:13 +00:00
|
|
|
usize m_cur_ent;
|
|
|
|
};
|