mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
lib: first draft of memory manager
This commit is contained in:
parent
f6c02b8429
commit
7582966e16
3 changed files with 67 additions and 0 deletions
47
fpga/include/villas/memory_manager.hpp
Normal file
47
fpga/include/villas/memory_manager.hpp
Normal file
|
@ -0,0 +1,47 @@
|
|||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include "log.hpp"
|
||||
#include "directed_graph.hpp"
|
||||
|
||||
namespace villas {
|
||||
|
||||
|
||||
class Mapping : public graph::Edge {
|
||||
public:
|
||||
// create mapping here (if needed)
|
||||
Mapping() {}
|
||||
|
||||
// destroy mapping here (if needed)
|
||||
~Mapping() {}
|
||||
|
||||
private:
|
||||
uintptr_t src;
|
||||
uintptr_t dest;
|
||||
size_t size;
|
||||
};
|
||||
|
||||
class AddressSpace : public graph::Vertex {
|
||||
private:
|
||||
// do we need any metadata? maybe a name?
|
||||
int id;
|
||||
};
|
||||
|
||||
|
||||
// is or has a graph
|
||||
class MemoryManager {
|
||||
|
||||
// This is a singleton
|
||||
private:
|
||||
MemoryManager() = default;
|
||||
static MemoryManager* instance;
|
||||
public:
|
||||
static MemoryManager& get();
|
||||
|
||||
|
||||
private:
|
||||
// std::list<>
|
||||
};
|
||||
|
||||
} // namespace villas
|
|
@ -25,6 +25,7 @@ set(SOURCES
|
|||
kernel/pci.c
|
||||
kernel/vfio.c
|
||||
|
||||
memory_manager.cpp
|
||||
plugin.c
|
||||
plugin.cpp
|
||||
utils.c
|
||||
|
|
19
fpga/lib/memory_manager.cpp
Normal file
19
fpga/lib/memory_manager.cpp
Normal file
|
@ -0,0 +1,19 @@
|
|||
#include "memory_manager.hpp"
|
||||
|
||||
namespace villas {
|
||||
|
||||
MemoryManager*
|
||||
MemoryManager::instance = nullptr;
|
||||
|
||||
MemoryManager&
|
||||
MemoryManager::get()
|
||||
{
|
||||
if(instance == nullptr) {
|
||||
instance = new MemoryManager;
|
||||
}
|
||||
|
||||
return *instance;
|
||||
}
|
||||
|
||||
|
||||
} // namespace villas
|
Loading…
Add table
Reference in a new issue