CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!
CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!
Path: blob/master/Core/HLE/KernelThreadDebugInterface.h
Views: 1401
// Copyright (c) 2018- PPSSPP Project.12// This program is free software: you can redistribute it and/or modify3// it under the terms of the GNU General Public License as published by4// the Free Software Foundation, version 2.0 or later versions.56// This program is distributed in the hope that it will be useful,7// but WITHOUT ANY WARRANTY; without even the implied warranty of8// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9// GNU General Public License 2.0 for more details.1011// A copy of the GPL 2.0 should have been included with the program.12// If not, see http://www.gnu.org/licenses/1314// Official git repository and contact information can be found at15// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.1617#pragma once1819#include <cstdio>20#include "Core/HLE/sceKernelThread.h"21#include "Core/MIPS/MIPSDebugInterface.h"2223class KernelThreadDebugInterface : public MIPSDebugInterface {24public:25KernelThreadDebugInterface(MIPSState *c, PSPThreadContext &t) : MIPSDebugInterface(c), ctx(t) {26}2728unsigned int getPC() override { return ctx.pc; }29void setPC(unsigned int address) override { ctx.pc = address; }3031u32 GetGPR32Value(int reg) override { return ctx.r[reg]; }32u32 GetPC() override { return ctx.pc; }33u32 GetLR() override { return ctx.r[MIPS_REG_RA]; }34void SetPC(u32 _pc) override { ctx.pc = _pc; }3536void PrintRegValue(int cat, int index, char *out, size_t outSize) override {37switch (cat) {38case 0: snprintf(out, outSize, "%08X", ctx.r[index]); break;39case 1: snprintf(out, outSize, "%f", ctx.f[index]); break;40case 2: snprintf(out, outSize, "N/A"); break;41}42}4344u32 GetHi() override {45return ctx.hi;46}4748u32 GetLo() override {49return ctx.lo;50}5152void SetHi(u32 val) override {53ctx.hi = val;54}5556void SetLo(u32 val) override {57ctx.lo = val;58}5960u32 GetRegValue(int cat, int index) override {61switch (cat) {62case 0: return ctx.r[index];63case 1: return ctx.fi[index];64case 2: return ctx.vi[voffset[index]];65default: return 0;66}67}6869void SetRegValue(int cat, int index, u32 value) override {70switch (cat) {71case 0:72if (index != 0)73ctx.r[index] = value;74break;7576case 1:77ctx.fi[index] = value;78break;7980case 2:81ctx.vi[voffset[index]] = value;82break;8384default:85break;86}87}8889protected:90PSPThreadContext &ctx;91};929394