-
Notifications
You must be signed in to change notification settings - Fork 5
/
rx63.hpp
122 lines (105 loc) · 2.25 KB
/
rx63.hpp
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#ifndef _Z8_HPP
#define _Z8_HPP
#pragma warning(disable : 4800)
#include "../idaidp.hpp"
#include "ins.hpp"
#include <segregs.hpp>
#include "../iohandler.hpp"
#define PLFM_RX63 0x8001
enum RX63_registers
{
r_r0, r_r1, r_r2, r_r3, r_r4, r_r5, r_r6, r_r7, r_r8, r_r9, r_r10, r_r11, r_r12, r_r13, r_r14, r_r15,
r_isp, r_usp, r_intb, r_pc, r_psw, r_bpc, r_bpsw, r_fintv, r_fpsw,
r_cs, r_ds
};
#define memex specflag1
#define ld specflag2
#define phrase_type specflag3
#define o_flag o_idpspec0
#define o_creg o_idpspec1
enum rx63_cregs
{
cr_psw = 0,
cr_pc = 1,
cr_usp = 2,
cr_fpsw = 3,
cr_bpsw = 8,
cr_bpc = 9,
cr_isp = 10,
cr_fintv = 11,
cr_intb = 12
};
enum rx63_phrases
{
rx63_phrasesf_r_plus, // [r+]
rx63_phrasesf_r_minus, // [-r]
rx63_phrasesf_r_r, // [r,r]
rx63_phrasesf_r_2_r // r-r
};
enum memex_t
{
memex_tb = 0,
memex_tw = 1,
memex_tl = 2,
memex_tuw = 3,
memex_tub = 4,
memex_ts = 5,
memex_ta = 6,
memex_tdont_show = 0x10
};
enum cflag_t
{
cflag_tflag_c = 0,
cflag_tflag_z = 1,
cflag_tflag_s = 2,
cflag_tflag_o = 3,
cflag_tflag_i = 8,
cflag_tflag_u = 9,
};
enum condition_t
{
condition_teq = 0,
condition_tne = 1,
condition_tc = 2,
condition_tnc = 3,
condition_tgtu = 4,
condition_tleu = 5,
condition_tpz = 6,
condition_tn = 7,
condition_tge = 8,
condition_tlt = 9,
condition_tgt = 10,
condition_tle = 11,
condition_to = 12,
condition_tno = 13,
condition_tbra = 14,
condition_tnone = 15
};
enum ld_t
{
ld_tin_reg = 0, // [reg]
ld_tdsp8 = 1,
ld_tdsp16 = 2,
ld_treg = 3 // reg
};
int idaapi ana(insn_t *insn);
int idaapi emu(const insn_t *insn);
struct rx63_iohandler_t : public iohandler_t
{
struct rx63_t& pm;
rx63_iohandler_t(rx63_t& _pm, netnode& nn) : iohandler_t(nn), pm(_pm) {}
};
struct rx63_t : public procmod_t
{
netnode helper;
rx63_iohandler_t ioh = rx63_iohandler_t(*this, helper);
virtual ssize_t idaapi on_event(ssize_t msgid, va_list va) override;
int idaapi emu(const insn_t &insn) const;
void handle_operand(const op_t &x, bool isload, const insn_t &insn, bool *flow) const;
void header(outctx_t &ctx) const;
void footer(outctx_t &ctx) const;
void segstart(outctx_t &ctx, segment_t *seg) const;
void segend(outctx_t &ctx, segment_t *seg) const;
void load_from_idb();
};
#endif