mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-13 00:00:45 +02:00
This isn't quite a 100% clean sweep of IWYU. There are some false positives where clang fails. Additionally there are still a few missed in the frontend side of things that I didn't get to
47 lines
1.1 KiB
C++
47 lines
1.1 KiB
C++
#pragma once
|
|
#include <FEXCore/IR/IR.h>
|
|
#include <FEXCore/IR/IREmitter.h>
|
|
|
|
#include "HarnessHelpers.h"
|
|
|
|
#include <FEXCore/Utils/Allocator.h>
|
|
|
|
#include <map>
|
|
#include <memory>
|
|
#include <stdint.h>
|
|
#include <string>
|
|
#include <sys/mman.h>
|
|
|
|
using namespace FEXCore::IR;
|
|
|
|
namespace FEX::IRLoader {
|
|
class Loader final {
|
|
public:
|
|
Loader(std::string const &Filename, std::string const &ConfigFilename);
|
|
|
|
bool IsValid() const { return ParsedCode != nullptr; }
|
|
IREmitter* GetIREmitter() { return ParsedCode.get(); }
|
|
uint64_t GetEntryRIP() const { return EntryRIP; }
|
|
|
|
bool CompareStates(FEXCore::Core::CPUState const* State) {
|
|
return Config.CompareStates(State, nullptr);
|
|
}
|
|
|
|
void LoadMemory() {
|
|
Config.LoadMemory();
|
|
}
|
|
|
|
void MapRegions() {
|
|
for (auto& [region, size] : Config.GetMemoryRegions()) {
|
|
FEXCore::Allocator::mmap(reinterpret_cast<void*>(region), size, PROT_READ | PROT_WRITE, MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
|
|
}
|
|
}
|
|
|
|
private:
|
|
uint64_t EntryRIP{};
|
|
std::unique_ptr<IREmitter> ParsedCode;
|
|
|
|
FEX::HarnessHelper::ConfigLoader Config;
|
|
};
|
|
}
|