add rsp operands to disassemble

This commit is contained in:
angie 2022-06-07 01:00:45 -04:00
parent 9b4ac24ca5
commit 13388832f7

View File

@ -196,23 +196,67 @@ size_t RabbitizerRegisterType_processImmediateBase(const RabbitizerInstr *self,
return totalSize;
}
/*
RabbitizerRegisterTypeRsp_processRs
RabbitizerRegisterTypeRsp_processRt
RabbitizerRegisterTypeRsp_processRd
RabbitizerRegisterTypeRsp_processCop0d
RabbitizerRegisterTypeRsp_processVs
RabbitizerRegisterTypeRsp_processVt
RabbitizerRegisterTypeRsp_processVd
*/
size_t RabbitizerRegisterTypeRsp_processVtElement(const RabbitizerInstr *self, char *dst, UNUSED const char *immOverride, UNUSED size_t immOverrideLength) {
size_t RabbitizerRegisterTypeRsp_processRs(const RabbitizerInstr *self, char *dst, UNUSED const char *immOverride, UNUSED size_t immOverrideLength) {
size_t totalSize = 0;
const char *reg = RabbitizerRegister_getNameRspGpr(self->rs);
RABUTILS_BUFFER_CPY(dst, totalSize, reg);
return totalSize;
}
size_t RabbitizerRegisterTypeRsp_processRt(const RabbitizerInstr *self, char *dst, UNUSED const char *immOverride, UNUSED size_t immOverrideLength) {
size_t totalSize = 0;
const char *reg = RabbitizerRegister_getNameRspGpr(self->rt);
RABUTILS_BUFFER_CPY(dst, totalSize, reg);
return totalSize;
}
size_t RabbitizerRegisterTypeRsp_processRd(const RabbitizerInstr *self, char *dst, UNUSED const char *immOverride, UNUSED size_t immOverrideLength) {
size_t totalSize = 0;
const char *reg = RabbitizerRegister_getNameRspVector(self->rd);
RABUTILS_BUFFER_CPY(dst, totalSize, reg);
return totalSize;
}
size_t RabbitizerRegisterTypeRsp_processCop0d(const RabbitizerInstr *self, char *dst, UNUSED const char *immOverride, UNUSED size_t immOverrideLength) {
size_t totalSize = 0;
const char *reg = RabbitizerRegister_getNameRspCop0(self->rd);
RABUTILS_BUFFER_CPY(dst, totalSize, reg);
return totalSize;
}
size_t RabbitizerRegisterTypeRsp_processVs(const RabbitizerInstr *self, char *dst, UNUSED const char *immOverride, UNUSED size_t immOverrideLength) {
size_t totalSize = 0;
const char *reg = RabbitizerRegister_getNameRspVector(self->rs);
RABUTILS_BUFFER_CPY(dst, totalSize, reg);
return totalSize;
}
size_t RabbitizerRegisterTypeRsp_processVt(const RabbitizerInstr *self, char *dst, UNUSED const char *immOverride, UNUSED size_t immOverrideLength) {
size_t totalSize = 0;
const char *reg = RabbitizerRegister_getNameRspVector(self->rt);
RABUTILS_BUFFER_CPY(dst, totalSize, reg);
return totalSize;
}
size_t RabbitizerRegisterTypeRsp_processVd(const RabbitizerInstr *self, char *dst, UNUSED const char *immOverride, UNUSED size_t immOverrideLength) {
size_t totalSize = 0;
const char *reg = RabbitizerRegister_getNameRspGpr(self->rd);
RABUTILS_BUFFER_CPY(dst, totalSize, reg);
return totalSize;
}
size_t RabbitizerRegisterTypeRsp_processVtElement(const RabbitizerInstr *self, char *dst, const char *immOverride, size_t immOverrideLength) {
size_t totalSize = 0;
const char *reg;
uint8_t element;
reg = RabbitizerRegister_getNameRspVector(self->rt);
RABUTILS_BUFFER_CPY(dst, totalSize, reg);
RABUTILS_BUFFER_ADVANCE(dst, totalSize, RabbitizerRegisterTypeRsp_processVt(self, dst, immOverride, immOverrideLength));
RABUTILS_BUFFER_WRITE_CHAR(dst, totalSize, '[');
@ -224,16 +268,14 @@ size_t RabbitizerRegisterTypeRsp_processVtElement(const RabbitizerInstr *self, c
return totalSize;
}
size_t RabbitizerRegisterTypeRsp_processOffsetVs(const RabbitizerInstr *self, char *dst, UNUSED const char *immOverride, UNUSED size_t immOverrideLength) {
size_t RabbitizerRegisterTypeRsp_processOffsetVs(const RabbitizerInstr *self, char *dst, const char *immOverride, size_t immOverrideLength) {
size_t totalSize = 0;
const char *reg;
RABUTILS_BUFFER_SPRINTF(dst, totalSize, "0x%X", RabbitizerInstrRsp_GetOffsetVector(self));
RABUTILS_BUFFER_WRITE_CHAR(dst, totalSize, '(');
reg = RabbitizerRegister_getNameRspGpr(self->rs);
RABUTILS_BUFFER_CPY(dst, totalSize, reg);
RABUTILS_BUFFER_ADVANCE(dst, totalSize, RabbitizerRegisterTypeRsp_processRs(self, dst, immOverride, immOverrideLength));
RABUTILS_BUFFER_WRITE_CHAR(dst, totalSize, ')');
@ -257,13 +299,14 @@ const OperandCallback instrOpercandCallbacks[] = {
[RABBITIZER_REGISTER_TYPE_IMM] = RabbitizerRegisterType_processImmediate,
[RABBITIZER_REGISTER_TYPE_IMM_base] = RabbitizerRegisterType_processImmediateBase,
// [RABBITIZER_REGISTER_TYPE_RSP_rs] = RabbitizerRegisterTypeRsp_processRs,
// [RABBITIZER_REGISTER_TYPE_RSP_rt] = RabbitizerRegisterTypeRsp_processRt,
// [RABBITIZER_REGISTER_TYPE_RSP_rd] = RabbitizerRegisterTypeRsp_processRd,
// [RABBITIZER_REGISTER_TYPE_RSP_cop0d] = RabbitizerRegisterTypeRsp_processCop0d,
// [RABBITIZER_REGISTER_TYPE_RSP_vs] = RabbitizerRegisterTypeRsp_processVs,
// [RABBITIZER_REGISTER_TYPE_RSP_vt] = RabbitizerRegisterTypeRsp_processVt,
// [RABBITIZER_REGISTER_TYPE_RSP_vd] = RabbitizerRegisterTypeRsp_processVd,
// rsp
[RABBITIZER_REGISTER_TYPE_RSP_rs] = RabbitizerRegisterTypeRsp_processRs,
[RABBITIZER_REGISTER_TYPE_RSP_rt] = RabbitizerRegisterTypeRsp_processRt,
[RABBITIZER_REGISTER_TYPE_RSP_rd] = RabbitizerRegisterTypeRsp_processRd,
[RABBITIZER_REGISTER_TYPE_RSP_cop0d] = RabbitizerRegisterTypeRsp_processCop0d,
[RABBITIZER_REGISTER_TYPE_RSP_vs] = RabbitizerRegisterTypeRsp_processVs,
[RABBITIZER_REGISTER_TYPE_RSP_vt] = RabbitizerRegisterTypeRsp_processVt,
[RABBITIZER_REGISTER_TYPE_RSP_vd] = RabbitizerRegisterTypeRsp_processVd,
[RABBITIZER_REGISTER_TYPE_RSP_vt_element] = RabbitizerRegisterTypeRsp_processVtElement,
[RABBITIZER_REGISTER_TYPE_RSP_offset_rs] = RabbitizerRegisterTypeRsp_processOffsetVs,
};