Path: blob/master/Core/HLE/KernelThreadDebugInterface.h
3186 views
// 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/PSPThreadContext.h"21#include "Core/MIPS/MIPSDebugInterface.h"2223struct PSPThreadContext;2425class KernelThreadDebugInterface : public DebugInterface {26public:27KernelThreadDebugInterface(PSPThreadContext *t) : ctx(*t) {}2829u32 GetGPR32Value(int reg) const override { return ctx.r[reg]; }30u32 GetHi() const override { return ctx.hi; }31u32 GetLo() const override { return ctx.lo; }32u32 GetPC() const override { return ctx.pc; }33u32 GetRA() const override { return ctx.r[MIPS_REG_RA]; }34u32 GetLLBit() const override { return 0; }35u32 GetFPCond() const override { return ctx.fpcond; }36void SetPC(u32 _pc) override { ctx.pc = _pc; }37void SetHi(u32 val) override { ctx.hi = val; }38void SetLo(u32 val) override { ctx.lo = val; }3940void PrintRegValue(int cat, int index, char *out, size_t outSize) const override {41switch (cat) {42case 0: snprintf(out, outSize, "%08X", ctx.r[index]); break;43case 1: snprintf(out, outSize, "%f", ctx.f[index]); break;44case 2: snprintf(out, outSize, "N/A"); break;45}46}4748u32 GetRegValue(int cat, int index) const override {49switch (cat) {50case 0: return ctx.r[index];51case 1: return ctx.fi[index];52case 2: return ctx.vi[voffset[index]];53default: return 0;54}55}5657void SetRegValue(int cat, int index, u32 value) override {58switch (cat) {59case 0:60if (index != 0)61ctx.r[index] = value;62break;6364case 1:65ctx.fi[index] = value;66break;6768case 2:69ctx.vi[voffset[index]] = value;70break;7172default:73break;74}75}7677protected:78PSPThreadContext &ctx;79};808182