#include "EmulateInstructionMIPS64.h"
#include <cstdlib>
#include <optional>
#include "lldb/Core/Address.h"
#include "lldb/Core/Opcode.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Host/PosixApi.h"
#include "lldb/Symbol/UnwindPlan.h"
#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/ConstString.h"
#include "lldb/Utility/DataExtractor.h"
#include "lldb/Utility/RegisterValue.h"
#include "lldb/Utility/Stream.h"
#include "llvm-c/Disassembler.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCDisassembler/MCDisassembler.h"
#include "llvm/MC/MCInst.h"
#include "llvm/MC/MCInstrInfo.h"
#include "llvm/MC/MCRegisterInfo.h"
#include "llvm/MC/MCSubtargetInfo.h"
#include "llvm/MC/MCTargetOptions.h"
#include "llvm/MC/TargetRegistry.h"
#include "llvm/Support/TargetSelect.h"
#include "llvm/ADT/STLExtras.h"
#include "Plugins/Process/Utility/InstructionUtils.h"
#include "Plugins/Process/Utility/RegisterContext_mips.h"
usingnamespacelldb;
usingnamespacelldb_private;
LLDB_PLUGIN_DEFINE_ADV(EmulateInstructionMIPS64, InstructionMIPS64)
#define UInt(x) …
#define integer …
#ifdef __mips__
extern "C" {
void LLVMInitializeMipsTargetInfo();
void LLVMInitializeMipsTarget();
void LLVMInitializeMipsAsmPrinter();
void LLVMInitializeMipsTargetMC();
void LLVMInitializeMipsDisassembler();
}
#endif
EmulateInstructionMIPS64::EmulateInstructionMIPS64(
const lldb_private::ArchSpec &arch)
: … { … }
void EmulateInstructionMIPS64::Initialize() { … }
void EmulateInstructionMIPS64::Terminate() { … }
llvm::StringRef EmulateInstructionMIPS64::GetPluginDescriptionStatic() { … }
EmulateInstruction *
EmulateInstructionMIPS64::CreateInstance(const ArchSpec &arch,
InstructionType inst_type) { … }
bool EmulateInstructionMIPS64::SetTargetTriple(const ArchSpec &arch) { … }
const char *EmulateInstructionMIPS64::GetRegisterName(unsigned reg_num,
bool alternate_name) { … }
std::optional<RegisterInfo>
EmulateInstructionMIPS64::GetRegisterInfo(RegisterKind reg_kind,
uint32_t reg_num) { … }
EmulateInstructionMIPS64::MipsOpcode *
EmulateInstructionMIPS64::GetOpcodeForInstruction(llvm::StringRef op_name) { … }
bool EmulateInstructionMIPS64::ReadInstruction() { … }
bool EmulateInstructionMIPS64::EvaluateInstruction(uint32_t evaluate_options) { … }
bool EmulateInstructionMIPS64::CreateFunctionEntryUnwind(
UnwindPlan &unwind_plan) { … }
bool EmulateInstructionMIPS64::nonvolatile_reg_p(uint64_t regnum) { … }
bool EmulateInstructionMIPS64::Emulate_DADDiu(llvm::MCInst &insn) { … }
bool EmulateInstructionMIPS64::Emulate_SD(llvm::MCInst &insn) { … }
bool EmulateInstructionMIPS64::Emulate_LD(llvm::MCInst &insn) { … }
bool EmulateInstructionMIPS64::Emulate_LUI(llvm::MCInst &insn) { … }
bool EmulateInstructionMIPS64::Emulate_DSUBU_DADDU(llvm::MCInst &insn) { … }
bool EmulateInstructionMIPS64::Emulate_BXX_3ops(llvm::MCInst &insn) { … }
bool EmulateInstructionMIPS64::Emulate_Bcond_Link(llvm::MCInst &insn) { … }
bool EmulateInstructionMIPS64::Emulate_BAL(llvm::MCInst &insn) { … }
bool EmulateInstructionMIPS64::Emulate_BALC(llvm::MCInst &insn) { … }
bool EmulateInstructionMIPS64::Emulate_Bcond_Link_C(llvm::MCInst &insn) { … }
bool EmulateInstructionMIPS64::Emulate_BXX_2ops(llvm::MCInst &insn) { … }
bool EmulateInstructionMIPS64::Emulate_BC(llvm::MCInst &insn) { … }
static int IsAdd64bitOverflow(int64_t a, int64_t b) { … }
bool EmulateInstructionMIPS64::Emulate_BXX_3ops_C(llvm::MCInst &insn) { … }
bool EmulateInstructionMIPS64::Emulate_BXX_2ops_C(llvm::MCInst &insn) { … }
bool EmulateInstructionMIPS64::Emulate_J(llvm::MCInst &insn) { … }
bool EmulateInstructionMIPS64::Emulate_JAL(llvm::MCInst &insn) { … }
bool EmulateInstructionMIPS64::Emulate_JALR(llvm::MCInst &insn) { … }
bool EmulateInstructionMIPS64::Emulate_JIALC(llvm::MCInst &insn) { … }
bool EmulateInstructionMIPS64::Emulate_JIC(llvm::MCInst &insn) { … }
bool EmulateInstructionMIPS64::Emulate_JR(llvm::MCInst &insn) { … }
bool EmulateInstructionMIPS64::Emulate_FP_branch(llvm::MCInst &insn) { … }
bool EmulateInstructionMIPS64::Emulate_BC1EQZ(llvm::MCInst &insn) { … }
bool EmulateInstructionMIPS64::Emulate_BC1NEZ(llvm::MCInst &insn) { … }
bool EmulateInstructionMIPS64::Emulate_3D_branch(llvm::MCInst &insn) { … }
bool EmulateInstructionMIPS64::Emulate_BNZB(llvm::MCInst &insn) { … }
bool EmulateInstructionMIPS64::Emulate_BNZH(llvm::MCInst &insn) { … }
bool EmulateInstructionMIPS64::Emulate_BNZW(llvm::MCInst &insn) { … }
bool EmulateInstructionMIPS64::Emulate_BNZD(llvm::MCInst &insn) { … }
bool EmulateInstructionMIPS64::Emulate_BZB(llvm::MCInst &insn) { … }
bool EmulateInstructionMIPS64::Emulate_BZH(llvm::MCInst &insn) { … }
bool EmulateInstructionMIPS64::Emulate_BZW(llvm::MCInst &insn) { … }
bool EmulateInstructionMIPS64::Emulate_BZD(llvm::MCInst &insn) { … }
bool EmulateInstructionMIPS64::Emulate_MSA_Branch_DF(llvm::MCInst &insn,
int element_byte_size,
bool bnz) { … }
bool EmulateInstructionMIPS64::Emulate_BNZV(llvm::MCInst &insn) { … }
bool EmulateInstructionMIPS64::Emulate_BZV(llvm::MCInst &insn) { … }
bool EmulateInstructionMIPS64::Emulate_MSA_Branch_V(llvm::MCInst &insn,
bool bnz) { … }
bool EmulateInstructionMIPS64::Emulate_LDST_Imm(llvm::MCInst &insn) { … }
bool EmulateInstructionMIPS64::Emulate_LDST_Reg(llvm::MCInst &insn) { … }