libTriton version 1.0 build 1590
Loading...
Searching...
No Matches
x8664Cpu.cpp
Go to the documentation of this file.
1
2/*
3** Copyright (C) - Triton
4**
5** This program is under the terms of the Apache License 2.0.
6*/
7
8#include <algorithm>
9#include <cctype>
10#include <cstring>
11
13#include <triton/coreUtils.hpp>
14#include <triton/cpuSize.hpp>
15#include <triton/exceptions.hpp>
17#include <triton/immediate.hpp>
18#include <triton/x8664Cpu.hpp>
19
20
21
22namespace triton {
23 namespace arch {
24 namespace x86 {
25
27 this->callbacks = callbacks;
28 this->handle = 0;
29
30 this->clear();
31 this->disassInit();
32 }
33
34
36 this->copy(other);
37 }
38
39
41 this->memory.clear();
42 if (this->handle) {
43 triton::extlibs::capstone::cs_close(&this->handle);
44 }
45 }
46
47
48 void x8664Cpu::disassInit(void) {
49 if (this->handle) {
50 triton::extlibs::capstone::cs_close(&this->handle);
51 }
52
53 if (triton::extlibs::capstone::cs_open(triton::extlibs::capstone::CS_ARCH_X86, triton::extlibs::capstone::CS_MODE_64, &this->handle) != triton::extlibs::capstone::CS_ERR_OK)
54 throw triton::exceptions::Disassembly("x8664Cpu::disassInit(): Cannot open capstone.");
55
56 triton::extlibs::capstone::cs_option(this->handle, triton::extlibs::capstone::CS_OPT_DETAIL, triton::extlibs::capstone::CS_OPT_ON);
57 triton::extlibs::capstone::cs_option(this->handle, triton::extlibs::capstone::CS_OPT_SYNTAX, triton::extlibs::capstone::CS_OPT_SYNTAX_INTEL);
58 }
59
60
61 void x8664Cpu::copy(const x8664Cpu& other) {
62 this->callbacks = other.callbacks;
63 this->memory = other.memory;
64
65 std::memcpy(this->rax, other.rax, sizeof(this->rax));
66 std::memcpy(this->rbx, other.rbx, sizeof(this->rbx));
67 std::memcpy(this->rcx, other.rcx, sizeof(this->rcx));
68 std::memcpy(this->rdx, other.rdx, sizeof(this->rdx));
69 std::memcpy(this->rdi, other.rdi, sizeof(this->rdi));
70 std::memcpy(this->rsi, other.rsi, sizeof(this->rsi));
71 std::memcpy(this->rsp, other.rsp, sizeof(this->rsp));
72 std::memcpy(this->rbp, other.rbp, sizeof(this->rbp));
73 std::memcpy(this->rip, other.rip, sizeof(this->rip));
74 std::memcpy(this->eflags, other.eflags, sizeof(this->eflags));
75 std::memcpy(this->r8, other.r8, sizeof(this->r8));
76 std::memcpy(this->r9, other.r9, sizeof(this->r9));
77 std::memcpy(this->r10, other.r10, sizeof(this->r10));
78 std::memcpy(this->r11, other.r11, sizeof(this->r11));
79 std::memcpy(this->r12, other.r12, sizeof(this->r12));
80 std::memcpy(this->r13, other.r13, sizeof(this->r13));
81 std::memcpy(this->r14, other.r14, sizeof(this->r14));
82 std::memcpy(this->r15, other.r15, sizeof(this->r15));
83 std::memcpy(this->st0, other.st0, sizeof(this->st0));
84 std::memcpy(this->st1, other.st1, sizeof(this->st1));
85 std::memcpy(this->st2, other.st2, sizeof(this->st2));
86 std::memcpy(this->st3, other.st3, sizeof(this->st3));
87 std::memcpy(this->st4, other.st4, sizeof(this->st4));
88 std::memcpy(this->st5, other.st5, sizeof(this->st5));
89 std::memcpy(this->st6, other.st6, sizeof(this->st6));
90 std::memcpy(this->st7, other.st7, sizeof(this->st7));
91 std::memcpy(this->zmm0, other.zmm0, sizeof(this->zmm0));
92 std::memcpy(this->zmm1, other.zmm1, sizeof(this->zmm1));
93 std::memcpy(this->zmm2, other.zmm2, sizeof(this->zmm2));
94 std::memcpy(this->zmm3, other.zmm3, sizeof(this->zmm3));
95 std::memcpy(this->zmm4, other.zmm4, sizeof(this->zmm4));
96 std::memcpy(this->zmm5, other.zmm5, sizeof(this->zmm5));
97 std::memcpy(this->zmm6, other.zmm6, sizeof(this->zmm6));
98 std::memcpy(this->zmm7, other.zmm7, sizeof(this->zmm7));
99 std::memcpy(this->zmm8, other.zmm8, sizeof(this->zmm8));
100 std::memcpy(this->zmm9, other.zmm9, sizeof(this->zmm9));
101 std::memcpy(this->zmm10, other.zmm10, sizeof(this->zmm10));
102 std::memcpy(this->zmm11, other.zmm11, sizeof(this->zmm11));
103 std::memcpy(this->zmm12, other.zmm12, sizeof(this->zmm12));
104 std::memcpy(this->zmm13, other.zmm13, sizeof(this->zmm13));
105 std::memcpy(this->zmm14, other.zmm14, sizeof(this->zmm14));
106 std::memcpy(this->zmm15, other.zmm15, sizeof(this->zmm15));
107 std::memcpy(this->zmm16, other.zmm16, sizeof(this->zmm16));
108 std::memcpy(this->zmm17, other.zmm17, sizeof(this->zmm17));
109 std::memcpy(this->zmm18, other.zmm18, sizeof(this->zmm18));
110 std::memcpy(this->zmm19, other.zmm19, sizeof(this->zmm19));
111 std::memcpy(this->zmm20, other.zmm20, sizeof(this->zmm20));
112 std::memcpy(this->zmm21, other.zmm21, sizeof(this->zmm21));
113 std::memcpy(this->zmm22, other.zmm22, sizeof(this->zmm22));
114 std::memcpy(this->zmm23, other.zmm23, sizeof(this->zmm23));
115 std::memcpy(this->zmm24, other.zmm24, sizeof(this->zmm24));
116 std::memcpy(this->zmm25, other.zmm25, sizeof(this->zmm25));
117 std::memcpy(this->zmm26, other.zmm26, sizeof(this->zmm26));
118 std::memcpy(this->zmm27, other.zmm27, sizeof(this->zmm27));
119 std::memcpy(this->zmm28, other.zmm28, sizeof(this->zmm28));
120 std::memcpy(this->zmm29, other.zmm29, sizeof(this->zmm29));
121 std::memcpy(this->zmm30, other.zmm30, sizeof(this->zmm30));
122 std::memcpy(this->zmm31, other.zmm31, sizeof(this->zmm31));
123 std::memcpy(this->mxcsr, other.mxcsr, sizeof(this->mxcsr));
124 std::memcpy(this->cr0, other.cr0, sizeof(this->cr0));
125 std::memcpy(this->cr1, other.cr1, sizeof(this->cr1));
126 std::memcpy(this->cr2, other.cr2, sizeof(this->cr2));
127 std::memcpy(this->cr3, other.cr3, sizeof(this->cr3));
128 std::memcpy(this->cr4, other.cr4, sizeof(this->cr4));
129 std::memcpy(this->cr5, other.cr5, sizeof(this->cr5));
130 std::memcpy(this->cr6, other.cr6, sizeof(this->cr6));
131 std::memcpy(this->cr7, other.cr7, sizeof(this->cr7));
132 std::memcpy(this->cr8, other.cr8, sizeof(this->cr8));
133 std::memcpy(this->cr9, other.cr9, sizeof(this->cr9));
134 std::memcpy(this->cr10, other.cr10, sizeof(this->cr10));
135 std::memcpy(this->cr11, other.cr11, sizeof(this->cr11));
136 std::memcpy(this->cr12, other.cr12, sizeof(this->cr12));
137 std::memcpy(this->cr13, other.cr13, sizeof(this->cr13));
138 std::memcpy(this->cr14, other.cr14, sizeof(this->cr14));
139 std::memcpy(this->cr15, other.cr15, sizeof(this->cr15));
140 std::memcpy(this->cs, other.cs, sizeof(this->cs));
141 std::memcpy(this->ds, other.ds, sizeof(this->ds));
142 std::memcpy(this->es, other.es, sizeof(this->es));
143 std::memcpy(this->fs, other.fs, sizeof(this->fs));
144 std::memcpy(this->gs, other.gs, sizeof(this->gs));
145 std::memcpy(this->ss, other.ss, sizeof(this->ss));
146 std::memcpy(this->dr0, other.dr0, sizeof(this->dr0));
147 std::memcpy(this->dr1, other.dr1, sizeof(this->dr1));
148 std::memcpy(this->dr2, other.dr2, sizeof(this->dr2));
149 std::memcpy(this->dr3, other.dr3, sizeof(this->dr3));
150 std::memcpy(this->dr6, other.dr6, sizeof(this->dr6));
151 std::memcpy(this->dr7, other.dr7, sizeof(this->dr7));
152 std::memcpy(this->mxcsr_mask, other.mxcsr_mask, sizeof(this->mxcsr_mask));
153 std::memcpy(this->fcw, other.fcw, sizeof(this->fcw));
154 std::memcpy(this->fsw, other.fsw, sizeof(this->fsw));
155 std::memcpy(this->ftw, other.ftw, sizeof(this->ftw));
156 std::memcpy(this->fop, other.fop, sizeof(this->fop));
157 std::memcpy(this->fip, other.fip, sizeof(this->fip));
158 std::memcpy(this->fcs, other.fcs, sizeof(this->fcs));
159 std::memcpy(this->fdp, other.fdp, sizeof(this->fdp));
160 std::memcpy(this->fds, other.fds, sizeof(this->fds));
161 std::memcpy(this->efer, other.efer, sizeof(this->efer));
162 std::memcpy(this->tsc, other.tsc, sizeof(this->tsc));
163 }
164
165
166 void x8664Cpu::clear(void) {
167 /* Clear memory */
168 this->memory.clear();
169
170 /* Clear registers */
171 std::memset(this->rax, 0x00, sizeof(this->rax));
172 std::memset(this->rbx, 0x00, sizeof(this->rbx));
173 std::memset(this->rcx, 0x00, sizeof(this->rcx));
174 std::memset(this->rdx, 0x00, sizeof(this->rdx));
175 std::memset(this->rdi, 0x00, sizeof(this->rdi));
176 std::memset(this->rsi, 0x00, sizeof(this->rsi));
177 std::memset(this->rsp, 0x00, sizeof(this->rsp));
178 std::memset(this->rbp, 0x00, sizeof(this->rbp));
179 std::memset(this->rip, 0x00, sizeof(this->rip));
180 std::memset(this->eflags, 0x00, sizeof(this->eflags));
181 std::memset(this->r8, 0x00, sizeof(this->r8));
182 std::memset(this->r9, 0x00, sizeof(this->r9));
183 std::memset(this->r10, 0x00, sizeof(this->r10));
184 std::memset(this->r11, 0x00, sizeof(this->r11));
185 std::memset(this->r12, 0x00, sizeof(this->r12));
186 std::memset(this->r13, 0x00, sizeof(this->r13));
187 std::memset(this->r14, 0x00, sizeof(this->r14));
188 std::memset(this->r15, 0x00, sizeof(this->r15));
189 std::memset(this->st0, 0x00, sizeof(this->st0));
190 std::memset(this->st1, 0x00, sizeof(this->st1));
191 std::memset(this->st2, 0x00, sizeof(this->st2));
192 std::memset(this->st3, 0x00, sizeof(this->st3));
193 std::memset(this->st4, 0x00, sizeof(this->st4));
194 std::memset(this->st5, 0x00, sizeof(this->st5));
195 std::memset(this->st6, 0x00, sizeof(this->st6));
196 std::memset(this->st7, 0x00, sizeof(this->st7));
197 std::memset(this->zmm0, 0x00, sizeof(this->zmm0));
198 std::memset(this->zmm1, 0x00, sizeof(this->zmm1));
199 std::memset(this->zmm2, 0x00, sizeof(this->zmm2));
200 std::memset(this->zmm3, 0x00, sizeof(this->zmm3));
201 std::memset(this->zmm4, 0x00, sizeof(this->zmm4));
202 std::memset(this->zmm5, 0x00, sizeof(this->zmm5));
203 std::memset(this->zmm6, 0x00, sizeof(this->zmm6));
204 std::memset(this->zmm7, 0x00, sizeof(this->zmm7));
205 std::memset(this->zmm8, 0x00, sizeof(this->zmm8));
206 std::memset(this->zmm9, 0x00, sizeof(this->zmm9));
207 std::memset(this->zmm10, 0x00, sizeof(this->zmm10));
208 std::memset(this->zmm11, 0x00, sizeof(this->zmm11));
209 std::memset(this->zmm12, 0x00, sizeof(this->zmm12));
210 std::memset(this->zmm13, 0x00, sizeof(this->zmm13));
211 std::memset(this->zmm14, 0x00, sizeof(this->zmm14));
212 std::memset(this->zmm15, 0x00, sizeof(this->zmm15));
213 std::memset(this->zmm16, 0x00, sizeof(this->zmm16));
214 std::memset(this->zmm17, 0x00, sizeof(this->zmm17));
215 std::memset(this->zmm18, 0x00, sizeof(this->zmm18));
216 std::memset(this->zmm19, 0x00, sizeof(this->zmm19));
217 std::memset(this->zmm20, 0x00, sizeof(this->zmm20));
218 std::memset(this->zmm21, 0x00, sizeof(this->zmm21));
219 std::memset(this->zmm22, 0x00, sizeof(this->zmm22));
220 std::memset(this->zmm23, 0x00, sizeof(this->zmm23));
221 std::memset(this->zmm24, 0x00, sizeof(this->zmm24));
222 std::memset(this->zmm25, 0x00, sizeof(this->zmm25));
223 std::memset(this->zmm26, 0x00, sizeof(this->zmm26));
224 std::memset(this->zmm27, 0x00, sizeof(this->zmm27));
225 std::memset(this->zmm28, 0x00, sizeof(this->zmm28));
226 std::memset(this->zmm29, 0x00, sizeof(this->zmm29));
227 std::memset(this->zmm30, 0x00, sizeof(this->zmm30));
228 std::memset(this->zmm31, 0x00, sizeof(this->zmm31));
229 std::memset(this->mxcsr, 0x00, sizeof(this->mxcsr));
230 std::memset(this->cr0, 0x00, sizeof(this->cr0));
231 std::memset(this->cr1, 0x00, sizeof(this->cr1));
232 std::memset(this->cr2, 0x00, sizeof(this->cr2));
233 std::memset(this->cr3, 0x00, sizeof(this->cr3));
234 std::memset(this->cr4, 0x00, sizeof(this->cr4));
235 std::memset(this->cr5, 0x00, sizeof(this->cr5));
236 std::memset(this->cr6, 0x00, sizeof(this->cr6));
237 std::memset(this->cr7, 0x00, sizeof(this->cr7));
238 std::memset(this->cr8, 0x00, sizeof(this->cr8));
239 std::memset(this->cr9, 0x00, sizeof(this->cr9));
240 std::memset(this->cr10, 0x00, sizeof(this->cr10));
241 std::memset(this->cr11, 0x00, sizeof(this->cr11));
242 std::memset(this->cr12, 0x00, sizeof(this->cr12));
243 std::memset(this->cr13, 0x00, sizeof(this->cr13));
244 std::memset(this->cr14, 0x00, sizeof(this->cr14));
245 std::memset(this->cr15, 0x00, sizeof(this->cr15));
246 std::memset(this->cs, 0x00, sizeof(this->cs));
247 std::memset(this->ds, 0x00, sizeof(this->ds));
248 std::memset(this->es, 0x00, sizeof(this->es));
249 std::memset(this->fs, 0x00, sizeof(this->fs));
250 std::memset(this->gs, 0x00, sizeof(this->gs));
251 std::memset(this->ss, 0x00, sizeof(this->ss));
252 std::memset(this->dr0, 0x00, sizeof(this->dr0));
253 std::memset(this->dr1, 0x00, sizeof(this->dr1));
254 std::memset(this->dr2, 0x00, sizeof(this->dr2));
255 std::memset(this->dr3, 0x00, sizeof(this->dr3));
256 std::memset(this->dr6, 0x00, sizeof(this->dr6));
257 std::memset(this->dr7, 0x00, sizeof(this->dr7));
258 std::memset(this->mxcsr_mask, 0x00, sizeof(this->mxcsr_mask));
259 std::memset(this->fcw, 0x00, sizeof(this->fcw));
260 std::memset(this->fsw, 0x00, sizeof(this->fsw));
261 std::memset(this->ftw, 0x00, sizeof(this->ftw));
262 std::memset(this->fop, 0x00, sizeof(this->fop));
263 std::memset(this->fip, 0x00, sizeof(this->fip));
264 std::memset(this->fcs, 0x00, sizeof(this->fcs));
265 std::memset(this->fdp, 0x00, sizeof(this->fdp));
266 std::memset(this->fds, 0x00, sizeof(this->fds));
267 std::memset(this->efer, 0x00, sizeof(this->efer));
268 std::memset(this->tsc, 0x00, sizeof(this->tsc));
269 }
270
271
273 this->copy(other);
274 return *this;
275 }
276
277
281
282
284 if (regId >= triton::arch::ID_REG_X86_AC && regId <= triton::arch::ID_REG_X86_ZF) { return true; }
285 if (regId >= triton::arch::ID_REG_X86_FTW && regId <= triton::arch::ID_REG_X86_FDP) { return true; }
286 if (regId >= triton::arch::ID_REG_X86_SSE_IE && regId <= triton::arch::ID_REG_X86_SSE_FZ) { return true; }
287 if (regId >= triton::arch::ID_REG_X86_FCW_IM && regId <= triton::arch::ID_REG_X86_FCW_X) { return true; }
288 if (regId >= triton::arch::ID_REG_X86_FSW_IE && regId <= triton::arch::ID_REG_X86_FSW_B) { return true; }
289 if (regId >= triton::arch::ID_REG_X86_EFER_TCE && regId <= triton::arch::ID_REG_X86_EFER_SCE) { return true; }
290
291 return false;
292 }
293
294
296 return (
297 this->isGPR(regId) ||
298 this->isMMX(regId) ||
299 this->isSTX(regId) ||
300 this->isSSE(regId) ||
301 this->isFPU(regId) ||
302 this->isEFER(regId) ||
303 this->isTSC(regId) ||
304 this->isAVX256(regId) ||
305 this->isAVX512(regId) ||
306 this->isControl(regId) ||
307 this->isDebug(regId) ||
308 this->isSegment(regId)
309 );
310 }
311
312
314 return (this->isFlag(regId) || this->isRegister(regId));
315 }
316
317
319 return ((regId >= triton::arch::ID_REG_X86_RAX && regId <= triton::arch::ID_REG_X86_EFLAGS) ? true : false);
320 }
321
322
324 return ((regId >= triton::arch::ID_REG_X86_MM0 && regId <= triton::arch::ID_REG_X86_MM7) ? true : false);
325 }
326
327
329 return ((regId >= triton::arch::ID_REG_X86_ST0 && regId <= triton::arch::ID_REG_X86_ST7) ? true : false);
330 }
331
332
334 return ((regId >= triton::arch::ID_REG_X86_MXCSR && regId <= triton::arch::ID_REG_X86_XMM15) ? true : false);
335 }
336
337
339 return ((regId >= triton::arch::ID_REG_X86_FTW && regId <= triton::arch::ID_REG_X86_FDP) ? true : false);
340 }
341
342
344 return ((regId == triton::arch::ID_REG_X86_EFER) ? true : false);
345 }
346
347
349 return ((regId == triton::arch::ID_REG_X86_TSC) ? true : false);
350 }
351
352
354 return ((regId >= triton::arch::ID_REG_X86_YMM0 && regId <= triton::arch::ID_REG_X86_YMM15) ? true : false);
355 }
356
357
359 return ((regId >= triton::arch::ID_REG_X86_ZMM0 && regId <= triton::arch::ID_REG_X86_ZMM31) ? true : false);
360 }
361
362
364 return ((regId >= triton::arch::ID_REG_X86_CR0 && regId <= triton::arch::ID_REG_X86_CR15) ? true : false);
365 }
366
367
369 return ((regId >= triton::arch::ID_REG_X86_DR0 && regId <= triton::arch::ID_REG_X86_DR7) ? true : false);
370 }
371
372
374 return ((regId >= triton::arch::ID_REG_X86_CS && regId <= triton::arch::ID_REG_X86_SS) ? true : false);
375 }
376
377
381
382
384 return triton::size::qword;
385 }
386
387
391
392
393 const std::unordered_map<triton::arch::register_e, const triton::arch::Register>& x8664Cpu::getAllRegisters(void) const {
394 return this->id2reg;
395 }
396
397 const std::unordered_map<triton::uint64, triton::uint8, IdentityHash<triton::uint64>>& x8664Cpu::getConcreteMemory(void) const {
398 return this->memory;
399 }
400
401
402 std::set<const triton::arch::Register*> x8664Cpu::getParentRegisters(void) const {
403 std::set<const triton::arch::Register*> ret;
404
405 for (const auto& kv: this->id2reg) {
406 auto regId = kv.first;
407 const auto& reg = kv.second;
408
409 /* Add GPR */
410 if (reg.getSize() == this->gprSize())
411 ret.insert(&reg);
412
413 /* Add Flags */
414 else if (this->isFlag(regId))
415 ret.insert(&reg);
416
417 /* Add STX */
418 else if (this->isSTX(regId))
419 ret.insert(&reg);
420
421 /* Add SSE */
422 else if (this->isSSE(regId))
423 ret.insert(&reg);
424
425 /* Add FPU */
426 else if (this->isFPU(regId))
427 ret.insert(&reg);
428
429 /* Add EFER */
430 else if (this->isEFER(regId))
431 ret.insert(&reg);
432
433 /* Add TSC */
434 else if (this->isTSC(regId))
435 ret.insert(&reg);
436
437 /* Add AVX-256 */
438 else if (this->isAVX256(regId))
439 ret.insert(&reg);
440
441 /* Add AVX-512 */
442 else if (this->isAVX512(regId))
443 ret.insert(&reg);
444
445 /* Add Control */
446 else if (this->isControl(regId))
447 ret.insert(&reg);
448
449 /* Add Debug */
450 else if (this->isDebug(regId))
451 ret.insert(&reg);
452
453 /* Add Segment */
454 else if (this->isSegment(regId))
455 ret.insert(&reg);
456 }
457
458 return ret;
459 }
460
461
463 try {
464 return this->id2reg.at(id);
465 } catch (const std::out_of_range&) {
466 throw triton::exceptions::Cpu("x8664Cpu::getRegister(): Invalid register for this architecture.");
467 }
468 }
469
470
471 const triton::arch::Register& x8664Cpu::getRegister(const std::string& name) const {
472 std::string lower = name;
473 std::transform(lower.begin(), lower.end(), lower.begin(), [](unsigned char c){ return std::tolower(c); });
474 try {
475 return this->getRegister(this->name2id.at(lower));
476 } catch (const std::out_of_range&) {
477 throw triton::exceptions::Cpu("x8664Cpu::getRegister(): Invalid register for this architecture.");
478 }
479 }
480
481
483 return this->getRegister(reg.getParent());
484 }
485
486
490
491
493 return this->getRegister(this->pcId);
494 }
495
496
498 return this->getRegister(this->spId);
499 }
500
501
503 triton::extlibs::capstone::cs_insn* insn;
504 triton::usize count = 0;
505
506 /* Check if the opcode and opcode' size are defined */
507 if (inst.getOpcode() == nullptr || inst.getSize() == 0)
508 throw triton::exceptions::Disassembly("x8664Cpu::disassembly(): Opcode and opcodeSize must be definied.");
509
510 /* Clear instructicon's operands if alredy defined */
511 inst.operands.clear();
512
513 /* Update instruction address if undefined */
514 if (!inst.getAddress()) {
515 inst.setAddress(static_cast<triton::uint64>(this->getConcreteRegisterValue(this->getProgramCounter())));
516 }
517
518 /* Let's disass and build our operands */
519 count = triton::extlibs::capstone::cs_disasm(this->handle, inst.getOpcode(), inst.getSize(), inst.getAddress(), 0, &insn);
520 if (count > 0) {
521 /* Detail information */
522 triton::extlibs::capstone::cs_detail* detail = insn->detail;
523
524 /* Init the disassembly */
525 std::stringstream str;
526
527 str << insn[0].mnemonic;
528 if (detail->x86.op_count)
529 str << " " << insn[0].op_str;
530
531 inst.setDisassembly(str.str());
532
533 /* Refine the size */
534 inst.setSize(insn[0].size);
535
536 /* Init the instruction's type */
537 inst.setType(this->capstoneInstructionToTritonInstruction(insn[0].id));
538
539 /* Init the instruction's prefix */
540 inst.setPrefix(this->capstonePrefixToTritonPrefix(detail->x86.prefix[0]));
541
542 /* Set architecture */
544
545 /* Init operands */
546 for (triton::uint32 n = 0; n < detail->x86.op_count; n++) {
547 triton::extlibs::capstone::cs_x86_op* op = &(detail->x86.operands[n]);
548 switch(op->type) {
549
550 case triton::extlibs::capstone::X86_OP_IMM:
551 inst.operands.push_back(triton::arch::OperandWrapper(triton::arch::Immediate(op->imm, op->size)));
552 break;
553
554 case triton::extlibs::capstone::X86_OP_MEM: {
556
557 /* Set the size of the memory access */
558 mem.setBits(((op->size * triton::bitsize::byte) - 1), 0);
559
560 /* LEA if exists */
561 const triton::arch::Register segment(*this, this->capstoneRegisterToTritonRegister(op->mem.segment));
562 const triton::arch::Register base(*this, this->capstoneRegisterToTritonRegister(op->mem.base));
563 const triton::arch::Register index(*this, this->capstoneRegisterToTritonRegister(op->mem.index));
564
565 triton::uint32 immsize = (
566 this->isRegisterValid(base.getId()) ? base.getSize() :
567 this->isRegisterValid(index.getId()) ? index.getSize() :
568 this->gprSize()
569 );
570
571 triton::arch::Immediate disp(op->mem.disp, immsize);
572 triton::arch::Immediate scale(op->mem.scale, immsize);
573
574 /* Specify that LEA contains a PC relative */
575 if (base.getId() == this->pcId)
576 mem.setPcRelative(inst.getNextAddress());
577
578 mem.setSegmentRegister(segment);
579 mem.setBaseRegister(base);
580 mem.setIndexRegister(index);
581 mem.setDisplacement(disp);
582 mem.setScale(scale);
583
584 inst.operands.push_back(triton::arch::OperandWrapper(mem));
585 break;
586 }
587
588 case triton::extlibs::capstone::X86_OP_REG:
590 break;
591
592 default:
593 throw triton::exceptions::Disassembly("x8664Cpu::disassembly(): Invalid operand.");
594 }
595 }
596
597 /* Set branch */
598 if (detail->groups_count > 0) {
599 for (triton::uint32 n = 0; n < detail->groups_count; n++) {
600 if (detail->groups[n] == triton::extlibs::capstone::X86_GRP_JUMP)
601 inst.setBranch(true);
602 if (detail->groups[n] == triton::extlibs::capstone::X86_GRP_JUMP ||
603 detail->groups[n] == triton::extlibs::capstone::X86_GRP_CALL ||
604 detail->groups[n] == triton::extlibs::capstone::X86_GRP_RET)
605 inst.setControlFlow(true);
606 }
607 }
608
609 /* Free capstone stuffs */
610 triton::extlibs::capstone::cs_free(insn, count);
611 }
612 else
613 throw triton::exceptions::Disassembly("x8664Cpu::disassembly(): Failed to disassemble the given code.");
614 }
615
616
618 if (execCallbacks && this->callbacks)
620
621 auto it = this->memory.find(addr);
622 if (it == this->memory.end()) {
623 return 0x00;
624 }
625
626 return it->second;
627 }
628
629
631 triton::uint512 ret = 0;
632 triton::uint64 addr = 0;
633 triton::uint32 size = 0;
634
635 if (execCallbacks && this->callbacks)
637
638 addr = mem.getAddress();
639 size = mem.getSize();
640
641 if (size == 0 || size > triton::size::dqqword)
642 throw triton::exceptions::Cpu("x8664Cpu::getConcreteMemoryValue(): Invalid size memory.");
643
644 for (triton::sint32 i = size-1; i >= 0; i--)
645 ret = ((ret << triton::bitsize::byte) | this->getConcreteMemoryValue(addr+i, false));
646
647 return ret;
648 }
649
650
651 std::vector<triton::uint8> x8664Cpu::getConcreteMemoryAreaValue(triton::uint64 baseAddr, triton::usize size, bool execCallbacks) const {
652 std::vector<triton::uint8> area;
653
654 for (triton::usize index = 0; index < size; index++)
655 area.push_back(this->getConcreteMemoryValue(baseAddr+index, execCallbacks));
656
657 return area;
658 }
659
660
662 triton::uint512 value = 0;
663
664 if (execCallbacks && this->callbacks)
666
667 switch (reg.getId()) {
668
669 case triton::arch::ID_REG_X86_RAX: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->rax, triton::size::qword); return val; }
670 case triton::arch::ID_REG_X86_EAX: { triton::uint32 val = 0; std::memcpy(&val, (triton::uint32*)this->rax, triton::size::dword); return val; }
671 case triton::arch::ID_REG_X86_AX: { triton::uint16 val = 0; std::memcpy(&val, (triton::uint16*)this->rax, triton::size::word); return val; }
672 case triton::arch::ID_REG_X86_AH: { triton::uint8 val = 0; std::memcpy(&val, (triton::uint8*)this->rax+1, triton::size::byte); return val; }
673 case triton::arch::ID_REG_X86_AL: { triton::uint8 val = 0; std::memcpy(&val, (triton::uint8*)this->rax, triton::size::byte); return val; }
674 case triton::arch::ID_REG_X86_RBX: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->rbx, triton::size::qword); return val; }
675 case triton::arch::ID_REG_X86_EBX: { triton::uint32 val = 0; std::memcpy(&val, (triton::uint32*)this->rbx, triton::size::dword); return val; }
676 case triton::arch::ID_REG_X86_BX: { triton::uint16 val = 0; std::memcpy(&val, (triton::uint16*)this->rbx, triton::size::word); return val; }
677 case triton::arch::ID_REG_X86_BH: { triton::uint8 val = 0; std::memcpy(&val, (triton::uint8*)this->rbx+1, triton::size::byte); return val; }
678 case triton::arch::ID_REG_X86_BL: { triton::uint8 val = 0; std::memcpy(&val, (triton::uint8*)this->rbx, triton::size::byte); return val; }
679 case triton::arch::ID_REG_X86_RCX: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->rcx, triton::size::qword); return val; }
680 case triton::arch::ID_REG_X86_ECX: { triton::uint32 val = 0; std::memcpy(&val, (triton::uint32*)this->rcx, triton::size::dword); return val; }
681 case triton::arch::ID_REG_X86_CX: { triton::uint16 val = 0; std::memcpy(&val, (triton::uint16*)this->rcx, triton::size::word); return val; }
682 case triton::arch::ID_REG_X86_CH: { triton::uint8 val = 0; std::memcpy(&val, (triton::uint8*)this->rcx+1, triton::size::byte); return val; }
683 case triton::arch::ID_REG_X86_CL: { triton::uint8 val = 0; std::memcpy(&val, (triton::uint8*)this->rcx, triton::size::byte); return val; }
684 case triton::arch::ID_REG_X86_RDX: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->rdx, triton::size::qword); return val; }
685 case triton::arch::ID_REG_X86_EDX: { triton::uint32 val = 0; std::memcpy(&val, (triton::uint32*)this->rdx, triton::size::dword); return val; }
686 case triton::arch::ID_REG_X86_DX: { triton::uint16 val = 0; std::memcpy(&val, (triton::uint16*)this->rdx, triton::size::word); return val; }
687 case triton::arch::ID_REG_X86_DH: { triton::uint8 val = 0; std::memcpy(&val, (triton::uint8*)this->rdx+1, triton::size::byte); return val; }
688 case triton::arch::ID_REG_X86_DL: { triton::uint8 val = 0; std::memcpy(&val, (triton::uint8*)this->rdx, triton::size::byte); return val; }
689
690 case triton::arch::ID_REG_X86_RDI: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->rdi, triton::size::qword); return val; }
691 case triton::arch::ID_REG_X86_EDI: { triton::uint32 val = 0; std::memcpy(&val, (triton::uint32*)this->rdi, triton::size::dword); return val; }
692 case triton::arch::ID_REG_X86_DI: { triton::uint16 val = 0; std::memcpy(&val, (triton::uint16*)this->rdi, triton::size::word); return val; }
693 case triton::arch::ID_REG_X86_DIL: { triton::uint8 val = 0; std::memcpy(&val, (triton::uint8*)this->rdi, triton::size::byte); return val; }
694 case triton::arch::ID_REG_X86_RSI: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->rsi, triton::size::qword); return val; }
695 case triton::arch::ID_REG_X86_ESI: { triton::uint32 val = 0; std::memcpy(&val, (triton::uint32*)this->rsi, triton::size::dword); return val; }
696 case triton::arch::ID_REG_X86_SI: { triton::uint16 val = 0; std::memcpy(&val, (triton::uint16*)this->rsi, triton::size::word); return val; }
697 case triton::arch::ID_REG_X86_SIL: { triton::uint8 val = 0; std::memcpy(&val, (triton::uint8*)this->rsi, triton::size::byte); return val; }
698 case triton::arch::ID_REG_X86_RSP: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->rsp, triton::size::qword); return val; }
699 case triton::arch::ID_REG_X86_ESP: { triton::uint32 val = 0; std::memcpy(&val, (triton::uint32*)this->rsp, triton::size::dword); return val; }
700 case triton::arch::ID_REG_X86_SP: { triton::uint16 val = 0; std::memcpy(&val, (triton::uint16*)this->rsp, triton::size::word); return val; }
701 case triton::arch::ID_REG_X86_SPL: { triton::uint8 val = 0; std::memcpy(&val, (triton::uint8*)this->rsp, triton::size::byte); return val; }
702 case triton::arch::ID_REG_X86_RBP: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->rbp, triton::size::qword); return val; }
703 case triton::arch::ID_REG_X86_EBP: { triton::uint32 val = 0; std::memcpy(&val, (triton::uint32*)this->rbp, triton::size::dword); return val; }
704 case triton::arch::ID_REG_X86_BP: { triton::uint16 val = 0; std::memcpy(&val, (triton::uint16*)this->rbp, triton::size::word); return val; }
705 case triton::arch::ID_REG_X86_BPL: { triton::uint8 val = 0; std::memcpy(&val, (triton::uint8*)this->rbp, triton::size::byte); return val; }
706
707 case triton::arch::ID_REG_X86_RIP: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->rip, triton::size::qword); return val; }
708 case triton::arch::ID_REG_X86_EIP: { triton::uint32 val = 0; std::memcpy(&val, (triton::uint32*)this->rip, triton::size::dword); return val; }
709 case triton::arch::ID_REG_X86_IP: { triton::uint16 val = 0; std::memcpy(&val, (triton::uint16*)this->rip, triton::size::word); return val; }
710
711 case triton::arch::ID_REG_X86_EFLAGS: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->eflags, sizeof(triton::uint64)); return val; }
712
713 case triton::arch::ID_REG_X86_R8: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->r8, triton::size::qword); return val; }
714 case triton::arch::ID_REG_X86_R8D: { triton::uint32 val = 0; std::memcpy(&val, (triton::uint32*)this->r8, triton::size::dword); return val; }
715 case triton::arch::ID_REG_X86_R8W: { triton::uint16 val = 0; std::memcpy(&val, (triton::uint16*)this->r8, triton::size::word); return val; }
716 case triton::arch::ID_REG_X86_R8B: { triton::uint8 val = 0; std::memcpy(&val, (triton::uint8*)this->r8, triton::size::byte); return val; }
717 case triton::arch::ID_REG_X86_R9: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->r9, triton::size::qword); return val; }
718 case triton::arch::ID_REG_X86_R9D: { triton::uint32 val = 0; std::memcpy(&val, (triton::uint32*)this->r9, triton::size::dword); return val; }
719 case triton::arch::ID_REG_X86_R9W: { triton::uint16 val = 0; std::memcpy(&val, (triton::uint16*)this->r9, triton::size::word); return val; }
720 case triton::arch::ID_REG_X86_R9B: { triton::uint8 val = 0; std::memcpy(&val, (triton::uint8*)this->r9, triton::size::byte); return val; }
721 case triton::arch::ID_REG_X86_R10: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->r10, triton::size::qword); return val; }
722 case triton::arch::ID_REG_X86_R10D: { triton::uint32 val = 0; std::memcpy(&val, (triton::uint32*)this->r10, triton::size::dword); return val; }
723 case triton::arch::ID_REG_X86_R10W: { triton::uint16 val = 0; std::memcpy(&val, (triton::uint16*)this->r10, triton::size::word); return val; }
724 case triton::arch::ID_REG_X86_R10B: { triton::uint8 val = 0; std::memcpy(&val, (triton::uint8*)this->r10, triton::size::byte); return val; }
725 case triton::arch::ID_REG_X86_R11: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->r11, triton::size::qword); return val; }
726 case triton::arch::ID_REG_X86_R11D: { triton::uint32 val = 0; std::memcpy(&val, (triton::uint32*)this->r11, triton::size::dword); return val; }
727 case triton::arch::ID_REG_X86_R11W: { triton::uint16 val = 0; std::memcpy(&val, (triton::uint16*)this->r11, triton::size::word); return val; }
728 case triton::arch::ID_REG_X86_R11B: { triton::uint8 val = 0; std::memcpy(&val, (triton::uint8*)this->r11, triton::size::byte); return val; }
729 case triton::arch::ID_REG_X86_R12: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->r12, triton::size::qword); return val; }
730 case triton::arch::ID_REG_X86_R12D: { triton::uint32 val = 0; std::memcpy(&val, (triton::uint32*)this->r12, triton::size::dword); return val; }
731 case triton::arch::ID_REG_X86_R12W: { triton::uint16 val = 0; std::memcpy(&val, (triton::uint16*)this->r12, triton::size::word); return val; }
732 case triton::arch::ID_REG_X86_R12B: { triton::uint8 val = 0; std::memcpy(&val, (triton::uint8*)this->r12, triton::size::byte); return val; }
733 case triton::arch::ID_REG_X86_R13: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->r13, triton::size::qword); return val; }
734 case triton::arch::ID_REG_X86_R13D: { triton::uint32 val = 0; std::memcpy(&val, (triton::uint32*)this->r13, triton::size::dword); return val; }
735 case triton::arch::ID_REG_X86_R13W: { triton::uint16 val = 0; std::memcpy(&val, (triton::uint16*)this->r13, triton::size::word); return val; }
736 case triton::arch::ID_REG_X86_R13B: { triton::uint8 val = 0; std::memcpy(&val, (triton::uint8*)this->r13, triton::size::byte); return val; }
737 case triton::arch::ID_REG_X86_R14: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->r14, triton::size::qword); return val; }
738 case triton::arch::ID_REG_X86_R14D: { triton::uint32 val = 0; std::memcpy(&val, (triton::uint32*)this->r14, triton::size::dword); return val; }
739 case triton::arch::ID_REG_X86_R14W: { triton::uint16 val = 0; std::memcpy(&val, (triton::uint16*)this->r14, triton::size::word); return val; }
740 case triton::arch::ID_REG_X86_R14B: { triton::uint8 val = 0; std::memcpy(&val, (triton::uint8*)this->r14, triton::size::byte); return val; }
741 case triton::arch::ID_REG_X86_R15: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->r15, triton::size::qword); return val; }
742 case triton::arch::ID_REG_X86_R15D: { triton::uint32 val = 0; std::memcpy(&val, (triton::uint32*)this->r15, triton::size::dword); return val; }
743 case triton::arch::ID_REG_X86_R15W: { triton::uint16 val = 0; std::memcpy(&val, (triton::uint16*)this->r15, triton::size::word); return val; }
744 case triton::arch::ID_REG_X86_R15B: { triton::uint8 val = 0; std::memcpy(&val, (triton::uint8*)this->r15, triton::size::byte); return val; }
745
746 case triton::arch::ID_REG_X86_MM0: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->st0, triton::size::qword); return val; }
747 case triton::arch::ID_REG_X86_MM1: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->st1, triton::size::qword); return val; }
748 case triton::arch::ID_REG_X86_MM2: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->st2, triton::size::qword); return val; }
749 case triton::arch::ID_REG_X86_MM3: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->st3, triton::size::qword); return val; }
750 case triton::arch::ID_REG_X86_MM4: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->st4, triton::size::qword); return val; }
751 case triton::arch::ID_REG_X86_MM5: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->st5, triton::size::qword); return val; }
752 case triton::arch::ID_REG_X86_MM6: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->st6, triton::size::qword); return val; }
753 case triton::arch::ID_REG_X86_MM7: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->st7, triton::size::qword); return val; }
754
755 case triton::arch::ID_REG_X86_ST0: { return triton::utils::cast<triton::uint512>(triton::utils::cast<triton::uint80>(this->st0)); }
756 case triton::arch::ID_REG_X86_ST1: { return triton::utils::cast<triton::uint512>(triton::utils::cast<triton::uint80>(this->st1)); }
757 case triton::arch::ID_REG_X86_ST2: { return triton::utils::cast<triton::uint512>(triton::utils::cast<triton::uint80>(this->st2)); }
758 case triton::arch::ID_REG_X86_ST3: { return triton::utils::cast<triton::uint512>(triton::utils::cast<triton::uint80>(this->st3)); }
759 case triton::arch::ID_REG_X86_ST4: { return triton::utils::cast<triton::uint512>(triton::utils::cast<triton::uint80>(this->st4)); }
760 case triton::arch::ID_REG_X86_ST5: { return triton::utils::cast<triton::uint512>(triton::utils::cast<triton::uint80>(this->st5)); }
761 case triton::arch::ID_REG_X86_ST6: { return triton::utils::cast<triton::uint512>(triton::utils::cast<triton::uint80>(this->st6)); }
762 case triton::arch::ID_REG_X86_ST7: { return triton::utils::cast<triton::uint512>(triton::utils::cast<triton::uint80>(this->st7)); }
763
764 case triton::arch::ID_REG_X86_XMM0: { return triton::utils::cast<triton::uint128>(this->zmm0); }
765 case triton::arch::ID_REG_X86_XMM1: { return triton::utils::cast<triton::uint128>(this->zmm1); }
766 case triton::arch::ID_REG_X86_XMM2: { return triton::utils::cast<triton::uint128>(this->zmm2); }
767 case triton::arch::ID_REG_X86_XMM3: { return triton::utils::cast<triton::uint128>(this->zmm3); }
768 case triton::arch::ID_REG_X86_XMM4: { return triton::utils::cast<triton::uint128>(this->zmm4); }
769 case triton::arch::ID_REG_X86_XMM5: { return triton::utils::cast<triton::uint128>(this->zmm5); }
770 case triton::arch::ID_REG_X86_XMM6: { return triton::utils::cast<triton::uint128>(this->zmm6); }
771 case triton::arch::ID_REG_X86_XMM7: { return triton::utils::cast<triton::uint128>(this->zmm7); }
772 case triton::arch::ID_REG_X86_XMM8: { return triton::utils::cast<triton::uint128>(this->zmm8); }
773 case triton::arch::ID_REG_X86_XMM9: { return triton::utils::cast<triton::uint128>(this->zmm9); }
774 case triton::arch::ID_REG_X86_XMM10: { return triton::utils::cast<triton::uint128>(this->zmm10); }
775 case triton::arch::ID_REG_X86_XMM11: { return triton::utils::cast<triton::uint128>(this->zmm11); }
776 case triton::arch::ID_REG_X86_XMM12: { return triton::utils::cast<triton::uint128>(this->zmm12); }
777 case triton::arch::ID_REG_X86_XMM13: { return triton::utils::cast<triton::uint128>(this->zmm13); }
778 case triton::arch::ID_REG_X86_XMM14: { return triton::utils::cast<triton::uint128>(this->zmm14); }
779 case triton::arch::ID_REG_X86_XMM15: { return triton::utils::cast<triton::uint128>(this->zmm15); }
780
781 case triton::arch::ID_REG_X86_YMM0: { return triton::utils::cast<triton::uint256>(this->zmm0); }
782 case triton::arch::ID_REG_X86_YMM1: { return triton::utils::cast<triton::uint256>(this->zmm1); }
783 case triton::arch::ID_REG_X86_YMM2: { return triton::utils::cast<triton::uint256>(this->zmm2); }
784 case triton::arch::ID_REG_X86_YMM3: { return triton::utils::cast<triton::uint256>(this->zmm3); }
785 case triton::arch::ID_REG_X86_YMM4: { return triton::utils::cast<triton::uint256>(this->zmm4); }
786 case triton::arch::ID_REG_X86_YMM5: { return triton::utils::cast<triton::uint256>(this->zmm5); }
787 case triton::arch::ID_REG_X86_YMM6: { return triton::utils::cast<triton::uint256>(this->zmm6); }
788 case triton::arch::ID_REG_X86_YMM7: { return triton::utils::cast<triton::uint256>(this->zmm7); }
789 case triton::arch::ID_REG_X86_YMM8: { return triton::utils::cast<triton::uint256>(this->zmm8); }
790 case triton::arch::ID_REG_X86_YMM9: { return triton::utils::cast<triton::uint256>(this->zmm9); }
791 case triton::arch::ID_REG_X86_YMM10: { return triton::utils::cast<triton::uint256>(this->zmm10); }
792 case triton::arch::ID_REG_X86_YMM11: { return triton::utils::cast<triton::uint256>(this->zmm11); }
793 case triton::arch::ID_REG_X86_YMM12: { return triton::utils::cast<triton::uint256>(this->zmm12); }
794 case triton::arch::ID_REG_X86_YMM13: { return triton::utils::cast<triton::uint256>(this->zmm13); }
795 case triton::arch::ID_REG_X86_YMM14: { return triton::utils::cast<triton::uint256>(this->zmm14); }
796 case triton::arch::ID_REG_X86_YMM15: { return triton::utils::cast<triton::uint256>(this->zmm15); }
797
798 case triton::arch::ID_REG_X86_ZMM0: { return triton::utils::cast<triton::uint512>(this->zmm0); }
799 case triton::arch::ID_REG_X86_ZMM1: { return triton::utils::cast<triton::uint512>(this->zmm1); }
800 case triton::arch::ID_REG_X86_ZMM2: { return triton::utils::cast<triton::uint512>(this->zmm2); }
801 case triton::arch::ID_REG_X86_ZMM3: { return triton::utils::cast<triton::uint512>(this->zmm3); }
802 case triton::arch::ID_REG_X86_ZMM4: { return triton::utils::cast<triton::uint512>(this->zmm4); }
803 case triton::arch::ID_REG_X86_ZMM5: { return triton::utils::cast<triton::uint512>(this->zmm5); }
804 case triton::arch::ID_REG_X86_ZMM6: { return triton::utils::cast<triton::uint512>(this->zmm6); }
805 case triton::arch::ID_REG_X86_ZMM7: { return triton::utils::cast<triton::uint512>(this->zmm7); }
806 case triton::arch::ID_REG_X86_ZMM8: { return triton::utils::cast<triton::uint512>(this->zmm8); }
807 case triton::arch::ID_REG_X86_ZMM9: { return triton::utils::cast<triton::uint512>(this->zmm9); }
808 case triton::arch::ID_REG_X86_ZMM10: { return triton::utils::cast<triton::uint512>(this->zmm10); }
809 case triton::arch::ID_REG_X86_ZMM11: { return triton::utils::cast<triton::uint512>(this->zmm11); }
810 case triton::arch::ID_REG_X86_ZMM12: { return triton::utils::cast<triton::uint512>(this->zmm12); }
811 case triton::arch::ID_REG_X86_ZMM13: { return triton::utils::cast<triton::uint512>(this->zmm13); }
812 case triton::arch::ID_REG_X86_ZMM14: { return triton::utils::cast<triton::uint512>(this->zmm14); }
813 case triton::arch::ID_REG_X86_ZMM15: { return triton::utils::cast<triton::uint512>(this->zmm15); }
814 case triton::arch::ID_REG_X86_ZMM16: { return triton::utils::cast<triton::uint512>(this->zmm16); }
815 case triton::arch::ID_REG_X86_ZMM17: { return triton::utils::cast<triton::uint512>(this->zmm17); }
816 case triton::arch::ID_REG_X86_ZMM18: { return triton::utils::cast<triton::uint512>(this->zmm18); }
817 case triton::arch::ID_REG_X86_ZMM19: { return triton::utils::cast<triton::uint512>(this->zmm19); }
818 case triton::arch::ID_REG_X86_ZMM20: { return triton::utils::cast<triton::uint512>(this->zmm20); }
819 case triton::arch::ID_REG_X86_ZMM21: { return triton::utils::cast<triton::uint512>(this->zmm21); }
820 case triton::arch::ID_REG_X86_ZMM22: { return triton::utils::cast<triton::uint512>(this->zmm22); }
821 case triton::arch::ID_REG_X86_ZMM23: { return triton::utils::cast<triton::uint512>(this->zmm23); }
822 case triton::arch::ID_REG_X86_ZMM24: { return triton::utils::cast<triton::uint512>(this->zmm24); }
823 case triton::arch::ID_REG_X86_ZMM25: { return triton::utils::cast<triton::uint512>(this->zmm25); }
824 case triton::arch::ID_REG_X86_ZMM26: { return triton::utils::cast<triton::uint512>(this->zmm26); }
825 case triton::arch::ID_REG_X86_ZMM27: { return triton::utils::cast<triton::uint512>(this->zmm27); }
826 case triton::arch::ID_REG_X86_ZMM28: { return triton::utils::cast<triton::uint512>(this->zmm28); }
827 case triton::arch::ID_REG_X86_ZMM29: { return triton::utils::cast<triton::uint512>(this->zmm29); }
828 case triton::arch::ID_REG_X86_ZMM30: { return triton::utils::cast<triton::uint512>(this->zmm30); }
829 case triton::arch::ID_REG_X86_ZMM31: { return triton::utils::cast<triton::uint512>(this->zmm31); }
830
831
832 case triton::arch::ID_REG_X86_TSC: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->tsc, sizeof(triton::uint64)); return val; }
833 case triton::arch::ID_REG_X86_MXCSR: { triton::uint32 val = 0; std::memcpy(&val, (triton::uint32*)this->mxcsr, sizeof(triton::uint32)); return val; }
834 case triton::arch::ID_REG_X86_MXCSR_MASK: { triton::uint32 val = 0; std::memcpy(&val, (triton::uint32*)this->mxcsr_mask, sizeof(triton::uint32)); return val; }
835
836 case triton::arch::ID_REG_X86_CR0: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->cr0, triton::size::qword); return val; }
837 case triton::arch::ID_REG_X86_CR1: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->cr1, triton::size::qword); return val; }
838 case triton::arch::ID_REG_X86_CR2: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->cr2, triton::size::qword); return val; }
839 case triton::arch::ID_REG_X86_CR3: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->cr3, triton::size::qword); return val; }
840 case triton::arch::ID_REG_X86_CR4: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->cr4, triton::size::qword); return val; }
841 case triton::arch::ID_REG_X86_CR5: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->cr5, triton::size::qword); return val; }
842 case triton::arch::ID_REG_X86_CR6: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->cr6, triton::size::qword); return val; }
843 case triton::arch::ID_REG_X86_CR7: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->cr7, triton::size::qword); return val; }
844 case triton::arch::ID_REG_X86_CR8: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->cr8, triton::size::qword); return val; }
845 case triton::arch::ID_REG_X86_CR9: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->cr9, triton::size::qword); return val; }
846 case triton::arch::ID_REG_X86_CR10: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->cr10, triton::size::qword); return val; }
847 case triton::arch::ID_REG_X86_CR11: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->cr11, triton::size::qword); return val; }
848 case triton::arch::ID_REG_X86_CR12: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->cr12, triton::size::qword); return val; }
849 case triton::arch::ID_REG_X86_CR13: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->cr13, triton::size::qword); return val; }
850 case triton::arch::ID_REG_X86_CR14: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->cr14, triton::size::qword); return val; }
851 case triton::arch::ID_REG_X86_CR15: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->cr15, triton::size::qword); return val; }
852
853 case triton::arch::ID_REG_X86_DR0: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->dr0, triton::size::qword); return val; }
854 case triton::arch::ID_REG_X86_DR1: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->dr1, triton::size::qword); return val; }
855 case triton::arch::ID_REG_X86_DR2: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->dr2, triton::size::qword); return val; }
856 case triton::arch::ID_REG_X86_DR3: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->dr3, triton::size::qword); return val; }
857 case triton::arch::ID_REG_X86_DR6: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->dr6, triton::size::qword); return val; }
858 case triton::arch::ID_REG_X86_DR7: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->dr7, triton::size::qword); return val; }
859
860 case triton::arch::ID_REG_X86_SSE_IE: { triton::uint32 flag = 0; std::memcpy(&flag, (triton::uint32*)this->mxcsr, sizeof(triton::uint32)); return ((flag >> 0) & 1); }
861 case triton::arch::ID_REG_X86_SSE_DE: { triton::uint32 flag = 0; std::memcpy(&flag, (triton::uint32*)this->mxcsr, sizeof(triton::uint32)); return ((flag >> 1) & 1); }
862 case triton::arch::ID_REG_X86_SSE_ZE: { triton::uint32 flag = 0; std::memcpy(&flag, (triton::uint32*)this->mxcsr, sizeof(triton::uint32)); return ((flag >> 2) & 1); }
863 case triton::arch::ID_REG_X86_SSE_OE: { triton::uint32 flag = 0; std::memcpy(&flag, (triton::uint32*)this->mxcsr, sizeof(triton::uint32)); return ((flag >> 3) & 1); }
864 case triton::arch::ID_REG_X86_SSE_UE: { triton::uint32 flag = 0; std::memcpy(&flag, (triton::uint32*)this->mxcsr, sizeof(triton::uint32)); return ((flag >> 4) & 1); }
865 case triton::arch::ID_REG_X86_SSE_PE: { triton::uint32 flag = 0; std::memcpy(&flag, (triton::uint32*)this->mxcsr, sizeof(triton::uint32)); return ((flag >> 5) & 1); }
866 case triton::arch::ID_REG_X86_SSE_DAZ: { triton::uint32 flag = 0; std::memcpy(&flag, (triton::uint32*)this->mxcsr, sizeof(triton::uint32)); return ((flag >> 6) & 1); }
867 case triton::arch::ID_REG_X86_SSE_IM: { triton::uint32 flag = 0; std::memcpy(&flag, (triton::uint32*)this->mxcsr, sizeof(triton::uint32)); return ((flag >> 7) & 1); }
868 case triton::arch::ID_REG_X86_SSE_DM: { triton::uint32 flag = 0; std::memcpy(&flag, (triton::uint32*)this->mxcsr, sizeof(triton::uint32)); return ((flag >> 8) & 1); }
869 case triton::arch::ID_REG_X86_SSE_ZM: { triton::uint32 flag = 0; std::memcpy(&flag, (triton::uint32*)this->mxcsr, sizeof(triton::uint32)); return ((flag >> 9) & 1); }
870 case triton::arch::ID_REG_X86_SSE_OM: { triton::uint32 flag = 0; std::memcpy(&flag, (triton::uint32*)this->mxcsr, sizeof(triton::uint32)); return ((flag >> 10) & 1); }
871 case triton::arch::ID_REG_X86_SSE_UM: { triton::uint32 flag = 0; std::memcpy(&flag, (triton::uint32*)this->mxcsr, sizeof(triton::uint32)); return ((flag >> 11) & 1); }
872 case triton::arch::ID_REG_X86_SSE_PM: { triton::uint32 flag = 0; std::memcpy(&flag, (triton::uint32*)this->mxcsr, sizeof(triton::uint32)); return ((flag >> 12) & 1); }
873 case triton::arch::ID_REG_X86_SSE_RL: { triton::uint32 flag = 0; std::memcpy(&flag, (triton::uint32*)this->mxcsr, sizeof(triton::uint32)); return ((flag >> 13) & 1); }
874 case triton::arch::ID_REG_X86_SSE_RH: { triton::uint32 flag = 0; std::memcpy(&flag, (triton::uint32*)this->mxcsr, sizeof(triton::uint32)); return ((flag >> 14) & 1); }
875 case triton::arch::ID_REG_X86_SSE_FZ: { triton::uint32 flag = 0; std::memcpy(&flag, (triton::uint32*)this->mxcsr, sizeof(triton::uint32)); return ((flag >> 15) & 1); }
876
877 case triton::arch::ID_REG_X86_CF: { triton::uint64 flag = 0; std::memcpy(&flag, (triton::uint64*)this->eflags, sizeof(triton::uint64)); return ((flag >> 0) & 1); }
878 case triton::arch::ID_REG_X86_PF: { triton::uint64 flag = 0; std::memcpy(&flag, (triton::uint64*)this->eflags, sizeof(triton::uint64)); return ((flag >> 2) & 1); }
879 case triton::arch::ID_REG_X86_AF: { triton::uint64 flag = 0; std::memcpy(&flag, (triton::uint64*)this->eflags, sizeof(triton::uint64)); return ((flag >> 4) & 1); }
880 case triton::arch::ID_REG_X86_ZF: { triton::uint64 flag = 0; std::memcpy(&flag, (triton::uint64*)this->eflags, sizeof(triton::uint64)); return ((flag >> 6) & 1); }
881 case triton::arch::ID_REG_X86_SF: { triton::uint64 flag = 0; std::memcpy(&flag, (triton::uint64*)this->eflags, sizeof(triton::uint64)); return ((flag >> 7) & 1); }
882 case triton::arch::ID_REG_X86_TF: { triton::uint64 flag = 0; std::memcpy(&flag, (triton::uint64*)this->eflags, sizeof(triton::uint64)); return ((flag >> 8) & 1); }
883 case triton::arch::ID_REG_X86_IF: { triton::uint64 flag = 0; std::memcpy(&flag, (triton::uint64*)this->eflags, sizeof(triton::uint64)); return ((flag >> 9) & 1); }
884 case triton::arch::ID_REG_X86_DF: { triton::uint64 flag = 0; std::memcpy(&flag, (triton::uint64*)this->eflags, sizeof(triton::uint64)); return ((flag >> 10) & 1); }
885 case triton::arch::ID_REG_X86_OF: { triton::uint64 flag = 0; std::memcpy(&flag, (triton::uint64*)this->eflags, sizeof(triton::uint64)); return ((flag >> 11) & 1); }
886 case triton::arch::ID_REG_X86_NT: { triton::uint64 flag = 0; std::memcpy(&flag, (triton::uint64*)this->eflags, sizeof(triton::uint64)); return ((flag >> 14) & 1); }
887 case triton::arch::ID_REG_X86_RF: { triton::uint64 flag = 0; std::memcpy(&flag, (triton::uint64*)this->eflags, sizeof(triton::uint64)); return ((flag >> 16) & 1); }
888 case triton::arch::ID_REG_X86_VM: { triton::uint64 flag = 0; std::memcpy(&flag, (triton::uint64*)this->eflags, sizeof(triton::uint64)); return ((flag >> 17) & 1); }
889 case triton::arch::ID_REG_X86_AC: { triton::uint64 flag = 0; std::memcpy(&flag, (triton::uint64*)this->eflags, sizeof(triton::uint64)); return ((flag >> 18) & 1); }
890 case triton::arch::ID_REG_X86_VIF: { triton::uint64 flag = 0; std::memcpy(&flag, (triton::uint64*)this->eflags, sizeof(triton::uint64)); return ((flag >> 19) & 1); }
891 case triton::arch::ID_REG_X86_VIP: { triton::uint64 flag = 0; std::memcpy(&flag, (triton::uint64*)this->eflags, sizeof(triton::uint64)); return ((flag >> 20) & 1); }
892 case triton::arch::ID_REG_X86_ID: { triton::uint64 flag = 0; std::memcpy(&flag, (triton::uint64*)this->eflags, sizeof(triton::uint64)); return ((flag >> 21) & 1); }
893
894 case triton::arch::ID_REG_X86_CS: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->cs, triton::size::qword); return val; }
895 case triton::arch::ID_REG_X86_DS: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->ds, triton::size::qword); return val; }
896 case triton::arch::ID_REG_X86_ES: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->es, triton::size::qword); return val; }
897 case triton::arch::ID_REG_X86_FS: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->fs, triton::size::qword); return val; }
898 case triton::arch::ID_REG_X86_GS: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->gs, triton::size::qword); return val; }
899 case triton::arch::ID_REG_X86_SS: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->ss, triton::size::qword); return val; }
900
901 case triton::arch::ID_REG_X86_FIP: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->fip, sizeof(triton::uint64)); return val; }
902 case triton::arch::ID_REG_X86_FDP: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->fdp, sizeof(triton::uint64)); return val; }
903 case triton::arch::ID_REG_X86_FCW: { triton::uint16 val = 0; std::memcpy(&val, (triton::uint16*)this->fcw, sizeof(triton::uint16)); return val; }
904 case triton::arch::ID_REG_X86_FSW: { triton::uint16 val = 0; std::memcpy(&val, (triton::uint16*)this->fsw, sizeof(triton::uint16)); return val; }
905 case triton::arch::ID_REG_X86_FOP: { triton::uint16 val = 0; std::memcpy(&val, (triton::uint16*)this->fop, sizeof(triton::uint16)); return val; }
906 case triton::arch::ID_REG_X86_FCS: { triton::uint16 val = 0; std::memcpy(&val, (triton::uint16*)this->fcs, sizeof(triton::uint16)); return val; }
907 case triton::arch::ID_REG_X86_FDS: { triton::uint16 val = 0; std::memcpy(&val, (triton::uint16*)this->fds, sizeof(triton::uint16)); return val; }
908 case triton::arch::ID_REG_X86_FTW: { triton::uint16 val = 0; std::memcpy(&val, (triton::uint16*)this->ftw, sizeof(triton::uint16)); return val; }
909
910 case triton::arch::ID_REG_X86_FCW_IM: { triton::uint16 flag = 0; std::memcpy(&flag, (triton::uint16*)this->fcw, sizeof(triton::uint16)); return ((flag >> 0) & 1); }
911 case triton::arch::ID_REG_X86_FCW_DM: { triton::uint16 flag = 0; std::memcpy(&flag, (triton::uint16*)this->fcw, sizeof(triton::uint16)); return ((flag >> 1) & 1); }
912 case triton::arch::ID_REG_X86_FCW_ZM: { triton::uint16 flag = 0; std::memcpy(&flag, (triton::uint16*)this->fcw, sizeof(triton::uint16)); return ((flag >> 2) & 1); }
913 case triton::arch::ID_REG_X86_FCW_OM: { triton::uint16 flag = 0; std::memcpy(&flag, (triton::uint16*)this->fcw, sizeof(triton::uint16)); return ((flag >> 3) & 1); }
914 case triton::arch::ID_REG_X86_FCW_UM: { triton::uint16 flag = 0; std::memcpy(&flag, (triton::uint16*)this->fcw, sizeof(triton::uint16)); return ((flag >> 4) & 1); }
915 case triton::arch::ID_REG_X86_FCW_PM: { triton::uint16 flag = 0; std::memcpy(&flag, (triton::uint16*)this->fcw, sizeof(triton::uint16)); return ((flag >> 5) & 1); }
916 case triton::arch::ID_REG_X86_FCW_PC: { triton::uint16 flag = 0; std::memcpy(&flag, (triton::uint16*)this->fcw, sizeof(triton::uint16)); return ((flag >> 8) & 3); }
917 case triton::arch::ID_REG_X86_FCW_RC: { triton::uint16 flag = 0; std::memcpy(&flag, (triton::uint16*)this->fcw, sizeof(triton::uint16)); return ((flag >> 10) & 3); }
918 case triton::arch::ID_REG_X86_FCW_X: { triton::uint16 flag = 0; std::memcpy(&flag, (triton::uint16*)this->fcw, sizeof(triton::uint16)); return ((flag >> 12) & 1); }
919
920 case triton::arch::ID_REG_X86_FSW_IE: { triton::uint16 flag = 0; std::memcpy(&flag, (triton::uint16*)this->fsw, sizeof(triton::uint16)); return ((flag >> 0) & 1); }
921 case triton::arch::ID_REG_X86_FSW_DE: { triton::uint16 flag = 0; std::memcpy(&flag, (triton::uint16*)this->fsw, sizeof(triton::uint16)); return ((flag >> 1) & 1); }
922 case triton::arch::ID_REG_X86_FSW_ZE: { triton::uint16 flag = 0; std::memcpy(&flag, (triton::uint16*)this->fsw, sizeof(triton::uint16)); return ((flag >> 2) & 1); }
923 case triton::arch::ID_REG_X86_FSW_OE: { triton::uint16 flag = 0; std::memcpy(&flag, (triton::uint16*)this->fsw, sizeof(triton::uint16)); return ((flag >> 3) & 1); }
924 case triton::arch::ID_REG_X86_FSW_UE: { triton::uint16 flag = 0; std::memcpy(&flag, (triton::uint16*)this->fsw, sizeof(triton::uint16)); return ((flag >> 4) & 1); }
925 case triton::arch::ID_REG_X86_FSW_PE: { triton::uint16 flag = 0; std::memcpy(&flag, (triton::uint16*)this->fsw, sizeof(triton::uint16)); return ((flag >> 5) & 1); }
926 case triton::arch::ID_REG_X86_FSW_SF: { triton::uint16 flag = 0; std::memcpy(&flag, (triton::uint16*)this->fsw, sizeof(triton::uint16)); return ((flag >> 6) & 1); }
927 case triton::arch::ID_REG_X86_FSW_ES: { triton::uint16 flag = 0; std::memcpy(&flag, (triton::uint16*)this->fsw, sizeof(triton::uint16)); return ((flag >> 7) & 1); }
928 case triton::arch::ID_REG_X86_FSW_C0: { triton::uint16 flag = 0; std::memcpy(&flag, (triton::uint16*)this->fsw, sizeof(triton::uint16)); return ((flag >> 8) & 1); }
929 case triton::arch::ID_REG_X86_FSW_C1: { triton::uint16 flag = 0; std::memcpy(&flag, (triton::uint16*)this->fsw, sizeof(triton::uint16)); return ((flag >> 9) & 1); }
930 case triton::arch::ID_REG_X86_FSW_C2: { triton::uint16 flag = 0; std::memcpy(&flag, (triton::uint16*)this->fsw, sizeof(triton::uint16)); return ((flag >> 10) & 1); }
931 case triton::arch::ID_REG_X86_FSW_TOP: { triton::uint16 flag = 0; std::memcpy(&flag, (triton::uint16*)this->fsw, sizeof(triton::uint16)); return ((flag >> 11) & 7); }
932 case triton::arch::ID_REG_X86_FSW_C3: { triton::uint16 flag = 0; std::memcpy(&flag, (triton::uint16*)this->fsw, sizeof(triton::uint16)); return ((flag >> 14) & 1); }
933 case triton::arch::ID_REG_X86_FSW_B: { triton::uint16 flag = 0; std::memcpy(&flag, (triton::uint16*)this->fsw, sizeof(triton::uint16)); return ((flag >> 15) & 1); }
934
935 case triton::arch::ID_REG_X86_EFER_SCE: { triton::uint64 flag = 0; std::memcpy(&flag, (triton::uint64*)this->efer, sizeof(triton::uint64)); return ((flag >> 0) & 1); }
936 case triton::arch::ID_REG_X86_EFER_LME: { triton::uint64 flag = 0; std::memcpy(&flag, (triton::uint64*)this->efer, sizeof(triton::uint64)); return ((flag >> 8) & 1); }
937 case triton::arch::ID_REG_X86_EFER_LMA: { triton::uint64 flag = 0; std::memcpy(&flag, (triton::uint64*)this->efer, sizeof(triton::uint64)); return ((flag >> 10) & 1); }
938 case triton::arch::ID_REG_X86_EFER_NXE: { triton::uint64 flag = 0; std::memcpy(&flag, (triton::uint64*)this->efer, sizeof(triton::uint64)); return ((flag >> 11) & 1); }
939 case triton::arch::ID_REG_X86_EFER_SVME: { triton::uint64 flag = 0; std::memcpy(&flag, (triton::uint64*)this->efer, sizeof(triton::uint64)); return ((flag >> 12) & 1); }
940 case triton::arch::ID_REG_X86_EFER_LMSLE: { triton::uint64 flag = 0; std::memcpy(&flag, (triton::uint64*)this->efer, sizeof(triton::uint64)); return ((flag >> 13) & 1); }
941 case triton::arch::ID_REG_X86_EFER_FFXSR: { triton::uint64 flag = 0; std::memcpy(&flag, (triton::uint64*)this->efer, sizeof(triton::uint64)); return ((flag >> 14) & 1); }
942 case triton::arch::ID_REG_X86_EFER_TCE: { triton::uint64 flag = 0; std::memcpy(&flag, (triton::uint64*)this->efer, sizeof(triton::uint64)); return ((flag >> 15) & 1); }
943 case triton::arch::ID_REG_X86_EFER: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->efer, sizeof(triton::uint64)); return val; }
944
945 default:
946 throw triton::exceptions::Cpu("x8664Cpu::getConcreteRegisterValue(): Invalid register.");
947 }
948
949 return value;
950 }
951
952
953 void x8664Cpu::setConcreteMemoryValue(triton::uint64 addr, triton::uint8 value, bool execCallbacks) {
954 if (execCallbacks && this->callbacks)
956 this->memory[addr] = value;
957 }
958
959
960 void x8664Cpu::setConcreteMemoryValue(const triton::arch::MemoryAccess& mem, const triton::uint512& value, bool execCallbacks) {
961 triton::uint64 addr = mem.getAddress();
962 triton::uint32 size = mem.getSize();
963 triton::uint512 cv = value;
964
965 if (cv > mem.getMaxValue())
966 throw triton::exceptions::Register("x8664Cpu::setConcreteMemoryValue(): You cannot set this concrete value (too big) to this memory access.");
967
968 if (size == 0 || size > triton::size::dqqword)
969 throw triton::exceptions::Cpu("x8664Cpu::setConcreteMemoryValue(): Invalid size memory.");
970
971 if (execCallbacks && this->callbacks)
973
974 for (triton::uint32 i = 0; i < size; i++) {
975 this->memory[addr+i] = static_cast<triton::uint8>((cv & 0xff));
976 cv >>= 8;
977 }
978 }
979
980
981 void x8664Cpu::setConcreteMemoryAreaValue(triton::uint64 baseAddr, const std::vector<triton::uint8>& values, bool execCallbacks) {
982 // Pre-reserving the memory. We modified the original robin_map to not force rehash on reserve.
983 this->memory.reserve(values.size() + this->memory.size());
984 for (triton::usize index = 0; index < values.size(); index++) {
985 this->setConcreteMemoryValue(baseAddr+index, values[index], execCallbacks);
986 }
987 }
988
989
990 void x8664Cpu::setConcreteMemoryAreaValue(triton::uint64 baseAddr, const void* area, triton::usize size, bool execCallbacks) {
991 // Pre-reserving the memory. We modified the original robin_map to not force rehash on every reserve if not needed.
992 this->memory.reserve(size + this->memory.size());
993 for (triton::usize index = 0; index < size; index++) {
994 this->setConcreteMemoryValue(baseAddr+index, reinterpret_cast<const triton::uint8*>(area)[index], execCallbacks);
995 }
996 }
997
998
999 void x8664Cpu::setConcreteRegisterValue(const triton::arch::Register& reg, const triton::uint512& value, bool execCallbacks) {
1000 if (value > reg.getMaxValue())
1001 throw triton::exceptions::Register("x8664Cpu::setConcreteRegisterValue(): You cannot set this concrete value (too big) to this register.");
1002
1003 if (execCallbacks && this->callbacks)
1005
1006 switch (reg.getId()) {
1007
1008 case triton::arch::ID_REG_X86_RAX: { triton::uint64 val = static_cast<triton::uint64>(value); std::memcpy((triton::uint64*)this->rax, &val, triton::size::qword); break; }
1009 case triton::arch::ID_REG_X86_EAX: { triton::uint32 val = static_cast<triton::uint32>(value); std::memcpy((triton::uint32*)this->rax, &val, triton::size::dword); break; }
1010 case triton::arch::ID_REG_X86_AX: { triton::uint16 val = static_cast<triton::uint16>(value); std::memcpy((triton::uint16*)this->rax, &val, triton::size::word); break; }
1011 case triton::arch::ID_REG_X86_AH: { triton::uint8 val = static_cast<triton::uint8>(value); std::memcpy((triton::uint8*)(this->rax+1), &val, triton::size::byte); break; }
1012 case triton::arch::ID_REG_X86_AL: { triton::uint8 val = static_cast<triton::uint8>(value); std::memcpy((triton::uint8*)this->rax, &val, triton::size::byte); break; }
1013 case triton::arch::ID_REG_X86_RBX: { triton::uint64 val = static_cast<triton::uint64>(value); std::memcpy((triton::uint64*)this->rbx, &val, triton::size::qword); break; }
1014 case triton::arch::ID_REG_X86_EBX: { triton::uint32 val = static_cast<triton::uint32>(value); std::memcpy((triton::uint32*)this->rbx, &val, triton::size::dword); break; }
1015 case triton::arch::ID_REG_X86_BX: { triton::uint16 val = static_cast<triton::uint16>(value); std::memcpy((triton::uint16*)this->rbx, &val, triton::size::word); break; }
1016 case triton::arch::ID_REG_X86_BH: { triton::uint8 val = static_cast<triton::uint8>(value); std::memcpy((triton::uint8*)(this->rbx+1), &val, triton::size::byte); break; }
1017 case triton::arch::ID_REG_X86_BL: { triton::uint8 val = static_cast<triton::uint8>(value); std::memcpy((triton::uint8*)this->rbx, &val, triton::size::byte); break; }
1018 case triton::arch::ID_REG_X86_RCX: { triton::uint64 val = static_cast<triton::uint64>(value); std::memcpy((triton::uint64*)this->rcx, &val, triton::size::qword); break; }
1019 case triton::arch::ID_REG_X86_ECX: { triton::uint32 val = static_cast<triton::uint32>(value); std::memcpy((triton::uint32*)this->rcx, &val, triton::size::dword); break; }
1020 case triton::arch::ID_REG_X86_CX: { triton::uint16 val = static_cast<triton::uint16>(value); std::memcpy((triton::uint16*)this->rcx, &val, triton::size::word); break; }
1021 case triton::arch::ID_REG_X86_CH: { triton::uint8 val = static_cast<triton::uint8>(value); std::memcpy((triton::uint8*)(this->rcx+1), &val, triton::size::byte); break; }
1022 case triton::arch::ID_REG_X86_CL: { triton::uint8 val = static_cast<triton::uint8>(value); std::memcpy((triton::uint8*)this->rcx, &val, triton::size::byte); break; }
1023 case triton::arch::ID_REG_X86_RDX: { triton::uint64 val = static_cast<triton::uint64>(value); std::memcpy((triton::uint64*)this->rdx, &val, triton::size::qword); break; }
1024 case triton::arch::ID_REG_X86_EDX: { triton::uint32 val = static_cast<triton::uint32>(value); std::memcpy((triton::uint32*)this->rdx, &val, triton::size::dword); break; }
1025 case triton::arch::ID_REG_X86_DX: { triton::uint16 val = static_cast<triton::uint16>(value); std::memcpy((triton::uint16*)this->rdx, &val, triton::size::word); break; }
1026 case triton::arch::ID_REG_X86_DH: { triton::uint8 val = static_cast<triton::uint8>(value); std::memcpy((triton::uint8*)(this->rdx+1), &val, triton::size::byte); break; }
1027 case triton::arch::ID_REG_X86_DL: { triton::uint8 val = static_cast<triton::uint8>(value); std::memcpy((triton::uint8*)this->rdx, &val, triton::size::byte); break; }
1028
1029 case triton::arch::ID_REG_X86_RDI: { triton::uint64 val = static_cast<triton::uint64>(value); std::memcpy((triton::uint64*)this->rdi, &val, triton::size::qword); break; }
1030 case triton::arch::ID_REG_X86_EDI: { triton::uint32 val = static_cast<triton::uint32>(value); std::memcpy((triton::uint32*)this->rdi, &val, triton::size::dword); break; }
1031 case triton::arch::ID_REG_X86_DI: { triton::uint16 val = static_cast<triton::uint16>(value); std::memcpy((triton::uint16*)this->rdi, &val, triton::size::word); break; }
1032 case triton::arch::ID_REG_X86_DIL: { triton::uint8 val = static_cast<triton::uint8>(value); std::memcpy((triton::uint8*)this->rdi, &val, triton::size::byte); break; }
1033 case triton::arch::ID_REG_X86_RSI: { triton::uint64 val = static_cast<triton::uint64>(value); std::memcpy((triton::uint64*)this->rsi, &val, triton::size::qword); break; }
1034 case triton::arch::ID_REG_X86_ESI: { triton::uint32 val = static_cast<triton::uint32>(value); std::memcpy((triton::uint32*)this->rsi, &val, triton::size::dword); break; }
1035 case triton::arch::ID_REG_X86_SI: { triton::uint16 val = static_cast<triton::uint16>(value); std::memcpy((triton::uint16*)this->rsi, &val, triton::size::word); break; }
1036 case triton::arch::ID_REG_X86_SIL: { triton::uint8 val = static_cast<triton::uint8>(value); std::memcpy((triton::uint8*)this->rsi, &val, triton::size::byte); break; }
1037 case triton::arch::ID_REG_X86_RSP: { triton::uint64 val = static_cast<triton::uint64>(value); std::memcpy((triton::uint64*)this->rsp, &val, triton::size::qword); break; }
1038 case triton::arch::ID_REG_X86_ESP: { triton::uint32 val = static_cast<triton::uint32>(value); std::memcpy((triton::uint32*)this->rsp, &val, triton::size::dword); break; }
1039 case triton::arch::ID_REG_X86_SP: { triton::uint16 val = static_cast<triton::uint16>(value); std::memcpy((triton::uint16*)this->rsp, &val, triton::size::word); break; }
1040 case triton::arch::ID_REG_X86_SPL: { triton::uint8 val = static_cast<triton::uint8>(value); std::memcpy((triton::uint8*)this->rsp, &val, triton::size::byte); break; }
1041 case triton::arch::ID_REG_X86_RBP: { triton::uint64 val = static_cast<triton::uint64>(value); std::memcpy((triton::uint64*)this->rbp, &val, triton::size::qword); break; }
1042 case triton::arch::ID_REG_X86_EBP: { triton::uint32 val = static_cast<triton::uint32>(value); std::memcpy((triton::uint32*)this->rbp, &val, triton::size::dword); break; }
1043 case triton::arch::ID_REG_X86_BP: { triton::uint16 val = static_cast<triton::uint16>(value); std::memcpy((triton::uint16*)this->rbp, &val, triton::size::word); break; }
1044 case triton::arch::ID_REG_X86_BPL: { triton::uint8 val = static_cast<triton::uint8>(value); std::memcpy((triton::uint8*)this->rbp, &val, triton::size::byte); break; }
1045
1046 case triton::arch::ID_REG_X86_RIP: { triton::uint64 val = static_cast<triton::uint64>(value); std::memcpy((triton::uint64*)this->rip, &val, triton::size::qword); break; }
1047 case triton::arch::ID_REG_X86_EIP: { triton::uint32 val = static_cast<triton::uint32>(value); std::memcpy((triton::uint32*)this->rip, &val, triton::size::dword); break; }
1048 case triton::arch::ID_REG_X86_IP: { triton::uint16 val = static_cast<triton::uint16>(value); std::memcpy((triton::uint16*)this->rip, &val, triton::size::word); break; }
1049
1050 case triton::arch::ID_REG_X86_EFLAGS: {
1051 triton::uint64 val = static_cast<triton::uint64>(value);
1052 std::memcpy((triton::uint64*)this->eflags, &val, sizeof(triton::uint64));
1053 break;
1054 }
1055
1056 case triton::arch::ID_REG_X86_CF: {
1057 triton::uint64 flag = 0;
1058 std::memcpy(&flag, (triton::uint64*)this->eflags, sizeof(triton::uint64));
1059 flag = !value.is_zero() ? (flag | (1 << 0)) : (flag & ~(1 << 0));
1060 std::memcpy((triton::uint64*)this->eflags, &flag, sizeof(triton::uint64));
1061 break;
1062 }
1063
1064 case triton::arch::ID_REG_X86_PF: {
1065 triton::uint64 flag = 0;
1066 std::memcpy(&flag, (triton::uint64*)this->eflags, sizeof(triton::uint64));
1067 flag = !value.is_zero() ? (flag | (1 << 2)) : (flag & ~(1 << 2));
1068 std::memcpy((triton::uint64*)this->eflags, &flag, sizeof(triton::uint64));
1069 break;
1070 }
1071
1072 case triton::arch::ID_REG_X86_AF: {
1073 triton::uint64 flag = 0;
1074 std::memcpy(&flag, (triton::uint64*)this->eflags, sizeof(triton::uint64));
1075 flag = !value.is_zero() ? (flag | (1 << 4)) : (flag & ~(1 << 4));
1076 std::memcpy((triton::uint64*)this->eflags, &flag, sizeof(triton::uint64));
1077 break;
1078 }
1079
1080 case triton::arch::ID_REG_X86_ZF: {
1081 triton::uint64 flag = 0;
1082 std::memcpy(&flag, (triton::uint64*)this->eflags, sizeof(triton::uint64));
1083 flag = !value.is_zero() ? (flag | (1 << 6)) : (flag & ~(1 << 6));
1084 std::memcpy((triton::uint64*)this->eflags, &flag, sizeof(triton::uint64));
1085 break;
1086 }
1087
1088 case triton::arch::ID_REG_X86_SF: {
1089 triton::uint64 flag = 0;
1090 std::memcpy(&flag, (triton::uint64*)this->eflags, sizeof(triton::uint64));
1091 flag = !value.is_zero() ? (flag | (1 << 7)) : (flag & ~(1 << 7));
1092 std::memcpy((triton::uint64*)this->eflags, &flag, sizeof(triton::uint64));
1093 break;
1094 }
1095
1096 case triton::arch::ID_REG_X86_TF: {
1097 triton::uint64 flag = 0;
1098 std::memcpy(&flag, (triton::uint64*)this->eflags, sizeof(triton::uint64));
1099 flag = !value.is_zero() ? (flag | (1 << 8)) : (flag & ~(1 << 8));
1100 std::memcpy((triton::uint64*)this->eflags, &flag, sizeof(triton::uint64));
1101 break;
1102 }
1103
1104 case triton::arch::ID_REG_X86_IF: {
1105 triton::uint64 flag = 0;
1106 std::memcpy(&flag, (triton::uint64*)this->eflags, sizeof(triton::uint64));
1107 flag = !value.is_zero() ? (flag | (1 << 9)) : (flag & ~(1 << 9));
1108 std::memcpy((triton::uint64*)this->eflags, &flag, sizeof(triton::uint64));
1109 break;
1110 }
1111
1112 case triton::arch::ID_REG_X86_DF: {
1113 triton::uint64 flag = 0;
1114 std::memcpy(&flag, (triton::uint64*)this->eflags, sizeof(triton::uint64));
1115 flag = !value.is_zero() ? (flag | (1 << 10)) : (flag & ~(1 << 10));
1116 std::memcpy((triton::uint64*)this->eflags, &flag, sizeof(triton::uint64));
1117 break;
1118 }
1119
1120 case triton::arch::ID_REG_X86_OF: {
1121 triton::uint64 flag = 0;
1122 std::memcpy(&flag, (triton::uint64*)this->eflags, sizeof(triton::uint64));
1123 flag = !value.is_zero() ? (flag | (1 << 11)) : (flag & ~(1 << 11));
1124 std::memcpy((triton::uint64*)this->eflags, &flag, sizeof(triton::uint64));
1125 break;
1126 }
1127
1128 case triton::arch::ID_REG_X86_NT: {
1129 triton::uint64 flag = 0;
1130 std::memcpy(&flag, (triton::uint64*)this->eflags, sizeof(triton::uint64));
1131 flag = !value.is_zero() ? (flag | (1 << 14)) : (flag & ~(1 << 14));
1132 std::memcpy((triton::uint64*)this->eflags, &flag, sizeof(triton::uint64));
1133 break;
1134 }
1135
1136 case triton::arch::ID_REG_X86_RF: {
1137 triton::uint64 flag = 0;
1138 std::memcpy(&flag, (triton::uint64*)this->eflags, sizeof(triton::uint64));
1139 flag = !value.is_zero() ? (flag | (1 << 16)) : (flag & ~(1 << 16));
1140 std::memcpy((triton::uint64*)this->eflags, &flag, sizeof(triton::uint64));
1141 break;
1142 }
1143
1144 case triton::arch::ID_REG_X86_VM: {
1145 triton::uint64 flag = 0;
1146 std::memcpy(&flag, (triton::uint64*)this->eflags, sizeof(triton::uint64));
1147 flag = !value.is_zero() ? (flag | (1 << 17)) : (flag & ~(1 << 17));
1148 std::memcpy((triton::uint64*)this->eflags, &flag, sizeof(triton::uint64));
1149 break;
1150 }
1151
1152 case triton::arch::ID_REG_X86_AC: {
1153 triton::uint64 flag = 0;
1154 std::memcpy(&flag, (triton::uint64*)this->eflags, sizeof(triton::uint64));
1155 flag = !value.is_zero() ? (flag | (1 << 18)) : (flag & ~(1 << 18));
1156 std::memcpy((triton::uint64*)this->eflags, &flag, sizeof(triton::uint64));
1157 break;
1158 }
1159
1160 case triton::arch::ID_REG_X86_VIF: {
1161 triton::uint64 flag = 0;
1162 std::memcpy(&flag, (triton::uint64*)this->eflags, sizeof(triton::uint64));
1163 flag = !value.is_zero() ? (flag | (1 << 19)) : (flag & ~(1 << 19));
1164 std::memcpy((triton::uint64*)this->eflags, &flag, sizeof(triton::uint64));
1165 break;
1166 }
1167
1168 case triton::arch::ID_REG_X86_VIP: {
1169 triton::uint64 flag = 0;
1170 std::memcpy(&flag, (triton::uint64*)this->eflags, sizeof(triton::uint64));
1171 flag = !value.is_zero() ? (flag | (1 << 20)) : (flag & ~(1 << 20));
1172 std::memcpy((triton::uint64*)this->eflags, &flag, sizeof(triton::uint64));
1173 break;
1174 }
1175
1176 case triton::arch::ID_REG_X86_ID: {
1177 triton::uint64 flag = 0;
1178 std::memcpy(&flag, (triton::uint64*)this->eflags, sizeof(triton::uint64));
1179 flag = !value.is_zero() ? (flag | (1 << 21)) : (flag & ~(1 << 21));
1180 std::memcpy((triton::uint64*)this->eflags, &flag, sizeof(triton::uint64));
1181 break;
1182 }
1183
1184 case triton::arch::ID_REG_X86_R8: { triton::uint64 val = static_cast<triton::uint64>(value); std::memcpy((triton::uint64*)this->r8, &val, triton::size::qword); break; }
1185 case triton::arch::ID_REG_X86_R8D: { triton::uint32 val = static_cast<triton::uint32>(value); std::memcpy((triton::uint32*)this->r8, &val, triton::size::dword); break; }
1186 case triton::arch::ID_REG_X86_R8W: { triton::uint16 val = static_cast<triton::uint16>(value); std::memcpy((triton::uint16*)this->r8, &val, triton::size::word); break; }
1187 case triton::arch::ID_REG_X86_R8B: { triton::uint8 val = static_cast<triton::uint8>(value); std::memcpy((triton::uint8*)this->r8, &val, triton::size::byte); break; }
1188 case triton::arch::ID_REG_X86_R9: { triton::uint64 val = static_cast<triton::uint64>(value); std::memcpy((triton::uint64*)this->r9, &val, triton::size::qword); break; }
1189 case triton::arch::ID_REG_X86_R9D: { triton::uint32 val = static_cast<triton::uint32>(value); std::memcpy((triton::uint32*)this->r9, &val, triton::size::dword); break; }
1190 case triton::arch::ID_REG_X86_R9W: { triton::uint16 val = static_cast<triton::uint16>(value); std::memcpy((triton::uint16*)this->r9, &val, triton::size::word); break; }
1191 case triton::arch::ID_REG_X86_R9B: { triton::uint8 val = static_cast<triton::uint8>(value); std::memcpy((triton::uint8*)this->r9, &val, triton::size::byte); break; }
1192 case triton::arch::ID_REG_X86_R10: { triton::uint64 val = static_cast<triton::uint64>(value); std::memcpy((triton::uint64*)this->r10, &val, triton::size::qword); break; }
1193 case triton::arch::ID_REG_X86_R10D: { triton::uint32 val = static_cast<triton::uint32>(value); std::memcpy((triton::uint32*)this->r10, &val, triton::size::dword); break; }
1194 case triton::arch::ID_REG_X86_R10W: { triton::uint16 val = static_cast<triton::uint16>(value); std::memcpy((triton::uint16*)this->r10, &val, triton::size::word); break; }
1195 case triton::arch::ID_REG_X86_R10B: { triton::uint8 val = static_cast<triton::uint8>(value); std::memcpy((triton::uint8*)this->r10, &val, triton::size::byte); break; }
1196 case triton::arch::ID_REG_X86_R11: { triton::uint64 val = static_cast<triton::uint64>(value); std::memcpy((triton::uint64*)this->r11, &val, triton::size::qword); break; }
1197 case triton::arch::ID_REG_X86_R11D: { triton::uint32 val = static_cast<triton::uint32>(value); std::memcpy((triton::uint32*)this->r11, &val, triton::size::dword); break; }
1198 case triton::arch::ID_REG_X86_R11W: { triton::uint16 val = static_cast<triton::uint16>(value); std::memcpy((triton::uint16*)this->r11, &val, triton::size::word); break; }
1199 case triton::arch::ID_REG_X86_R11B: { triton::uint8 val = static_cast<triton::uint8>(value); std::memcpy((triton::uint8*)this->r11, &val, triton::size::byte); break; }
1200 case triton::arch::ID_REG_X86_R12: { triton::uint64 val = static_cast<triton::uint64>(value); std::memcpy((triton::uint64*)this->r12, &val, triton::size::qword); break; }
1201 case triton::arch::ID_REG_X86_R12D: { triton::uint32 val = static_cast<triton::uint32>(value); std::memcpy((triton::uint32*)this->r12, &val, triton::size::dword); break; }
1202 case triton::arch::ID_REG_X86_R12W: { triton::uint16 val = static_cast<triton::uint16>(value); std::memcpy((triton::uint16*)this->r12, &val, triton::size::word); break; }
1203 case triton::arch::ID_REG_X86_R12B: { triton::uint8 val = static_cast<triton::uint8>(value); std::memcpy((triton::uint8*)this->r12, &val, triton::size::byte); break; }
1204 case triton::arch::ID_REG_X86_R13: { triton::uint64 val = static_cast<triton::uint64>(value); std::memcpy((triton::uint64*)this->r13, &val, triton::size::qword); break; }
1205 case triton::arch::ID_REG_X86_R13D: { triton::uint32 val = static_cast<triton::uint32>(value); std::memcpy((triton::uint32*)this->r13, &val, triton::size::dword); break; }
1206 case triton::arch::ID_REG_X86_R13W: { triton::uint16 val = static_cast<triton::uint16>(value); std::memcpy((triton::uint16*)this->r13, &val, triton::size::word); break; }
1207 case triton::arch::ID_REG_X86_R13B: { triton::uint8 val = static_cast<triton::uint8>(value); std::memcpy((triton::uint8*)this->r13, &val, triton::size::byte); break; }
1208 case triton::arch::ID_REG_X86_R14: { triton::uint64 val = static_cast<triton::uint64>(value); std::memcpy((triton::uint64*)this->r14, &val, triton::size::qword); break; }
1209 case triton::arch::ID_REG_X86_R14D: { triton::uint32 val = static_cast<triton::uint32>(value); std::memcpy((triton::uint32*)this->r14, &val, triton::size::dword); break; }
1210 case triton::arch::ID_REG_X86_R14W: { triton::uint16 val = static_cast<triton::uint16>(value); std::memcpy((triton::uint16*)this->r14, &val, triton::size::word); break; }
1211 case triton::arch::ID_REG_X86_R14B: { triton::uint8 val = static_cast<triton::uint8>(value); std::memcpy((triton::uint8*)this->r14, &val, triton::size::byte); break; }
1212 case triton::arch::ID_REG_X86_R15: { triton::uint64 val = static_cast<triton::uint64>(value); std::memcpy((triton::uint64*)this->r15, &val, triton::size::qword); break; }
1213 case triton::arch::ID_REG_X86_R15D: { triton::uint32 val = static_cast<triton::uint32>(value); std::memcpy((triton::uint32*)this->r15, &val, triton::size::dword); break; }
1214 case triton::arch::ID_REG_X86_R15W: { triton::uint16 val = static_cast<triton::uint16>(value); std::memcpy((triton::uint16*)this->r15, &val, triton::size::word); break; }
1215 case triton::arch::ID_REG_X86_R15B: { triton::uint8 val = static_cast<triton::uint8>(value); std::memcpy((triton::uint8*)this->r15, &val, triton::size::byte); break; }
1216
1217 case triton::arch::ID_REG_X86_MM0: { triton::uint64 val = static_cast<triton::uint64>(value); std::memcpy((triton::uint64*)this->st0, &val, triton::size::qword); break; }
1218 case triton::arch::ID_REG_X86_MM1: { triton::uint64 val = static_cast<triton::uint64>(value); std::memcpy((triton::uint64*)this->st1, &val, triton::size::qword); break; }
1219 case triton::arch::ID_REG_X86_MM2: { triton::uint64 val = static_cast<triton::uint64>(value); std::memcpy((triton::uint64*)this->st2, &val, triton::size::qword); break; }
1220 case triton::arch::ID_REG_X86_MM3: { triton::uint64 val = static_cast<triton::uint64>(value); std::memcpy((triton::uint64*)this->st3, &val, triton::size::qword); break; }
1221 case triton::arch::ID_REG_X86_MM4: { triton::uint64 val = static_cast<triton::uint64>(value); std::memcpy((triton::uint64*)this->st4, &val, triton::size::qword); break; }
1222 case triton::arch::ID_REG_X86_MM5: { triton::uint64 val = static_cast<triton::uint64>(value); std::memcpy((triton::uint64*)this->st5, &val, triton::size::qword); break; }
1223 case triton::arch::ID_REG_X86_MM6: { triton::uint64 val = static_cast<triton::uint64>(value); std::memcpy((triton::uint64*)this->st6, &val, triton::size::qword); break; }
1224 case triton::arch::ID_REG_X86_MM7: { triton::uint64 val = static_cast<triton::uint64>(value); std::memcpy((triton::uint64*)this->st7, &val, triton::size::qword); break; }
1225
1226 case triton::arch::ID_REG_X86_ST0: { triton::utils::fromUintToBuffer(triton::utils::cast<triton::uint80>(value), this->st0); break; }
1227 case triton::arch::ID_REG_X86_ST1: { triton::utils::fromUintToBuffer(triton::utils::cast<triton::uint80>(value), this->st1); break; }
1228 case triton::arch::ID_REG_X86_ST2: { triton::utils::fromUintToBuffer(triton::utils::cast<triton::uint80>(value), this->st2); break; }
1229 case triton::arch::ID_REG_X86_ST3: { triton::utils::fromUintToBuffer(triton::utils::cast<triton::uint80>(value), this->st3); break; }
1230 case triton::arch::ID_REG_X86_ST4: { triton::utils::fromUintToBuffer(triton::utils::cast<triton::uint80>(value), this->st4); break; }
1231 case triton::arch::ID_REG_X86_ST5: { triton::utils::fromUintToBuffer(triton::utils::cast<triton::uint80>(value), this->st5); break; }
1232 case triton::arch::ID_REG_X86_ST6: { triton::utils::fromUintToBuffer(triton::utils::cast<triton::uint80>(value), this->st6); break; }
1233 case triton::arch::ID_REG_X86_ST7: { triton::utils::fromUintToBuffer(triton::utils::cast<triton::uint80>(value), this->st7); break; }
1234
1235 case triton::arch::ID_REG_X86_XMM0: { triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->zmm0); break; }
1236 case triton::arch::ID_REG_X86_XMM1: { triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->zmm1); break; }
1237 case triton::arch::ID_REG_X86_XMM2: { triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->zmm2); break; }
1238 case triton::arch::ID_REG_X86_XMM3: { triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->zmm3); break; }
1239 case triton::arch::ID_REG_X86_XMM4: { triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->zmm4); break; }
1240 case triton::arch::ID_REG_X86_XMM5: { triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->zmm5); break; }
1241 case triton::arch::ID_REG_X86_XMM6: { triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->zmm6); break; }
1242 case triton::arch::ID_REG_X86_XMM7: { triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->zmm7); break; }
1243 case triton::arch::ID_REG_X86_XMM8: { triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->zmm8); break; }
1244 case triton::arch::ID_REG_X86_XMM9: { triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->zmm9); break; }
1245 case triton::arch::ID_REG_X86_XMM10: { triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->zmm10); break; }
1246 case triton::arch::ID_REG_X86_XMM11: { triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->zmm11); break; }
1247 case triton::arch::ID_REG_X86_XMM12: { triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->zmm12); break; }
1248 case triton::arch::ID_REG_X86_XMM13: { triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->zmm13); break; }
1249 case triton::arch::ID_REG_X86_XMM14: { triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->zmm14); break; }
1250 case triton::arch::ID_REG_X86_XMM15: { triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->zmm15); break; }
1251
1252 case triton::arch::ID_REG_X86_YMM0: { triton::utils::fromUintToBuffer(static_cast<triton::uint256>(value), this->zmm0); break; }
1253 case triton::arch::ID_REG_X86_YMM1: { triton::utils::fromUintToBuffer(static_cast<triton::uint256>(value), this->zmm1); break; }
1254 case triton::arch::ID_REG_X86_YMM2: { triton::utils::fromUintToBuffer(static_cast<triton::uint256>(value), this->zmm2); break; }
1255 case triton::arch::ID_REG_X86_YMM3: { triton::utils::fromUintToBuffer(static_cast<triton::uint256>(value), this->zmm3); break; }
1256 case triton::arch::ID_REG_X86_YMM4: { triton::utils::fromUintToBuffer(static_cast<triton::uint256>(value), this->zmm4); break; }
1257 case triton::arch::ID_REG_X86_YMM5: { triton::utils::fromUintToBuffer(static_cast<triton::uint256>(value), this->zmm5); break; }
1258 case triton::arch::ID_REG_X86_YMM6: { triton::utils::fromUintToBuffer(static_cast<triton::uint256>(value), this->zmm6); break; }
1259 case triton::arch::ID_REG_X86_YMM7: { triton::utils::fromUintToBuffer(static_cast<triton::uint256>(value), this->zmm7); break; }
1260 case triton::arch::ID_REG_X86_YMM8: { triton::utils::fromUintToBuffer(static_cast<triton::uint256>(value), this->zmm8); break; }
1261 case triton::arch::ID_REG_X86_YMM9: { triton::utils::fromUintToBuffer(static_cast<triton::uint256>(value), this->zmm9); break; }
1262 case triton::arch::ID_REG_X86_YMM10: { triton::utils::fromUintToBuffer(static_cast<triton::uint256>(value), this->zmm10); break; }
1263 case triton::arch::ID_REG_X86_YMM11: { triton::utils::fromUintToBuffer(static_cast<triton::uint256>(value), this->zmm11); break; }
1264 case triton::arch::ID_REG_X86_YMM12: { triton::utils::fromUintToBuffer(static_cast<triton::uint256>(value), this->zmm12); break; }
1265 case triton::arch::ID_REG_X86_YMM13: { triton::utils::fromUintToBuffer(static_cast<triton::uint256>(value), this->zmm13); break; }
1266 case triton::arch::ID_REG_X86_YMM14: { triton::utils::fromUintToBuffer(static_cast<triton::uint256>(value), this->zmm14); break; }
1267 case triton::arch::ID_REG_X86_YMM15: { triton::utils::fromUintToBuffer(static_cast<triton::uint256>(value), this->zmm15); break; }
1268
1269 case triton::arch::ID_REG_X86_ZMM0: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm0); break; }
1270 case triton::arch::ID_REG_X86_ZMM1: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm1); break; }
1271 case triton::arch::ID_REG_X86_ZMM2: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm2); break; }
1272 case triton::arch::ID_REG_X86_ZMM3: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm3); break; }
1273 case triton::arch::ID_REG_X86_ZMM4: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm4); break; }
1274 case triton::arch::ID_REG_X86_ZMM5: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm5); break; }
1275 case triton::arch::ID_REG_X86_ZMM6: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm6); break; }
1276 case triton::arch::ID_REG_X86_ZMM7: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm7); break; }
1277 case triton::arch::ID_REG_X86_ZMM8: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm8); break; }
1278 case triton::arch::ID_REG_X86_ZMM9: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm9); break; }
1279 case triton::arch::ID_REG_X86_ZMM10: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm10); break; }
1280 case triton::arch::ID_REG_X86_ZMM11: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm11); break; }
1281 case triton::arch::ID_REG_X86_ZMM12: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm12); break; }
1282 case triton::arch::ID_REG_X86_ZMM13: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm13); break; }
1283 case triton::arch::ID_REG_X86_ZMM14: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm14); break; }
1284 case triton::arch::ID_REG_X86_ZMM15: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm15); break; }
1285 case triton::arch::ID_REG_X86_ZMM16: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm16); break; }
1286 case triton::arch::ID_REG_X86_ZMM17: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm17); break; }
1287 case triton::arch::ID_REG_X86_ZMM18: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm18); break; }
1288 case triton::arch::ID_REG_X86_ZMM19: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm19); break; }
1289 case triton::arch::ID_REG_X86_ZMM20: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm20); break; }
1290 case triton::arch::ID_REG_X86_ZMM21: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm21); break; }
1291 case triton::arch::ID_REG_X86_ZMM22: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm22); break; }
1292 case triton::arch::ID_REG_X86_ZMM23: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm23); break; }
1293 case triton::arch::ID_REG_X86_ZMM24: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm24); break; }
1294 case triton::arch::ID_REG_X86_ZMM25: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm25); break; }
1295 case triton::arch::ID_REG_X86_ZMM26: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm26); break; }
1296 case triton::arch::ID_REG_X86_ZMM27: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm27); break; }
1297 case triton::arch::ID_REG_X86_ZMM28: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm28); break; }
1298 case triton::arch::ID_REG_X86_ZMM29: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm29); break; }
1299 case triton::arch::ID_REG_X86_ZMM30: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm30); break; }
1300 case triton::arch::ID_REG_X86_ZMM31: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm31); break; }
1301
1302 case triton::arch::ID_REG_X86_MXCSR: {
1303 triton::uint32 val = static_cast<triton::uint32>(value);
1304 std::memcpy((triton::uint32*)this->mxcsr, &val, sizeof(triton::uint32));
1305 break;
1306 }
1307
1308 case triton::arch::ID_REG_X86_MXCSR_MASK: {
1309 triton::uint32 val = static_cast<triton::uint32>(value);
1310 std::memcpy((triton::uint32*)this->mxcsr_mask, &val, sizeof(triton::uint32));
1311 break;
1312 }
1313
1314 case triton::arch::ID_REG_X86_SSE_IE: {
1315 triton::uint32 flag = 0;
1316 std::memcpy(&flag, (triton::uint32*)this->mxcsr, sizeof(triton::uint32));
1317 flag = !value.is_zero() ? (flag | (1 << 0)) : (flag & ~(1 << 0));
1318 std::memcpy((triton::uint32*)this->mxcsr, &flag, sizeof(triton::uint32));
1319 break;
1320 }
1321
1322 case triton::arch::ID_REG_X86_SSE_DE: {
1323 triton::uint32 flag = 0;
1324 std::memcpy(&flag, (triton::uint32*)this->mxcsr, sizeof(triton::uint32));
1325 flag = !value.is_zero() ? (flag | (1 << 1)) : (flag & ~(1 << 1));
1326 std::memcpy((triton::uint32*)this->mxcsr, &flag, sizeof(triton::uint32));
1327 break;
1328 }
1329
1330 case triton::arch::ID_REG_X86_SSE_ZE: {
1331 triton::uint32 flag = 0;
1332 std::memcpy(&flag, (triton::uint32*)this->mxcsr, sizeof(triton::uint32));
1333 flag = !value.is_zero() ? (flag | (1 << 2)) : (flag & ~(1 << 2));
1334 std::memcpy((triton::uint32*)this->mxcsr, &flag, sizeof(triton::uint32));
1335 break;
1336 }
1337
1338 case triton::arch::ID_REG_X86_SSE_OE: {
1339 triton::uint32 flag = 0;
1340 std::memcpy(&flag, (triton::uint32*)this->mxcsr, sizeof(triton::uint32));
1341 flag = !value.is_zero() ? (flag | (1 << 3)) : (flag & ~(1 << 3));
1342 std::memcpy((triton::uint32*)this->mxcsr, &flag, sizeof(triton::uint32));
1343 break;
1344 }
1345
1346 case triton::arch::ID_REG_X86_SSE_UE: {
1347 triton::uint32 flag = 0;
1348 std::memcpy(&flag, (triton::uint32*)this->mxcsr, sizeof(triton::uint32));
1349 flag = !value.is_zero() ? (flag | (1 << 4)) : (flag & ~(1 << 4));
1350 std::memcpy((triton::uint32*)this->mxcsr, &flag, sizeof(triton::uint32));
1351 break;
1352 }
1353
1354 case triton::arch::ID_REG_X86_SSE_PE: {
1355 triton::uint32 flag = 0;
1356 std::memcpy(&flag, (triton::uint32*)this->mxcsr, sizeof(triton::uint32));
1357 flag = !value.is_zero() ? (flag | (1 << 5)) : (flag & ~(1 << 5));
1358 std::memcpy((triton::uint32*)this->mxcsr, &flag, sizeof(triton::uint32));
1359 break;
1360 }
1361
1362 case triton::arch::ID_REG_X86_SSE_DAZ: {
1363 triton::uint32 flag = 0;
1364 std::memcpy(&flag, (triton::uint32*)this->mxcsr, sizeof(triton::uint32));
1365 flag = !value.is_zero() ? (flag | (1 << 6)) : (flag & ~(1 << 6));
1366 std::memcpy((triton::uint32*)this->mxcsr, &flag, sizeof(triton::uint32));
1367 break;
1368 }
1369
1370 case triton::arch::ID_REG_X86_SSE_IM: {
1371 triton::uint32 flag = 0;
1372 std::memcpy(&flag, (triton::uint32*)this->mxcsr, sizeof(triton::uint32));
1373 flag = !value.is_zero() ? (flag | (1 << 7)) : (flag & ~(1 << 7));
1374 std::memcpy((triton::uint32*)this->mxcsr, &flag, sizeof(triton::uint32));
1375 break;
1376 }
1377
1378 case triton::arch::ID_REG_X86_SSE_DM: {
1379 triton::uint32 flag = 0;
1380 std::memcpy(&flag, (triton::uint32*)this->mxcsr, sizeof(triton::uint32));
1381 flag = !value.is_zero() ? (flag | (1 << 8)) : (flag & ~(1 << 8));
1382 std::memcpy((triton::uint32*)this->mxcsr, &flag, sizeof(triton::uint32));
1383 break;
1384 }
1385
1386 case triton::arch::ID_REG_X86_SSE_ZM: {
1387 triton::uint32 flag = 0;
1388 std::memcpy(&flag, (triton::uint32*)this->mxcsr, sizeof(triton::uint32));
1389 flag = !value.is_zero() ? (flag | (1 << 9)) : (flag & ~(1 << 9));
1390 std::memcpy((triton::uint32*)this->mxcsr, &flag, sizeof(triton::uint32));
1391 break;
1392 }
1393
1394 case triton::arch::ID_REG_X86_SSE_OM: {
1395 triton::uint32 flag = 0;
1396 std::memcpy(&flag, (triton::uint32*)this->mxcsr, sizeof(triton::uint32));
1397 flag = !value.is_zero() ? (flag | (1 << 10)) : (flag & ~(1 << 10));
1398 std::memcpy((triton::uint32*)this->mxcsr, &flag, sizeof(triton::uint32));
1399 break;
1400 }
1401
1402 case triton::arch::ID_REG_X86_SSE_UM: {
1403 triton::uint32 flag = 0;
1404 std::memcpy(&flag, (triton::uint32*)this->mxcsr, sizeof(triton::uint32));
1405 flag = !value.is_zero() ? (flag | (1 << 11)) : (flag & ~(1 << 11));
1406 std::memcpy((triton::uint32*)this->mxcsr, &flag, sizeof(triton::uint32));
1407 break;
1408 }
1409
1410 case triton::arch::ID_REG_X86_SSE_PM: {
1411 triton::uint32 flag = 0;
1412 std::memcpy(&flag, (triton::uint32*)this->mxcsr, sizeof(triton::uint32));
1413 flag = !value.is_zero() ? (flag | (1 << 12)) : (flag & ~(1 << 12));
1414 std::memcpy((triton::uint32*)this->mxcsr, &flag, sizeof(triton::uint32));
1415 break;
1416 }
1417
1418 case triton::arch::ID_REG_X86_SSE_RL: {
1419 triton::uint32 flag = 0;
1420 std::memcpy(&flag, (triton::uint32*)this->mxcsr, sizeof(triton::uint32));
1421 flag = !value.is_zero() ? (flag | (1 << 13)) : (flag & ~(1 << 13));
1422 std::memcpy((triton::uint32*)this->mxcsr, &flag, sizeof(triton::uint32));
1423 break;
1424 }
1425
1426 case triton::arch::ID_REG_X86_SSE_RH: {
1427 triton::uint32 flag = 0;
1428 std::memcpy(&flag, (triton::uint32*)this->mxcsr, sizeof(triton::uint32));
1429 flag = !value.is_zero() ? (flag | (1 << 14)) : (flag & ~(1 << 14));
1430 std::memcpy((triton::uint32*)this->mxcsr, &flag, sizeof(triton::uint32));
1431 break;
1432 }
1433
1434 case triton::arch::ID_REG_X86_SSE_FZ: {
1435 triton::uint32 flag = 0;
1436 std::memcpy(&flag, (triton::uint32*)this->mxcsr, sizeof(triton::uint32));
1437 flag = !value.is_zero() ? (flag | (1 << 15)) : (flag & ~(1 << 15));
1438 std::memcpy((triton::uint32*)this->mxcsr, &flag, sizeof(triton::uint32));
1439 break;
1440 }
1441
1442 case triton::arch::ID_REG_X86_FIP: {
1443 triton::uint64 val = static_cast<triton::uint64>(value);
1444 std::memcpy((triton::uint64*)this->fip, &val, sizeof(triton::uint64));
1445 break;
1446 }
1447
1448 case triton::arch::ID_REG_X86_FDP: {
1449 triton::uint64 val = static_cast<triton::uint64>(value);
1450 std::memcpy((triton::uint64*)this->fdp, &val, sizeof(triton::uint64));
1451 break;
1452 }
1453
1454 case triton::arch::ID_REG_X86_FCW: {
1455 triton::uint16 val = static_cast<triton::uint16>(value);
1456 std::memcpy((triton::uint16*)this->fcw, &val, sizeof(triton::uint16));
1457 break;
1458 }
1459
1460 case triton::arch::ID_REG_X86_FSW: {
1461 triton::uint16 val = static_cast<triton::uint16>(value);
1462 std::memcpy((triton::uint16*)this->fsw, &val, sizeof(triton::uint16));
1463 break;
1464 }
1465
1466 case triton::arch::ID_REG_X86_FOP: {
1467 triton::uint16 val = static_cast<triton::uint16>(value);
1468 std::memcpy((triton::uint16*)this->fop, &val, sizeof(triton::uint16));
1469 break;
1470 }
1471
1472 case triton::arch::ID_REG_X86_FCS: {
1473 triton::uint16 val = static_cast<triton::uint16>(value);
1474 std::memcpy((triton::uint16*)this->fcs, &val, sizeof(triton::uint16));
1475 break;
1476 }
1477
1478 case triton::arch::ID_REG_X86_FDS: {
1479 triton::uint16 val = static_cast<triton::uint16>(value);
1480 std::memcpy((triton::uint16*)this->fds, &val, sizeof(triton::uint16));
1481 break;
1482 }
1483
1484 case triton::arch::ID_REG_X86_FTW: {
1485 triton::uint16 val = static_cast<triton::uint16>(value);
1486 std::memcpy((triton::uint16*)this->ftw, &val, sizeof(triton::uint16));
1487 break;
1488 }
1489
1490 case triton::arch::ID_REG_X86_FCW_IM: {
1491 triton::uint16 flag = 0;
1492 std::memcpy(&flag, (triton::uint16*)this->fcw, sizeof(triton::uint16));
1493 flag = !value.is_zero() ? (flag | (1 << 0)) : (flag & ~(1 << 0));
1494 std::memcpy((triton::uint16*)this->fcw, &flag, sizeof(triton::uint16));
1495 break;
1496 }
1497
1498 case triton::arch::ID_REG_X86_FCW_DM: {
1499 triton::uint16 flag = 0;
1500 std::memcpy(&flag, (triton::uint16*)this->fcw, sizeof(triton::uint16));
1501 flag = !value.is_zero() ? (flag | (1 << 1)) : (flag & ~(1 << 1));
1502 std::memcpy((triton::uint16*)this->fcw, &flag, sizeof(triton::uint16));
1503 break;
1504 }
1505
1506 case triton::arch::ID_REG_X86_FCW_ZM: {
1507 triton::uint16 flag = 0;
1508 std::memcpy(&flag, (triton::uint16*)this->fcw, sizeof(triton::uint16));
1509 flag = !value.is_zero() ? (flag | (1 << 2)) : (flag & ~(1 << 2));
1510 std::memcpy((triton::uint16*)this->fcw, &flag, sizeof(triton::uint16));
1511 break;
1512 }
1513
1514 case triton::arch::ID_REG_X86_FCW_OM: {
1515 triton::uint16 flag = 0;
1516 std::memcpy(&flag, (triton::uint16*)this->fcw, sizeof(triton::uint16));
1517 flag = !value.is_zero() ? (flag | (1 << 3)) : (flag & ~(1 << 3));
1518 std::memcpy((triton::uint16*)this->fcw, &flag, sizeof(triton::uint16));
1519 break;
1520 }
1521
1522 case triton::arch::ID_REG_X86_FCW_UM: {
1523 triton::uint16 flag = 0;
1524 std::memcpy(&flag, (triton::uint16*)this->fcw, sizeof(triton::uint16));
1525 flag = !value.is_zero() ? (flag | (1 << 4)) : (flag & ~(1 << 4));
1526 std::memcpy((triton::uint16*)this->fcw, &flag, sizeof(triton::uint16));
1527 break;
1528 }
1529
1530 case triton::arch::ID_REG_X86_FCW_PM: {
1531 triton::uint16 flag = 0;
1532 std::memcpy(&flag, (triton::uint16*)this->fcw, sizeof(triton::uint16));
1533 flag = !value.is_zero() ? (flag | (1 << 5)) : (flag & ~(1 << 5));
1534 std::memcpy((triton::uint16*)this->fcw, &flag, sizeof(triton::uint16));
1535 break;
1536 }
1537
1538 case triton::arch::ID_REG_X86_FCW_PC: {
1539 triton::uint16 flag = 0;
1540 std::memcpy(&flag, (triton::uint16*)this->fcw, sizeof(triton::uint16));
1541 flag = (flag & 0xFCFF) | (static_cast<triton::uint16>(value) << 8);
1542 std::memcpy((triton::uint16*)this->fcw, &flag, sizeof(triton::uint16));
1543 break;
1544 }
1545
1546 case triton::arch::ID_REG_X86_FCW_RC: {
1547 triton::uint16 flag = 0;
1548 std::memcpy(&flag, (triton::uint16*)this->fcw, sizeof(triton::uint16));
1549 flag = (flag & 0xF3FF) | (static_cast<triton::uint16>(value) << 10);
1550 std::memcpy((triton::uint16*)this->fcw, &flag, sizeof(triton::uint16));
1551 break;
1552 }
1553
1554 case triton::arch::ID_REG_X86_FCW_X: {
1555 triton::uint16 flag = 0;
1556 std::memcpy(&flag, (triton::uint16*)this->fcw, sizeof(triton::uint16));
1557 flag = !value.is_zero() ? (flag | (1 << 12)) : (flag & ~(1 << 12));
1558 std::memcpy((triton::uint16*)this->fcw, &flag, sizeof(triton::uint16));
1559 break;
1560 }
1561
1562 case triton::arch::ID_REG_X86_FSW_IE: {
1563 triton::uint16 flag = 0;
1564 std::memcpy(&flag, (triton::uint16*)this->fsw, sizeof(triton::uint16));
1565 flag = !value.is_zero() ? (flag | (1 << 0)) : (flag & ~(1 << 0));
1566 std::memcpy((triton::uint16*)this->fsw, &flag, sizeof(triton::uint16));
1567 break;
1568 }
1569
1570 case triton::arch::ID_REG_X86_FSW_DE: {
1571 triton::uint16 flag = 0;
1572 std::memcpy(&flag, (triton::uint16*)this->fsw, sizeof(triton::uint16));
1573 flag = !value.is_zero() ? (flag | (1 << 1)) : (flag & ~(1 << 1));
1574 std::memcpy((triton::uint16*)this->fsw, &flag, sizeof(triton::uint16));
1575 break;
1576 }
1577
1578 case triton::arch::ID_REG_X86_FSW_ZE: {
1579 triton::uint16 flag = 0;
1580 std::memcpy(&flag, (triton::uint16*)this->fsw, sizeof(triton::uint16));
1581 flag = !value.is_zero() ? (flag | (1 << 2)) : (flag & ~(1 << 2));
1582 std::memcpy((triton::uint16*)this->fsw, &flag, sizeof(triton::uint16));
1583 break;
1584 }
1585
1586 case triton::arch::ID_REG_X86_FSW_OE: {
1587 triton::uint16 flag = 0;
1588 std::memcpy(&flag, (triton::uint16*)this->fsw, sizeof(triton::uint16));
1589 flag = !value.is_zero() ? (flag | (1 << 3)) : (flag & ~(1 << 3));
1590 std::memcpy((triton::uint16*)this->fsw, &flag, sizeof(triton::uint16));
1591 break;
1592 }
1593
1594 case triton::arch::ID_REG_X86_FSW_UE: {
1595 triton::uint16 flag = 0;
1596 std::memcpy(&flag, (triton::uint16*)this->fsw, sizeof(triton::uint16));
1597 flag = !value.is_zero() ? (flag | (1 << 4)) : (flag & ~(1 << 4));
1598 std::memcpy((triton::uint16*)this->fsw, &flag, sizeof(triton::uint16));
1599 break;
1600 }
1601
1602 case triton::arch::ID_REG_X86_FSW_PE: {
1603 triton::uint16 flag = 0;
1604 std::memcpy(&flag, (triton::uint16*)this->fsw, sizeof(triton::uint16));
1605 flag = !value.is_zero() ? (flag | (1 << 5)) : (flag & ~(1 << 5));
1606 std::memcpy((triton::uint16*)this->fsw, &flag, sizeof(triton::uint16));
1607 break;
1608 }
1609
1610 case triton::arch::ID_REG_X86_FSW_SF: {
1611 triton::uint16 flag = 0;
1612 std::memcpy(&flag, (triton::uint16*)this->fsw, sizeof(triton::uint16));
1613 flag = !value.is_zero() ? (flag | (1 << 6)) : (flag & ~(1 << 6));
1614 std::memcpy((triton::uint16*)this->fsw, &flag, sizeof(triton::uint16));
1615 break;
1616 }
1617
1618 case triton::arch::ID_REG_X86_FSW_ES: {
1619 triton::uint16 flag = 0;
1620 std::memcpy(&flag, (triton::uint16*)this->fsw, sizeof(triton::uint16));
1621 flag = !value.is_zero() ? (flag | (1 << 7)) : (flag & ~(1 << 7));
1622 std::memcpy((triton::uint16*)this->fsw, &flag, sizeof(triton::uint16));
1623 break;
1624 }
1625
1626 case triton::arch::ID_REG_X86_FSW_C0: {
1627 triton::uint16 flag = 0;
1628 std::memcpy(&flag, (triton::uint16*)this->fsw, sizeof(triton::uint16));
1629 flag = !value.is_zero() ? (flag | (1 << 8)) : (flag & ~(1 << 8));
1630 std::memcpy((triton::uint16*)this->fsw, &flag, sizeof(triton::uint16));
1631 break;
1632 }
1633
1634 case triton::arch::ID_REG_X86_FSW_C1: {
1635 triton::uint16 flag = 0;
1636 std::memcpy(&flag, (triton::uint16*)this->fsw, sizeof(triton::uint16));
1637 flag = !value.is_zero() ? (flag | (1 << 9)) : (flag & ~(1 << 9));
1638 std::memcpy((triton::uint16*)this->fsw, &flag, sizeof(triton::uint16));
1639 break;
1640 }
1641
1642 case triton::arch::ID_REG_X86_FSW_C2: {
1643 triton::uint16 flag = 0;
1644 std::memcpy(&flag, (triton::uint16*)this->fsw, sizeof(triton::uint16));
1645 flag = !value.is_zero() ? (flag | (1 << 10)) : (flag & ~(1 << 10));
1646 std::memcpy((triton::uint16*)this->fsw, &flag, sizeof(triton::uint16));
1647 break;
1648 }
1649
1650 case triton::arch::ID_REG_X86_FSW_TOP: {
1651 triton::uint16 flag = 0;
1652 std::memcpy(&flag, (triton::uint16*)this->fsw, sizeof(triton::uint16));
1653 flag = (flag & 0xC7FF) | (static_cast<triton::uint16>(value) << 11);
1654 std::memcpy((triton::uint16*)this->fsw, &flag, sizeof(triton::uint16));
1655 break;
1656 }
1657
1658 case triton::arch::ID_REG_X86_FSW_C3: {
1659 triton::uint16 flag = 0;
1660 std::memcpy(&flag, (triton::uint16*)this->fsw, sizeof(triton::uint16));
1661 flag = !value.is_zero() ? (flag | (1 << 14)) : (flag & ~(1 << 14));
1662 std::memcpy((triton::uint16*)this->fsw, &flag, sizeof(triton::uint16));
1663 break;
1664 }
1665
1666 case triton::arch::ID_REG_X86_FSW_B: {
1667 triton::uint16 flag = 0;
1668 std::memcpy(&flag, (triton::uint16*)this->fsw, sizeof(triton::uint16));
1669 flag = !value.is_zero() ? (flag | (1 << 15)) : (flag & ~(1 << 15));
1670 std::memcpy((triton::uint16*)this->fsw, &flag, sizeof(triton::uint16));
1671 break;
1672 }
1673
1674 case triton::arch::ID_REG_X86_EFER: {
1675 triton::uint64 val = static_cast<triton::uint64>(value);
1676 std::memcpy((triton::uint64*)this->efer, &val, sizeof(triton::uint64));
1677 break;
1678 }
1679
1680 case triton::arch::ID_REG_X86_EFER_SCE: {
1681 triton::uint64 flag = 0;
1682 std::memcpy(&flag, (triton::uint64*)this->efer, sizeof(triton::uint64));
1683 flag = !value.is_zero() ? (flag | (1 << 0)) : (flag & ~(1 << 0));
1684 std::memcpy((triton::uint64*)this->efer, &flag, sizeof(triton::uint64));
1685 break;
1686 }
1687
1688 case triton::arch::ID_REG_X86_EFER_LME: {
1689 triton::uint64 flag = 0;
1690 std::memcpy(&flag, (triton::uint64*)this->efer, sizeof(triton::uint64));
1691 flag = !value.is_zero() ? (flag | (1 << 8)) : (flag & ~(1 << 8));
1692 std::memcpy((triton::uint64*)this->efer, &flag, sizeof(triton::uint64));
1693 break;
1694 }
1695
1696 case triton::arch::ID_REG_X86_EFER_LMA: {
1697 triton::uint64 flag = 0;
1698 std::memcpy(&flag, (triton::uint64*)this->efer, sizeof(triton::uint64));
1699 flag = !value.is_zero() ? (flag | (1 << 10)) : (flag & ~(1 << 10));
1700 std::memcpy((triton::uint64*)this->efer, &flag, sizeof(triton::uint64));
1701 break;
1702 }
1703
1704 case triton::arch::ID_REG_X86_EFER_NXE: {
1705 triton::uint64 flag = 0;
1706 std::memcpy(&flag, (triton::uint64*)this->efer, sizeof(triton::uint64));
1707 flag = !value.is_zero() ? (flag | (1 << 11)) : (flag & ~(1 << 11));
1708 std::memcpy((triton::uint64*)this->efer, &flag, sizeof(triton::uint64));
1709 break;
1710 }
1711
1712 case triton::arch::ID_REG_X86_EFER_SVME: {
1713 triton::uint64 flag = 0;
1714 std::memcpy(&flag, (triton::uint64*)this->efer, sizeof(triton::uint64));
1715 flag = !value.is_zero() ? (flag | (1 << 12)) : (flag & ~(1 << 12));
1716 std::memcpy((triton::uint64*)this->efer, &flag, sizeof(triton::uint64));
1717 break;
1718 }
1719
1720 case triton::arch::ID_REG_X86_EFER_LMSLE: {
1721 triton::uint64 flag = 0;
1722 std::memcpy(&flag, (triton::uint64*)this->efer, sizeof(triton::uint64));
1723 flag = !value.is_zero() ? (flag | (1 << 13)) : (flag & ~(1 << 13));
1724 std::memcpy((triton::uint64*)this->efer, &flag, sizeof(triton::uint64));
1725 break;
1726 }
1727
1728 case triton::arch::ID_REG_X86_EFER_FFXSR: {
1729 triton::uint64 flag = 0;
1730 std::memcpy(&flag, (triton::uint64*)this->efer, sizeof(triton::uint64));
1731 flag = !value.is_zero() ? (flag | (1 << 14)) : (flag & ~(1 << 14));
1732 std::memcpy((triton::uint64*)this->efer, &flag, sizeof(triton::uint64));
1733 break;
1734 }
1735
1736 case triton::arch::ID_REG_X86_EFER_TCE: {
1737 triton::uint64 flag = 0;
1738 std::memcpy(&flag, (triton::uint64*)this->efer, sizeof(triton::uint64));
1739 flag = !value.is_zero() ? (flag | (1 << 15)) : (flag & ~(1 << 15));
1740 std::memcpy((triton::uint64*)this->efer, &flag, sizeof(triton::uint64));
1741 break;
1742 }
1743
1744 case triton::arch::ID_REG_X86_CR0: { triton::uint64 val = static_cast<triton::uint64>(value); std::memcpy((triton::uint64*)this->cr0, &val, triton::size::qword); break; }
1745 case triton::arch::ID_REG_X86_CR1: { triton::uint64 val = static_cast<triton::uint64>(value); std::memcpy((triton::uint64*)this->cr1, &val, triton::size::qword); break; }
1746 case triton::arch::ID_REG_X86_CR2: { triton::uint64 val = static_cast<triton::uint64>(value); std::memcpy((triton::uint64*)this->cr2, &val, triton::size::qword); break; }
1747 case triton::arch::ID_REG_X86_CR3: { triton::uint64 val = static_cast<triton::uint64>(value); std::memcpy((triton::uint64*)this->cr3, &val, triton::size::qword); break; }
1748 case triton::arch::ID_REG_X86_CR4: { triton::uint64 val = static_cast<triton::uint64>(value); std::memcpy((triton::uint64*)this->cr4, &val, triton::size::qword); break; }
1749 case triton::arch::ID_REG_X86_CR5: { triton::uint64 val = static_cast<triton::uint64>(value); std::memcpy((triton::uint64*)this->cr5, &val, triton::size::qword); break; }
1750 case triton::arch::ID_REG_X86_CR6: { triton::uint64 val = static_cast<triton::uint64>(value); std::memcpy((triton::uint64*)this->cr6, &val, triton::size::qword); break; }
1751 case triton::arch::ID_REG_X86_CR7: { triton::uint64 val = static_cast<triton::uint64>(value); std::memcpy((triton::uint64*)this->cr7, &val, triton::size::qword); break; }
1752 case triton::arch::ID_REG_X86_CR8: { triton::uint64 val = static_cast<triton::uint64>(value); std::memcpy((triton::uint64*)this->cr8, &val, triton::size::qword); break; }
1753 case triton::arch::ID_REG_X86_CR9: { triton::uint64 val = static_cast<triton::uint64>(value); std::memcpy((triton::uint64*)this->cr9, &val, triton::size::qword); break; }
1754 case triton::arch::ID_REG_X86_CR10: { triton::uint64 val = static_cast<triton::uint64>(value); std::memcpy((triton::uint64*)this->cr10, &val, triton::size::qword); break; }
1755 case triton::arch::ID_REG_X86_CR11: { triton::uint64 val = static_cast<triton::uint64>(value); std::memcpy((triton::uint64*)this->cr11, &val, triton::size::qword); break; }
1756 case triton::arch::ID_REG_X86_CR12: { triton::uint64 val = static_cast<triton::uint64>(value); std::memcpy((triton::uint64*)this->cr12, &val, triton::size::qword); break; }
1757 case triton::arch::ID_REG_X86_CR13: { triton::uint64 val = static_cast<triton::uint64>(value); std::memcpy((triton::uint64*)this->cr13, &val, triton::size::qword); break; }
1758 case triton::arch::ID_REG_X86_CR14: { triton::uint64 val = static_cast<triton::uint64>(value); std::memcpy((triton::uint64*)this->cr14, &val, triton::size::qword); break; }
1759 case triton::arch::ID_REG_X86_CR15: { triton::uint64 val = static_cast<triton::uint64>(value); std::memcpy((triton::uint64*)this->cr15, &val, triton::size::qword); break; }
1760
1761 case triton::arch::ID_REG_X86_DR0: { triton::uint64 val = static_cast<triton::uint64>(value); std::memcpy((triton::uint64*)this->dr0, &val, triton::size::qword); break; }
1762 case triton::arch::ID_REG_X86_DR1: { triton::uint64 val = static_cast<triton::uint64>(value); std::memcpy((triton::uint64*)this->dr1, &val, triton::size::qword); break; }
1763 case triton::arch::ID_REG_X86_DR2: { triton::uint64 val = static_cast<triton::uint64>(value); std::memcpy((triton::uint64*)this->dr2, &val, triton::size::qword); break; }
1764 case triton::arch::ID_REG_X86_DR3: { triton::uint64 val = static_cast<triton::uint64>(value); std::memcpy((triton::uint64*)this->dr3, &val, triton::size::qword); break; }
1765 case triton::arch::ID_REG_X86_DR6: { triton::uint64 val = static_cast<triton::uint64>(value); std::memcpy((triton::uint64*)this->dr6, &val, triton::size::qword); break; }
1766 case triton::arch::ID_REG_X86_DR7: { triton::uint64 val = static_cast<triton::uint64>(value); std::memcpy((triton::uint64*)this->dr7, &val, triton::size::qword); break; }
1767
1768 case triton::arch::ID_REG_X86_CS: { triton::uint64 val = static_cast<triton::uint64>(value); std::memcpy((triton::uint64*)this->cs, &val, triton::size::qword); break; }
1769 case triton::arch::ID_REG_X86_DS: { triton::uint64 val = static_cast<triton::uint64>(value); std::memcpy((triton::uint64*)this->ds, &val, triton::size::qword); break; }
1770 case triton::arch::ID_REG_X86_ES: { triton::uint64 val = static_cast<triton::uint64>(value); std::memcpy((triton::uint64*)this->es, &val, triton::size::qword); break; }
1771 case triton::arch::ID_REG_X86_FS: { triton::uint64 val = static_cast<triton::uint64>(value); std::memcpy((triton::uint64*)this->fs, &val, triton::size::qword); break; }
1772 case triton::arch::ID_REG_X86_GS: { triton::uint64 val = static_cast<triton::uint64>(value); std::memcpy((triton::uint64*)this->gs, &val, triton::size::qword); break; }
1773 case triton::arch::ID_REG_X86_SS: { triton::uint64 val = static_cast<triton::uint64>(value); std::memcpy((triton::uint64*)this->ss, &val, triton::size::qword); break; }
1774
1775 case triton::arch::ID_REG_X86_TSC: { triton::uint64 val = static_cast<triton::uint64>(value); std::memcpy((triton::uint64*)this->tsc, &val, triton::size::qword); break; }
1776
1777 default:
1778 throw triton::exceptions::Cpu("x8664Cpu:setConcreteRegisterValue(): Invalid register.");
1779 }
1780 }
1781
1782
1783 bool x8664Cpu::isThumb(void) const {
1784 /* There is no thumb mode in x86_64 */
1785 return false;
1786 }
1787
1788
1789 void x8664Cpu::setThumb(bool state) {
1790 /* There is no thumb mode in x86_64 */
1791 }
1792
1793
1795 /* There is no exclusive memory access support in x86_64 */
1796 return false;
1797 }
1798
1799
1801 /* There is no exclusive memory access support in x86_64 */
1802 }
1803
1804
1808
1809
1811 for (triton::usize index = 0; index < size; index++) {
1812 if (this->memory.find(baseAddr + index) == this->memory.end()) {
1813 return false;
1814 }
1815 }
1816 return true;
1817 }
1818
1819
1823
1824
1826 for (triton::usize index = 0; index < size; index++) {
1827 if (this->memory.find(baseAddr + index) != this->memory.end()) {
1828 this->memory.erase(baseAddr + index);
1829 }
1830 }
1831 }
1832
1833 }; /* x86 namespace */
1834 }; /* arch namespace */
1835}; /* triton namespace */
TRITON_EXPORT triton::uint512 getMaxValue(void) const
Returns the max possible value of the bitvector.
TRITON_EXPORT void setBits(triton::uint32 high, triton::uint32 low)
Sets the bits (high, low) position.
This class is used to represent an immediate.
Definition immediate.hpp:37
This class is used to represent an instruction.
TRITON_EXPORT triton::uint32 getSize(void) const
Returns the size of the instruction.
TRITON_EXPORT void setDisassembly(const std::string &str)
Sets the disassembly of the instruction.
TRITON_EXPORT const triton::uint8 * getOpcode(void) const
Returns the opcode of the instruction.
TRITON_EXPORT void setType(triton::uint32 type)
Sets the type of the instruction.
TRITON_EXPORT void setPrefix(triton::arch::x86::prefix_e prefix)
Sets the prefix of the instruction (mainly for X86).
TRITON_EXPORT void setAddress(triton::uint64 addr)
Sets the address of the instruction.
TRITON_EXPORT void setArchitecture(triton::arch::architecture_e arch)
Sets the instruction's architecture.
TRITON_EXPORT triton::uint64 getAddress(void) const
Returns the address of the instruction.
TRITON_EXPORT void setBranch(bool flag)
Sets flag to define this instruction as branch or not.
TRITON_EXPORT void setSize(triton::uint32 size)
Sets the size of the instruction.
std::vector< triton::arch::OperandWrapper > operands
A list of operands.
TRITON_EXPORT void setControlFlow(bool flag)
Sets flag to define this instruction changes the control flow or not.
TRITON_EXPORT triton::uint64 getNextAddress(void) const
Returns the next address of the instruction.
This class is used to represent a memory access.
TRITON_EXPORT void setDisplacement(const triton::arch::Immediate &displacement)
LEA - Sets the displacement operand.
TRITON_EXPORT void setScale(const triton::arch::Immediate &scale)
LEA - Sets the scale operand.
TRITON_EXPORT triton::uint64 getAddress(void) const
Returns the address of the memory.
TRITON_EXPORT void setPcRelative(triton::uint64 addr)
LEA - Sets pc relative.
TRITON_EXPORT triton::uint32 getSize(void) const
Returns the size (in bytes) of the memory vector.
TRITON_EXPORT void setIndexRegister(const triton::arch::Register &index)
LEA - Sets the index register operand.
TRITON_EXPORT void setSegmentRegister(const triton::arch::Register &segment)
LEA - Sets the segment register operand.
TRITON_EXPORT void setBaseRegister(const triton::arch::Register &base)
LEA - Sets the base register operand.
This class is used as operand wrapper.
This class is used when an instruction has a register operand.
Definition register.hpp:44
TRITON_EXPORT triton::arch::register_e getParent(void) const
Returns the parent id of the register.
Definition register.cpp:58
TRITON_EXPORT triton::arch::register_e getId(void) const
Returns the id of the register.
Definition register.cpp:53
TRITON_EXPORT triton::uint32 getSize(void) const
Returns the size (in bytes) of the register.
Definition register.cpp:68
This class is used to describe the x86 (64-bits) spec.
Definition x8664Cpu.hpp:53
triton::uint8 gs[triton::size::qword]
Concrete value of GS.
Definition x8664Cpu.hpp:238
triton::uint8 zmm0[triton::size::dqqword]
Concrete value of zmm0.
Definition x8664Cpu.hpp:134
TRITON_EXPORT bool isRegister(triton::arch::register_e regId) const
Returns true if the register ID is a register.
Definition x8664Cpu.cpp:295
triton::uint8 zmm18[triton::size::dqqword]
Concrete value of zmm18.
Definition x8664Cpu.hpp:170
triton::uint8 cr12[triton::size::qword]
Concrete value of cr12.
Definition x8664Cpu.hpp:222
triton::uint8 rax[triton::size::qword]
Concrete value of rax.
Definition x8664Cpu.hpp:82
TRITON_EXPORT x8664Cpu & operator=(const x8664Cpu &other)
Copies a x8664Cpu class.
Definition x8664Cpu.cpp:272
triton::uint8 dr7[triton::size::qword]
Condete value of dr7.
Definition x8664Cpu.hpp:252
TRITON_EXPORT triton::uint32 numberOfRegisters(void) const
Returns the number of registers according to the CPU architecture.
Definition x8664Cpu.cpp:378
triton::uint8 st4[triton::size::fword]
Concrete value of st4.
Definition x8664Cpu.hpp:126
TRITON_EXPORT void setMemoryExclusiveTag(const triton::arch::MemoryAccess &mem, bool tag)
Sets exclusive memory access tag. Only valid for Arm32 and AArch64.
triton::uint8 zmm30[triton::size::dqqword]
Concrete value of zmm30.
Definition x8664Cpu.hpp:194
triton::uint8 es[triton::size::qword]
Concrete value of ES.
Definition x8664Cpu.hpp:234
triton::uint8 zmm10[triton::size::dqqword]
Concrete value of zmm10.
Definition x8664Cpu.hpp:154
TRITON_EXPORT triton::uint512 getConcreteRegisterValue(const triton::arch::Register &reg, bool execCallbacks=true) const
Returns the concrete value of a register.
Definition x8664Cpu.cpp:661
triton::uint8 r10[triton::size::qword]
Concrete value of r10.
Definition x8664Cpu.hpp:104
TRITON_EXPORT const std::unordered_map< triton::uint64, triton::uint8, IdentityHash< triton::uint64 > > & getConcreteMemory(void) const
Return all memory.
Definition x8664Cpu.cpp:397
triton::uint8 zmm12[triton::size::dqqword]
Concrete value of zmm12.
Definition x8664Cpu.hpp:158
triton::uint8 cr1[triton::size::qword]
Concrete value of cr1.
Definition x8664Cpu.hpp:200
triton::uint8 st1[triton::size::fword]
Concrete value of st1.
Definition x8664Cpu.hpp:120
triton::uint8 zmm21[triton::size::dqqword]
Concrete value of zmm21.
Definition x8664Cpu.hpp:176
triton::uint8 r12[triton::size::qword]
Concrete value of r12.
Definition x8664Cpu.hpp:108
triton::uint8 cr10[triton::size::qword]
Concrete value of cr10.
Definition x8664Cpu.hpp:218
triton::uint8 eflags[triton::size::qword]
Concrete value of eflags.
Definition x8664Cpu.hpp:116
TRITON_EXPORT const triton::arch::Register & getProgramCounter(void) const
Returns the program counter register.
Definition x8664Cpu.cpp:492
TRITON_EXPORT bool isMemoryExclusive(const triton::arch::MemoryAccess &mem) const
Returns true if the given memory access is tagged as exclusive. Only valid for Arm32 and AArch64.
triton::uint8 zmm5[triton::size::dqqword]
Concrete value of zmm5.
Definition x8664Cpu.hpp:144
TRITON_EXPORT x8664Cpu(triton::callbacks::Callbacks *callbacks=nullptr)
Constructor.
Definition x8664Cpu.cpp:26
triton::uint8 cr7[triton::size::qword]
Concrete value of cr7.
Definition x8664Cpu.hpp:212
triton::uint8 zmm7[triton::size::dqqword]
Concrete value of zmm7.
Definition x8664Cpu.hpp:148
TRITON_EXPORT triton::uint512 getConcreteMemoryValue(const triton::arch::MemoryAccess &mem, bool execCallbacks=true) const
Returns the concrete value of memory cells.
Definition x8664Cpu.cpp:630
triton::uint8 zmm9[triton::size::dqqword]
Concrete value of zmm9.
Definition x8664Cpu.hpp:152
triton::uint8 zmm2[triton::size::dqqword]
Concrete value of zmm2.
Definition x8664Cpu.hpp:138
triton::uint8 dr1[triton::size::qword]
Condete value of dr1.
Definition x8664Cpu.hpp:244
TRITON_EXPORT const triton::arch::Register & getRegister(triton::arch::register_e id) const
Returns register from id.
Definition x8664Cpu.cpp:462
std::unordered_map< triton::uint64, triton::uint8, IdentityHash< triton::uint64 > > memory
map of address -> concrete value
Definition x8664Cpu.hpp:79
triton::uint8 zmm27[triton::size::dqqword]
Concrete value of zmm27.
Definition x8664Cpu.hpp:188
TRITON_EXPORT const std::unordered_map< triton::arch::register_e, const triton::arch::Register > & getAllRegisters(void) const
Returns all registers.
Definition x8664Cpu.cpp:393
triton::uint8 mxcsr_mask[triton::size::dword]
Concrete value of the SSE Register State Mask.
Definition x8664Cpu.hpp:274
triton::uint8 rip[triton::size::qword]
Concrete value of rip.
Definition x8664Cpu.hpp:98
triton::uint8 zmm16[triton::size::dqqword]
Concrete value of zmm16.
Definition x8664Cpu.hpp:166
TRITON_EXPORT bool isAVX256(triton::arch::register_e regId) const
Returns true if regId is a AVX-256 (YMM) register.
Definition x8664Cpu.cpp:353
TRITON_EXPORT bool isEFER(triton::arch::register_e regId) const
Returns true if regId is an EFER register.
Definition x8664Cpu.cpp:343
TRITON_EXPORT std::set< const triton::arch::Register * > getParentRegisters(void) const
Returns all parent registers.
Definition x8664Cpu.cpp:402
triton::uint8 zmm20[triton::size::dqqword]
Concrete value of zmm20.
Definition x8664Cpu.hpp:174
TRITON_EXPORT void setConcreteMemoryAreaValue(triton::uint64 baseAddr, const std::vector< triton::uint8 > &values, bool execCallbacks=true)
[architecture api] - Sets the concrete value of a memory area.
Definition x8664Cpu.cpp:981
TRITON_EXPORT bool isMMX(triton::arch::register_e regId) const
Returns true if regId is a MMX register.
Definition x8664Cpu.cpp:323
triton::uint8 dr6[triton::size::qword]
Condete value of dr6.
Definition x8664Cpu.hpp:250
triton::uint8 cr13[triton::size::qword]
Concrete value of cr13.
Definition x8664Cpu.hpp:224
TRITON_EXPORT std::vector< triton::uint8 > getConcreteMemoryAreaValue(triton::uint64 baseAddr, triton::usize size, bool execCallbacks=true) const
Returns the concrete value of a memory area.
Definition x8664Cpu.cpp:651
triton::uint8 fdp[triton::size::qword]
Concrete value of the x87 FPU Instruction Operand Pointer Offset.
Definition x8664Cpu.hpp:266
TRITON_EXPORT triton::uint32 gprSize(void) const
Returns the bit in byte of the General Purpose Registers.
Definition x8664Cpu.cpp:383
triton::uint8 cr14[triton::size::qword]
Concrete value of cr14.
Definition x8664Cpu.hpp:226
triton::uint8 st5[triton::size::fword]
Concrete value of st5.
Definition x8664Cpu.hpp:128
triton::uint8 zmm6[triton::size::dqqword]
Concrete value of zmm6.
Definition x8664Cpu.hpp:146
triton::uint8 cr2[triton::size::qword]
Concrete value of cr2.
Definition x8664Cpu.hpp:202
triton::uint8 cr11[triton::size::qword]
Concrete value of cr11.
Definition x8664Cpu.hpp:220
triton::uint8 cr4[triton::size::qword]
Concrete value of cr4.
Definition x8664Cpu.hpp:206
TRITON_EXPORT bool isSSE(triton::arch::register_e regId) const
Returns true if regId is a SSE register.
Definition x8664Cpu.cpp:333
triton::uint8 cr8[triton::size::qword]
Concrete value of cr8.
Definition x8664Cpu.hpp:214
triton::uint8 dr0[triton::size::qword]
Concrete value of dr0.
Definition x8664Cpu.hpp:242
triton::uint8 zmm13[triton::size::dqqword]
Concrete value of zmm13.
Definition x8664Cpu.hpp:160
triton::uint8 cr9[triton::size::qword]
Concrete value of cr9.
Definition x8664Cpu.hpp:216
triton::uint8 st7[triton::size::fword]
Concrete value of st7.
Definition x8664Cpu.hpp:132
triton::uint8 fcw[triton::size::word]
Concrete value of the x87 FPU Control Word.
Definition x8664Cpu.hpp:254
triton::uint8 zmm8[triton::size::dqqword]
Concrete value of zmm8.
Definition x8664Cpu.hpp:150
triton::uint8 efer[triton::size::qword]
Concrete value of the EFER MSR Register.
Definition x8664Cpu.hpp:270
TRITON_EXPORT void setConcreteRegisterValue(const triton::arch::Register &reg, const triton::uint512 &value, bool execCallbacks=true)
[architecture api] - Sets the concrete value of a register.
Definition x8664Cpu.cpp:999
triton::uint8 zmm22[triton::size::dqqword]
Concrete value of zmm22.
Definition x8664Cpu.hpp:178
triton::uint8 ss[triton::size::qword]
Concrete value of SS.
Definition x8664Cpu.hpp:240
triton::uint8 r9[triton::size::qword]
Concrete value of r9.
Definition x8664Cpu.hpp:102
triton::uint8 rdx[triton::size::qword]
Concrete value of rdx.
Definition x8664Cpu.hpp:88
triton::uint8 mxcsr[triton::size::dword]
Concrete value of the SSE Register State.
Definition x8664Cpu.hpp:272
triton::uint8 cr0[triton::size::qword]
Concrete value of cr0.
Definition x8664Cpu.hpp:198
triton::uint8 r15[triton::size::qword]
Concrete value of r15.
Definition x8664Cpu.hpp:114
triton::uint8 dr3[triton::size::qword]
Condete value of dr3.
Definition x8664Cpu.hpp:248
triton::uint8 rsi[triton::size::qword]
Concrete value of rsi.
Definition x8664Cpu.hpp:92
TRITON_EXPORT bool isConcreteMemoryValueDefined(const triton::arch::MemoryAccess &mem) const
Returns true if memory cells have a defined concrete value.
triton::uint8 fs[triton::size::qword]
Concrete value of FS.
Definition x8664Cpu.hpp:236
triton::uint8 r11[triton::size::qword]
Concrete value of r11.
Definition x8664Cpu.hpp:106
TRITON_EXPORT bool isControl(triton::arch::register_e regId) const
Returns true if regId is a control (cr) register.
Definition x8664Cpu.cpp:363
triton::uint8 cr5[triton::size::qword]
Concrete value of cr5.
Definition x8664Cpu.hpp:208
TRITON_EXPORT bool isAVX512(triton::arch::register_e regId) const
Returns true if regId is a AVX-512 (ZMM) register.
Definition x8664Cpu.cpp:358
TRITON_EXPORT triton::uint32 gprBitSize(void) const
Returns the bit in bit of the General Purpose Registers.
Definition x8664Cpu.cpp:388
triton::uint8 fcs[triton::size::word]
Concrete value of the x87 FPU Instruction Pointer Selector.
Definition x8664Cpu.hpp:264
triton::uint8 fop[triton::size::word]
Concrete value of the x87 FPU Opcode.
Definition x8664Cpu.hpp:260
TRITON_EXPORT bool isFlag(triton::arch::register_e regId) const
Returns true if the register ID is a flag.
Definition x8664Cpu.cpp:283
triton::uint8 zmm29[triton::size::dqqword]
Concrete value of zmm29.
Definition x8664Cpu.hpp:192
TRITON_EXPORT void disassembly(triton::arch::Instruction &inst)
Disassembles the instruction according to the architecture.
Definition x8664Cpu.cpp:502
triton::uint8 zmm31[triton::size::dqqword]
Concrete value of zmm31.
Definition x8664Cpu.hpp:196
triton::uint8 rbx[triton::size::qword]
Concrete value of rbx.
Definition x8664Cpu.hpp:84
triton::uint8 zmm4[triton::size::dqqword]
Concrete value of zmm4.
Definition x8664Cpu.hpp:142
TRITON_EXPORT bool isSegment(triton::arch::register_e regId) const
Returns true if regId is a Segment.
Definition x8664Cpu.cpp:373
triton::uint8 zmm3[triton::size::dqqword]
Concrete value of zmm3.
Definition x8664Cpu.hpp:140
triton::uint8 fds[triton::size::word]
Concrete value of the x87 FPU Instruction Operand Pointer Selector.
Definition x8664Cpu.hpp:268
TRITON_EXPORT const triton::arch::Register & getParentRegister(const triton::arch::Register &reg) const
Returns parent register from a given one.
Definition x8664Cpu.cpp:482
triton::uint8 zmm14[triton::size::dqqword]
Concrete value of zmm14.
Definition x8664Cpu.hpp:162
triton::uint8 r8[triton::size::qword]
Concrete value of r8.
Definition x8664Cpu.hpp:100
triton::uint8 rdi[triton::size::qword]
Concrete value of rdi.
Definition x8664Cpu.hpp:90
TRITON_EXPORT bool isGPR(triton::arch::register_e regId) const
Returns true if regId is a GRP.
Definition x8664Cpu.cpp:318
TRITON_EXPORT const triton::arch::Register & getStackPointer(void) const
Returns the stack pointer register.
Definition x8664Cpu.cpp:497
triton::uint8 st0[triton::size::fword]
Concrete value of st0.
Definition x8664Cpu.hpp:118
triton::uint8 zmm24[triton::size::dqqword]
Concrete value of zmm24.
Definition x8664Cpu.hpp:182
virtual TRITON_EXPORT ~x8664Cpu()
Destructor.
Definition x8664Cpu.cpp:40
TRITON_EXPORT bool isThumb(void) const
Returns true if the execution mode is Thumb. Only useful for Arm32.
triton::uint8 r14[triton::size::qword]
Concrete value of r14.
Definition x8664Cpu.hpp:112
triton::uint8 tsc[triton::size::qword]
Concrete value of the TSC Register.
Definition x8664Cpu.hpp:276
triton::uint8 cr3[triton::size::qword]
Concrete value of cr3.
Definition x8664Cpu.hpp:204
triton::uint8 zmm1[triton::size::dqqword]
Concrete value of zmm1.
Definition x8664Cpu.hpp:136
triton::uint8 zmm28[triton::size::dqqword]
Concrete value of zmm28.
Definition x8664Cpu.hpp:190
triton::uint8 ds[triton::size::qword]
Concrete value of DS.
Definition x8664Cpu.hpp:232
TRITON_EXPORT void clearConcreteMemoryValue(const triton::arch::MemoryAccess &mem)
Clears concrete values assigned to the memory cells.
triton::uint8 zmm23[triton::size::dqqword]
Concrete value of zmm23.
Definition x8664Cpu.hpp:180
triton::uint8 st6[triton::size::fword]
Concrete value of st6.
Definition x8664Cpu.hpp:130
triton::uint8 zmm19[triton::size::dqqword]
Concrete value of zmm19.
Definition x8664Cpu.hpp:172
triton::uint8 rbp[triton::size::qword]
Concrete value of rbp.
Definition x8664Cpu.hpp:94
triton::uint8 zmm11[triton::size::dqqword]
Concrete value of zmm11.
Definition x8664Cpu.hpp:156
TRITON_EXPORT triton::arch::endianness_e getEndianness(void) const
Returns the kind of endianness as triton::arch::endianness_e.
Definition x8664Cpu.cpp:278
triton::uint8 rcx[triton::size::qword]
Concrete value of rcx.
Definition x8664Cpu.hpp:86
TRITON_EXPORT void setConcreteMemoryValue(const triton::arch::MemoryAccess &mem, const triton::uint512 &value, bool execCallbacks=true)
[architecture api] - Sets the concrete value of memory cells.
Definition x8664Cpu.cpp:960
triton::uint8 st3[triton::size::fword]
Concrete value of st3.
Definition x8664Cpu.hpp:124
triton::uint8 fsw[triton::size::word]
Concrete value of the x87 FPU Status Word.
Definition x8664Cpu.hpp:256
triton::uint8 r13[triton::size::qword]
Concrete value of r13.
Definition x8664Cpu.hpp:110
triton::uint8 cr6[triton::size::qword]
Concrete value of cr6.
Definition x8664Cpu.hpp:210
triton::uint8 dr2[triton::size::qword]
Condete value of dr2.
Definition x8664Cpu.hpp:246
TRITON_EXPORT bool isFPU(triton::arch::register_e regId) const
Returns true if regId is a FPU register.
Definition x8664Cpu.cpp:338
triton::uint8 cr15[triton::size::qword]
Concrete value of cr15.
Definition x8664Cpu.hpp:228
TRITON_EXPORT void setThumb(bool state)
Sets CPU state to Thumb mode.
TRITON_EXPORT bool isRegisterValid(triton::arch::register_e regId) const
Returns true if the register ID is valid.
Definition x8664Cpu.cpp:313
TRITON_EXPORT void clear(void)
Clears the architecture states (registers and memory).
Definition x8664Cpu.cpp:166
triton::uint8 fip[triton::size::qword]
Concrete value of the x87 FPU Instruction Pointer Offset.
Definition x8664Cpu.hpp:262
triton::uint8 zmm26[triton::size::dqqword]
Concrete value of zmm26.
Definition x8664Cpu.hpp:186
triton::uint8 rsp[triton::size::qword]
Concrete value of rsp.
Definition x8664Cpu.hpp:96
TRITON_EXPORT bool isSTX(triton::arch::register_e regId) const
Returns true if regId is a STX register.
Definition x8664Cpu.cpp:328
triton::uint8 zmm25[triton::size::dqqword]
Concrete value of zmm25.
Definition x8664Cpu.hpp:184
triton::uint8 st2[triton::size::fword]
Concrete value of st2.
Definition x8664Cpu.hpp:122
triton::uint8 zmm15[triton::size::dqqword]
Concrete value of zmm15.
Definition x8664Cpu.hpp:164
triton::uint8 ftw[triton::size::word]
Concrete value of the x87 FPU Tag Word.
Definition x8664Cpu.hpp:258
TRITON_EXPORT bool isTSC(triton::arch::register_e regId) const
Returns true if regId is an TSC register.
Definition x8664Cpu.cpp:348
triton::uint8 zmm17[triton::size::dqqword]
Concrete value of zmm17.
Definition x8664Cpu.hpp:168
TRITON_EXPORT bool isDebug(triton::arch::register_e regId) const
Returns true if regId is a debug (dr) register.
Definition x8664Cpu.cpp:368
triton::uint8 cs[triton::size::qword]
Concrete value of CS.
Definition x8664Cpu.hpp:230
The x86Specifications class defines specifications about the x86 and x86_64 CPU.
TRITON_EXPORT triton::arch::register_e capstoneRegisterToTritonRegister(triton::uint32 id) const
Converts a capstone's register id to a triton's register id.
std::unordered_map< triton::arch::register_e, const triton::arch::Register > id2reg
List of registers specification available for this architecture.
TRITON_EXPORT triton::arch::x86::prefix_e capstonePrefixToTritonPrefix(triton::uint32 id) const
Converts a capstone's prefix id to a triton's prefix id.
TRITON_EXPORT triton::uint32 capstoneInstructionToTritonInstruction(triton::uint32 id) const
Converts a capstone's instruction id to a triton's instruction id.
The callbacks class.
Definition callbacks.hpp:79
TRITON_EXPORT triton::ast::SharedAbstractNode processCallbacks(triton::callbacks::callback_e kind, triton::ast::SharedAbstractNode node)
Processes callbacks according to the kind and the C++ polymorphism.
The exception class used by all CPUs.
The exception class used by the disassembler.
The exception class used by register operands.
register_e
Types of register.
Definition archEnums.hpp:64
@ ID_REG_LAST_ITEM
must be the last item
Definition archEnums.hpp:84
constexpr triton::uint32 byte
byte size in bit
Definition cpuSize.hpp:60
constexpr triton::uint32 qword
qword size in bit
Definition cpuSize.hpp:66
constexpr triton::uint32 dword
dword size in byte
Definition cpuSize.hpp:34
constexpr triton::uint32 dqqword
dqqword size in byte
Definition cpuSize.hpp:44
constexpr triton::uint32 word
word size in byte
Definition cpuSize.hpp:32
constexpr triton::uint32 byte
byte size in byte
Definition cpuSize.hpp:30
constexpr triton::uint32 qword
qword size in byte
Definition cpuSize.hpp:36
math::wide_integer::uint128_t uint128
unsigned 128-bits
std::int32_t sint32
signed 32-bits
math::wide_integer::uint256_t uint256
unsigned 256-bits
std::uint16_t uint16
unisgned 16-bits
std::size_t usize
unsigned MAX_INT 32 or 64 bits according to the CPU.
std::uint64_t uint64
unisgned 64-bits
math::wide_integer::uint512_t uint512
unsigned 512-bits
std::uint32_t uint32
unisgned 32-bits
std::uint8_t uint8
unisgned 8-bits
TRITON_EXPORT void fromUintToBuffer(triton::uint80 value, triton::uint8 *buffer)
Inject the value into the buffer. Make sure that the buffer contains at least 10 allocated bytes.
Definition coreUtils.cpp:16
The Triton namespace.