Wrote new Multiboot2 table reader
This commit is contained in:
@@ -1,9 +1,6 @@
|
||||
#ifndef MEMORYMAP_H
|
||||
#define MEMORYMAP_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "systypes.hpp"
|
||||
|
||||
namespace kernel
|
||||
@@ -16,6 +13,7 @@ public:
|
||||
enum Type
|
||||
{
|
||||
AVAILABLE = 1,
|
||||
UNAVAILABLE = 2,
|
||||
ACPI = 3,
|
||||
DEFECTIVE = 5
|
||||
};
|
||||
@@ -24,38 +22,82 @@ public:
|
||||
{
|
||||
public:
|
||||
|
||||
physaddr_t getLocation();
|
||||
Region();
|
||||
|
||||
size_t getSize();
|
||||
Region(Region& copy);
|
||||
|
||||
Type getType();
|
||||
Region(physaddr_t location, size_t size, Type type);
|
||||
|
||||
bool contains(physaddr_t location, size_t size);
|
||||
|
||||
const Region& operator=(const Region& rhs);
|
||||
|
||||
const bool operator==(const Region& rhs) const;
|
||||
|
||||
const bool operator<(const Region& rhs) const;
|
||||
|
||||
const bool operator>(const Region& rhs) const;
|
||||
|
||||
const bool operator<=(const Region& rhs) const;
|
||||
|
||||
const bool operator>=(const Region& rhs) const;
|
||||
|
||||
physaddr_t getLocation() const;
|
||||
|
||||
size_t getSize() const;
|
||||
|
||||
Type getType() const;
|
||||
|
||||
physaddr_t getEnd() const;
|
||||
|
||||
bool contains(const Region& r) const;
|
||||
|
||||
bool contains(physaddr_t location, size_t size) const;
|
||||
|
||||
bool overlaps(const Region& r) const;
|
||||
|
||||
bool bordersLeft(const Region& right) const;
|
||||
|
||||
bool bordersRight(const Region& left) const;
|
||||
|
||||
bool borders(const Region& r) const;
|
||||
|
||||
void truncateLeft(physaddr_t left);
|
||||
|
||||
void truncateRight(physaddr_t right);
|
||||
|
||||
private:
|
||||
|
||||
physaddr_t location;
|
||||
|
||||
size_t size;
|
||||
|
||||
uint32_t type;
|
||||
|
||||
physaddr_t m_location;
|
||||
|
||||
size_t m_size;
|
||||
|
||||
size_t m_type;
|
||||
|
||||
};
|
||||
|
||||
MemoryMap(Region* map, size_t entries);
|
||||
|
||||
MemoryMap();
|
||||
|
||||
Region& operator[](size_t index);
|
||||
MemoryMap(MemoryMap& copy);
|
||||
|
||||
size_t size();
|
||||
const Region& operator[](size_t index) const;
|
||||
|
||||
size_t size() const;
|
||||
|
||||
size_t totalMemory() const;
|
||||
|
||||
void insertEntry(physaddr_t location, size_t size, Type type);
|
||||
|
||||
private:
|
||||
|
||||
Region* map;
|
||||
void remove(unsigned int index);
|
||||
|
||||
size_t entries;
|
||||
|
||||
static const unsigned int maxEntries = 16;
|
||||
|
||||
Region m_map[maxEntries];
|
||||
|
||||
size_t m_entries;
|
||||
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
Reference in New Issue
Block a user