libTriton version 1.0 build 1588
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
280 }
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
380 }
381
382
384 return triton::size::qword;
385 }
386
387
390 }
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
398 std::set<const triton::arch::Register*> x8664Cpu::getParentRegisters(void) const {
399 std::set<const triton::arch::Register*> ret;
400
401 for (const auto& kv: this->id2reg) {
402 auto regId = kv.first;
403 const auto& reg = kv.second;
404
405 /* Add GPR */
406 if (reg.getSize() == this->gprSize())
407 ret.insert(&reg);
408
409 /* Add Flags */
410 else if (this->isFlag(regId))
411 ret.insert(&reg);
412
413 /* Add STX */
414 else if (this->isSTX(regId))
415 ret.insert(&reg);
416
417 /* Add SSE */
418 else if (this->isSSE(regId))
419 ret.insert(&reg);
420
421 /* Add FPU */
422 else if (this->isFPU(regId))
423 ret.insert(&reg);
424
425 /* Add EFER */
426 else if (this->isEFER(regId))
427 ret.insert(&reg);
428
429 /* Add TSC */
430 else if (this->isTSC(regId))
431 ret.insert(&reg);
432
433 /* Add AVX-256 */
434 else if (this->isAVX256(regId))
435 ret.insert(&reg);
436
437 /* Add AVX-512 */
438 else if (this->isAVX512(regId))
439 ret.insert(&reg);
440
441 /* Add Control */
442 else if (this->isControl(regId))
443 ret.insert(&reg);
444
445 /* Add Debug */
446 else if (this->isDebug(regId))
447 ret.insert(&reg);
448
449 /* Add Segment */
450 else if (this->isSegment(regId))
451 ret.insert(&reg);
452 }
453
454 return ret;
455 }
456
457
459 try {
460 return this->id2reg.at(id);
461 } catch (const std::out_of_range&) {
462 throw triton::exceptions::Cpu("x8664Cpu::getRegister(): Invalid register for this architecture.");
463 }
464 }
465
466
467 const triton::arch::Register& x8664Cpu::getRegister(const std::string& name) const {
468 std::string lower = name;
469 std::transform(lower.begin(), lower.end(), lower.begin(), [](unsigned char c){ return std::tolower(c); });
470 try {
471 return this->getRegister(this->name2id.at(lower));
472 } catch (const std::out_of_range&) {
473 throw triton::exceptions::Cpu("x8664Cpu::getRegister(): Invalid register for this architecture.");
474 }
475 }
476
477
479 return this->getRegister(reg.getParent());
480 }
481
482
484 return this->getParentRegister(this->getRegister(id));
485 }
486
487
489 return this->getRegister(this->pcId);
490 }
491
492
494 return this->getRegister(this->spId);
495 }
496
497
499 triton::extlibs::capstone::cs_insn* insn;
500 triton::usize count = 0;
501
502 /* Check if the opcode and opcode' size are defined */
503 if (inst.getOpcode() == nullptr || inst.getSize() == 0)
504 throw triton::exceptions::Disassembly("x8664Cpu::disassembly(): Opcode and opcodeSize must be definied.");
505
506 /* Clear instructicon's operands if alredy defined */
507 inst.operands.clear();
508
509 /* Update instruction address if undefined */
510 if (!inst.getAddress()) {
511 inst.setAddress(static_cast<triton::uint64>(this->getConcreteRegisterValue(this->getProgramCounter())));
512 }
513
514 /* Let's disass and build our operands */
515 count = triton::extlibs::capstone::cs_disasm(this->handle, inst.getOpcode(), inst.getSize(), inst.getAddress(), 0, &insn);
516 if (count > 0) {
517 /* Detail information */
518 triton::extlibs::capstone::cs_detail* detail = insn->detail;
519
520 /* Init the disassembly */
521 std::stringstream str;
522
523 str << insn[0].mnemonic;
524 if (detail->x86.op_count)
525 str << " " << insn[0].op_str;
526
527 inst.setDisassembly(str.str());
528
529 /* Refine the size */
530 inst.setSize(insn[0].size);
531
532 /* Init the instruction's type */
533 inst.setType(this->capstoneInstructionToTritonInstruction(insn[0].id));
534
535 /* Init the instruction's prefix */
536 inst.setPrefix(this->capstonePrefixToTritonPrefix(detail->x86.prefix[0]));
537
538 /* Set architecture */
540
541 /* Init operands */
542 for (triton::uint32 n = 0; n < detail->x86.op_count; n++) {
543 triton::extlibs::capstone::cs_x86_op* op = &(detail->x86.operands[n]);
544 switch(op->type) {
545
546 case triton::extlibs::capstone::X86_OP_IMM:
547 inst.operands.push_back(triton::arch::OperandWrapper(triton::arch::Immediate(op->imm, op->size)));
548 break;
549
550 case triton::extlibs::capstone::X86_OP_MEM: {
552
553 /* Set the size of the memory access */
554 mem.setBits(((op->size * triton::bitsize::byte) - 1), 0);
555
556 /* LEA if exists */
557 const triton::arch::Register segment(*this, this->capstoneRegisterToTritonRegister(op->mem.segment));
558 const triton::arch::Register base(*this, this->capstoneRegisterToTritonRegister(op->mem.base));
559 const triton::arch::Register index(*this, this->capstoneRegisterToTritonRegister(op->mem.index));
560
561 triton::uint32 immsize = (
562 this->isRegisterValid(base.getId()) ? base.getSize() :
563 this->isRegisterValid(index.getId()) ? index.getSize() :
564 this->gprSize()
565 );
566
567 triton::arch::Immediate disp(op->mem.disp, immsize);
568 triton::arch::Immediate scale(op->mem.scale, immsize);
569
570 /* Specify that LEA contains a PC relative */
571 if (base.getId() == this->pcId)
572 mem.setPcRelative(inst.getNextAddress());
573
574 mem.setSegmentRegister(segment);
575 mem.setBaseRegister(base);
576 mem.setIndexRegister(index);
577 mem.setDisplacement(disp);
578 mem.setScale(scale);
579
580 inst.operands.push_back(triton::arch::OperandWrapper(mem));
581 break;
582 }
583
584 case triton::extlibs::capstone::X86_OP_REG:
586 break;
587
588 default:
589 throw triton::exceptions::Disassembly("x8664Cpu::disassembly(): Invalid operand.");
590 }
591 }
592
593 /* Set branch */
594 if (detail->groups_count > 0) {
595 for (triton::uint32 n = 0; n < detail->groups_count; n++) {
596 if (detail->groups[n] == triton::extlibs::capstone::X86_GRP_JUMP)
597 inst.setBranch(true);
598 if (detail->groups[n] == triton::extlibs::capstone::X86_GRP_JUMP ||
599 detail->groups[n] == triton::extlibs::capstone::X86_GRP_CALL ||
600 detail->groups[n] == triton::extlibs::capstone::X86_GRP_RET)
601 inst.setControlFlow(true);
602 }
603 }
604
605 /* Free capstone stuffs */
606 triton::extlibs::capstone::cs_free(insn, count);
607 }
608 else
609 throw triton::exceptions::Disassembly("x8664Cpu::disassembly(): Failed to disassemble the given code.");
610 }
611
612
614 if (execCallbacks && this->callbacks)
616
617 auto it = this->memory.find(addr);
618 if (it == this->memory.end()) {
619 return 0x00;
620 }
621
622 return it->second;
623 }
624
625
627 triton::uint512 ret = 0;
628 triton::uint64 addr = 0;
629 triton::uint32 size = 0;
630
631 if (execCallbacks && this->callbacks)
633
634 addr = mem.getAddress();
635 size = mem.getSize();
636
637 if (size == 0 || size > triton::size::dqqword)
638 throw triton::exceptions::Cpu("x8664Cpu::getConcreteMemoryValue(): Invalid size memory.");
639
640 for (triton::sint32 i = size-1; i >= 0; i--)
641 ret = ((ret << triton::bitsize::byte) | this->getConcreteMemoryValue(addr+i, false));
642
643 return ret;
644 }
645
646
647 std::vector<triton::uint8> x8664Cpu::getConcreteMemoryAreaValue(triton::uint64 baseAddr, triton::usize size, bool execCallbacks) const {
648 std::vector<triton::uint8> area;
649
650 for (triton::usize index = 0; index < size; index++)
651 area.push_back(this->getConcreteMemoryValue(baseAddr+index, execCallbacks));
652
653 return area;
654 }
655
656
658 triton::uint512 value = 0;
659
660 if (execCallbacks && this->callbacks)
662
663 switch (reg.getId()) {
664
665 case triton::arch::ID_REG_X86_RAX: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->rax, triton::size::qword); return val; }
666 case triton::arch::ID_REG_X86_EAX: { triton::uint32 val = 0; std::memcpy(&val, (triton::uint32*)this->rax, triton::size::dword); return val; }
667 case triton::arch::ID_REG_X86_AX: { triton::uint16 val = 0; std::memcpy(&val, (triton::uint16*)this->rax, triton::size::word); return val; }
668 case triton::arch::ID_REG_X86_AH: { triton::uint8 val = 0; std::memcpy(&val, (triton::uint8*)this->rax+1, triton::size::byte); return val; }
669 case triton::arch::ID_REG_X86_AL: { triton::uint8 val = 0; std::memcpy(&val, (triton::uint8*)this->rax, triton::size::byte); return val; }
670 case triton::arch::ID_REG_X86_RBX: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->rbx, triton::size::qword); return val; }
671 case triton::arch::ID_REG_X86_EBX: { triton::uint32 val = 0; std::memcpy(&val, (triton::uint32*)this->rbx, triton::size::dword); return val; }
672 case triton::arch::ID_REG_X86_BX: { triton::uint16 val = 0; std::memcpy(&val, (triton::uint16*)this->rbx, triton::size::word); return val; }
673 case triton::arch::ID_REG_X86_BH: { triton::uint8 val = 0; std::memcpy(&val, (triton::uint8*)this->rbx+1, triton::size::byte); return val; }
674 case triton::arch::ID_REG_X86_BL: { triton::uint8 val = 0; std::memcpy(&val, (triton::uint8*)this->rbx, triton::size::byte); return val; }
675 case triton::arch::ID_REG_X86_RCX: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->rcx, triton::size::qword); return val; }
676 case triton::arch::ID_REG_X86_ECX: { triton::uint32 val = 0; std::memcpy(&val, (triton::uint32*)this->rcx, triton::size::dword); return val; }
677 case triton::arch::ID_REG_X86_CX: { triton::uint16 val = 0; std::memcpy(&val, (triton::uint16*)this->rcx, triton::size::word); return val; }
678 case triton::arch::ID_REG_X86_CH: { triton::uint8 val = 0; std::memcpy(&val, (triton::uint8*)this->rcx+1, triton::size::byte); return val; }
679 case triton::arch::ID_REG_X86_CL: { triton::uint8 val = 0; std::memcpy(&val, (triton::uint8*)this->rcx, triton::size::byte); return val; }
680 case triton::arch::ID_REG_X86_RDX: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->rdx, triton::size::qword); return val; }
681 case triton::arch::ID_REG_X86_EDX: { triton::uint32 val = 0; std::memcpy(&val, (triton::uint32*)this->rdx, triton::size::dword); return val; }
682 case triton::arch::ID_REG_X86_DX: { triton::uint16 val = 0; std::memcpy(&val, (triton::uint16*)this->rdx, triton::size::word); return val; }
683 case triton::arch::ID_REG_X86_DH: { triton::uint8 val = 0; std::memcpy(&val, (triton::uint8*)this->rdx+1, triton::size::byte); return val; }
684 case triton::arch::ID_REG_X86_DL: { triton::uint8 val = 0; std::memcpy(&val, (triton::uint8*)this->rdx, triton::size::byte); return val; }
685
686 case triton::arch::ID_REG_X86_RDI: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->rdi, triton::size::qword); return val; }
687 case triton::arch::ID_REG_X86_EDI: { triton::uint32 val = 0; std::memcpy(&val, (triton::uint32*)this->rdi, triton::size::dword); return val; }
688 case triton::arch::ID_REG_X86_DI: { triton::uint16 val = 0; std::memcpy(&val, (triton::uint16*)this->rdi, triton::size::word); return val; }
689 case triton::arch::ID_REG_X86_DIL: { triton::uint8 val = 0; std::memcpy(&val, (triton::uint8*)this->rdi, triton::size::byte); return val; }
690 case triton::arch::ID_REG_X86_RSI: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->rsi, triton::size::qword); return val; }
691 case triton::arch::ID_REG_X86_ESI: { triton::uint32 val = 0; std::memcpy(&val, (triton::uint32*)this->rsi, triton::size::dword); return val; }
692 case triton::arch::ID_REG_X86_SI: { triton::uint16 val = 0; std::memcpy(&val, (triton::uint16*)this->rsi, triton::size::word); return val; }
693 case triton::arch::ID_REG_X86_SIL: { triton::uint8 val = 0; std::memcpy(&val, (triton::uint8*)this->rsi, triton::size::byte); return val; }
694 case triton::arch::ID_REG_X86_RSP: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->rsp, triton::size::qword); return val; }
695 case triton::arch::ID_REG_X86_ESP: { triton::uint32 val = 0; std::memcpy(&val, (triton::uint32*)this->rsp, triton::size::dword); return val; }
696 case triton::arch::ID_REG_X86_SP: { triton::uint16 val = 0; std::memcpy(&val, (triton::uint16*)this->rsp, triton::size::word); return val; }
697 case triton::arch::ID_REG_X86_SPL: { triton::uint8 val = 0; std::memcpy(&val, (triton::uint8*)this->rsp, triton::size::byte); return val; }
698 case triton::arch::ID_REG_X86_RBP: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->rbp, triton::size::qword); return val; }
699 case triton::arch::ID_REG_X86_EBP: { triton::uint32 val = 0; std::memcpy(&val, (triton::uint32*)this->rbp, triton::size::dword); return val; }
700 case triton::arch::ID_REG_X86_BP: { triton::uint16 val = 0; std::memcpy(&val, (triton::uint16*)this->rbp, triton::size::word); return val; }
701 case triton::arch::ID_REG_X86_BPL: { triton::uint8 val = 0; std::memcpy(&val, (triton::uint8*)this->rbp, triton::size::byte); return val; }
702
703 case triton::arch::ID_REG_X86_RIP: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->rip, triton::size::qword); return val; }
704 case triton::arch::ID_REG_X86_EIP: { triton::uint32 val = 0; std::memcpy(&val, (triton::uint32*)this->rip, triton::size::dword); return val; }
705 case triton::arch::ID_REG_X86_IP: { triton::uint16 val = 0; std::memcpy(&val, (triton::uint16*)this->rip, triton::size::word); return val; }
706
707 case triton::arch::ID_REG_X86_EFLAGS: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->eflags, sizeof(triton::uint64)); return val; }
708
709 case triton::arch::ID_REG_X86_R8: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->r8, triton::size::qword); return val; }
710 case triton::arch::ID_REG_X86_R8D: { triton::uint32 val = 0; std::memcpy(&val, (triton::uint32*)this->r8, triton::size::dword); return val; }
711 case triton::arch::ID_REG_X86_R8W: { triton::uint16 val = 0; std::memcpy(&val, (triton::uint16*)this->r8, triton::size::word); return val; }
712 case triton::arch::ID_REG_X86_R8B: { triton::uint8 val = 0; std::memcpy(&val, (triton::uint8*)this->r8, triton::size::byte); return val; }
713 case triton::arch::ID_REG_X86_R9: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->r9, triton::size::qword); return val; }
714 case triton::arch::ID_REG_X86_R9D: { triton::uint32 val = 0; std::memcpy(&val, (triton::uint32*)this->r9, triton::size::dword); return val; }
715 case triton::arch::ID_REG_X86_R9W: { triton::uint16 val = 0; std::memcpy(&val, (triton::uint16*)this->r9, triton::size::word); return val; }
716 case triton::arch::ID_REG_X86_R9B: { triton::uint8 val = 0; std::memcpy(&val, (triton::uint8*)this->r9, triton::size::byte); return val; }
717 case triton::arch::ID_REG_X86_R10: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->r10, triton::size::qword); return val; }
718 case triton::arch::ID_REG_X86_R10D: { triton::uint32 val = 0; std::memcpy(&val, (triton::uint32*)this->r10, triton::size::dword); return val; }
719 case triton::arch::ID_REG_X86_R10W: { triton::uint16 val = 0; std::memcpy(&val, (triton::uint16*)this->r10, triton::size::word); return val; }
720 case triton::arch::ID_REG_X86_R10B: { triton::uint8 val = 0; std::memcpy(&val, (triton::uint8*)this->r10, triton::size::byte); return val; }
721 case triton::arch::ID_REG_X86_R11: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->r11, triton::size::qword); return val; }
722 case triton::arch::ID_REG_X86_R11D: { triton::uint32 val = 0; std::memcpy(&val, (triton::uint32*)this->r11, triton::size::dword); return val; }
723 case triton::arch::ID_REG_X86_R11W: { triton::uint16 val = 0; std::memcpy(&val, (triton::uint16*)this->r11, triton::size::word); return val; }
724 case triton::arch::ID_REG_X86_R11B: { triton::uint8 val = 0; std::memcpy(&val, (triton::uint8*)this->r11, triton::size::byte); return val; }
725 case triton::arch::ID_REG_X86_R12: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->r12, triton::size::qword); return val; }
726 case triton::arch::ID_REG_X86_R12D: { triton::uint32 val = 0; std::memcpy(&val, (triton::uint32*)this->r12, triton::size::dword); return val; }
727 case triton::arch::ID_REG_X86_R12W: { triton::uint16 val = 0; std::memcpy(&val, (triton::uint16*)this->r12, triton::size::word); return val; }
728 case triton::arch::ID_REG_X86_R12B: { triton::uint8 val = 0; std::memcpy(&val, (triton::uint8*)this->r12, triton::size::byte); return val; }
729 case triton::arch::ID_REG_X86_R13: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->r13, triton::size::qword); return val; }
730 case triton::arch::ID_REG_X86_R13D: { triton::uint32 val = 0; std::memcpy(&val, (triton::uint32*)this->r13, triton::size::dword); return val; }
731 case triton::arch::ID_REG_X86_R13W: { triton::uint16 val = 0; std::memcpy(&val, (triton::uint16*)this->r13, triton::size::word); return val; }
732 case triton::arch::ID_REG_X86_R13B: { triton::uint8 val = 0; std::memcpy(&val, (triton::uint8*)this->r13, triton::size::byte); return val; }
733 case triton::arch::ID_REG_X86_R14: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->r14, triton::size::qword); return val; }
734 case triton::arch::ID_REG_X86_R14D: { triton::uint32 val = 0; std::memcpy(&val, (triton::uint32*)this->r14, triton::size::dword); return val; }
735 case triton::arch::ID_REG_X86_R14W: { triton::uint16 val = 0; std::memcpy(&val, (triton::uint16*)this->r14, triton::size::word); return val; }
736 case triton::arch::ID_REG_X86_R14B: { triton::uint8 val = 0; std::memcpy(&val, (triton::uint8*)this->r14, triton::size::byte); return val; }
737 case triton::arch::ID_REG_X86_R15: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->r15, triton::size::qword); return val; }
738 case triton::arch::ID_REG_X86_R15D: { triton::uint32 val = 0; std::memcpy(&val, (triton::uint32*)this->r15, triton::size::dword); return val; }
739 case triton::arch::ID_REG_X86_R15W: { triton::uint16 val = 0; std::memcpy(&val, (triton::uint16*)this->r15, triton::size::word); return val; }
740 case triton::arch::ID_REG_X86_R15B: { triton::uint8 val = 0; std::memcpy(&val, (triton::uint8*)this->r15, triton::size::byte); return val; }
741
742 case triton::arch::ID_REG_X86_MM0: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->st0, triton::size::qword); return val; }
743 case triton::arch::ID_REG_X86_MM1: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->st1, triton::size::qword); return val; }
744 case triton::arch::ID_REG_X86_MM2: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->st2, triton::size::qword); return val; }
745 case triton::arch::ID_REG_X86_MM3: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->st3, triton::size::qword); return val; }
746 case triton::arch::ID_REG_X86_MM4: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->st4, triton::size::qword); return val; }
747 case triton::arch::ID_REG_X86_MM5: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->st5, triton::size::qword); return val; }
748 case triton::arch::ID_REG_X86_MM6: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->st6, triton::size::qword); return val; }
749 case triton::arch::ID_REG_X86_MM7: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->st7, triton::size::qword); return val; }
750
751 case triton::arch::ID_REG_X86_ST0: { return triton::utils::cast<triton::uint512>(triton::utils::cast<triton::uint80>(this->st0)); }
752 case triton::arch::ID_REG_X86_ST1: { return triton::utils::cast<triton::uint512>(triton::utils::cast<triton::uint80>(this->st1)); }
753 case triton::arch::ID_REG_X86_ST2: { return triton::utils::cast<triton::uint512>(triton::utils::cast<triton::uint80>(this->st2)); }
754 case triton::arch::ID_REG_X86_ST3: { return triton::utils::cast<triton::uint512>(triton::utils::cast<triton::uint80>(this->st3)); }
755 case triton::arch::ID_REG_X86_ST4: { return triton::utils::cast<triton::uint512>(triton::utils::cast<triton::uint80>(this->st4)); }
756 case triton::arch::ID_REG_X86_ST5: { return triton::utils::cast<triton::uint512>(triton::utils::cast<triton::uint80>(this->st5)); }
757 case triton::arch::ID_REG_X86_ST6: { return triton::utils::cast<triton::uint512>(triton::utils::cast<triton::uint80>(this->st6)); }
758 case triton::arch::ID_REG_X86_ST7: { return triton::utils::cast<triton::uint512>(triton::utils::cast<triton::uint80>(this->st7)); }
759
760 case triton::arch::ID_REG_X86_XMM0: { return triton::utils::cast<triton::uint128>(this->zmm0); }
761 case triton::arch::ID_REG_X86_XMM1: { return triton::utils::cast<triton::uint128>(this->zmm1); }
762 case triton::arch::ID_REG_X86_XMM2: { return triton::utils::cast<triton::uint128>(this->zmm2); }
763 case triton::arch::ID_REG_X86_XMM3: { return triton::utils::cast<triton::uint128>(this->zmm3); }
764 case triton::arch::ID_REG_X86_XMM4: { return triton::utils::cast<triton::uint128>(this->zmm4); }
765 case triton::arch::ID_REG_X86_XMM5: { return triton::utils::cast<triton::uint128>(this->zmm5); }
766 case triton::arch::ID_REG_X86_XMM6: { return triton::utils::cast<triton::uint128>(this->zmm6); }
767 case triton::arch::ID_REG_X86_XMM7: { return triton::utils::cast<triton::uint128>(this->zmm7); }
768 case triton::arch::ID_REG_X86_XMM8: { return triton::utils::cast<triton::uint128>(this->zmm8); }
769 case triton::arch::ID_REG_X86_XMM9: { return triton::utils::cast<triton::uint128>(this->zmm9); }
770 case triton::arch::ID_REG_X86_XMM10: { return triton::utils::cast<triton::uint128>(this->zmm10); }
771 case triton::arch::ID_REG_X86_XMM11: { return triton::utils::cast<triton::uint128>(this->zmm11); }
772 case triton::arch::ID_REG_X86_XMM12: { return triton::utils::cast<triton::uint128>(this->zmm12); }
773 case triton::arch::ID_REG_X86_XMM13: { return triton::utils::cast<triton::uint128>(this->zmm13); }
774 case triton::arch::ID_REG_X86_XMM14: { return triton::utils::cast<triton::uint128>(this->zmm14); }
775 case triton::arch::ID_REG_X86_XMM15: { return triton::utils::cast<triton::uint128>(this->zmm15); }
776
777 case triton::arch::ID_REG_X86_YMM0: { return triton::utils::cast<triton::uint256>(this->zmm0); }
778 case triton::arch::ID_REG_X86_YMM1: { return triton::utils::cast<triton::uint256>(this->zmm1); }
779 case triton::arch::ID_REG_X86_YMM2: { return triton::utils::cast<triton::uint256>(this->zmm2); }
780 case triton::arch::ID_REG_X86_YMM3: { return triton::utils::cast<triton::uint256>(this->zmm3); }
781 case triton::arch::ID_REG_X86_YMM4: { return triton::utils::cast<triton::uint256>(this->zmm4); }
782 case triton::arch::ID_REG_X86_YMM5: { return triton::utils::cast<triton::uint256>(this->zmm5); }
783 case triton::arch::ID_REG_X86_YMM6: { return triton::utils::cast<triton::uint256>(this->zmm6); }
784 case triton::arch::ID_REG_X86_YMM7: { return triton::utils::cast<triton::uint256>(this->zmm7); }
785 case triton::arch::ID_REG_X86_YMM8: { return triton::utils::cast<triton::uint256>(this->zmm8); }
786 case triton::arch::ID_REG_X86_YMM9: { return triton::utils::cast<triton::uint256>(this->zmm9); }
787 case triton::arch::ID_REG_X86_YMM10: { return triton::utils::cast<triton::uint256>(this->zmm10); }
788 case triton::arch::ID_REG_X86_YMM11: { return triton::utils::cast<triton::uint256>(this->zmm11); }
789 case triton::arch::ID_REG_X86_YMM12: { return triton::utils::cast<triton::uint256>(this->zmm12); }
790 case triton::arch::ID_REG_X86_YMM13: { return triton::utils::cast<triton::uint256>(this->zmm13); }
791 case triton::arch::ID_REG_X86_YMM14: { return triton::utils::cast<triton::uint256>(this->zmm14); }
792 case triton::arch::ID_REG_X86_YMM15: { return triton::utils::cast<triton::uint256>(this->zmm15); }
793
794 case triton::arch::ID_REG_X86_ZMM0: { return triton::utils::cast<triton::uint512>(this->zmm0); }
795 case triton::arch::ID_REG_X86_ZMM1: { return triton::utils::cast<triton::uint512>(this->zmm1); }
796 case triton::arch::ID_REG_X86_ZMM2: { return triton::utils::cast<triton::uint512>(this->zmm2); }
797 case triton::arch::ID_REG_X86_ZMM3: { return triton::utils::cast<triton::uint512>(this->zmm3); }
798 case triton::arch::ID_REG_X86_ZMM4: { return triton::utils::cast<triton::uint512>(this->zmm4); }
799 case triton::arch::ID_REG_X86_ZMM5: { return triton::utils::cast<triton::uint512>(this->zmm5); }
800 case triton::arch::ID_REG_X86_ZMM6: { return triton::utils::cast<triton::uint512>(this->zmm6); }
801 case triton::arch::ID_REG_X86_ZMM7: { return triton::utils::cast<triton::uint512>(this->zmm7); }
802 case triton::arch::ID_REG_X86_ZMM8: { return triton::utils::cast<triton::uint512>(this->zmm8); }
803 case triton::arch::ID_REG_X86_ZMM9: { return triton::utils::cast<triton::uint512>(this->zmm9); }
804 case triton::arch::ID_REG_X86_ZMM10: { return triton::utils::cast<triton::uint512>(this->zmm10); }
805 case triton::arch::ID_REG_X86_ZMM11: { return triton::utils::cast<triton::uint512>(this->zmm11); }
806 case triton::arch::ID_REG_X86_ZMM12: { return triton::utils::cast<triton::uint512>(this->zmm12); }
807 case triton::arch::ID_REG_X86_ZMM13: { return triton::utils::cast<triton::uint512>(this->zmm13); }
808 case triton::arch::ID_REG_X86_ZMM14: { return triton::utils::cast<triton::uint512>(this->zmm14); }
809 case triton::arch::ID_REG_X86_ZMM15: { return triton::utils::cast<triton::uint512>(this->zmm15); }
810 case triton::arch::ID_REG_X86_ZMM16: { return triton::utils::cast<triton::uint512>(this->zmm16); }
811 case triton::arch::ID_REG_X86_ZMM17: { return triton::utils::cast<triton::uint512>(this->zmm17); }
812 case triton::arch::ID_REG_X86_ZMM18: { return triton::utils::cast<triton::uint512>(this->zmm18); }
813 case triton::arch::ID_REG_X86_ZMM19: { return triton::utils::cast<triton::uint512>(this->zmm19); }
814 case triton::arch::ID_REG_X86_ZMM20: { return triton::utils::cast<triton::uint512>(this->zmm20); }
815 case triton::arch::ID_REG_X86_ZMM21: { return triton::utils::cast<triton::uint512>(this->zmm21); }
816 case triton::arch::ID_REG_X86_ZMM22: { return triton::utils::cast<triton::uint512>(this->zmm22); }
817 case triton::arch::ID_REG_X86_ZMM23: { return triton::utils::cast<triton::uint512>(this->zmm23); }
818 case triton::arch::ID_REG_X86_ZMM24: { return triton::utils::cast<triton::uint512>(this->zmm24); }
819 case triton::arch::ID_REG_X86_ZMM25: { return triton::utils::cast<triton::uint512>(this->zmm25); }
820 case triton::arch::ID_REG_X86_ZMM26: { return triton::utils::cast<triton::uint512>(this->zmm26); }
821 case triton::arch::ID_REG_X86_ZMM27: { return triton::utils::cast<triton::uint512>(this->zmm27); }
822 case triton::arch::ID_REG_X86_ZMM28: { return triton::utils::cast<triton::uint512>(this->zmm28); }
823 case triton::arch::ID_REG_X86_ZMM29: { return triton::utils::cast<triton::uint512>(this->zmm29); }
824 case triton::arch::ID_REG_X86_ZMM30: { return triton::utils::cast<triton::uint512>(this->zmm30); }
825 case triton::arch::ID_REG_X86_ZMM31: { return triton::utils::cast<triton::uint512>(this->zmm31); }
826
827
828 case triton::arch::ID_REG_X86_TSC: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->tsc, sizeof(triton::uint64)); return val; }
829 case triton::arch::ID_REG_X86_MXCSR: { triton::uint32 val = 0; std::memcpy(&val, (triton::uint32*)this->mxcsr, sizeof(triton::uint32)); return val; }
830 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; }
831
832 case triton::arch::ID_REG_X86_CR0: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->cr0, triton::size::qword); return val; }
833 case triton::arch::ID_REG_X86_CR1: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->cr1, triton::size::qword); return val; }
834 case triton::arch::ID_REG_X86_CR2: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->cr2, triton::size::qword); return val; }
835 case triton::arch::ID_REG_X86_CR3: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->cr3, triton::size::qword); return val; }
836 case triton::arch::ID_REG_X86_CR4: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->cr4, triton::size::qword); return val; }
837 case triton::arch::ID_REG_X86_CR5: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->cr5, triton::size::qword); return val; }
838 case triton::arch::ID_REG_X86_CR6: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->cr6, triton::size::qword); return val; }
839 case triton::arch::ID_REG_X86_CR7: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->cr7, triton::size::qword); return val; }
840 case triton::arch::ID_REG_X86_CR8: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->cr8, triton::size::qword); return val; }
841 case triton::arch::ID_REG_X86_CR9: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->cr9, triton::size::qword); return val; }
842 case triton::arch::ID_REG_X86_CR10: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->cr10, triton::size::qword); return val; }
843 case triton::arch::ID_REG_X86_CR11: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->cr11, triton::size::qword); return val; }
844 case triton::arch::ID_REG_X86_CR12: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->cr12, triton::size::qword); return val; }
845 case triton::arch::ID_REG_X86_CR13: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->cr13, triton::size::qword); return val; }
846 case triton::arch::ID_REG_X86_CR14: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->cr14, triton::size::qword); return val; }
847 case triton::arch::ID_REG_X86_CR15: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->cr15, triton::size::qword); return val; }
848
849 case triton::arch::ID_REG_X86_DR0: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->dr0, triton::size::qword); return val; }
850 case triton::arch::ID_REG_X86_DR1: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->dr1, triton::size::qword); return val; }
851 case triton::arch::ID_REG_X86_DR2: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->dr2, triton::size::qword); return val; }
852 case triton::arch::ID_REG_X86_DR3: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->dr3, triton::size::qword); return val; }
853 case triton::arch::ID_REG_X86_DR6: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->dr6, triton::size::qword); return val; }
854 case triton::arch::ID_REG_X86_DR7: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->dr7, triton::size::qword); return val; }
855
856 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); }
857 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); }
858 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); }
859 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); }
860 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); }
861 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); }
862 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); }
863 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); }
864 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); }
865 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); }
866 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); }
867 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); }
868 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); }
869 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); }
870 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); }
871 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); }
872
873 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); }
874 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); }
875 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); }
876 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); }
877 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); }
878 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); }
879 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); }
880 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); }
881 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); }
882 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); }
883 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); }
884 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); }
885 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); }
886 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); }
887 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); }
888 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); }
889
890 case triton::arch::ID_REG_X86_CS: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->cs, triton::size::qword); return val; }
891 case triton::arch::ID_REG_X86_DS: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->ds, triton::size::qword); return val; }
892 case triton::arch::ID_REG_X86_ES: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->es, triton::size::qword); return val; }
893 case triton::arch::ID_REG_X86_FS: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->fs, triton::size::qword); return val; }
894 case triton::arch::ID_REG_X86_GS: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->gs, triton::size::qword); return val; }
895 case triton::arch::ID_REG_X86_SS: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->ss, triton::size::qword); return val; }
896
897 case triton::arch::ID_REG_X86_FIP: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->fip, sizeof(triton::uint64)); return val; }
898 case triton::arch::ID_REG_X86_FDP: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->fdp, sizeof(triton::uint64)); return val; }
899 case triton::arch::ID_REG_X86_FCW: { triton::uint16 val = 0; std::memcpy(&val, (triton::uint16*)this->fcw, sizeof(triton::uint16)); return val; }
900 case triton::arch::ID_REG_X86_FSW: { triton::uint16 val = 0; std::memcpy(&val, (triton::uint16*)this->fsw, sizeof(triton::uint16)); return val; }
901 case triton::arch::ID_REG_X86_FOP: { triton::uint16 val = 0; std::memcpy(&val, (triton::uint16*)this->fop, sizeof(triton::uint16)); return val; }
902 case triton::arch::ID_REG_X86_FCS: { triton::uint16 val = 0; std::memcpy(&val, (triton::uint16*)this->fcs, sizeof(triton::uint16)); return val; }
903 case triton::arch::ID_REG_X86_FDS: { triton::uint16 val = 0; std::memcpy(&val, (triton::uint16*)this->fds, sizeof(triton::uint16)); return val; }
904 case triton::arch::ID_REG_X86_FTW: { triton::uint16 val = 0; std::memcpy(&val, (triton::uint16*)this->ftw, sizeof(triton::uint16)); return val; }
905
906 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); }
907 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); }
908 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); }
909 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); }
910 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); }
911 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); }
912 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); }
913 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); }
914 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); }
915
916 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); }
917 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); }
918 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); }
919 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); }
920 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); }
921 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); }
922 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); }
923 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); }
924 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); }
925 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); }
926 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); }
927 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); }
928 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); }
929 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); }
930
931 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); }
932 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); }
933 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); }
934 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); }
935 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); }
936 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); }
937 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); }
938 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); }
939 case triton::arch::ID_REG_X86_EFER: { triton::uint64 val = 0; std::memcpy(&val, (triton::uint64*)this->efer, sizeof(triton::uint64)); return val; }
940
941 default:
942 throw triton::exceptions::Cpu("x8664Cpu::getConcreteRegisterValue(): Invalid register.");
943 }
944
945 return value;
946 }
947
948
949 void x8664Cpu::setConcreteMemoryValue(triton::uint64 addr, triton::uint8 value, bool execCallbacks) {
950 if (execCallbacks && this->callbacks)
952 this->memory[addr] = value;
953 }
954
955
956 void x8664Cpu::setConcreteMemoryValue(const triton::arch::MemoryAccess& mem, const triton::uint512& value, bool execCallbacks) {
957 triton::uint64 addr = mem.getAddress();
958 triton::uint32 size = mem.getSize();
959 triton::uint512 cv = value;
960
961 if (cv > mem.getMaxValue())
962 throw triton::exceptions::Register("x8664Cpu::setConcreteMemoryValue(): You cannot set this concrete value (too big) to this memory access.");
963
964 if (size == 0 || size > triton::size::dqqword)
965 throw triton::exceptions::Cpu("x8664Cpu::setConcreteMemoryValue(): Invalid size memory.");
966
967 if (execCallbacks && this->callbacks)
969
970 for (triton::uint32 i = 0; i < size; i++) {
971 this->memory[addr+i] = static_cast<triton::uint8>((cv & 0xff));
972 cv >>= 8;
973 }
974 }
975
976
977 void x8664Cpu::setConcreteMemoryAreaValue(triton::uint64 baseAddr, const std::vector<triton::uint8>& values, bool execCallbacks) {
978 // Pre-reserving the memory. We modified the original robin_map to not force rehash on reserve.
979 this->memory.reserve(values.size() + this->memory.size());
980 for (triton::usize index = 0; index < values.size(); index++) {
981 this->setConcreteMemoryValue(baseAddr+index, values[index], execCallbacks);
982 }
983 }
984
985
986 void x8664Cpu::setConcreteMemoryAreaValue(triton::uint64 baseAddr, const void* area, triton::usize size, bool execCallbacks) {
987 // Pre-reserving the memory. We modified the original robin_map to not force rehash on every reserve if not needed.
988 this->memory.reserve(size + this->memory.size());
989 for (triton::usize index = 0; index < size; index++) {
990 this->setConcreteMemoryValue(baseAddr+index, reinterpret_cast<const triton::uint8*>(area)[index], execCallbacks);
991 }
992 }
993
994
995 void x8664Cpu::setConcreteRegisterValue(const triton::arch::Register& reg, const triton::uint512& value, bool execCallbacks) {
996 if (value > reg.getMaxValue())
997 throw triton::exceptions::Register("x8664Cpu::setConcreteRegisterValue(): You cannot set this concrete value (too big) to this register.");
998
999 if (execCallbacks && this->callbacks)
1001
1002 switch (reg.getId()) {
1003
1004 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; }
1005 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; }
1006 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; }
1007 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; }
1008 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; }
1009 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; }
1010 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; }
1011 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; }
1012 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; }
1013 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; }
1014 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; }
1015 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; }
1016 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; }
1017 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; }
1018 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; }
1019 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; }
1020 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; }
1021 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; }
1022 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; }
1023 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; }
1024
1025 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; }
1026 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; }
1027 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; }
1028 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; }
1029 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; }
1030 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; }
1031 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; }
1032 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; }
1033 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; }
1034 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; }
1035 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; }
1036 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; }
1037 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; }
1038 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; }
1039 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; }
1040 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; }
1041
1042 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; }
1043 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; }
1044 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; }
1045
1046 case triton::arch::ID_REG_X86_EFLAGS: {
1047 triton::uint64 val = static_cast<triton::uint64>(value);
1048 std::memcpy((triton::uint64*)this->eflags, &val, sizeof(triton::uint64));
1049 break;
1050 }
1051
1052 case triton::arch::ID_REG_X86_CF: {
1053 triton::uint64 flag = 0;
1054 std::memcpy(&flag, (triton::uint64*)this->eflags, sizeof(triton::uint64));
1055 flag = !value.is_zero() ? (flag | (1 << 0)) : (flag & ~(1 << 0));
1056 std::memcpy((triton::uint64*)this->eflags, &flag, sizeof(triton::uint64));
1057 break;
1058 }
1059
1060 case triton::arch::ID_REG_X86_PF: {
1061 triton::uint64 flag = 0;
1062 std::memcpy(&flag, (triton::uint64*)this->eflags, sizeof(triton::uint64));
1063 flag = !value.is_zero() ? (flag | (1 << 2)) : (flag & ~(1 << 2));
1064 std::memcpy((triton::uint64*)this->eflags, &flag, sizeof(triton::uint64));
1065 break;
1066 }
1067
1068 case triton::arch::ID_REG_X86_AF: {
1069 triton::uint64 flag = 0;
1070 std::memcpy(&flag, (triton::uint64*)this->eflags, sizeof(triton::uint64));
1071 flag = !value.is_zero() ? (flag | (1 << 4)) : (flag & ~(1 << 4));
1072 std::memcpy((triton::uint64*)this->eflags, &flag, sizeof(triton::uint64));
1073 break;
1074 }
1075
1076 case triton::arch::ID_REG_X86_ZF: {
1077 triton::uint64 flag = 0;
1078 std::memcpy(&flag, (triton::uint64*)this->eflags, sizeof(triton::uint64));
1079 flag = !value.is_zero() ? (flag | (1 << 6)) : (flag & ~(1 << 6));
1080 std::memcpy((triton::uint64*)this->eflags, &flag, sizeof(triton::uint64));
1081 break;
1082 }
1083
1084 case triton::arch::ID_REG_X86_SF: {
1085 triton::uint64 flag = 0;
1086 std::memcpy(&flag, (triton::uint64*)this->eflags, sizeof(triton::uint64));
1087 flag = !value.is_zero() ? (flag | (1 << 7)) : (flag & ~(1 << 7));
1088 std::memcpy((triton::uint64*)this->eflags, &flag, sizeof(triton::uint64));
1089 break;
1090 }
1091
1092 case triton::arch::ID_REG_X86_TF: {
1093 triton::uint64 flag = 0;
1094 std::memcpy(&flag, (triton::uint64*)this->eflags, sizeof(triton::uint64));
1095 flag = !value.is_zero() ? (flag | (1 << 8)) : (flag & ~(1 << 8));
1096 std::memcpy((triton::uint64*)this->eflags, &flag, sizeof(triton::uint64));
1097 break;
1098 }
1099
1100 case triton::arch::ID_REG_X86_IF: {
1101 triton::uint64 flag = 0;
1102 std::memcpy(&flag, (triton::uint64*)this->eflags, sizeof(triton::uint64));
1103 flag = !value.is_zero() ? (flag | (1 << 9)) : (flag & ~(1 << 9));
1104 std::memcpy((triton::uint64*)this->eflags, &flag, sizeof(triton::uint64));
1105 break;
1106 }
1107
1108 case triton::arch::ID_REG_X86_DF: {
1109 triton::uint64 flag = 0;
1110 std::memcpy(&flag, (triton::uint64*)this->eflags, sizeof(triton::uint64));
1111 flag = !value.is_zero() ? (flag | (1 << 10)) : (flag & ~(1 << 10));
1112 std::memcpy((triton::uint64*)this->eflags, &flag, sizeof(triton::uint64));
1113 break;
1114 }
1115
1116 case triton::arch::ID_REG_X86_OF: {
1117 triton::uint64 flag = 0;
1118 std::memcpy(&flag, (triton::uint64*)this->eflags, sizeof(triton::uint64));
1119 flag = !value.is_zero() ? (flag | (1 << 11)) : (flag & ~(1 << 11));
1120 std::memcpy((triton::uint64*)this->eflags, &flag, sizeof(triton::uint64));
1121 break;
1122 }
1123
1124 case triton::arch::ID_REG_X86_NT: {
1125 triton::uint64 flag = 0;
1126 std::memcpy(&flag, (triton::uint64*)this->eflags, sizeof(triton::uint64));
1127 flag = !value.is_zero() ? (flag | (1 << 14)) : (flag & ~(1 << 14));
1128 std::memcpy((triton::uint64*)this->eflags, &flag, sizeof(triton::uint64));
1129 break;
1130 }
1131
1132 case triton::arch::ID_REG_X86_RF: {
1133 triton::uint64 flag = 0;
1134 std::memcpy(&flag, (triton::uint64*)this->eflags, sizeof(triton::uint64));
1135 flag = !value.is_zero() ? (flag | (1 << 16)) : (flag & ~(1 << 16));
1136 std::memcpy((triton::uint64*)this->eflags, &flag, sizeof(triton::uint64));
1137 break;
1138 }
1139
1140 case triton::arch::ID_REG_X86_VM: {
1141 triton::uint64 flag = 0;
1142 std::memcpy(&flag, (triton::uint64*)this->eflags, sizeof(triton::uint64));
1143 flag = !value.is_zero() ? (flag | (1 << 17)) : (flag & ~(1 << 17));
1144 std::memcpy((triton::uint64*)this->eflags, &flag, sizeof(triton::uint64));
1145 break;
1146 }
1147
1148 case triton::arch::ID_REG_X86_AC: {
1149 triton::uint64 flag = 0;
1150 std::memcpy(&flag, (triton::uint64*)this->eflags, sizeof(triton::uint64));
1151 flag = !value.is_zero() ? (flag | (1 << 18)) : (flag & ~(1 << 18));
1152 std::memcpy((triton::uint64*)this->eflags, &flag, sizeof(triton::uint64));
1153 break;
1154 }
1155
1156 case triton::arch::ID_REG_X86_VIF: {
1157 triton::uint64 flag = 0;
1158 std::memcpy(&flag, (triton::uint64*)this->eflags, sizeof(triton::uint64));
1159 flag = !value.is_zero() ? (flag | (1 << 19)) : (flag & ~(1 << 19));
1160 std::memcpy((triton::uint64*)this->eflags, &flag, sizeof(triton::uint64));
1161 break;
1162 }
1163
1164 case triton::arch::ID_REG_X86_VIP: {
1165 triton::uint64 flag = 0;
1166 std::memcpy(&flag, (triton::uint64*)this->eflags, sizeof(triton::uint64));
1167 flag = !value.is_zero() ? (flag | (1 << 20)) : (flag & ~(1 << 20));
1168 std::memcpy((triton::uint64*)this->eflags, &flag, sizeof(triton::uint64));
1169 break;
1170 }
1171
1172 case triton::arch::ID_REG_X86_ID: {
1173 triton::uint64 flag = 0;
1174 std::memcpy(&flag, (triton::uint64*)this->eflags, sizeof(triton::uint64));
1175 flag = !value.is_zero() ? (flag | (1 << 21)) : (flag & ~(1 << 21));
1176 std::memcpy((triton::uint64*)this->eflags, &flag, sizeof(triton::uint64));
1177 break;
1178 }
1179
1180 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; }
1181 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; }
1182 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; }
1183 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; }
1184 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; }
1185 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; }
1186 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; }
1187 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; }
1188 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; }
1189 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; }
1190 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; }
1191 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; }
1192 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; }
1193 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; }
1194 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; }
1195 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; }
1196 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; }
1197 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; }
1198 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; }
1199 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; }
1200 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; }
1201 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; }
1202 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; }
1203 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; }
1204 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; }
1205 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; }
1206 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; }
1207 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; }
1208 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; }
1209 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; }
1210 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; }
1211 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; }
1212
1213 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; }
1214 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; }
1215 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; }
1216 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; }
1217 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; }
1218 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; }
1219 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; }
1220 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; }
1221
1222 case triton::arch::ID_REG_X86_ST0: { triton::utils::fromUintToBuffer(triton::utils::cast<triton::uint80>(value), this->st0); break; }
1223 case triton::arch::ID_REG_X86_ST1: { triton::utils::fromUintToBuffer(triton::utils::cast<triton::uint80>(value), this->st1); break; }
1224 case triton::arch::ID_REG_X86_ST2: { triton::utils::fromUintToBuffer(triton::utils::cast<triton::uint80>(value), this->st2); break; }
1225 case triton::arch::ID_REG_X86_ST3: { triton::utils::fromUintToBuffer(triton::utils::cast<triton::uint80>(value), this->st3); break; }
1226 case triton::arch::ID_REG_X86_ST4: { triton::utils::fromUintToBuffer(triton::utils::cast<triton::uint80>(value), this->st4); break; }
1227 case triton::arch::ID_REG_X86_ST5: { triton::utils::fromUintToBuffer(triton::utils::cast<triton::uint80>(value), this->st5); break; }
1228 case triton::arch::ID_REG_X86_ST6: { triton::utils::fromUintToBuffer(triton::utils::cast<triton::uint80>(value), this->st6); break; }
1229 case triton::arch::ID_REG_X86_ST7: { triton::utils::fromUintToBuffer(triton::utils::cast<triton::uint80>(value), this->st7); break; }
1230
1231 case triton::arch::ID_REG_X86_XMM0: { triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->zmm0); break; }
1232 case triton::arch::ID_REG_X86_XMM1: { triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->zmm1); break; }
1233 case triton::arch::ID_REG_X86_XMM2: { triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->zmm2); break; }
1234 case triton::arch::ID_REG_X86_XMM3: { triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->zmm3); break; }
1235 case triton::arch::ID_REG_X86_XMM4: { triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->zmm4); break; }
1236 case triton::arch::ID_REG_X86_XMM5: { triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->zmm5); break; }
1237 case triton::arch::ID_REG_X86_XMM6: { triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->zmm6); break; }
1238 case triton::arch::ID_REG_X86_XMM7: { triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->zmm7); break; }
1239 case triton::arch::ID_REG_X86_XMM8: { triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->zmm8); break; }
1240 case triton::arch::ID_REG_X86_XMM9: { triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->zmm9); break; }
1241 case triton::arch::ID_REG_X86_XMM10: { triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->zmm10); break; }
1242 case triton::arch::ID_REG_X86_XMM11: { triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->zmm11); break; }
1243 case triton::arch::ID_REG_X86_XMM12: { triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->zmm12); break; }
1244 case triton::arch::ID_REG_X86_XMM13: { triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->zmm13); break; }
1245 case triton::arch::ID_REG_X86_XMM14: { triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->zmm14); break; }
1246 case triton::arch::ID_REG_X86_XMM15: { triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->zmm15); break; }
1247
1248 case triton::arch::ID_REG_X86_YMM0: { triton::utils::fromUintToBuffer(static_cast<triton::uint256>(value), this->zmm0); break; }
1249 case triton::arch::ID_REG_X86_YMM1: { triton::utils::fromUintToBuffer(static_cast<triton::uint256>(value), this->zmm1); break; }
1250 case triton::arch::ID_REG_X86_YMM2: { triton::utils::fromUintToBuffer(static_cast<triton::uint256>(value), this->zmm2); break; }
1251 case triton::arch::ID_REG_X86_YMM3: { triton::utils::fromUintToBuffer(static_cast<triton::uint256>(value), this->zmm3); break; }
1252 case triton::arch::ID_REG_X86_YMM4: { triton::utils::fromUintToBuffer(static_cast<triton::uint256>(value), this->zmm4); break; }
1253 case triton::arch::ID_REG_X86_YMM5: { triton::utils::fromUintToBuffer(static_cast<triton::uint256>(value), this->zmm5); break; }
1254 case triton::arch::ID_REG_X86_YMM6: { triton::utils::fromUintToBuffer(static_cast<triton::uint256>(value), this->zmm6); break; }
1255 case triton::arch::ID_REG_X86_YMM7: { triton::utils::fromUintToBuffer(static_cast<triton::uint256>(value), this->zmm7); break; }
1256 case triton::arch::ID_REG_X86_YMM8: { triton::utils::fromUintToBuffer(static_cast<triton::uint256>(value), this->zmm8); break; }
1257 case triton::arch::ID_REG_X86_YMM9: { triton::utils::fromUintToBuffer(static_cast<triton::uint256>(value), this->zmm9); break; }
1258 case triton::arch::ID_REG_X86_YMM10: { triton::utils::fromUintToBuffer(static_cast<triton::uint256>(value), this->zmm10); break; }
1259 case triton::arch::ID_REG_X86_YMM11: { triton::utils::fromUintToBuffer(static_cast<triton::uint256>(value), this->zmm11); break; }
1260 case triton::arch::ID_REG_X86_YMM12: { triton::utils::fromUintToBuffer(static_cast<triton::uint256>(value), this->zmm12); break; }
1261 case triton::arch::ID_REG_X86_YMM13: { triton::utils::fromUintToBuffer(static_cast<triton::uint256>(value), this->zmm13); break; }
1262 case triton::arch::ID_REG_X86_YMM14: { triton::utils::fromUintToBuffer(static_cast<triton::uint256>(value), this->zmm14); break; }
1263 case triton::arch::ID_REG_X86_YMM15: { triton::utils::fromUintToBuffer(static_cast<triton::uint256>(value), this->zmm15); break; }
1264
1265 case triton::arch::ID_REG_X86_ZMM0: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm0); break; }
1266 case triton::arch::ID_REG_X86_ZMM1: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm1); break; }
1267 case triton::arch::ID_REG_X86_ZMM2: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm2); break; }
1268 case triton::arch::ID_REG_X86_ZMM3: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm3); break; }
1269 case triton::arch::ID_REG_X86_ZMM4: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm4); break; }
1270 case triton::arch::ID_REG_X86_ZMM5: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm5); break; }
1271 case triton::arch::ID_REG_X86_ZMM6: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm6); break; }
1272 case triton::arch::ID_REG_X86_ZMM7: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm7); break; }
1273 case triton::arch::ID_REG_X86_ZMM8: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm8); break; }
1274 case triton::arch::ID_REG_X86_ZMM9: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm9); break; }
1275 case triton::arch::ID_REG_X86_ZMM10: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm10); break; }
1276 case triton::arch::ID_REG_X86_ZMM11: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm11); break; }
1277 case triton::arch::ID_REG_X86_ZMM12: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm12); break; }
1278 case triton::arch::ID_REG_X86_ZMM13: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm13); break; }
1279 case triton::arch::ID_REG_X86_ZMM14: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm14); break; }
1280 case triton::arch::ID_REG_X86_ZMM15: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm15); break; }
1281 case triton::arch::ID_REG_X86_ZMM16: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm16); break; }
1282 case triton::arch::ID_REG_X86_ZMM17: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm17); break; }
1283 case triton::arch::ID_REG_X86_ZMM18: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm18); break; }
1284 case triton::arch::ID_REG_X86_ZMM19: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm19); break; }
1285 case triton::arch::ID_REG_X86_ZMM20: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm20); break; }
1286 case triton::arch::ID_REG_X86_ZMM21: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm21); break; }
1287 case triton::arch::ID_REG_X86_ZMM22: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm22); break; }
1288 case triton::arch::ID_REG_X86_ZMM23: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm23); break; }
1289 case triton::arch::ID_REG_X86_ZMM24: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm24); break; }
1290 case triton::arch::ID_REG_X86_ZMM25: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm25); break; }
1291 case triton::arch::ID_REG_X86_ZMM26: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm26); break; }
1292 case triton::arch::ID_REG_X86_ZMM27: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm27); break; }
1293 case triton::arch::ID_REG_X86_ZMM28: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm28); break; }
1294 case triton::arch::ID_REG_X86_ZMM29: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm29); break; }
1295 case triton::arch::ID_REG_X86_ZMM30: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm30); break; }
1296 case triton::arch::ID_REG_X86_ZMM31: { triton::utils::fromUintToBuffer(static_cast<triton::uint512>(value), this->zmm31); break; }
1297
1298 case triton::arch::ID_REG_X86_MXCSR: {
1299 triton::uint32 val = static_cast<triton::uint32>(value);
1300 std::memcpy((triton::uint32*)this->mxcsr, &val, sizeof(triton::uint32));
1301 break;
1302 }
1303
1304 case triton::arch::ID_REG_X86_MXCSR_MASK: {
1305 triton::uint32 val = static_cast<triton::uint32>(value);
1306 std::memcpy((triton::uint32*)this->mxcsr_mask, &val, sizeof(triton::uint32));
1307 break;
1308 }
1309
1310 case triton::arch::ID_REG_X86_SSE_IE: {
1311 triton::uint32 flag = 0;
1312 std::memcpy(&flag, (triton::uint32*)this->mxcsr, sizeof(triton::uint32));
1313 flag = !value.is_zero() ? (flag | (1 << 0)) : (flag & ~(1 << 0));
1314 std::memcpy((triton::uint32*)this->mxcsr, &flag, sizeof(triton::uint32));
1315 break;
1316 }
1317
1318 case triton::arch::ID_REG_X86_SSE_DE: {
1319 triton::uint32 flag = 0;
1320 std::memcpy(&flag, (triton::uint32*)this->mxcsr, sizeof(triton::uint32));
1321 flag = !value.is_zero() ? (flag | (1 << 1)) : (flag & ~(1 << 1));
1322 std::memcpy((triton::uint32*)this->mxcsr, &flag, sizeof(triton::uint32));
1323 break;
1324 }
1325
1326 case triton::arch::ID_REG_X86_SSE_ZE: {
1327 triton::uint32 flag = 0;
1328 std::memcpy(&flag, (triton::uint32*)this->mxcsr, sizeof(triton::uint32));
1329 flag = !value.is_zero() ? (flag | (1 << 2)) : (flag & ~(1 << 2));
1330 std::memcpy((triton::uint32*)this->mxcsr, &flag, sizeof(triton::uint32));
1331 break;
1332 }
1333
1334 case triton::arch::ID_REG_X86_SSE_OE: {
1335 triton::uint32 flag = 0;
1336 std::memcpy(&flag, (triton::uint32*)this->mxcsr, sizeof(triton::uint32));
1337 flag = !value.is_zero() ? (flag | (1 << 3)) : (flag & ~(1 << 3));
1338 std::memcpy((triton::uint32*)this->mxcsr, &flag, sizeof(triton::uint32));
1339 break;
1340 }
1341
1342 case triton::arch::ID_REG_X86_SSE_UE: {
1343 triton::uint32 flag = 0;
1344 std::memcpy(&flag, (triton::uint32*)this->mxcsr, sizeof(triton::uint32));
1345 flag = !value.is_zero() ? (flag | (1 << 4)) : (flag & ~(1 << 4));
1346 std::memcpy((triton::uint32*)this->mxcsr, &flag, sizeof(triton::uint32));
1347 break;
1348 }
1349
1350 case triton::arch::ID_REG_X86_SSE_PE: {
1351 triton::uint32 flag = 0;
1352 std::memcpy(&flag, (triton::uint32*)this->mxcsr, sizeof(triton::uint32));
1353 flag = !value.is_zero() ? (flag | (1 << 5)) : (flag & ~(1 << 5));
1354 std::memcpy((triton::uint32*)this->mxcsr, &flag, sizeof(triton::uint32));
1355 break;
1356 }
1357
1358 case triton::arch::ID_REG_X86_SSE_DAZ: {
1359 triton::uint32 flag = 0;
1360 std::memcpy(&flag, (triton::uint32*)this->mxcsr, sizeof(triton::uint32));
1361 flag = !value.is_zero() ? (flag | (1 << 6)) : (flag & ~(1 << 6));
1362 std::memcpy((triton::uint32*)this->mxcsr, &flag, sizeof(triton::uint32));
1363 break;
1364 }
1365
1366 case triton::arch::ID_REG_X86_SSE_IM: {
1367 triton::uint32 flag = 0;
1368 std::memcpy(&flag, (triton::uint32*)this->mxcsr, sizeof(triton::uint32));
1369 flag = !value.is_zero() ? (flag | (1 << 7)) : (flag & ~(1 << 7));
1370 std::memcpy((triton::uint32*)this->mxcsr, &flag, sizeof(triton::uint32));
1371 break;
1372 }
1373
1374 case triton::arch::ID_REG_X86_SSE_DM: {
1375 triton::uint32 flag = 0;
1376 std::memcpy(&flag, (triton::uint32*)this->mxcsr, sizeof(triton::uint32));
1377 flag = !value.is_zero() ? (flag | (1 << 8)) : (flag & ~(1 << 8));
1378 std::memcpy((triton::uint32*)this->mxcsr, &flag, sizeof(triton::uint32));
1379 break;
1380 }
1381
1382 case triton::arch::ID_REG_X86_SSE_ZM: {
1383 triton::uint32 flag = 0;
1384 std::memcpy(&flag, (triton::uint32*)this->mxcsr, sizeof(triton::uint32));
1385 flag = !value.is_zero() ? (flag | (1 << 9)) : (flag & ~(1 << 9));
1386 std::memcpy((triton::uint32*)this->mxcsr, &flag, sizeof(triton::uint32));
1387 break;
1388 }
1389
1390 case triton::arch::ID_REG_X86_SSE_OM: {
1391 triton::uint32 flag = 0;
1392 std::memcpy(&flag, (triton::uint32*)this->mxcsr, sizeof(triton::uint32));
1393 flag = !value.is_zero() ? (flag | (1 << 10)) : (flag & ~(1 << 10));
1394 std::memcpy((triton::uint32*)this->mxcsr, &flag, sizeof(triton::uint32));
1395 break;
1396 }
1397
1398 case triton::arch::ID_REG_X86_SSE_UM: {
1399 triton::uint32 flag = 0;
1400 std::memcpy(&flag, (triton::uint32*)this->mxcsr, sizeof(triton::uint32));
1401 flag = !value.is_zero() ? (flag | (1 << 11)) : (flag & ~(1 << 11));
1402 std::memcpy((triton::uint32*)this->mxcsr, &flag, sizeof(triton::uint32));
1403 break;
1404 }
1405
1406 case triton::arch::ID_REG_X86_SSE_PM: {
1407 triton::uint32 flag = 0;
1408 std::memcpy(&flag, (triton::uint32*)this->mxcsr, sizeof(triton::uint32));
1409 flag = !value.is_zero() ? (flag | (1 << 12)) : (flag & ~(1 << 12));
1410 std::memcpy((triton::uint32*)this->mxcsr, &flag, sizeof(triton::uint32));
1411 break;
1412 }
1413
1414 case triton::arch::ID_REG_X86_SSE_RL: {
1415 triton::uint32 flag = 0;
1416 std::memcpy(&flag, (triton::uint32*)this->mxcsr, sizeof(triton::uint32));
1417 flag = !value.is_zero() ? (flag | (1 << 13)) : (flag & ~(1 << 13));
1418 std::memcpy((triton::uint32*)this->mxcsr, &flag, sizeof(triton::uint32));
1419 break;
1420 }
1421
1422 case triton::arch::ID_REG_X86_SSE_RH: {
1423 triton::uint32 flag = 0;
1424 std::memcpy(&flag, (triton::uint32*)this->mxcsr, sizeof(triton::uint32));
1425 flag = !value.is_zero() ? (flag | (1 << 14)) : (flag & ~(1 << 14));
1426 std::memcpy((triton::uint32*)this->mxcsr, &flag, sizeof(triton::uint32));
1427 break;
1428 }
1429
1430 case triton::arch::ID_REG_X86_SSE_FZ: {
1431 triton::uint32 flag = 0;
1432 std::memcpy(&flag, (triton::uint32*)this->mxcsr, sizeof(triton::uint32));
1433 flag = !value.is_zero() ? (flag | (1 << 15)) : (flag & ~(1 << 15));
1434 std::memcpy((triton::uint32*)this->mxcsr, &flag, sizeof(triton::uint32));
1435 break;
1436 }
1437
1438 case triton::arch::ID_REG_X86_FIP: {
1439 triton::uint64 val = static_cast<triton::uint64>(value);
1440 std::memcpy((triton::uint64*)this->fip, &val, sizeof(triton::uint64));
1441 break;
1442 }
1443
1444 case triton::arch::ID_REG_X86_FDP: {
1445 triton::uint64 val = static_cast<triton::uint64>(value);
1446 std::memcpy((triton::uint64*)this->fdp, &val, sizeof(triton::uint64));
1447 break;
1448 }
1449
1450 case triton::arch::ID_REG_X86_FCW: {
1451 triton::uint16 val = static_cast<triton::uint16>(value);
1452 std::memcpy((triton::uint16*)this->fcw, &val, sizeof(triton::uint16));
1453 break;
1454 }
1455
1456 case triton::arch::ID_REG_X86_FSW: {
1457 triton::uint16 val = static_cast<triton::uint16>(value);
1458 std::memcpy((triton::uint16*)this->fsw, &val, sizeof(triton::uint16));
1459 break;
1460 }
1461
1462 case triton::arch::ID_REG_X86_FOP: {
1463 triton::uint16 val = static_cast<triton::uint16>(value);
1464 std::memcpy((triton::uint16*)this->fop, &val, sizeof(triton::uint16));
1465 break;
1466 }
1467
1468 case triton::arch::ID_REG_X86_FCS: {
1469 triton::uint16 val = static_cast<triton::uint16>(value);
1470 std::memcpy((triton::uint16*)this->fcs, &val, sizeof(triton::uint16));
1471 break;
1472 }
1473
1474 case triton::arch::ID_REG_X86_FDS: {
1475 triton::uint16 val = static_cast<triton::uint16>(value);
1476 std::memcpy((triton::uint16*)this->fds, &val, sizeof(triton::uint16));
1477 break;
1478 }
1479
1480 case triton::arch::ID_REG_X86_FTW: {
1481 triton::uint16 val = static_cast<triton::uint16>(value);
1482 std::memcpy((triton::uint16*)this->ftw, &val, sizeof(triton::uint16));
1483 break;
1484 }
1485
1486 case triton::arch::ID_REG_X86_FCW_IM: {
1487 triton::uint16 flag = 0;
1488 std::memcpy(&flag, (triton::uint16*)this->fcw, sizeof(triton::uint16));
1489 flag = !value.is_zero() ? (flag | (1 << 0)) : (flag & ~(1 << 0));
1490 std::memcpy((triton::uint16*)this->fcw, &flag, sizeof(triton::uint16));
1491 break;
1492 }
1493
1494 case triton::arch::ID_REG_X86_FCW_DM: {
1495 triton::uint16 flag = 0;
1496 std::memcpy(&flag, (triton::uint16*)this->fcw, sizeof(triton::uint16));
1497 flag = !value.is_zero() ? (flag | (1 << 1)) : (flag & ~(1 << 1));
1498 std::memcpy((triton::uint16*)this->fcw, &flag, sizeof(triton::uint16));
1499 break;
1500 }
1501
1502 case triton::arch::ID_REG_X86_FCW_ZM: {
1503 triton::uint16 flag = 0;
1504 std::memcpy(&flag, (triton::uint16*)this->fcw, sizeof(triton::uint16));
1505 flag = !value.is_zero() ? (flag | (1 << 2)) : (flag & ~(1 << 2));
1506 std::memcpy((triton::uint16*)this->fcw, &flag, sizeof(triton::uint16));
1507 break;
1508 }
1509
1510 case triton::arch::ID_REG_X86_FCW_OM: {
1511 triton::uint16 flag = 0;
1512 std::memcpy(&flag, (triton::uint16*)this->fcw, sizeof(triton::uint16));
1513 flag = !value.is_zero() ? (flag | (1 << 3)) : (flag & ~(1 << 3));
1514 std::memcpy((triton::uint16*)this->fcw, &flag, sizeof(triton::uint16));
1515 break;
1516 }
1517
1518 case triton::arch::ID_REG_X86_FCW_UM: {
1519 triton::uint16 flag = 0;
1520 std::memcpy(&flag, (triton::uint16*)this->fcw, sizeof(triton::uint16));
1521 flag = !value.is_zero() ? (flag | (1 << 4)) : (flag & ~(1 << 4));
1522 std::memcpy((triton::uint16*)this->fcw, &flag, sizeof(triton::uint16));
1523 break;
1524 }
1525
1526 case triton::arch::ID_REG_X86_FCW_PM: {
1527 triton::uint16 flag = 0;
1528 std::memcpy(&flag, (triton::uint16*)this->fcw, sizeof(triton::uint16));
1529 flag = !value.is_zero() ? (flag | (1 << 5)) : (flag & ~(1 << 5));
1530 std::memcpy((triton::uint16*)this->fcw, &flag, sizeof(triton::uint16));
1531 break;
1532 }
1533
1534 case triton::arch::ID_REG_X86_FCW_PC: {
1535 triton::uint16 flag = 0;
1536 std::memcpy(&flag, (triton::uint16*)this->fcw, sizeof(triton::uint16));
1537 flag = (flag & 0xFCFF) | (static_cast<triton::uint16>(value) << 8);
1538 std::memcpy((triton::uint16*)this->fcw, &flag, sizeof(triton::uint16));
1539 break;
1540 }
1541
1542 case triton::arch::ID_REG_X86_FCW_RC: {
1543 triton::uint16 flag = 0;
1544 std::memcpy(&flag, (triton::uint16*)this->fcw, sizeof(triton::uint16));
1545 flag = (flag & 0xF3FF) | (static_cast<triton::uint16>(value) << 10);
1546 std::memcpy((triton::uint16*)this->fcw, &flag, sizeof(triton::uint16));
1547 break;
1548 }
1549
1550 case triton::arch::ID_REG_X86_FCW_X: {
1551 triton::uint16 flag = 0;
1552 std::memcpy(&flag, (triton::uint16*)this->fcw, sizeof(triton::uint16));
1553 flag = !value.is_zero() ? (flag | (1 << 12)) : (flag & ~(1 << 12));
1554 std::memcpy((triton::uint16*)this->fcw, &flag, sizeof(triton::uint16));
1555 break;
1556 }
1557
1558 case triton::arch::ID_REG_X86_FSW_IE: {
1559 triton::uint16 flag = 0;
1560 std::memcpy(&flag, (triton::uint16*)this->fsw, sizeof(triton::uint16));
1561 flag = !value.is_zero() ? (flag | (1 << 0)) : (flag & ~(1 << 0));
1562 std::memcpy((triton::uint16*)this->fsw, &flag, sizeof(triton::uint16));
1563 break;
1564 }
1565
1566 case triton::arch::ID_REG_X86_FSW_DE: {
1567 triton::uint16 flag = 0;
1568 std::memcpy(&flag, (triton::uint16*)this->fsw, sizeof(triton::uint16));
1569 flag = !value.is_zero() ? (flag | (1 << 1)) : (flag & ~(1 << 1));
1570 std::memcpy((triton::uint16*)this->fsw, &flag, sizeof(triton::uint16));
1571 break;
1572 }
1573
1574 case triton::arch::ID_REG_X86_FSW_ZE: {
1575 triton::uint16 flag = 0;
1576 std::memcpy(&flag, (triton::uint16*)this->fsw, sizeof(triton::uint16));
1577 flag = !value.is_zero() ? (flag | (1 << 2)) : (flag & ~(1 << 2));
1578 std::memcpy((triton::uint16*)this->fsw, &flag, sizeof(triton::uint16));
1579 break;
1580 }
1581
1582 case triton::arch::ID_REG_X86_FSW_OE: {
1583 triton::uint16 flag = 0;
1584 std::memcpy(&flag, (triton::uint16*)this->fsw, sizeof(triton::uint16));
1585 flag = !value.is_zero() ? (flag | (1 << 3)) : (flag & ~(1 << 3));
1586 std::memcpy((triton::uint16*)this->fsw, &flag, sizeof(triton::uint16));
1587 break;
1588 }
1589
1590 case triton::arch::ID_REG_X86_FSW_UE: {
1591 triton::uint16 flag = 0;
1592 std::memcpy(&flag, (triton::uint16*)this->fsw, sizeof(triton::uint16));
1593 flag = !value.is_zero() ? (flag | (1 << 4)) : (flag & ~(1 << 4));
1594 std::memcpy((triton::uint16*)this->fsw, &flag, sizeof(triton::uint16));
1595 break;
1596 }
1597
1598 case triton::arch::ID_REG_X86_FSW_PE: {
1599 triton::uint16 flag = 0;
1600 std::memcpy(&flag, (triton::uint16*)this->fsw, sizeof(triton::uint16));
1601 flag = !value.is_zero() ? (flag | (1 << 5)) : (flag & ~(1 << 5));
1602 std::memcpy((triton::uint16*)this->fsw, &flag, sizeof(triton::uint16));
1603 break;
1604 }
1605
1606 case triton::arch::ID_REG_X86_FSW_SF: {
1607 triton::uint16 flag = 0;
1608 std::memcpy(&flag, (triton::uint16*)this->fsw, sizeof(triton::uint16));
1609 flag = !value.is_zero() ? (flag | (1 << 6)) : (flag & ~(1 << 6));
1610 std::memcpy((triton::uint16*)this->fsw, &flag, sizeof(triton::uint16));
1611 break;
1612 }
1613
1614 case triton::arch::ID_REG_X86_FSW_ES: {
1615 triton::uint16 flag = 0;
1616 std::memcpy(&flag, (triton::uint16*)this->fsw, sizeof(triton::uint16));
1617 flag = !value.is_zero() ? (flag | (1 << 7)) : (flag & ~(1 << 7));
1618 std::memcpy((triton::uint16*)this->fsw, &flag, sizeof(triton::uint16));
1619 break;
1620 }
1621
1622 case triton::arch::ID_REG_X86_FSW_C0: {
1623 triton::uint16 flag = 0;
1624 std::memcpy(&flag, (triton::uint16*)this->fsw, sizeof(triton::uint16));
1625 flag = !value.is_zero() ? (flag | (1 << 8)) : (flag & ~(1 << 8));
1626 std::memcpy((triton::uint16*)this->fsw, &flag, sizeof(triton::uint16));
1627 break;
1628 }
1629
1630 case triton::arch::ID_REG_X86_FSW_C1: {
1631 triton::uint16 flag = 0;
1632 std::memcpy(&flag, (triton::uint16*)this->fsw, sizeof(triton::uint16));
1633 flag = !value.is_zero() ? (flag | (1 << 9)) : (flag & ~(1 << 9));
1634 std::memcpy((triton::uint16*)this->fsw, &flag, sizeof(triton::uint16));
1635 break;
1636 }
1637
1638 case triton::arch::ID_REG_X86_FSW_C2: {
1639 triton::uint16 flag = 0;
1640 std::memcpy(&flag, (triton::uint16*)this->fsw, sizeof(triton::uint16));
1641 flag = !value.is_zero() ? (flag | (1 << 10)) : (flag & ~(1 << 10));
1642 std::memcpy((triton::uint16*)this->fsw, &flag, sizeof(triton::uint16));
1643 break;
1644 }
1645
1646 case triton::arch::ID_REG_X86_FSW_TOP: {
1647 triton::uint16 flag = 0;
1648 std::memcpy(&flag, (triton::uint16*)this->fsw, sizeof(triton::uint16));
1649 flag = (flag & 0xC7FF) | (static_cast<triton::uint16>(value) << 11);
1650 std::memcpy((triton::uint16*)this->fsw, &flag, sizeof(triton::uint16));
1651 break;
1652 }
1653
1654 case triton::arch::ID_REG_X86_FSW_C3: {
1655 triton::uint16 flag = 0;
1656 std::memcpy(&flag, (triton::uint16*)this->fsw, sizeof(triton::uint16));
1657 flag = !value.is_zero() ? (flag | (1 << 14)) : (flag & ~(1 << 14));
1658 std::memcpy((triton::uint16*)this->fsw, &flag, sizeof(triton::uint16));
1659 break;
1660 }
1661
1662 case triton::arch::ID_REG_X86_FSW_B: {
1663 triton::uint16 flag = 0;
1664 std::memcpy(&flag, (triton::uint16*)this->fsw, sizeof(triton::uint16));
1665 flag = !value.is_zero() ? (flag | (1 << 15)) : (flag & ~(1 << 15));
1666 std::memcpy((triton::uint16*)this->fsw, &flag, sizeof(triton::uint16));
1667 break;
1668 }
1669
1670 case triton::arch::ID_REG_X86_EFER: {
1671 triton::uint64 val = static_cast<triton::uint64>(value);
1672 std::memcpy((triton::uint64*)this->efer, &val, sizeof(triton::uint64));
1673 break;
1674 }
1675
1676 case triton::arch::ID_REG_X86_EFER_SCE: {
1677 triton::uint64 flag = 0;
1678 std::memcpy(&flag, (triton::uint64*)this->efer, sizeof(triton::uint64));
1679 flag = !value.is_zero() ? (flag | (1 << 0)) : (flag & ~(1 << 0));
1680 std::memcpy((triton::uint64*)this->efer, &flag, sizeof(triton::uint64));
1681 break;
1682 }
1683
1684 case triton::arch::ID_REG_X86_EFER_LME: {
1685 triton::uint64 flag = 0;
1686 std::memcpy(&flag, (triton::uint64*)this->efer, sizeof(triton::uint64));
1687 flag = !value.is_zero() ? (flag | (1 << 8)) : (flag & ~(1 << 8));
1688 std::memcpy((triton::uint64*)this->efer, &flag, sizeof(triton::uint64));
1689 break;
1690 }
1691
1692 case triton::arch::ID_REG_X86_EFER_LMA: {
1693 triton::uint64 flag = 0;
1694 std::memcpy(&flag, (triton::uint64*)this->efer, sizeof(triton::uint64));
1695 flag = !value.is_zero() ? (flag | (1 << 10)) : (flag & ~(1 << 10));
1696 std::memcpy((triton::uint64*)this->efer, &flag, sizeof(triton::uint64));
1697 break;
1698 }
1699
1700 case triton::arch::ID_REG_X86_EFER_NXE: {
1701 triton::uint64 flag = 0;
1702 std::memcpy(&flag, (triton::uint64*)this->efer, sizeof(triton::uint64));
1703 flag = !value.is_zero() ? (flag | (1 << 11)) : (flag & ~(1 << 11));
1704 std::memcpy((triton::uint64*)this->efer, &flag, sizeof(triton::uint64));
1705 break;
1706 }
1707
1708 case triton::arch::ID_REG_X86_EFER_SVME: {
1709 triton::uint64 flag = 0;
1710 std::memcpy(&flag, (triton::uint64*)this->efer, sizeof(triton::uint64));
1711 flag = !value.is_zero() ? (flag | (1 << 12)) : (flag & ~(1 << 12));
1712 std::memcpy((triton::uint64*)this->efer, &flag, sizeof(triton::uint64));
1713 break;
1714 }
1715
1716 case triton::arch::ID_REG_X86_EFER_LMSLE: {
1717 triton::uint64 flag = 0;
1718 std::memcpy(&flag, (triton::uint64*)this->efer, sizeof(triton::uint64));
1719 flag = !value.is_zero() ? (flag | (1 << 13)) : (flag & ~(1 << 13));
1720 std::memcpy((triton::uint64*)this->efer, &flag, sizeof(triton::uint64));
1721 break;
1722 }
1723
1724 case triton::arch::ID_REG_X86_EFER_FFXSR: {
1725 triton::uint64 flag = 0;
1726 std::memcpy(&flag, (triton::uint64*)this->efer, sizeof(triton::uint64));
1727 flag = !value.is_zero() ? (flag | (1 << 14)) : (flag & ~(1 << 14));
1728 std::memcpy((triton::uint64*)this->efer, &flag, sizeof(triton::uint64));
1729 break;
1730 }
1731
1732 case triton::arch::ID_REG_X86_EFER_TCE: {
1733 triton::uint64 flag = 0;
1734 std::memcpy(&flag, (triton::uint64*)this->efer, sizeof(triton::uint64));
1735 flag = !value.is_zero() ? (flag | (1 << 15)) : (flag & ~(1 << 15));
1736 std::memcpy((triton::uint64*)this->efer, &flag, sizeof(triton::uint64));
1737 break;
1738 }
1739
1740 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; }
1741 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; }
1742 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; }
1743 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; }
1744 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; }
1745 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; }
1746 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; }
1747 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; }
1748 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; }
1749 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; }
1750 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; }
1751 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; }
1752 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; }
1753 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; }
1754 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; }
1755 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; }
1756
1757 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; }
1758 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; }
1759 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; }
1760 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; }
1761 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; }
1762 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; }
1763
1764 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; }
1765 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; }
1766 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; }
1767 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; }
1768 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; }
1769 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; }
1770
1771 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; }
1772
1773 default:
1774 throw triton::exceptions::Cpu("x8664Cpu:setConcreteRegisterValue(): Invalid register.");
1775 }
1776 }
1777
1778
1779 bool x8664Cpu::isThumb(void) const {
1780 /* There is no thumb mode in x86_64 */
1781 return false;
1782 }
1783
1784
1785 void x8664Cpu::setThumb(bool state) {
1786 /* There is no thumb mode in x86_64 */
1787 }
1788
1789
1791 /* There is no exclusive memory access support in x86_64 */
1792 return false;
1793 }
1794
1795
1797 /* There is no exclusive memory access support in x86_64 */
1798 }
1799
1800
1802 return this->isConcreteMemoryValueDefined(mem.getAddress(), mem.getSize());
1803 }
1804
1805
1807 for (triton::usize index = 0; index < size; index++) {
1808 if (this->memory.find(baseAddr + index) == this->memory.end()) {
1809 return false;
1810 }
1811 }
1812 return true;
1813 }
1814
1815
1817 this->clearConcreteMemoryValue(mem.getAddress(), mem.getSize());
1818 }
1819
1820
1822 for (triton::usize index = 0; index < size; index++) {
1823 if (this->memory.find(baseAddr + index) != this->memory.end()) {
1824 this->memory.erase(baseAddr + index);
1825 }
1826 }
1827 }
1828
1829 }; /* x86 namespace */
1830 }; /* arch namespace */
1831}; /* triton namespace */
TRITON_EXPORT triton::uint512 getMaxValue(void) const
Returns the max possible value of the bitvector.
Definition: bitsVector.cpp:49
TRITON_EXPORT void setBits(triton::uint32 high, triton::uint32 low)
Sets the bits (high, low) position.
Definition: bitsVector.cpp:72
This class is used to represent an immediate.
Definition: immediate.hpp:37
This class is used to represent an instruction.
Definition: instruction.hpp:48
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.
Definition: x8664Cpu.cpp:1796
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:657
triton::uint8 r10[triton::size::qword]
Concrete value of r10.
Definition: x8664Cpu.hpp:104
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:488
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.
Definition: x8664Cpu.cpp:1790
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:626
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:458
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:398
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:977
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:647
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:995
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.
Definition: x8664Cpu.cpp:1801
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:498
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:478
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:493
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.
Definition: x8664Cpu.cpp:1779
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.
Definition: x8664Cpu.cpp:1816
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:956
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.
Definition: x8664Cpu.cpp:1785
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.
Definition: callbacks.cpp:193
The exception class used by all CPUs.
Definition: exceptions.hpp:317
The exception class used by the disassembler.
Definition: exceptions.hpp:365
The exception class used by register operands.
Definition: exceptions.hpp:257
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
std::int32_t sint32
signed 32-bits
Definition: tritonTypes.hpp:79
std::uint16_t uint16
unisgned 16-bits
Definition: tritonTypes.hpp:36
std::size_t usize
unsigned MAX_INT 32 or 64 bits according to the CPU.
std::uint64_t uint64
unisgned 64-bits
Definition: tritonTypes.hpp:42
std::uint32_t uint32
unisgned 32-bits
Definition: tritonTypes.hpp:39
std::uint8_t uint8
unisgned 8-bits
Definition: tritonTypes.hpp:33
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.