interface: Allow saving and storing of contexts

This commit is contained in:
MerryMage
2017-12-03 18:25:40 +00:00
parent 19a7fb8992
commit 4393473d06
4 changed files with 140 additions and 1 deletions

View File

@@ -0,0 +1,44 @@
/* This file is part of the dynarmic project.
* Copyright (c) 2016 MerryMage
* This software may be used and distributed according to the terms of the GNU
* General Public License version 2 or any later version.
*/
#pragma once
#include <array>
#include <cstdint>
#include <memory>
namespace Dynarmic {
struct Context {
public:
Context();
~Context();
Context(const Context&);
Context(Context&&);
Context& operator=(const Context&);
Context& operator=(Context&&);
/// View and modify registers.
std::array<std::uint32_t, 16>& Regs();
const std::array<std::uint32_t, 16>& Regs() const;
std::array<std::uint32_t, 64>& ExtRegs();
const std::array<std::uint32_t, 64>& ExtRegs() const;
/// View and modify CPSR.
std::uint32_t Cpsr() const;
void SetCpsr(std::uint32_t value);
/// View and modify FPSCR.
std::uint32_t Fpscr() const;
void SetFpscr(std::uint32_t value);
private:
friend class Jit;
struct Impl;
std::unique_ptr<Impl> impl;
};
} // namespace Dynarmic

View File

@@ -15,6 +15,8 @@
namespace Dynarmic {
struct Context;
namespace IR {
class LocationDescriptor;
}
@@ -70,6 +72,10 @@ public:
std::uint32_t Fpscr() const;
void SetFpscr(std::uint32_t value);
Context SaveContext() const;
void SaveContext(Context&) const;
void LoadContext(const Context&);
/**
* Returns true if Jit::Run was called but hasn't returned yet.
* i.e.: We're in a callback.