[rpcsx-os] dmem: fix allocator

This commit is contained in:
DH 2023-11-10 21:04:33 +03:00
parent 84a8523568
commit a98ac71b83
2 changed files with 8 additions and 3 deletions

View File

@ -1,6 +1,7 @@
#pragma once
#include "io-device.hpp"
#include "orbis/KernelAllocator.hpp"
#include "orbis/error/ErrorCode.hpp"
#include "orbis/file.hpp"
#include "orbis/utils/Rc.hpp"
@ -21,7 +22,7 @@ struct DmemDevice : public IoDevice {
auto operator<=>(const AllocationInfo &) const = default;
};
rx::MemoryTableWithPayload<AllocationInfo> allocations;
rx::MemoryTableWithPayload<AllocationInfo, orbis::kallocator> allocations;
orbis::ErrorCode allocate(std::uint64_t *start, std::uint64_t searchEnd,
std::uint64_t len, std::uint64_t alignment,

View File

@ -202,9 +202,13 @@ public:
}
};
template <typename PayloadT> class MemoryTableWithPayload {
template <typename PayloadT,
template <typename> typename Allocator = std::allocator>
class MemoryTableWithPayload {
enum class Kind { O, X, XO };
std::map<std::uint64_t, std::pair<Kind, PayloadT>> mAreas;
std::map<std::uint64_t, std::pair<Kind, PayloadT>, std::less<>,
Allocator<std::pair<const std::uint64_t, std::pair<Kind, PayloadT>>>>
mAreas;
public:
struct AreaInfo {