Moving alloy/ into xenia/cpu/ to start simplifying things.
This commit is contained in:
@@ -10,9 +10,11 @@
|
||||
#ifndef XENIA_MEMORY_H_
|
||||
#define XENIA_MEMORY_H_
|
||||
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "alloy/memory.h"
|
||||
#include "xenia/memory.h"
|
||||
|
||||
#include "xenia/common.h"
|
||||
#include "xenia/cpu/mmio_handler.h"
|
||||
@@ -42,12 +44,29 @@ struct AllocationInfo {
|
||||
uint32_t type; // TBD
|
||||
};
|
||||
|
||||
class Memory : public alloy::Memory {
|
||||
class Memory {
|
||||
public:
|
||||
Memory();
|
||||
~Memory() override;
|
||||
~Memory();
|
||||
|
||||
int Initialize() override;
|
||||
int Initialize();
|
||||
|
||||
inline uint8_t* membase() const { return membase_; }
|
||||
inline uint8_t* Translate(uint64_t guest_address) const {
|
||||
return membase_ + guest_address;
|
||||
};
|
||||
inline uint64_t* reserve_address() { return &reserve_address_; }
|
||||
inline uint64_t* reserve_value() { return &reserve_value_; }
|
||||
|
||||
uint64_t trace_base() const { return trace_base_; }
|
||||
void set_trace_base(uint64_t value) { trace_base_ = value; }
|
||||
|
||||
// TODO(benvanik): make poly memory utils for these.
|
||||
void Zero(uint64_t address, size_t size);
|
||||
void Fill(uint64_t address, size_t size, uint8_t value);
|
||||
void Copy(uint64_t dest, uint64_t src, size_t size);
|
||||
uint64_t SearchAligned(uint64_t start, uint64_t end, const uint32_t* values,
|
||||
size_t value_count);
|
||||
|
||||
bool AddMappedRange(uint64_t address, uint64_t mask, uint64_t size,
|
||||
void* context, cpu::MMIOReadCallback read_callback,
|
||||
@@ -73,6 +92,12 @@ class Memory : public alloy::Memory {
|
||||
void UnmapViews();
|
||||
|
||||
private:
|
||||
size_t system_page_size_;
|
||||
uint8_t* membase_;
|
||||
uint64_t reserve_address_;
|
||||
uint64_t reserve_value_;
|
||||
uint64_t trace_base_;
|
||||
|
||||
HANDLE mapping_;
|
||||
uint8_t* mapping_base_;
|
||||
union {
|
||||
|
||||
Reference in New Issue
Block a user