diff options
Diffstat (limited to 'includes/mipsdump.h')
-rw-r--r-- | includes/mipsdump.h | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/includes/mipsdump.h b/includes/mipsdump.h new file mode 100644 index 0000000..a6c6288 --- /dev/null +++ b/includes/mipsdump.h @@ -0,0 +1,73 @@ +#ifndef __MIPSDUMP_H__ +#define __MIPSDUMP_H__ + +#include <Exceptions.h> +#include <mipsdis.h> + +enum arg_type { + T_GPREGISTER, + T_CPREGISTER, + T_IMM8, + T_IMM16, + T_IMM32, + T_OFB, +}; + +union arg { + Uint32 v; + struct { + Uint32 o; + int r; + int w; + } OfB; +}; + +template<class T1, class T2> +struct mypair { + T1 left; + T2 right; +}; + +typedef mypair<int, arg> pairarg; + +class TDump : public TDis { + public: + TDump(mipsmem *); + virtual void add_branch(Uint32); + virtual void add_jump(Uint32); + virtual void add_function(Uint32); + virtual void SetTag(Uint32, int, bool); + virtual void Name(const String &); + virtual void PushGPReg(int); + virtual void PushCPReg(int); + virtual void PushImm(Uint32); + virtual void PushTarget(Uint32); + virtual void PushSa(Uint32); + virtual void PushOfB(int reg, Uint32, int); + virtual void PushOffset(Uint32); + virtual void PushFull(Uint32); + virtual void Invalid(); + virtual void Suspect(); + virtual void Comment(const String &); + + virtual void reset(); + + String name; + std::vector<pairarg> args; + String comments; + + Uint32 tg; + + bool invalid, hasbr, hastg, hasfc; +}; + +class Dumper : public Base { + public: + Dumper(mipsmem *); + void process(); + private: + TDump * dump; + mipsmem * mm; +}; + +#endif |