summaryrefslogtreecommitdiff
path: root/includes/mipsdis.h
blob: 5ce250611805da5a20574e0ee15e26395c0f4ae0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#ifndef __MIPSDIS_H__
#define __MIPSDIS_H__
#include <Exceptions.h>
#include <queue>
#include "mipsmem.h"

class TDis : public Base {
  public:
      TDis(mipsmem *);
    virtual mipsmem * getmem();
    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();

    bool invalid;
    std::priority_queue<int, std::vector<int>, std::greater<int> > bheap;
    std::priority_queue<int, std::vector<int>, std::greater<int> > jheap;
    std::priority_queue<int, std::vector<int>, std::greater<int> > fheap;
    
    Uint32 pc;
  private:
    mipsmem * mm;
};

class Disassembler : public Base {
  public:
      Disassembler(mipsmem *);
      virtual ~Disassembler();
    void mainloop();
    void crawl_code(Uint32 = 0xffffffff);
  private:
    mipsmem * mm;
    TDis * dis;
    bool started;
    bool infunction;
};


#endif