unicorn-engine 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,36 @@
1
+ /*
2
+
3
+ Ruby bindings for the Unicorn Emulator Engine
4
+
5
+ Copyright(c) 2016 Sascha Schirra
6
+
7
+ This program is free software; you can redistribute it and/or
8
+ modify it under the terms of the GNU General Public License
9
+ version 2 as 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
+
20
+ */
21
+ VALUE m_uc_initialize(VALUE self, VALUE arch, VALUE mode);
22
+ VALUE m_uc_emu_start(int argc, VALUE* argv, VALUE self);
23
+ VALUE m_uc_emu_stop(VALUE self);
24
+ VALUE m_uc_reg_read(VALUE self, VALUE reg_id);
25
+ VALUE m_uc_reg_write(VALUE self, VALUE reg_id, VALUE reg_value);
26
+ VALUE m_uc_mem_read(VALUE self, VALUE address, VALUE size);
27
+ VALUE m_uc_mem_write(VALUE self, VALUE address, VALUE bytes);
28
+ VALUE m_uc_mem_map(int argc, VALUE* argv, VALUE self);
29
+ VALUE m_uc_mem_unmap(VALUE self, VALUE address, VALUE size);
30
+ VALUE m_uc_mem_protect(VALUE self, VALUE address, VALUE size, VALUE perms);
31
+ VALUE m_uc_hook_add(int argc, VALUE* argv, VALUE self);
32
+ VALUE m_uc_hook_del(VALUE self, VALUE hook);
33
+ VALUE m_uc_query(VALUE self, VALUE query_mode);
34
+ VALUE m_uc_context_save(VALUE self);
35
+ VALUE m_uc_context_update(VALUE self, VALUE context);
36
+ VALUE m_uc_context_restore(VALUE self, VALUE context);
@@ -0,0 +1,283 @@
1
+ # For Unicorn Engine. AUTO-GENERATED FILE, DO NOT EDIT [arm64_const.rb]
2
+
3
+ module UnicornEngine
4
+
5
+ # ARM64 registers
6
+
7
+ UC_ARM64_REG_INVALID = 0
8
+ UC_ARM64_REG_X29 = 1
9
+ UC_ARM64_REG_X30 = 2
10
+ UC_ARM64_REG_NZCV = 3
11
+ UC_ARM64_REG_SP = 4
12
+ UC_ARM64_REG_WSP = 5
13
+ UC_ARM64_REG_WZR = 6
14
+ UC_ARM64_REG_XZR = 7
15
+ UC_ARM64_REG_B0 = 8
16
+ UC_ARM64_REG_B1 = 9
17
+ UC_ARM64_REG_B2 = 10
18
+ UC_ARM64_REG_B3 = 11
19
+ UC_ARM64_REG_B4 = 12
20
+ UC_ARM64_REG_B5 = 13
21
+ UC_ARM64_REG_B6 = 14
22
+ UC_ARM64_REG_B7 = 15
23
+ UC_ARM64_REG_B8 = 16
24
+ UC_ARM64_REG_B9 = 17
25
+ UC_ARM64_REG_B10 = 18
26
+ UC_ARM64_REG_B11 = 19
27
+ UC_ARM64_REG_B12 = 20
28
+ UC_ARM64_REG_B13 = 21
29
+ UC_ARM64_REG_B14 = 22
30
+ UC_ARM64_REG_B15 = 23
31
+ UC_ARM64_REG_B16 = 24
32
+ UC_ARM64_REG_B17 = 25
33
+ UC_ARM64_REG_B18 = 26
34
+ UC_ARM64_REG_B19 = 27
35
+ UC_ARM64_REG_B20 = 28
36
+ UC_ARM64_REG_B21 = 29
37
+ UC_ARM64_REG_B22 = 30
38
+ UC_ARM64_REG_B23 = 31
39
+ UC_ARM64_REG_B24 = 32
40
+ UC_ARM64_REG_B25 = 33
41
+ UC_ARM64_REG_B26 = 34
42
+ UC_ARM64_REG_B27 = 35
43
+ UC_ARM64_REG_B28 = 36
44
+ UC_ARM64_REG_B29 = 37
45
+ UC_ARM64_REG_B30 = 38
46
+ UC_ARM64_REG_B31 = 39
47
+ UC_ARM64_REG_D0 = 40
48
+ UC_ARM64_REG_D1 = 41
49
+ UC_ARM64_REG_D2 = 42
50
+ UC_ARM64_REG_D3 = 43
51
+ UC_ARM64_REG_D4 = 44
52
+ UC_ARM64_REG_D5 = 45
53
+ UC_ARM64_REG_D6 = 46
54
+ UC_ARM64_REG_D7 = 47
55
+ UC_ARM64_REG_D8 = 48
56
+ UC_ARM64_REG_D9 = 49
57
+ UC_ARM64_REG_D10 = 50
58
+ UC_ARM64_REG_D11 = 51
59
+ UC_ARM64_REG_D12 = 52
60
+ UC_ARM64_REG_D13 = 53
61
+ UC_ARM64_REG_D14 = 54
62
+ UC_ARM64_REG_D15 = 55
63
+ UC_ARM64_REG_D16 = 56
64
+ UC_ARM64_REG_D17 = 57
65
+ UC_ARM64_REG_D18 = 58
66
+ UC_ARM64_REG_D19 = 59
67
+ UC_ARM64_REG_D20 = 60
68
+ UC_ARM64_REG_D21 = 61
69
+ UC_ARM64_REG_D22 = 62
70
+ UC_ARM64_REG_D23 = 63
71
+ UC_ARM64_REG_D24 = 64
72
+ UC_ARM64_REG_D25 = 65
73
+ UC_ARM64_REG_D26 = 66
74
+ UC_ARM64_REG_D27 = 67
75
+ UC_ARM64_REG_D28 = 68
76
+ UC_ARM64_REG_D29 = 69
77
+ UC_ARM64_REG_D30 = 70
78
+ UC_ARM64_REG_D31 = 71
79
+ UC_ARM64_REG_H0 = 72
80
+ UC_ARM64_REG_H1 = 73
81
+ UC_ARM64_REG_H2 = 74
82
+ UC_ARM64_REG_H3 = 75
83
+ UC_ARM64_REG_H4 = 76
84
+ UC_ARM64_REG_H5 = 77
85
+ UC_ARM64_REG_H6 = 78
86
+ UC_ARM64_REG_H7 = 79
87
+ UC_ARM64_REG_H8 = 80
88
+ UC_ARM64_REG_H9 = 81
89
+ UC_ARM64_REG_H10 = 82
90
+ UC_ARM64_REG_H11 = 83
91
+ UC_ARM64_REG_H12 = 84
92
+ UC_ARM64_REG_H13 = 85
93
+ UC_ARM64_REG_H14 = 86
94
+ UC_ARM64_REG_H15 = 87
95
+ UC_ARM64_REG_H16 = 88
96
+ UC_ARM64_REG_H17 = 89
97
+ UC_ARM64_REG_H18 = 90
98
+ UC_ARM64_REG_H19 = 91
99
+ UC_ARM64_REG_H20 = 92
100
+ UC_ARM64_REG_H21 = 93
101
+ UC_ARM64_REG_H22 = 94
102
+ UC_ARM64_REG_H23 = 95
103
+ UC_ARM64_REG_H24 = 96
104
+ UC_ARM64_REG_H25 = 97
105
+ UC_ARM64_REG_H26 = 98
106
+ UC_ARM64_REG_H27 = 99
107
+ UC_ARM64_REG_H28 = 100
108
+ UC_ARM64_REG_H29 = 101
109
+ UC_ARM64_REG_H30 = 102
110
+ UC_ARM64_REG_H31 = 103
111
+ UC_ARM64_REG_Q0 = 104
112
+ UC_ARM64_REG_Q1 = 105
113
+ UC_ARM64_REG_Q2 = 106
114
+ UC_ARM64_REG_Q3 = 107
115
+ UC_ARM64_REG_Q4 = 108
116
+ UC_ARM64_REG_Q5 = 109
117
+ UC_ARM64_REG_Q6 = 110
118
+ UC_ARM64_REG_Q7 = 111
119
+ UC_ARM64_REG_Q8 = 112
120
+ UC_ARM64_REG_Q9 = 113
121
+ UC_ARM64_REG_Q10 = 114
122
+ UC_ARM64_REG_Q11 = 115
123
+ UC_ARM64_REG_Q12 = 116
124
+ UC_ARM64_REG_Q13 = 117
125
+ UC_ARM64_REG_Q14 = 118
126
+ UC_ARM64_REG_Q15 = 119
127
+ UC_ARM64_REG_Q16 = 120
128
+ UC_ARM64_REG_Q17 = 121
129
+ UC_ARM64_REG_Q18 = 122
130
+ UC_ARM64_REG_Q19 = 123
131
+ UC_ARM64_REG_Q20 = 124
132
+ UC_ARM64_REG_Q21 = 125
133
+ UC_ARM64_REG_Q22 = 126
134
+ UC_ARM64_REG_Q23 = 127
135
+ UC_ARM64_REG_Q24 = 128
136
+ UC_ARM64_REG_Q25 = 129
137
+ UC_ARM64_REG_Q26 = 130
138
+ UC_ARM64_REG_Q27 = 131
139
+ UC_ARM64_REG_Q28 = 132
140
+ UC_ARM64_REG_Q29 = 133
141
+ UC_ARM64_REG_Q30 = 134
142
+ UC_ARM64_REG_Q31 = 135
143
+ UC_ARM64_REG_S0 = 136
144
+ UC_ARM64_REG_S1 = 137
145
+ UC_ARM64_REG_S2 = 138
146
+ UC_ARM64_REG_S3 = 139
147
+ UC_ARM64_REG_S4 = 140
148
+ UC_ARM64_REG_S5 = 141
149
+ UC_ARM64_REG_S6 = 142
150
+ UC_ARM64_REG_S7 = 143
151
+ UC_ARM64_REG_S8 = 144
152
+ UC_ARM64_REG_S9 = 145
153
+ UC_ARM64_REG_S10 = 146
154
+ UC_ARM64_REG_S11 = 147
155
+ UC_ARM64_REG_S12 = 148
156
+ UC_ARM64_REG_S13 = 149
157
+ UC_ARM64_REG_S14 = 150
158
+ UC_ARM64_REG_S15 = 151
159
+ UC_ARM64_REG_S16 = 152
160
+ UC_ARM64_REG_S17 = 153
161
+ UC_ARM64_REG_S18 = 154
162
+ UC_ARM64_REG_S19 = 155
163
+ UC_ARM64_REG_S20 = 156
164
+ UC_ARM64_REG_S21 = 157
165
+ UC_ARM64_REG_S22 = 158
166
+ UC_ARM64_REG_S23 = 159
167
+ UC_ARM64_REG_S24 = 160
168
+ UC_ARM64_REG_S25 = 161
169
+ UC_ARM64_REG_S26 = 162
170
+ UC_ARM64_REG_S27 = 163
171
+ UC_ARM64_REG_S28 = 164
172
+ UC_ARM64_REG_S29 = 165
173
+ UC_ARM64_REG_S30 = 166
174
+ UC_ARM64_REG_S31 = 167
175
+ UC_ARM64_REG_W0 = 168
176
+ UC_ARM64_REG_W1 = 169
177
+ UC_ARM64_REG_W2 = 170
178
+ UC_ARM64_REG_W3 = 171
179
+ UC_ARM64_REG_W4 = 172
180
+ UC_ARM64_REG_W5 = 173
181
+ UC_ARM64_REG_W6 = 174
182
+ UC_ARM64_REG_W7 = 175
183
+ UC_ARM64_REG_W8 = 176
184
+ UC_ARM64_REG_W9 = 177
185
+ UC_ARM64_REG_W10 = 178
186
+ UC_ARM64_REG_W11 = 179
187
+ UC_ARM64_REG_W12 = 180
188
+ UC_ARM64_REG_W13 = 181
189
+ UC_ARM64_REG_W14 = 182
190
+ UC_ARM64_REG_W15 = 183
191
+ UC_ARM64_REG_W16 = 184
192
+ UC_ARM64_REG_W17 = 185
193
+ UC_ARM64_REG_W18 = 186
194
+ UC_ARM64_REG_W19 = 187
195
+ UC_ARM64_REG_W20 = 188
196
+ UC_ARM64_REG_W21 = 189
197
+ UC_ARM64_REG_W22 = 190
198
+ UC_ARM64_REG_W23 = 191
199
+ UC_ARM64_REG_W24 = 192
200
+ UC_ARM64_REG_W25 = 193
201
+ UC_ARM64_REG_W26 = 194
202
+ UC_ARM64_REG_W27 = 195
203
+ UC_ARM64_REG_W28 = 196
204
+ UC_ARM64_REG_W29 = 197
205
+ UC_ARM64_REG_W30 = 198
206
+ UC_ARM64_REG_X0 = 199
207
+ UC_ARM64_REG_X1 = 200
208
+ UC_ARM64_REG_X2 = 201
209
+ UC_ARM64_REG_X3 = 202
210
+ UC_ARM64_REG_X4 = 203
211
+ UC_ARM64_REG_X5 = 204
212
+ UC_ARM64_REG_X6 = 205
213
+ UC_ARM64_REG_X7 = 206
214
+ UC_ARM64_REG_X8 = 207
215
+ UC_ARM64_REG_X9 = 208
216
+ UC_ARM64_REG_X10 = 209
217
+ UC_ARM64_REG_X11 = 210
218
+ UC_ARM64_REG_X12 = 211
219
+ UC_ARM64_REG_X13 = 212
220
+ UC_ARM64_REG_X14 = 213
221
+ UC_ARM64_REG_X15 = 214
222
+ UC_ARM64_REG_X16 = 215
223
+ UC_ARM64_REG_X17 = 216
224
+ UC_ARM64_REG_X18 = 217
225
+ UC_ARM64_REG_X19 = 218
226
+ UC_ARM64_REG_X20 = 219
227
+ UC_ARM64_REG_X21 = 220
228
+ UC_ARM64_REG_X22 = 221
229
+ UC_ARM64_REG_X23 = 222
230
+ UC_ARM64_REG_X24 = 223
231
+ UC_ARM64_REG_X25 = 224
232
+ UC_ARM64_REG_X26 = 225
233
+ UC_ARM64_REG_X27 = 226
234
+ UC_ARM64_REG_X28 = 227
235
+ UC_ARM64_REG_V0 = 228
236
+ UC_ARM64_REG_V1 = 229
237
+ UC_ARM64_REG_V2 = 230
238
+ UC_ARM64_REG_V3 = 231
239
+ UC_ARM64_REG_V4 = 232
240
+ UC_ARM64_REG_V5 = 233
241
+ UC_ARM64_REG_V6 = 234
242
+ UC_ARM64_REG_V7 = 235
243
+ UC_ARM64_REG_V8 = 236
244
+ UC_ARM64_REG_V9 = 237
245
+ UC_ARM64_REG_V10 = 238
246
+ UC_ARM64_REG_V11 = 239
247
+ UC_ARM64_REG_V12 = 240
248
+ UC_ARM64_REG_V13 = 241
249
+ UC_ARM64_REG_V14 = 242
250
+ UC_ARM64_REG_V15 = 243
251
+ UC_ARM64_REG_V16 = 244
252
+ UC_ARM64_REG_V17 = 245
253
+ UC_ARM64_REG_V18 = 246
254
+ UC_ARM64_REG_V19 = 247
255
+ UC_ARM64_REG_V20 = 248
256
+ UC_ARM64_REG_V21 = 249
257
+ UC_ARM64_REG_V22 = 250
258
+ UC_ARM64_REG_V23 = 251
259
+ UC_ARM64_REG_V24 = 252
260
+ UC_ARM64_REG_V25 = 253
261
+ UC_ARM64_REG_V26 = 254
262
+ UC_ARM64_REG_V27 = 255
263
+ UC_ARM64_REG_V28 = 256
264
+ UC_ARM64_REG_V29 = 257
265
+ UC_ARM64_REG_V30 = 258
266
+ UC_ARM64_REG_V31 = 259
267
+
268
+ # pseudo registers
269
+ UC_ARM64_REG_PC = 260
270
+ UC_ARM64_REG_CPACR_EL1 = 261
271
+
272
+ # thread registers
273
+ UC_ARM64_REG_TPIDR_EL0 = 262
274
+ UC_ARM64_REG_TPIDRRO_EL0 = 263
275
+ UC_ARM64_REG_TPIDR_EL1 = 264
276
+ UC_ARM64_REG_ENDING = 265
277
+
278
+ # alias registers
279
+ UC_ARM64_REG_IP1 = 215
280
+ UC_ARM64_REG_IP0 = 216
281
+ UC_ARM64_REG_FP = 1
282
+ UC_ARM64_REG_LR = 2
283
+ end
@@ -0,0 +1,131 @@
1
+ # For Unicorn Engine. AUTO-GENERATED FILE, DO NOT EDIT [arm_const.rb]
2
+
3
+ module UnicornEngine
4
+
5
+ # ARM registers
6
+
7
+ UC_ARM_REG_INVALID = 0
8
+ UC_ARM_REG_APSR = 1
9
+ UC_ARM_REG_APSR_NZCV = 2
10
+ UC_ARM_REG_CPSR = 3
11
+ UC_ARM_REG_FPEXC = 4
12
+ UC_ARM_REG_FPINST = 5
13
+ UC_ARM_REG_FPSCR = 6
14
+ UC_ARM_REG_FPSCR_NZCV = 7
15
+ UC_ARM_REG_FPSID = 8
16
+ UC_ARM_REG_ITSTATE = 9
17
+ UC_ARM_REG_LR = 10
18
+ UC_ARM_REG_PC = 11
19
+ UC_ARM_REG_SP = 12
20
+ UC_ARM_REG_SPSR = 13
21
+ UC_ARM_REG_D0 = 14
22
+ UC_ARM_REG_D1 = 15
23
+ UC_ARM_REG_D2 = 16
24
+ UC_ARM_REG_D3 = 17
25
+ UC_ARM_REG_D4 = 18
26
+ UC_ARM_REG_D5 = 19
27
+ UC_ARM_REG_D6 = 20
28
+ UC_ARM_REG_D7 = 21
29
+ UC_ARM_REG_D8 = 22
30
+ UC_ARM_REG_D9 = 23
31
+ UC_ARM_REG_D10 = 24
32
+ UC_ARM_REG_D11 = 25
33
+ UC_ARM_REG_D12 = 26
34
+ UC_ARM_REG_D13 = 27
35
+ UC_ARM_REG_D14 = 28
36
+ UC_ARM_REG_D15 = 29
37
+ UC_ARM_REG_D16 = 30
38
+ UC_ARM_REG_D17 = 31
39
+ UC_ARM_REG_D18 = 32
40
+ UC_ARM_REG_D19 = 33
41
+ UC_ARM_REG_D20 = 34
42
+ UC_ARM_REG_D21 = 35
43
+ UC_ARM_REG_D22 = 36
44
+ UC_ARM_REG_D23 = 37
45
+ UC_ARM_REG_D24 = 38
46
+ UC_ARM_REG_D25 = 39
47
+ UC_ARM_REG_D26 = 40
48
+ UC_ARM_REG_D27 = 41
49
+ UC_ARM_REG_D28 = 42
50
+ UC_ARM_REG_D29 = 43
51
+ UC_ARM_REG_D30 = 44
52
+ UC_ARM_REG_D31 = 45
53
+ UC_ARM_REG_FPINST2 = 46
54
+ UC_ARM_REG_MVFR0 = 47
55
+ UC_ARM_REG_MVFR1 = 48
56
+ UC_ARM_REG_MVFR2 = 49
57
+ UC_ARM_REG_Q0 = 50
58
+ UC_ARM_REG_Q1 = 51
59
+ UC_ARM_REG_Q2 = 52
60
+ UC_ARM_REG_Q3 = 53
61
+ UC_ARM_REG_Q4 = 54
62
+ UC_ARM_REG_Q5 = 55
63
+ UC_ARM_REG_Q6 = 56
64
+ UC_ARM_REG_Q7 = 57
65
+ UC_ARM_REG_Q8 = 58
66
+ UC_ARM_REG_Q9 = 59
67
+ UC_ARM_REG_Q10 = 60
68
+ UC_ARM_REG_Q11 = 61
69
+ UC_ARM_REG_Q12 = 62
70
+ UC_ARM_REG_Q13 = 63
71
+ UC_ARM_REG_Q14 = 64
72
+ UC_ARM_REG_Q15 = 65
73
+ UC_ARM_REG_R0 = 66
74
+ UC_ARM_REG_R1 = 67
75
+ UC_ARM_REG_R2 = 68
76
+ UC_ARM_REG_R3 = 69
77
+ UC_ARM_REG_R4 = 70
78
+ UC_ARM_REG_R5 = 71
79
+ UC_ARM_REG_R6 = 72
80
+ UC_ARM_REG_R7 = 73
81
+ UC_ARM_REG_R8 = 74
82
+ UC_ARM_REG_R9 = 75
83
+ UC_ARM_REG_R10 = 76
84
+ UC_ARM_REG_R11 = 77
85
+ UC_ARM_REG_R12 = 78
86
+ UC_ARM_REG_S0 = 79
87
+ UC_ARM_REG_S1 = 80
88
+ UC_ARM_REG_S2 = 81
89
+ UC_ARM_REG_S3 = 82
90
+ UC_ARM_REG_S4 = 83
91
+ UC_ARM_REG_S5 = 84
92
+ UC_ARM_REG_S6 = 85
93
+ UC_ARM_REG_S7 = 86
94
+ UC_ARM_REG_S8 = 87
95
+ UC_ARM_REG_S9 = 88
96
+ UC_ARM_REG_S10 = 89
97
+ UC_ARM_REG_S11 = 90
98
+ UC_ARM_REG_S12 = 91
99
+ UC_ARM_REG_S13 = 92
100
+ UC_ARM_REG_S14 = 93
101
+ UC_ARM_REG_S15 = 94
102
+ UC_ARM_REG_S16 = 95
103
+ UC_ARM_REG_S17 = 96
104
+ UC_ARM_REG_S18 = 97
105
+ UC_ARM_REG_S19 = 98
106
+ UC_ARM_REG_S20 = 99
107
+ UC_ARM_REG_S21 = 100
108
+ UC_ARM_REG_S22 = 101
109
+ UC_ARM_REG_S23 = 102
110
+ UC_ARM_REG_S24 = 103
111
+ UC_ARM_REG_S25 = 104
112
+ UC_ARM_REG_S26 = 105
113
+ UC_ARM_REG_S27 = 106
114
+ UC_ARM_REG_S28 = 107
115
+ UC_ARM_REG_S29 = 108
116
+ UC_ARM_REG_S30 = 109
117
+ UC_ARM_REG_S31 = 110
118
+ UC_ARM_REG_C1_C0_2 = 111
119
+ UC_ARM_REG_C13_C0_2 = 112
120
+ UC_ARM_REG_C13_C0_3 = 113
121
+ UC_ARM_REG_ENDING = 114
122
+
123
+ # alias registers
124
+ UC_ARM_REG_R13 = 12
125
+ UC_ARM_REG_R14 = 10
126
+ UC_ARM_REG_R15 = 11
127
+ UC_ARM_REG_SB = 75
128
+ UC_ARM_REG_SL = 76
129
+ UC_ARM_REG_FP = 77
130
+ UC_ARM_REG_IP = 78
131
+ end