This repository has been archived on 2025-12-14. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
github.ong19th.Citron/src/core/debugger/gdbstub_arch.h
Zephyron 9ae0eeeb87 Revert incorrect copyright attribution for non-contributed files
- In commit b3facaa6bb, the copyright header was
  updated to include "Citron Homebrew Project" across multiple files, regardless
  of whether any contributions were made.

- This commit removes the incorrect attribution and reverts the copyright header
  to its previous state.

- Copyright attribution should only be added when meaningful contributions have
  been made to the file.

- This commit ensures proper compliance with copyright standards and maintains
  correct attribution to the respective contributors.

- Special thanks to Tachi for pointing out the need for these corrections and
  ensuring that proper attribution practices are followed.
2025-01-14 15:33:24 +10:00

69 lines
2.7 KiB
C++

// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <string>
#include "common/common_types.h"
namespace Kernel {
class KThread;
}
namespace Core {
class GDBStubArch {
public:
virtual ~GDBStubArch() = default;
virtual std::string_view GetTargetXML() const = 0;
virtual std::string RegRead(const Kernel::KThread* thread, size_t id) const = 0;
virtual void RegWrite(Kernel::KThread* thread, size_t id, std::string_view value) const = 0;
virtual std::string ReadRegisters(const Kernel::KThread* thread) const = 0;
virtual void WriteRegisters(Kernel::KThread* thread, std::string_view register_data) const = 0;
virtual std::string ThreadStatus(const Kernel::KThread* thread, u8 signal) const = 0;
virtual u32 BreakpointInstruction() const = 0;
};
class GDBStubA64 final : public GDBStubArch {
public:
std::string_view GetTargetXML() const override;
std::string RegRead(const Kernel::KThread* thread, size_t id) const override;
void RegWrite(Kernel::KThread* thread, size_t id, std::string_view value) const override;
std::string ReadRegisters(const Kernel::KThread* thread) const override;
void WriteRegisters(Kernel::KThread* thread, std::string_view register_data) const override;
std::string ThreadStatus(const Kernel::KThread* thread, u8 signal) const override;
u32 BreakpointInstruction() const override;
private:
static constexpr u32 FP_REGISTER = 29;
static constexpr u32 LR_REGISTER = 30;
static constexpr u32 SP_REGISTER = 31;
static constexpr u32 PC_REGISTER = 32;
static constexpr u32 PSTATE_REGISTER = 33;
static constexpr u32 Q0_REGISTER = 34;
static constexpr u32 FPSR_REGISTER = 66;
static constexpr u32 FPCR_REGISTER = 67;
};
class GDBStubA32 final : public GDBStubArch {
public:
std::string_view GetTargetXML() const override;
std::string RegRead(const Kernel::KThread* thread, size_t id) const override;
void RegWrite(Kernel::KThread* thread, size_t id, std::string_view value) const override;
std::string ReadRegisters(const Kernel::KThread* thread) const override;
void WriteRegisters(Kernel::KThread* thread, std::string_view register_data) const override;
std::string ThreadStatus(const Kernel::KThread* thread, u8 signal) const override;
u32 BreakpointInstruction() const override;
private:
static constexpr u32 SP_REGISTER = 13;
static constexpr u32 LR_REGISTER = 14;
static constexpr u32 PC_REGISTER = 15;
static constexpr u32 CPSR_REGISTER = 25;
static constexpr u32 D0_REGISTER = 32;
static constexpr u32 Q0_REGISTER = 64;
static constexpr u32 FPSCR_REGISTER = 80;
};
} // namespace Core