1 |
/* |
2 |
* HT Editor |
3 |
* ppcdis.h |
4 |
* |
5 |
* Copyright (C) 1999-2002 Sebastian Biallas (sb@web-productions.de) |
6 |
* |
7 |
* This program is free software; you can redistribute it and/or modify |
8 |
* it under the terms of the GNU General Public License version 2 as |
9 |
* published by the Free Software Foundation. |
10 |
* |
11 |
* This program is distributed in the hope that it will be useful, |
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
* GNU General Public License for more details. |
15 |
* |
16 |
* You should have received a copy of the GNU General Public License |
17 |
* along with this program; if not, write to the Free Software |
18 |
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
19 |
*/ |
20 |
|
21 |
#ifndef __PPC_DIS_H__ |
22 |
#define __PPC_DIS_H__ |
23 |
|
24 |
#include "system/types.h" |
25 |
#include "asm.h" |
26 |
#include "ppcopc.h" |
27 |
|
28 |
struct ppcdis_operand { |
29 |
int flags; |
30 |
const powerpc_operand *op; |
31 |
union { |
32 |
int reg; // general register |
33 |
int freg; // float register |
34 |
int creg; // condition register |
35 |
int vreg; // vector register |
36 |
uint32 imm; |
37 |
struct { |
38 |
uint32 disp; |
39 |
int gr; |
40 |
} mem; |
41 |
struct { |
42 |
uint32 mem; |
43 |
} abs; |
44 |
struct { |
45 |
uint32 mem; |
46 |
} rel; |
47 |
}; |
48 |
}; |
49 |
|
50 |
struct ppcdis_insn { |
51 |
bool valid; |
52 |
int size; |
53 |
const char * name; |
54 |
uint32 data; |
55 |
int ops; |
56 |
ppcdis_operand op[8]; |
57 |
}; |
58 |
|
59 |
class PPCDisassembler: public Disassembler { |
60 |
protected: |
61 |
char insnstr[256]; |
62 |
ppcdis_insn insn; |
63 |
public: |
64 |
PPCDisassembler(); |
65 |
|
66 |
virtual dis_insn *decode(const byte *code, int maxlen, CPU_ADDR addr); |
67 |
virtual dis_insn *duplicateInsn(dis_insn *disasm_insn); |
68 |
virtual void getOpcodeMetrics(int &min_length, int &max_length, int &min_look_ahead, int &avg_look_ahead, int &addr_align); |
69 |
virtual byte getSize(dis_insn *disasm_insn); |
70 |
virtual char *getName(); |
71 |
virtual char *str(dis_insn *disasm_insn, int style); |
72 |
virtual char *strf(dis_insn *disasm_insn, int style, char *format); |
73 |
virtual ObjectID getObjectID() const; |
74 |
virtual bool validInsn(dis_insn *disasm_insn); |
75 |
}; |
76 |
|
77 |
#endif |