mirror of
https://git.suyu.dev/suyu/dynarmic.git
synced 2026-02-19 06:49:38 +00:00
interface: Allow saving and storing of contexts
This commit is contained in:
44
include/dynarmic/context.h
Normal file
44
include/dynarmic/context.h
Normal 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
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user