libTriton version 1.0 build 1590
Loading...
Searching...
No Matches
aarch64Cpu.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
12#include <triton/aarch64Cpu.hpp>
14#include <triton/coreUtils.hpp>
15#include <triton/cpuSize.hpp>
16#include <triton/exceptions.hpp>
18#include <triton/immediate.hpp>
19
20
21
22namespace triton {
23 namespace arch {
24 namespace arm {
25 namespace aarch64 {
26
28 this->callbacks = callbacks;
29 this->handle = 0;
30
31 this->clear();
32 this->disassInit();
33 }
34
35
37 this->copy(other);
38 }
39
40
42 this->memory.clear();
43 if (this->handle) {
44 triton::extlibs::capstone::cs_close(&this->handle);
45 }
46 }
47
48
49 void AArch64Cpu::disassInit(void) {
50 if (this->handle) {
51 triton::extlibs::capstone::cs_close(&this->handle);
52 }
53
54 if (triton::extlibs::capstone::cs_open(triton::extlibs::capstone::CS_ARCH_ARM64, triton::extlibs::capstone::CS_MODE_ARM, &this->handle) != triton::extlibs::capstone::CS_ERR_OK)
55 throw triton::exceptions::Disassembly("AArch64Cpu::disassInit(): Cannot open capstone.");
56
57 triton::extlibs::capstone::cs_option(this->handle, triton::extlibs::capstone::CS_OPT_DETAIL, triton::extlibs::capstone::CS_OPT_ON);
58 }
59
60
61 void AArch64Cpu::copy(const AArch64Cpu& other) {
62 this->callbacks = other.callbacks;
63 this->exclusiveMemoryTags = other.exclusiveMemoryTags;
64 this->memory = other.memory;
65
66 std::memcpy(this->x0, other.x0, sizeof(this->x0));
67 std::memcpy(this->x1, other.x1, sizeof(this->x1));
68 std::memcpy(this->x2, other.x2, sizeof(this->x2));
69 std::memcpy(this->x3, other.x3, sizeof(this->x3));
70 std::memcpy(this->x4, other.x4, sizeof(this->x4));
71 std::memcpy(this->x5, other.x5, sizeof(this->x5));
72 std::memcpy(this->x6, other.x6, sizeof(this->x6));
73 std::memcpy(this->x7, other.x7, sizeof(this->x7));
74 std::memcpy(this->x8, other.x8, sizeof(this->x8));
75 std::memcpy(this->x9, other.x9, sizeof(this->x9));
76 std::memcpy(this->x10, other.x10, sizeof(this->x10));
77 std::memcpy(this->x11, other.x11, sizeof(this->x11));
78 std::memcpy(this->x12, other.x12, sizeof(this->x12));
79 std::memcpy(this->x13, other.x13, sizeof(this->x13));
80 std::memcpy(this->x14, other.x14, sizeof(this->x14));
81 std::memcpy(this->x15, other.x15, sizeof(this->x15));
82 std::memcpy(this->x16, other.x16, sizeof(this->x16));
83 std::memcpy(this->x17, other.x17, sizeof(this->x17));
84 std::memcpy(this->x18, other.x18, sizeof(this->x18));
85 std::memcpy(this->x19, other.x19, sizeof(this->x19));
86 std::memcpy(this->x20, other.x20, sizeof(this->x20));
87 std::memcpy(this->x21, other.x21, sizeof(this->x21));
88 std::memcpy(this->x22, other.x22, sizeof(this->x22));
89 std::memcpy(this->x23, other.x23, sizeof(this->x23));
90 std::memcpy(this->x24, other.x24, sizeof(this->x24));
91 std::memcpy(this->x25, other.x25, sizeof(this->x25));
92 std::memcpy(this->x26, other.x26, sizeof(this->x26));
93 std::memcpy(this->x27, other.x27, sizeof(this->x27));
94 std::memcpy(this->x28, other.x28, sizeof(this->x28));
95 std::memcpy(this->x29, other.x29, sizeof(this->x29));
96 std::memcpy(this->x30, other.x30, sizeof(this->x30));
97 std::memcpy(this->q0, other.q0, sizeof(this->q0));
98 std::memcpy(this->q1, other.q1, sizeof(this->q1));
99 std::memcpy(this->q2, other.q2, sizeof(this->q2));
100 std::memcpy(this->q3, other.q3, sizeof(this->q3));
101 std::memcpy(this->q4, other.q4, sizeof(this->q4));
102 std::memcpy(this->q5, other.q5, sizeof(this->q5));
103 std::memcpy(this->q6, other.q6, sizeof(this->q6));
104 std::memcpy(this->q7, other.q7, sizeof(this->q7));
105 std::memcpy(this->q8, other.q8, sizeof(this->q8));
106 std::memcpy(this->q9, other.q9, sizeof(this->q9));
107 std::memcpy(this->q10, other.q10, sizeof(this->q10));
108 std::memcpy(this->q11, other.q11, sizeof(this->q11));
109 std::memcpy(this->q12, other.q12, sizeof(this->q12));
110 std::memcpy(this->q13, other.q13, sizeof(this->q13));
111 std::memcpy(this->q14, other.q14, sizeof(this->q14));
112 std::memcpy(this->q15, other.q15, sizeof(this->q15));
113 std::memcpy(this->q16, other.q16, sizeof(this->q16));
114 std::memcpy(this->q17, other.q17, sizeof(this->q17));
115 std::memcpy(this->q18, other.q18, sizeof(this->q18));
116 std::memcpy(this->q19, other.q19, sizeof(this->q19));
117 std::memcpy(this->q20, other.q20, sizeof(this->q20));
118 std::memcpy(this->q21, other.q21, sizeof(this->q21));
119 std::memcpy(this->q22, other.q22, sizeof(this->q22));
120 std::memcpy(this->q23, other.q23, sizeof(this->q23));
121 std::memcpy(this->q24, other.q24, sizeof(this->q24));
122 std::memcpy(this->q25, other.q25, sizeof(this->q25));
123 std::memcpy(this->q26, other.q26, sizeof(this->q26));
124 std::memcpy(this->q27, other.q27, sizeof(this->q27));
125 std::memcpy(this->q28, other.q28, sizeof(this->q28));
126 std::memcpy(this->q29, other.q29, sizeof(this->q29));
127 std::memcpy(this->q30, other.q30, sizeof(this->q30));
128 std::memcpy(this->q31, other.q31, sizeof(this->q31));
129 std::memcpy(this->sp, other.sp, sizeof(this->sp));
130 std::memcpy(this->pc, other.pc, sizeof(this->pc));
131 std::memcpy(this->spsr, other.spsr, sizeof(this->spsr));
132
134 #define SYS_REG_SPEC(_, LOWER_NAME, _2, _3, _4, _5) \
135 std::memcpy(this->LOWER_NAME, other.LOWER_NAME, sizeof(this->LOWER_NAME));
136 #define REG_SPEC(_1, _2, _3, _4, _5, _6)
137 #define REG_SPEC_NO_CAPSTONE(_1, _2, _3, _4, _5, _6)
138 #include "triton/aarch64.spec"
139 }
140
141
142 void AArch64Cpu::clear(void) {
143 /* Clear memory */
144 this->memory.clear();
145
146 /* Clear registers */
147 std::memset(this->x0, 0x00, sizeof(this->x0));
148 std::memset(this->x1, 0x00, sizeof(this->x1));
149 std::memset(this->x2, 0x00, sizeof(this->x2));
150 std::memset(this->x3, 0x00, sizeof(this->x3));
151 std::memset(this->x4, 0x00, sizeof(this->x4));
152 std::memset(this->x5, 0x00, sizeof(this->x5));
153 std::memset(this->x6, 0x00, sizeof(this->x6));
154 std::memset(this->x7, 0x00, sizeof(this->x7));
155 std::memset(this->x8, 0x00, sizeof(this->x8));
156 std::memset(this->x9, 0x00, sizeof(this->x9));
157 std::memset(this->x10, 0x00, sizeof(this->x10));
158 std::memset(this->x11, 0x00, sizeof(this->x11));
159 std::memset(this->x12, 0x00, sizeof(this->x12));
160 std::memset(this->x13, 0x00, sizeof(this->x13));
161 std::memset(this->x14, 0x00, sizeof(this->x14));
162 std::memset(this->x15, 0x00, sizeof(this->x15));
163 std::memset(this->x16, 0x00, sizeof(this->x16));
164 std::memset(this->x17, 0x00, sizeof(this->x17));
165 std::memset(this->x18, 0x00, sizeof(this->x18));
166 std::memset(this->x19, 0x00, sizeof(this->x19));
167 std::memset(this->x20, 0x00, sizeof(this->x20));
168 std::memset(this->x21, 0x00, sizeof(this->x21));
169 std::memset(this->x22, 0x00, sizeof(this->x22));
170 std::memset(this->x23, 0x00, sizeof(this->x23));
171 std::memset(this->x24, 0x00, sizeof(this->x24));
172 std::memset(this->x25, 0x00, sizeof(this->x25));
173 std::memset(this->x26, 0x00, sizeof(this->x26));
174 std::memset(this->x27, 0x00, sizeof(this->x27));
175 std::memset(this->x28, 0x00, sizeof(this->x28));
176 std::memset(this->x29, 0x00, sizeof(this->x29));
177 std::memset(this->x30, 0x00, sizeof(this->x30));
178 std::memset(this->q0, 0x00, sizeof(this->q0));
179 std::memset(this->q1, 0x00, sizeof(this->q1));
180 std::memset(this->q2, 0x00, sizeof(this->q2));
181 std::memset(this->q3, 0x00, sizeof(this->q3));
182 std::memset(this->q4, 0x00, sizeof(this->q4));
183 std::memset(this->q5, 0x00, sizeof(this->q5));
184 std::memset(this->q6, 0x00, sizeof(this->q6));
185 std::memset(this->q7, 0x00, sizeof(this->q7));
186 std::memset(this->q8, 0x00, sizeof(this->q8));
187 std::memset(this->q9, 0x00, sizeof(this->q9));
188 std::memset(this->q10, 0x00, sizeof(this->q10));
189 std::memset(this->q11, 0x00, sizeof(this->q11));
190 std::memset(this->q12, 0x00, sizeof(this->q12));
191 std::memset(this->q13, 0x00, sizeof(this->q13));
192 std::memset(this->q14, 0x00, sizeof(this->q14));
193 std::memset(this->q15, 0x00, sizeof(this->q15));
194 std::memset(this->q16, 0x00, sizeof(this->q16));
195 std::memset(this->q17, 0x00, sizeof(this->q17));
196 std::memset(this->q18, 0x00, sizeof(this->q18));
197 std::memset(this->q19, 0x00, sizeof(this->q19));
198 std::memset(this->q20, 0x00, sizeof(this->q20));
199 std::memset(this->q21, 0x00, sizeof(this->q21));
200 std::memset(this->q22, 0x00, sizeof(this->q22));
201 std::memset(this->q23, 0x00, sizeof(this->q23));
202 std::memset(this->q24, 0x00, sizeof(this->q24));
203 std::memset(this->q25, 0x00, sizeof(this->q25));
204 std::memset(this->q26, 0x00, sizeof(this->q26));
205 std::memset(this->q27, 0x00, sizeof(this->q27));
206 std::memset(this->q28, 0x00, sizeof(this->q28));
207 std::memset(this->q29, 0x00, sizeof(this->q29));
208 std::memset(this->q30, 0x00, sizeof(this->q30));
209 std::memset(this->q31, 0x00, sizeof(this->q31));
210 std::memset(this->sp, 0x00, sizeof(this->sp));
211 std::memset(this->pc, 0x00, sizeof(this->pc));
212 std::memset(this->spsr, 0x00, sizeof(this->spsr));
213
215 #define SYS_REG_SPEC(_, LOWER_NAME, _2, _3, _4, _5) \
216 std::memset(this->LOWER_NAME, 0x00, sizeof(this->LOWER_NAME));
217 #define REG_SPEC(_1, _2, _3, _4, _5, _6)
218 #define REG_SPEC_NO_CAPSTONE(_1, _2, _3, _4, _5, _6)
219 #include "triton/aarch64.spec"
220 }
221
222
224 this->copy(other);
225 return *this;
226 }
227
228
232
233
235 return ((regId >= triton::arch::ID_REG_AARCH64_C && regId <= triton::arch::ID_REG_AARCH64_Z) ? true : false);
236 }
237
238
240 return (this->isGPR(regId) || this->isScalarRegister(regId) || this->isVectorRegister(regId) || this->isSystemRegister(regId));
241 }
242
243
245 return (this->isFlag(regId) || this->isRegister(regId));
246 }
247
248
250 return ((regId >= triton::arch::ID_REG_AARCH64_X0 && regId <= triton::arch::ID_REG_AARCH64_WZR) ? true : false);
251 }
252
253
255 return ((regId >= triton::arch::ID_REG_AARCH64_Q0 && regId <= triton::arch::ID_REG_AARCH64_B31) ? true : false);
256 }
257
258
260 return ((regId >= triton::arch::ID_REG_AARCH64_V0 && regId <= triton::arch::ID_REG_AARCH64_V31) ? true : false);
261 }
262
263
265 return ((regId >= triton::arch::ID_REG_AARCH64_ACTLR_EL1 && regId <= triton::arch::ID_REG_AARCH64_ZCR_EL3) ? true : false);
266 }
267
268
272
273
277
278
282
283
284 const std::unordered_map<triton::arch::register_e, const triton::arch::Register>& AArch64Cpu::getAllRegisters(void) const {
285 return this->id2reg;
286 }
287
288 const std::unordered_map<triton::uint64, triton::uint8, IdentityHash<triton::uint64>>& AArch64Cpu::getConcreteMemory(void) const {
289 return this->memory;
290 }
291
292
293 std::set<const triton::arch::Register*> AArch64Cpu::getParentRegisters(void) const {
294 std::set<const triton::arch::Register*> ret;
295
296 for (const auto& kv: this->id2reg) {
297 auto regId = kv.first;
298 const auto& reg = kv.second;
299
300 /* Skip Vector and System registers */
301 if (this->isVectorRegister(regId) || this->isSystemRegister(regId))
302 continue;
303
304 /* Add GPR */
305 if (reg.getSize() == this->gprSize())
306 ret.insert(&reg);
307
308 /* Add scalar register */
309 if (this->isScalarRegister(regId) && reg.getSize() == triton::bitsize::dqword)
310 ret.insert(&reg);
311
312 /* Add Flags */
313 else if (this->isFlag(regId))
314 ret.insert(&reg);
315 }
316
317 return ret;
318 }
319
320
322 try {
323 return this->id2reg.at(id);
324 } catch (const std::out_of_range&) {
325 throw triton::exceptions::Cpu("AArch64Cpu::getRegister(): Invalid register for this architecture.");
326 }
327 }
328
329
330 const triton::arch::Register& AArch64Cpu::getRegister(const std::string& name) const {
331 std::string lower = name;
332 std::transform(lower.begin(), lower.end(), lower.begin(), [](unsigned char c){ return std::tolower(c); });
333 try {
334 return this->getRegister(this->name2id.at(lower));
335 } catch (const std::out_of_range&) {
336 throw triton::exceptions::Cpu("AArch64Cpu::getRegister(): Invalid register for this architecture.");
337 }
338 }
339
340
344
345
349
350
352 return this->getRegister(this->pcId);
353 }
354
355
357 return this->getRegister(this->spId);
358 }
359
360
362 triton::extlibs::capstone::cs_insn* insn;
363 triton::usize count = 0;
364 triton::uint32 size = 0;
365
366 /* Check if the opcode and opcode' size are defined */
367 if (inst.getOpcode() == nullptr || inst.getSize() == 0)
368 throw triton::exceptions::Disassembly("AArch64Cpu::disassembly(): Opcode and opcodeSize must be definied.");
369
370 /* Clear instructicon's operands if alredy defined */
371 inst.operands.clear();
372
373 /* Update instruction address if undefined */
374 if (!inst.getAddress()) {
375 inst.setAddress(static_cast<triton::uint64>(this->getConcreteRegisterValue(this->getProgramCounter())));
376 }
377
378 /* Let's disass and build our operands */
379 count = triton::extlibs::capstone::cs_disasm(this->handle, inst.getOpcode(), inst.getSize(), inst.getAddress(), 0, &insn);
380 if (count > 0) {
381 /* Detail information */
382 triton::extlibs::capstone::cs_detail* detail = insn->detail;
383
384 /* Init the disassembly */
385 std::stringstream str;
386
387 str << insn[0].mnemonic;
388 if (detail->arm64.op_count)
389 str << " " << insn[0].op_str;
390
391 inst.setDisassembly(str.str());
392
393 /* Refine the size */
394 inst.setSize(insn[0].size);
395
396 /* Init the instruction's type */
397 inst.setType(this->capstoneInstructionToTritonInstruction(insn[0].id));
398
399 /* Init the instruction's code codition */
400 inst.setCodeCondition(this->capstoneConditionToTritonCondition(detail->arm64.cc));
401
402 /* Init the instruction's write back flag */
403 inst.setWriteBack(detail->arm64.writeback);
404
405 /* Set True if the instruction udpate flags */
406 inst.setUpdateFlag(detail->arm64.update_flags);
407
408 /* Set architecture */
410
411 /* Init operands */
412 for (triton::uint32 n = 0; n < detail->arm64.op_count; n++) {
413 triton::extlibs::capstone::cs_arm64_op* op = &(detail->arm64.operands[n]);
414 switch(op->type) {
415
416 case triton::extlibs::capstone::ARM64_OP_IMM: {
417 triton::arch::Immediate imm(op->imm, size ? size : triton::size::qword);
418
419 /*
420 * Instruction such that CBZ, CBNZ or TBZ may imply a wrong size.
421 * So, if Triton truncates the value by setting a size less than
422 * the original one, we redefine the size automatically.
423 */
424 if (static_cast<triton::uint64>(op->imm) > imm.getValue()) {
425 imm = Immediate();
426 imm.setValue(op->imm, 0); /* By setting 0 as size, we automatically identify the size of the value */
427 }
428
429 /* Set Shift type and value */
430 imm.setShiftType(this->capstoneShiftToTritonShift(op->shift.type));
431 imm.setShiftValue(op->shift.value);
432
433 inst.operands.push_back(triton::arch::OperandWrapper(imm));
434 break;
435 }
436
437 case triton::extlibs::capstone::ARM64_OP_MEM: {
439
440 /* Set the size of the memory access */
441 mem.setBits(size ? ((size * triton::bitsize::byte) - 1) : triton::bitsize::qword - 1, 0);
442
443 /* LEA if exists */
444 triton::arch::Register base(*this, this->capstoneRegisterToTritonRegister(op->mem.base));
445 triton::arch::Register index(*this, this->capstoneRegisterToTritonRegister(op->mem.index));
446
447 triton::uint32 immsize = (
448 this->isRegisterValid(base.getId()) ? base.getSize() :
449 this->isRegisterValid(index.getId()) ? index.getSize() :
450 this->gprSize()
451 );
452
453 triton::arch::Immediate disp(op->mem.disp, immsize);
454
455 /* Specify that LEA contains a PC relative */
456 if (base.getId() == this->pcId) {
457 mem.setPcRelative(inst.getNextAddress());
458 }
459
460 /* Set Shift type and value */
461 index.setShiftType(this->capstoneShiftToTritonShift(op->shift.type));
462 index.setShiftValue(op->shift.value);
463
464 /* Set extend type and size */
465 index.setExtendType(this->capstoneExtendToTritonExtend(op->ext));
466 if (op->ext != triton::extlibs::capstone::ARM64_EXT_INVALID) {
467 index.setExtendedSize(base.getBitSize());
468 }
469
470 /* Note that in ARM64 there is no segment register and scale value */
471 mem.setBaseRegister(base);
472 mem.setIndexRegister(index);
473 mem.setDisplacement(disp);
474
475 /* If there is an index register available, set scale to 1 to perform this following computation (base) + (index * scale) */
476 if (this->isRegisterValid(index.getId())) {
477 mem.setScale(triton::arch::Immediate(1, immsize));
478 }
479
480 inst.operands.push_back(triton::arch::OperandWrapper(mem));
481 break;
482 }
483
484 case triton::extlibs::capstone::ARM64_OP_REG: {
486
487 /* Set Shift type and value */
488 reg.setShiftType(this->capstoneShiftToTritonShift(op->shift.type));
489 reg.setShiftValue(op->shift.value);
490
491 /* Set extend type and size */
493 if (op->ext != triton::extlibs::capstone::ARM64_EXT_INVALID) {
495 }
496
497 /* Init the vector arrangement specifier */
498 reg.setVASType(this->capstoneVASToTritonVAS(op->vas));
499
500 /* Init the vector index (-1 if irrelevant) */
501 reg.setVectorIndex(op->vector_index);
502
503 /* Define a base address for next operand */
504 size = this->getMemoryOperandSpecialSize(inst.getType());
505 if (!size) {
506 size = reg.getSize();
507 }
508
509 inst.operands.push_back(triton::arch::OperandWrapper(reg));
510 break;
511 }
512
513 case triton::extlibs::capstone::ARM64_OP_SYS: {
515
516 /* Define a base address for next operand */
517 size = this->getMemoryOperandSpecialSize(inst.getType());
518 if (!size) {
519 size = reg.getSize();
520 }
521
522 inst.operands.push_back(triton::arch::OperandWrapper(reg));
523 break;
524 }
525
526 default:
527 /* NOTE: FP, CIMM, and missing one are not supported yet. */
528 throw triton::exceptions::Disassembly("AArch64Cpu::disassembly(): Invalid operand.");
529 } // switch
530 } // for operand
531
532 /* Set control flow */
533 if (insn[0].id == triton::extlibs::capstone::ARM64_INS_RET)
534 inst.setControlFlow(true);
535
536 /* Set branch */
537 if (detail->groups_count > 0) {
538 for (triton::uint32 n = 0; n < detail->groups_count; n++) {
539 if (detail->groups[n] == triton::extlibs::capstone::ARM64_GRP_JUMP) {
540 inst.setBranch(true);
541 inst.setControlFlow(true);
542 }
543 }
544 }
545
546 /* Free capstone stuffs */
547 triton::extlibs::capstone::cs_free(insn, count);
548 }
549 else
550 throw triton::exceptions::Disassembly("AArch64Cpu::disassembly(): Failed to disassemble the given code.");
551 }
552
553
555 if (execCallbacks && this->callbacks)
557
558 auto it = this->memory.find(addr);
559 if (it == this->memory.end())
560 return 0x00;
561
562 return it->second;
563 }
564
565
567 triton::uint512 ret = 0;
568 triton::uint64 addr = 0;
569 triton::uint32 size = 0;
570
571 if (execCallbacks && this->callbacks)
573
574 addr = mem.getAddress();
575 size = mem.getSize();
576
577 if (size == 0 || size > triton::size::dqqword)
578 throw triton::exceptions::Cpu("AArch64Cpu::getConcreteMemoryValue(): Invalid size memory.");
579
580 for (triton::sint32 i = size-1; i >= 0; i--)
581 ret = ((ret << triton::bitsize::byte) | this->getConcreteMemoryValue(addr+i, false));
582
583 return ret;
584 }
585
586
587 std::vector<triton::uint8> AArch64Cpu::getConcreteMemoryAreaValue(triton::uint64 baseAddr, triton::usize size, bool execCallbacks) const {
588 std::vector<triton::uint8> area;
589
590 for (triton::usize index = 0; index < size; index++)
591 area.push_back(this->getConcreteMemoryValue(baseAddr+index, execCallbacks));
592
593 return area;
594 }
595
596
598 triton::uint512 value = 0;
599
600 if (execCallbacks && this->callbacks)
602
603 switch (reg.getId()) {
604 case triton::arch::ID_REG_AARCH64_X0: return (*((triton::uint64*)(this->x0)));
605 case triton::arch::ID_REG_AARCH64_W0: return (*((triton::uint32*)(this->x0)));
606 case triton::arch::ID_REG_AARCH64_X1: return (*((triton::uint64*)(this->x1)));
607 case triton::arch::ID_REG_AARCH64_W1: return (*((triton::uint32*)(this->x1)));
608 case triton::arch::ID_REG_AARCH64_X2: return (*((triton::uint64*)(this->x2)));
609 case triton::arch::ID_REG_AARCH64_W2: return (*((triton::uint32*)(this->x2)));
610 case triton::arch::ID_REG_AARCH64_X3: return (*((triton::uint64*)(this->x3)));
611 case triton::arch::ID_REG_AARCH64_W3: return (*((triton::uint32*)(this->x3)));
612 case triton::arch::ID_REG_AARCH64_X4: return (*((triton::uint64*)(this->x4)));
613 case triton::arch::ID_REG_AARCH64_W4: return (*((triton::uint32*)(this->x4)));
614 case triton::arch::ID_REG_AARCH64_X5: return (*((triton::uint64*)(this->x5)));
615 case triton::arch::ID_REG_AARCH64_W5: return (*((triton::uint32*)(this->x5)));
616 case triton::arch::ID_REG_AARCH64_X6: return (*((triton::uint64*)(this->x6)));
617 case triton::arch::ID_REG_AARCH64_W6: return (*((triton::uint32*)(this->x6)));
618 case triton::arch::ID_REG_AARCH64_X7: return (*((triton::uint64*)(this->x7)));
619 case triton::arch::ID_REG_AARCH64_W7: return (*((triton::uint32*)(this->x7)));
620 case triton::arch::ID_REG_AARCH64_X8: return (*((triton::uint64*)(this->x8)));
621 case triton::arch::ID_REG_AARCH64_W8: return (*((triton::uint32*)(this->x8)));
622 case triton::arch::ID_REG_AARCH64_X9: return (*((triton::uint64*)(this->x9)));
623 case triton::arch::ID_REG_AARCH64_W9: return (*((triton::uint32*)(this->x9)));
624 case triton::arch::ID_REG_AARCH64_X10: return (*((triton::uint64*)(this->x10)));
625 case triton::arch::ID_REG_AARCH64_W10: return (*((triton::uint32*)(this->x10)));
626 case triton::arch::ID_REG_AARCH64_X11: return (*((triton::uint64*)(this->x11)));
627 case triton::arch::ID_REG_AARCH64_W11: return (*((triton::uint32*)(this->x11)));
628 case triton::arch::ID_REG_AARCH64_X12: return (*((triton::uint64*)(this->x12)));
629 case triton::arch::ID_REG_AARCH64_W12: return (*((triton::uint32*)(this->x12)));
630 case triton::arch::ID_REG_AARCH64_X13: return (*((triton::uint64*)(this->x13)));
631 case triton::arch::ID_REG_AARCH64_W13: return (*((triton::uint32*)(this->x13)));
632 case triton::arch::ID_REG_AARCH64_X14: return (*((triton::uint64*)(this->x14)));
633 case triton::arch::ID_REG_AARCH64_W14: return (*((triton::uint32*)(this->x14)));
634 case triton::arch::ID_REG_AARCH64_X15: return (*((triton::uint64*)(this->x15)));
635 case triton::arch::ID_REG_AARCH64_W15: return (*((triton::uint32*)(this->x15)));
636 case triton::arch::ID_REG_AARCH64_X16: return (*((triton::uint64*)(this->x16)));
637 case triton::arch::ID_REG_AARCH64_W16: return (*((triton::uint32*)(this->x16)));
638 case triton::arch::ID_REG_AARCH64_X17: return (*((triton::uint64*)(this->x17)));
639 case triton::arch::ID_REG_AARCH64_W17: return (*((triton::uint32*)(this->x17)));
640 case triton::arch::ID_REG_AARCH64_X18: return (*((triton::uint64*)(this->x18)));
641 case triton::arch::ID_REG_AARCH64_W18: return (*((triton::uint32*)(this->x18)));
642 case triton::arch::ID_REG_AARCH64_X19: return (*((triton::uint64*)(this->x19)));
643 case triton::arch::ID_REG_AARCH64_W19: return (*((triton::uint32*)(this->x19)));
644 case triton::arch::ID_REG_AARCH64_X20: return (*((triton::uint64*)(this->x20)));
645 case triton::arch::ID_REG_AARCH64_W20: return (*((triton::uint32*)(this->x20)));
646 case triton::arch::ID_REG_AARCH64_X21: return (*((triton::uint64*)(this->x21)));
647 case triton::arch::ID_REG_AARCH64_W21: return (*((triton::uint32*)(this->x21)));
648 case triton::arch::ID_REG_AARCH64_X22: return (*((triton::uint64*)(this->x22)));
649 case triton::arch::ID_REG_AARCH64_W22: return (*((triton::uint32*)(this->x22)));
650 case triton::arch::ID_REG_AARCH64_X23: return (*((triton::uint64*)(this->x23)));
651 case triton::arch::ID_REG_AARCH64_W23: return (*((triton::uint32*)(this->x23)));
652 case triton::arch::ID_REG_AARCH64_X24: return (*((triton::uint64*)(this->x24)));
653 case triton::arch::ID_REG_AARCH64_W24: return (*((triton::uint32*)(this->x24)));
654 case triton::arch::ID_REG_AARCH64_X25: return (*((triton::uint64*)(this->x25)));
655 case triton::arch::ID_REG_AARCH64_W25: return (*((triton::uint32*)(this->x25)));
656 case triton::arch::ID_REG_AARCH64_X26: return (*((triton::uint64*)(this->x26)));
657 case triton::arch::ID_REG_AARCH64_W26: return (*((triton::uint32*)(this->x26)));
658 case triton::arch::ID_REG_AARCH64_X27: return (*((triton::uint64*)(this->x27)));
659 case triton::arch::ID_REG_AARCH64_W27: return (*((triton::uint32*)(this->x27)));
660 case triton::arch::ID_REG_AARCH64_X28: return (*((triton::uint64*)(this->x28)));
661 case triton::arch::ID_REG_AARCH64_W28: return (*((triton::uint32*)(this->x28)));
662 case triton::arch::ID_REG_AARCH64_X29: return (*((triton::uint64*)(this->x29)));
663 case triton::arch::ID_REG_AARCH64_W29: return (*((triton::uint32*)(this->x29)));
664 case triton::arch::ID_REG_AARCH64_X30: return (*((triton::uint64*)(this->x30)));
665 case triton::arch::ID_REG_AARCH64_W30: return (*((triton::uint32*)(this->x30)));
666 case triton::arch::ID_REG_AARCH64_SP: return (*((triton::uint64*)(this->sp)));
667 case triton::arch::ID_REG_AARCH64_WSP: return (*((triton::uint32*)(this->sp)));
668 case triton::arch::ID_REG_AARCH64_PC: return (*((triton::uint64*)(this->pc)));
669 case triton::arch::ID_REG_AARCH64_XZR: return 0;
670 case triton::arch::ID_REG_AARCH64_WZR: return 0;
671 case triton::arch::ID_REG_AARCH64_SPSR: return (*((triton::uint32*)(this->spsr)));
672 case triton::arch::ID_REG_AARCH64_N: return (((*((triton::uint32*)(this->spsr))) >> 31) & 1);
673 case triton::arch::ID_REG_AARCH64_Z: return (((*((triton::uint32*)(this->spsr))) >> 30) & 1);
674 case triton::arch::ID_REG_AARCH64_C: return (((*((triton::uint32*)(this->spsr))) >> 29) & 1);
675 case triton::arch::ID_REG_AARCH64_V: return (((*((triton::uint32*)(this->spsr))) >> 28) & 1);
676 case triton::arch::ID_REG_AARCH64_Q0: return triton::utils::cast<triton::uint128>(this->q0);
677 case triton::arch::ID_REG_AARCH64_D0: return (*((triton::uint64*)(this->q0)));
678 case triton::arch::ID_REG_AARCH64_S0: return (*((triton::uint32*)(this->q0)));
679 case triton::arch::ID_REG_AARCH64_H0: return (*((triton::uint16*)(this->q0)));
680 case triton::arch::ID_REG_AARCH64_B0: return (*((triton::uint8*)(this->q0)));
681 case triton::arch::ID_REG_AARCH64_Q1: return triton::utils::cast<triton::uint128>(this->q1);
682 case triton::arch::ID_REG_AARCH64_D1: return (*((triton::uint64*)(this->q1)));
683 case triton::arch::ID_REG_AARCH64_S1: return (*((triton::uint32*)(this->q1)));
684 case triton::arch::ID_REG_AARCH64_H1: return (*((triton::uint16*)(this->q1)));
685 case triton::arch::ID_REG_AARCH64_B1: return (*((triton::uint8*)(this->q1)));
686 case triton::arch::ID_REG_AARCH64_Q2: return triton::utils::cast<triton::uint128>(this->q2);
687 case triton::arch::ID_REG_AARCH64_D2: return (*((triton::uint64*)(this->q2)));
688 case triton::arch::ID_REG_AARCH64_S2: return (*((triton::uint32*)(this->q2)));
689 case triton::arch::ID_REG_AARCH64_H2: return (*((triton::uint16*)(this->q2)));
690 case triton::arch::ID_REG_AARCH64_B2: return (*((triton::uint8*)(this->q2)));
691 case triton::arch::ID_REG_AARCH64_Q3: return triton::utils::cast<triton::uint128>(this->q3);
692 case triton::arch::ID_REG_AARCH64_D3: return (*((triton::uint64*)(this->q3)));
693 case triton::arch::ID_REG_AARCH64_S3: return (*((triton::uint32*)(this->q3)));
694 case triton::arch::ID_REG_AARCH64_H3: return (*((triton::uint16*)(this->q3)));
695 case triton::arch::ID_REG_AARCH64_B3: return (*((triton::uint8*)(this->q3)));
696 case triton::arch::ID_REG_AARCH64_Q4: return triton::utils::cast<triton::uint128>(this->q4);
697 case triton::arch::ID_REG_AARCH64_D4: return (*((triton::uint64*)(this->q4)));
698 case triton::arch::ID_REG_AARCH64_S4: return (*((triton::uint32*)(this->q4)));
699 case triton::arch::ID_REG_AARCH64_H4: return (*((triton::uint16*)(this->q4)));
700 case triton::arch::ID_REG_AARCH64_B4: return (*((triton::uint8*)(this->q4)));
701 case triton::arch::ID_REG_AARCH64_Q5: return triton::utils::cast<triton::uint128>(this->q5);
702 case triton::arch::ID_REG_AARCH64_D5: return (*((triton::uint64*)(this->q5)));
703 case triton::arch::ID_REG_AARCH64_S5: return (*((triton::uint32*)(this->q5)));
704 case triton::arch::ID_REG_AARCH64_H5: return (*((triton::uint16*)(this->q5)));
705 case triton::arch::ID_REG_AARCH64_B5: return (*((triton::uint8*)(this->q5)));
706 case triton::arch::ID_REG_AARCH64_Q6: return triton::utils::cast<triton::uint128>(this->q6);
707 case triton::arch::ID_REG_AARCH64_D6: return (*((triton::uint64*)(this->q6)));
708 case triton::arch::ID_REG_AARCH64_S6: return (*((triton::uint32*)(this->q6)));
709 case triton::arch::ID_REG_AARCH64_H6: return (*((triton::uint16*)(this->q6)));
710 case triton::arch::ID_REG_AARCH64_B6: return (*((triton::uint8*)(this->q6)));
711 case triton::arch::ID_REG_AARCH64_Q7: return triton::utils::cast<triton::uint128>(this->q7);
712 case triton::arch::ID_REG_AARCH64_D7: return (*((triton::uint64*)(this->q7)));
713 case triton::arch::ID_REG_AARCH64_S7: return (*((triton::uint32*)(this->q7)));
714 case triton::arch::ID_REG_AARCH64_H7: return (*((triton::uint16*)(this->q7)));
715 case triton::arch::ID_REG_AARCH64_B7: return (*((triton::uint8*)(this->q7)));
716 case triton::arch::ID_REG_AARCH64_Q8: return triton::utils::cast<triton::uint128>(this->q8);
717 case triton::arch::ID_REG_AARCH64_D8: return (*((triton::uint64*)(this->q8)));
718 case triton::arch::ID_REG_AARCH64_S8: return (*((triton::uint32*)(this->q8)));
719 case triton::arch::ID_REG_AARCH64_H8: return (*((triton::uint16*)(this->q8)));
720 case triton::arch::ID_REG_AARCH64_B8: return (*((triton::uint8*)(this->q8)));
721 case triton::arch::ID_REG_AARCH64_Q9: return triton::utils::cast<triton::uint128>(this->q9);
722 case triton::arch::ID_REG_AARCH64_D9: return (*((triton::uint64*)(this->q9)));
723 case triton::arch::ID_REG_AARCH64_S9: return (*((triton::uint32*)(this->q9)));
724 case triton::arch::ID_REG_AARCH64_H9: return (*((triton::uint16*)(this->q9)));
725 case triton::arch::ID_REG_AARCH64_B9: return (*((triton::uint8*)(this->q9)));
726 case triton::arch::ID_REG_AARCH64_Q10: return triton::utils::cast<triton::uint128>(this->q10);
727 case triton::arch::ID_REG_AARCH64_D10: return (*((triton::uint64*)(this->q10)));
728 case triton::arch::ID_REG_AARCH64_S10: return (*((triton::uint32*)(this->q10)));
729 case triton::arch::ID_REG_AARCH64_H10: return (*((triton::uint16*)(this->q10)));
730 case triton::arch::ID_REG_AARCH64_B10: return (*((triton::uint8*)(this->q10)));
731 case triton::arch::ID_REG_AARCH64_Q11: return triton::utils::cast<triton::uint128>(this->q11);
732 case triton::arch::ID_REG_AARCH64_D11: return (*((triton::uint64*)(this->q11)));
733 case triton::arch::ID_REG_AARCH64_S11: return (*((triton::uint32*)(this->q11)));
734 case triton::arch::ID_REG_AARCH64_H11: return (*((triton::uint16*)(this->q11)));
735 case triton::arch::ID_REG_AARCH64_B11: return (*((triton::uint8*)(this->q11)));
736 case triton::arch::ID_REG_AARCH64_Q12: return triton::utils::cast<triton::uint128>(this->q12);
737 case triton::arch::ID_REG_AARCH64_D12: return (*((triton::uint64*)(this->q12)));
738 case triton::arch::ID_REG_AARCH64_S12: return (*((triton::uint32*)(this->q12)));
739 case triton::arch::ID_REG_AARCH64_H12: return (*((triton::uint16*)(this->q12)));
740 case triton::arch::ID_REG_AARCH64_B12: return (*((triton::uint8*)(this->q12)));
741 case triton::arch::ID_REG_AARCH64_Q13: return triton::utils::cast<triton::uint128>(this->q13);
742 case triton::arch::ID_REG_AARCH64_D13: return (*((triton::uint64*)(this->q13)));
743 case triton::arch::ID_REG_AARCH64_S13: return (*((triton::uint32*)(this->q13)));
744 case triton::arch::ID_REG_AARCH64_H13: return (*((triton::uint16*)(this->q13)));
745 case triton::arch::ID_REG_AARCH64_B13: return (*((triton::uint8*)(this->q13)));
746 case triton::arch::ID_REG_AARCH64_Q14: return triton::utils::cast<triton::uint128>(this->q14);
747 case triton::arch::ID_REG_AARCH64_D14: return (*((triton::uint64*)(this->q14)));
748 case triton::arch::ID_REG_AARCH64_S14: return (*((triton::uint32*)(this->q14)));
749 case triton::arch::ID_REG_AARCH64_H14: return (*((triton::uint16*)(this->q14)));
750 case triton::arch::ID_REG_AARCH64_B14: return (*((triton::uint8*)(this->q14)));
751 case triton::arch::ID_REG_AARCH64_Q15: return triton::utils::cast<triton::uint128>(this->q15);
752 case triton::arch::ID_REG_AARCH64_D15: return (*((triton::uint64*)(this->q15)));
753 case triton::arch::ID_REG_AARCH64_S15: return (*((triton::uint32*)(this->q15)));
754 case triton::arch::ID_REG_AARCH64_H15: return (*((triton::uint16*)(this->q15)));
755 case triton::arch::ID_REG_AARCH64_B15: return (*((triton::uint8*)(this->q15)));
756 case triton::arch::ID_REG_AARCH64_Q16: return triton::utils::cast<triton::uint128>(this->q16);
757 case triton::arch::ID_REG_AARCH64_D16: return (*((triton::uint64*)(this->q16)));
758 case triton::arch::ID_REG_AARCH64_S16: return (*((triton::uint32*)(this->q16)));
759 case triton::arch::ID_REG_AARCH64_H16: return (*((triton::uint16*)(this->q16)));
760 case triton::arch::ID_REG_AARCH64_B16: return (*((triton::uint8*)(this->q16)));
761 case triton::arch::ID_REG_AARCH64_Q17: return triton::utils::cast<triton::uint128>(this->q17);
762 case triton::arch::ID_REG_AARCH64_D17: return (*((triton::uint64*)(this->q17)));
763 case triton::arch::ID_REG_AARCH64_S17: return (*((triton::uint32*)(this->q17)));
764 case triton::arch::ID_REG_AARCH64_H17: return (*((triton::uint16*)(this->q17)));
765 case triton::arch::ID_REG_AARCH64_B17: return (*((triton::uint8*)(this->q17)));
766 case triton::arch::ID_REG_AARCH64_Q18: return triton::utils::cast<triton::uint128>(this->q18);
767 case triton::arch::ID_REG_AARCH64_D18: return (*((triton::uint64*)(this->q18)));
768 case triton::arch::ID_REG_AARCH64_S18: return (*((triton::uint32*)(this->q18)));
769 case triton::arch::ID_REG_AARCH64_H18: return (*((triton::uint16*)(this->q18)));
770 case triton::arch::ID_REG_AARCH64_B18: return (*((triton::uint8*)(this->q18)));
771 case triton::arch::ID_REG_AARCH64_Q19: return triton::utils::cast<triton::uint128>(this->q19);
772 case triton::arch::ID_REG_AARCH64_D19: return (*((triton::uint64*)(this->q19)));
773 case triton::arch::ID_REG_AARCH64_S19: return (*((triton::uint32*)(this->q19)));
774 case triton::arch::ID_REG_AARCH64_H19: return (*((triton::uint16*)(this->q19)));
775 case triton::arch::ID_REG_AARCH64_B19: return (*((triton::uint8*)(this->q19)));
776 case triton::arch::ID_REG_AARCH64_Q20: return triton::utils::cast<triton::uint128>(this->q20);
777 case triton::arch::ID_REG_AARCH64_D20: return (*((triton::uint64*)(this->q20)));
778 case triton::arch::ID_REG_AARCH64_S20: return (*((triton::uint32*)(this->q20)));
779 case triton::arch::ID_REG_AARCH64_H20: return (*((triton::uint16*)(this->q20)));
780 case triton::arch::ID_REG_AARCH64_B20: return (*((triton::uint8*)(this->q20)));
781 case triton::arch::ID_REG_AARCH64_Q21: return triton::utils::cast<triton::uint128>(this->q21);
782 case triton::arch::ID_REG_AARCH64_D21: return (*((triton::uint64*)(this->q21)));
783 case triton::arch::ID_REG_AARCH64_S21: return (*((triton::uint32*)(this->q21)));
784 case triton::arch::ID_REG_AARCH64_H21: return (*((triton::uint16*)(this->q21)));
785 case triton::arch::ID_REG_AARCH64_B21: return (*((triton::uint8*)(this->q21)));
786 case triton::arch::ID_REG_AARCH64_Q22: return triton::utils::cast<triton::uint128>(this->q22);
787 case triton::arch::ID_REG_AARCH64_D22: return (*((triton::uint64*)(this->q22)));
788 case triton::arch::ID_REG_AARCH64_S22: return (*((triton::uint32*)(this->q22)));
789 case triton::arch::ID_REG_AARCH64_H22: return (*((triton::uint16*)(this->q22)));
790 case triton::arch::ID_REG_AARCH64_B22: return (*((triton::uint8*)(this->q22)));
791 case triton::arch::ID_REG_AARCH64_Q23: return triton::utils::cast<triton::uint128>(this->q23);
792 case triton::arch::ID_REG_AARCH64_D23: return (*((triton::uint64*)(this->q23)));
793 case triton::arch::ID_REG_AARCH64_S23: return (*((triton::uint32*)(this->q23)));
794 case triton::arch::ID_REG_AARCH64_H23: return (*((triton::uint16*)(this->q23)));
795 case triton::arch::ID_REG_AARCH64_B23: return (*((triton::uint8*)(this->q23)));
796 case triton::arch::ID_REG_AARCH64_Q24: return triton::utils::cast<triton::uint128>(this->q24);
797 case triton::arch::ID_REG_AARCH64_D24: return (*((triton::uint64*)(this->q24)));
798 case triton::arch::ID_REG_AARCH64_S24: return (*((triton::uint32*)(this->q24)));
799 case triton::arch::ID_REG_AARCH64_H24: return (*((triton::uint16*)(this->q24)));
800 case triton::arch::ID_REG_AARCH64_B24: return (*((triton::uint8*)(this->q24)));
801 case triton::arch::ID_REG_AARCH64_Q25: return triton::utils::cast<triton::uint128>(this->q25);
802 case triton::arch::ID_REG_AARCH64_D25: return (*((triton::uint64*)(this->q25)));
803 case triton::arch::ID_REG_AARCH64_S25: return (*((triton::uint32*)(this->q25)));
804 case triton::arch::ID_REG_AARCH64_H25: return (*((triton::uint16*)(this->q25)));
805 case triton::arch::ID_REG_AARCH64_B25: return (*((triton::uint8*)(this->q25)));
806 case triton::arch::ID_REG_AARCH64_Q26: return triton::utils::cast<triton::uint128>(this->q26);
807 case triton::arch::ID_REG_AARCH64_D26: return (*((triton::uint64*)(this->q26)));
808 case triton::arch::ID_REG_AARCH64_S26: return (*((triton::uint32*)(this->q26)));
809 case triton::arch::ID_REG_AARCH64_H26: return (*((triton::uint16*)(this->q26)));
810 case triton::arch::ID_REG_AARCH64_B26: return (*((triton::uint8*)(this->q26)));
811 case triton::arch::ID_REG_AARCH64_Q27: return triton::utils::cast<triton::uint128>(this->q27);
812 case triton::arch::ID_REG_AARCH64_D27: return (*((triton::uint64*)(this->q27)));
813 case triton::arch::ID_REG_AARCH64_S27: return (*((triton::uint32*)(this->q27)));
814 case triton::arch::ID_REG_AARCH64_H27: return (*((triton::uint16*)(this->q27)));
815 case triton::arch::ID_REG_AARCH64_B27: return (*((triton::uint8*)(this->q27)));
816 case triton::arch::ID_REG_AARCH64_Q28: return triton::utils::cast<triton::uint128>(this->q28);
817 case triton::arch::ID_REG_AARCH64_D28: return (*((triton::uint64*)(this->q28)));
818 case triton::arch::ID_REG_AARCH64_S28: return (*((triton::uint32*)(this->q28)));
819 case triton::arch::ID_REG_AARCH64_H28: return (*((triton::uint16*)(this->q28)));
820 case triton::arch::ID_REG_AARCH64_B28: return (*((triton::uint8*)(this->q28)));
821 case triton::arch::ID_REG_AARCH64_Q29: return triton::utils::cast<triton::uint128>(this->q29);
822 case triton::arch::ID_REG_AARCH64_D29: return (*((triton::uint64*)(this->q29)));
823 case triton::arch::ID_REG_AARCH64_S29: return (*((triton::uint32*)(this->q29)));
824 case triton::arch::ID_REG_AARCH64_H29: return (*((triton::uint16*)(this->q29)));
825 case triton::arch::ID_REG_AARCH64_B29: return (*((triton::uint8*)(this->q29)));
826 case triton::arch::ID_REG_AARCH64_Q30: return triton::utils::cast<triton::uint128>(this->q30);
827 case triton::arch::ID_REG_AARCH64_D30: return (*((triton::uint64*)(this->q30)));
828 case triton::arch::ID_REG_AARCH64_S30: return (*((triton::uint32*)(this->q30)));
829 case triton::arch::ID_REG_AARCH64_H30: return (*((triton::uint16*)(this->q30)));
830 case triton::arch::ID_REG_AARCH64_B30: return (*((triton::uint8*)(this->q30)));
831 case triton::arch::ID_REG_AARCH64_Q31: return triton::utils::cast<triton::uint128>(this->q31);
832 case triton::arch::ID_REG_AARCH64_D31: return (*((triton::uint64*)(this->q31)));
833 case triton::arch::ID_REG_AARCH64_S31: return (*((triton::uint32*)(this->q31)));
834 case triton::arch::ID_REG_AARCH64_H31: return (*((triton::uint16*)(this->q31)));
835 case triton::arch::ID_REG_AARCH64_B31: return (*((triton::uint8*)(this->q31)));
836 case triton::arch::ID_REG_AARCH64_V0: return triton::utils::cast<triton::uint128>(this->q0);
837 case triton::arch::ID_REG_AARCH64_V1: return triton::utils::cast<triton::uint128>(this->q1);
838 case triton::arch::ID_REG_AARCH64_V2: return triton::utils::cast<triton::uint128>(this->q2);
839 case triton::arch::ID_REG_AARCH64_V3: return triton::utils::cast<triton::uint128>(this->q3);
840 case triton::arch::ID_REG_AARCH64_V4: return triton::utils::cast<triton::uint128>(this->q4);
841 case triton::arch::ID_REG_AARCH64_V5: return triton::utils::cast<triton::uint128>(this->q5);
842 case triton::arch::ID_REG_AARCH64_V6: return triton::utils::cast<triton::uint128>(this->q6);
843 case triton::arch::ID_REG_AARCH64_V7: return triton::utils::cast<triton::uint128>(this->q7);
844 case triton::arch::ID_REG_AARCH64_V8: return triton::utils::cast<triton::uint128>(this->q8);
845 case triton::arch::ID_REG_AARCH64_V9: return triton::utils::cast<triton::uint128>(this->q9);
846 case triton::arch::ID_REG_AARCH64_V10: return triton::utils::cast<triton::uint128>(this->q10);
847 case triton::arch::ID_REG_AARCH64_V11: return triton::utils::cast<triton::uint128>(this->q11);
848 case triton::arch::ID_REG_AARCH64_V12: return triton::utils::cast<triton::uint128>(this->q12);
849 case triton::arch::ID_REG_AARCH64_V13: return triton::utils::cast<triton::uint128>(this->q13);
850 case triton::arch::ID_REG_AARCH64_V14: return triton::utils::cast<triton::uint128>(this->q14);
851 case triton::arch::ID_REG_AARCH64_V15: return triton::utils::cast<triton::uint128>(this->q15);
852 case triton::arch::ID_REG_AARCH64_V16: return triton::utils::cast<triton::uint128>(this->q16);
853 case triton::arch::ID_REG_AARCH64_V17: return triton::utils::cast<triton::uint128>(this->q17);
854 case triton::arch::ID_REG_AARCH64_V18: return triton::utils::cast<triton::uint128>(this->q18);
855 case triton::arch::ID_REG_AARCH64_V19: return triton::utils::cast<triton::uint128>(this->q19);
856 case triton::arch::ID_REG_AARCH64_V20: return triton::utils::cast<triton::uint128>(this->q20);
857 case triton::arch::ID_REG_AARCH64_V21: return triton::utils::cast<triton::uint128>(this->q21);
858 case triton::arch::ID_REG_AARCH64_V22: return triton::utils::cast<triton::uint128>(this->q22);
859 case triton::arch::ID_REG_AARCH64_V23: return triton::utils::cast<triton::uint128>(this->q23);
860 case triton::arch::ID_REG_AARCH64_V24: return triton::utils::cast<triton::uint128>(this->q24);
861 case triton::arch::ID_REG_AARCH64_V25: return triton::utils::cast<triton::uint128>(this->q25);
862 case triton::arch::ID_REG_AARCH64_V26: return triton::utils::cast<triton::uint128>(this->q26);
863 case triton::arch::ID_REG_AARCH64_V27: return triton::utils::cast<triton::uint128>(this->q27);
864 case triton::arch::ID_REG_AARCH64_V28: return triton::utils::cast<triton::uint128>(this->q28);
865 case triton::arch::ID_REG_AARCH64_V29: return triton::utils::cast<triton::uint128>(this->q29);
866 case triton::arch::ID_REG_AARCH64_V30: return triton::utils::cast<triton::uint128>(this->q30);
867 case triton::arch::ID_REG_AARCH64_V31: return triton::utils::cast<triton::uint128>(this->q31);
868
870 #define SYS_REG_SPEC(UPPER_NAME, LOWER_NAME, _2, _3, _4, _5) \
871 case triton::arch::ID_REG_AARCH64_##UPPER_NAME: return (*((triton::uint64*)(this->LOWER_NAME)));
872 #define REG_SPEC(_1, _2, _3, _4, _5, _6)
873 #define REG_SPEC_NO_CAPSTONE(_1, _2, _3, _4, _5, _6)
874 #include "triton/aarch64.spec"
875
876 default:
877 throw triton::exceptions::Cpu("AArch64Cpu::getConcreteRegisterValue(): Invalid register.");
878 }
879
880 return value;
881 }
882
883
885 if (execCallbacks && this->callbacks)
887 this->memory[addr] = value;
888 }
889
890
891 void AArch64Cpu::setConcreteMemoryValue(const triton::arch::MemoryAccess& mem, const triton::uint512& value, bool execCallbacks) {
892 triton::uint64 addr = mem.getAddress();
893 triton::uint32 size = mem.getSize();
894 triton::uint512 cv = value;
895
896 if (cv > mem.getMaxValue())
897 throw triton::exceptions::Register("AArch64Cpu::setConcreteMemoryValue(): You cannot set this concrete value (too big) to this memory access.");
898
899 if (size == 0 || size > triton::size::dqqword)
900 throw triton::exceptions::Cpu("AArch64Cpu::setConcreteMemoryValue(): Invalid size memory.");
901
902 if (execCallbacks && this->callbacks)
904
905 for (triton::uint32 i = 0; i < size; i++) {
906 this->memory[addr+i] = static_cast<triton::uint8>((cv & 0xff));
907 cv >>= 8;
908 }
909 }
910
911
912 void AArch64Cpu::setConcreteMemoryAreaValue(triton::uint64 baseAddr, const std::vector<triton::uint8>& values, bool execCallbacks) {
913 this->memory.reserve(values.size() + this->memory.size());
914 for (triton::usize index = 0; index < values.size(); index++) {
915 this->setConcreteMemoryValue(baseAddr+index, values[index], execCallbacks);
916 }
917 }
918
919
920 void AArch64Cpu::setConcreteMemoryAreaValue(triton::uint64 baseAddr, const void* area, triton::usize size, bool execCallbacks) {
921 this->memory.reserve(size + this->memory.size());
922 for (triton::usize index = 0; index < size; index++) {
923 this->setConcreteMemoryValue(baseAddr+index, reinterpret_cast<const triton::uint8*>(area)[index], execCallbacks);
924 }
925 }
926
927
928 void AArch64Cpu::setConcreteRegisterValue(const triton::arch::Register& reg, const triton::uint512& value, bool execCallbacks) {
929 if (value > reg.getMaxValue())
930 throw triton::exceptions::Register("AArch64Cpu::setConcreteRegisterValue(): You cannot set this concrete value (too big) to this register.");
931
932 if (execCallbacks && this->callbacks)
934
935 switch (reg.getId()) {
936 case triton::arch::ID_REG_AARCH64_X0: (*((triton::uint64*)(this->x0))) = static_cast<triton::uint64>(value); break;
937 case triton::arch::ID_REG_AARCH64_W0: (*((triton::uint32*)(this->x0))) = static_cast<triton::uint32>(value); break;
938 case triton::arch::ID_REG_AARCH64_X1: (*((triton::uint64*)(this->x1))) = static_cast<triton::uint64>(value); break;
939 case triton::arch::ID_REG_AARCH64_W1: (*((triton::uint32*)(this->x1))) = static_cast<triton::uint32>(value); break;
940 case triton::arch::ID_REG_AARCH64_X2: (*((triton::uint64*)(this->x2))) = static_cast<triton::uint64>(value); break;
941 case triton::arch::ID_REG_AARCH64_W2: (*((triton::uint32*)(this->x2))) = static_cast<triton::uint32>(value); break;
942 case triton::arch::ID_REG_AARCH64_X3: (*((triton::uint64*)(this->x3))) = static_cast<triton::uint64>(value); break;
943 case triton::arch::ID_REG_AARCH64_W3: (*((triton::uint32*)(this->x3))) = static_cast<triton::uint32>(value); break;
944 case triton::arch::ID_REG_AARCH64_X4: (*((triton::uint64*)(this->x4))) = static_cast<triton::uint64>(value); break;
945 case triton::arch::ID_REG_AARCH64_W4: (*((triton::uint32*)(this->x4))) = static_cast<triton::uint32>(value); break;
946 case triton::arch::ID_REG_AARCH64_X5: (*((triton::uint64*)(this->x5))) = static_cast<triton::uint64>(value); break;
947 case triton::arch::ID_REG_AARCH64_W5: (*((triton::uint32*)(this->x5))) = static_cast<triton::uint32>(value); break;
948 case triton::arch::ID_REG_AARCH64_X6: (*((triton::uint64*)(this->x6))) = static_cast<triton::uint64>(value); break;
949 case triton::arch::ID_REG_AARCH64_W6: (*((triton::uint32*)(this->x6))) = static_cast<triton::uint32>(value); break;
950 case triton::arch::ID_REG_AARCH64_X7: (*((triton::uint64*)(this->x7))) = static_cast<triton::uint64>(value); break;
951 case triton::arch::ID_REG_AARCH64_W7: (*((triton::uint32*)(this->x7))) = static_cast<triton::uint32>(value); break;
952 case triton::arch::ID_REG_AARCH64_X8: (*((triton::uint64*)(this->x8))) = static_cast<triton::uint64>(value); break;
953 case triton::arch::ID_REG_AARCH64_W8: (*((triton::uint32*)(this->x8))) = static_cast<triton::uint32>(value); break;
954 case triton::arch::ID_REG_AARCH64_X9: (*((triton::uint64*)(this->x9))) = static_cast<triton::uint64>(value); break;
955 case triton::arch::ID_REG_AARCH64_W9: (*((triton::uint32*)(this->x9))) = static_cast<triton::uint32>(value); break;
956 case triton::arch::ID_REG_AARCH64_X10: (*((triton::uint64*)(this->x10))) = static_cast<triton::uint64>(value); break;
957 case triton::arch::ID_REG_AARCH64_W10: (*((triton::uint32*)(this->x10))) = static_cast<triton::uint32>(value); break;
958 case triton::arch::ID_REG_AARCH64_X11: (*((triton::uint64*)(this->x11))) = static_cast<triton::uint64>(value); break;
959 case triton::arch::ID_REG_AARCH64_W11: (*((triton::uint32*)(this->x11))) = static_cast<triton::uint32>(value); break;
960 case triton::arch::ID_REG_AARCH64_X12: (*((triton::uint64*)(this->x12))) = static_cast<triton::uint64>(value); break;
961 case triton::arch::ID_REG_AARCH64_W12: (*((triton::uint32*)(this->x12))) = static_cast<triton::uint32>(value); break;
962 case triton::arch::ID_REG_AARCH64_X13: (*((triton::uint64*)(this->x13))) = static_cast<triton::uint64>(value); break;
963 case triton::arch::ID_REG_AARCH64_W13: (*((triton::uint32*)(this->x13))) = static_cast<triton::uint32>(value); break;
964 case triton::arch::ID_REG_AARCH64_X14: (*((triton::uint64*)(this->x14))) = static_cast<triton::uint64>(value); break;
965 case triton::arch::ID_REG_AARCH64_W14: (*((triton::uint32*)(this->x14))) = static_cast<triton::uint32>(value); break;
966 case triton::arch::ID_REG_AARCH64_X15: (*((triton::uint64*)(this->x15))) = static_cast<triton::uint64>(value); break;
967 case triton::arch::ID_REG_AARCH64_W15: (*((triton::uint32*)(this->x15))) = static_cast<triton::uint32>(value); break;
968 case triton::arch::ID_REG_AARCH64_X16: (*((triton::uint64*)(this->x16))) = static_cast<triton::uint64>(value); break;
969 case triton::arch::ID_REG_AARCH64_W16: (*((triton::uint32*)(this->x16))) = static_cast<triton::uint32>(value); break;
970 case triton::arch::ID_REG_AARCH64_X17: (*((triton::uint64*)(this->x17))) = static_cast<triton::uint64>(value); break;
971 case triton::arch::ID_REG_AARCH64_W17: (*((triton::uint32*)(this->x17))) = static_cast<triton::uint32>(value); break;
972 case triton::arch::ID_REG_AARCH64_X18: (*((triton::uint64*)(this->x18))) = static_cast<triton::uint64>(value); break;
973 case triton::arch::ID_REG_AARCH64_W18: (*((triton::uint32*)(this->x18))) = static_cast<triton::uint32>(value); break;
974 case triton::arch::ID_REG_AARCH64_X19: (*((triton::uint64*)(this->x19))) = static_cast<triton::uint64>(value); break;
975 case triton::arch::ID_REG_AARCH64_W19: (*((triton::uint32*)(this->x19))) = static_cast<triton::uint32>(value); break;
976 case triton::arch::ID_REG_AARCH64_X20: (*((triton::uint64*)(this->x20))) = static_cast<triton::uint64>(value); break;
977 case triton::arch::ID_REG_AARCH64_W20: (*((triton::uint32*)(this->x20))) = static_cast<triton::uint32>(value); break;
978 case triton::arch::ID_REG_AARCH64_X21: (*((triton::uint64*)(this->x21))) = static_cast<triton::uint64>(value); break;
979 case triton::arch::ID_REG_AARCH64_W21: (*((triton::uint32*)(this->x21))) = static_cast<triton::uint32>(value); break;
980 case triton::arch::ID_REG_AARCH64_X22: (*((triton::uint64*)(this->x22))) = static_cast<triton::uint64>(value); break;
981 case triton::arch::ID_REG_AARCH64_W22: (*((triton::uint32*)(this->x22))) = static_cast<triton::uint32>(value); break;
982 case triton::arch::ID_REG_AARCH64_X23: (*((triton::uint64*)(this->x23))) = static_cast<triton::uint64>(value); break;
983 case triton::arch::ID_REG_AARCH64_W23: (*((triton::uint32*)(this->x23))) = static_cast<triton::uint32>(value); break;
984 case triton::arch::ID_REG_AARCH64_X24: (*((triton::uint64*)(this->x24))) = static_cast<triton::uint64>(value); break;
985 case triton::arch::ID_REG_AARCH64_W24: (*((triton::uint32*)(this->x24))) = static_cast<triton::uint32>(value); break;
986 case triton::arch::ID_REG_AARCH64_X25: (*((triton::uint64*)(this->x25))) = static_cast<triton::uint64>(value); break;
987 case triton::arch::ID_REG_AARCH64_W25: (*((triton::uint32*)(this->x25))) = static_cast<triton::uint32>(value); break;
988 case triton::arch::ID_REG_AARCH64_X26: (*((triton::uint64*)(this->x26))) = static_cast<triton::uint64>(value); break;
989 case triton::arch::ID_REG_AARCH64_W26: (*((triton::uint32*)(this->x26))) = static_cast<triton::uint32>(value); break;
990 case triton::arch::ID_REG_AARCH64_X27: (*((triton::uint64*)(this->x27))) = static_cast<triton::uint64>(value); break;
991 case triton::arch::ID_REG_AARCH64_W27: (*((triton::uint32*)(this->x27))) = static_cast<triton::uint32>(value); break;
992 case triton::arch::ID_REG_AARCH64_X28: (*((triton::uint64*)(this->x28))) = static_cast<triton::uint64>(value); break;
993 case triton::arch::ID_REG_AARCH64_W28: (*((triton::uint32*)(this->x28))) = static_cast<triton::uint32>(value); break;
994 case triton::arch::ID_REG_AARCH64_X29: (*((triton::uint64*)(this->x29))) = static_cast<triton::uint64>(value); break;
995 case triton::arch::ID_REG_AARCH64_W29: (*((triton::uint32*)(this->x29))) = static_cast<triton::uint32>(value); break;
996 case triton::arch::ID_REG_AARCH64_X30: (*((triton::uint64*)(this->x30))) = static_cast<triton::uint64>(value); break;
997 case triton::arch::ID_REG_AARCH64_W30: (*((triton::uint32*)(this->x30))) = static_cast<triton::uint32>(value); break;
998 case triton::arch::ID_REG_AARCH64_SP: (*((triton::uint64*)(this->sp))) = static_cast<triton::uint64>(value); break;
999 case triton::arch::ID_REG_AARCH64_WSP: (*((triton::uint32*)(this->sp))) = static_cast<triton::uint32>(value); break;
1000 case triton::arch::ID_REG_AARCH64_PC: (*((triton::uint64*)(this->pc))) = static_cast<triton::uint64>(value); break;
1001 case triton::arch::ID_REG_AARCH64_SPSR: (*((triton::uint32*)(this->spsr))) = static_cast<triton::uint32>(value); break;
1002
1003 case triton::arch::ID_REG_AARCH64_XZR: break; // Just do nothing
1004 case triton::arch::ID_REG_AARCH64_WZR: break; // Just do nothing
1005
1006 case triton::arch::ID_REG_AARCH64_N: {
1007 triton::uint32 b = (*((triton::uint32*)(this->spsr)));
1008 (*((triton::uint32*)(this->spsr))) = !value.is_zero() ? b | (1 << 31) : b & ~(1 << 31);
1009 break;
1010 }
1011 case triton::arch::ID_REG_AARCH64_Z: {
1012 triton::uint32 b = (*((triton::uint32*)(this->spsr)));
1013 (*((triton::uint32*)(this->spsr))) = !value.is_zero() ? b | (1 << 30) : b & ~(1 << 30);
1014 break;
1015 }
1016 case triton::arch::ID_REG_AARCH64_C: {
1017 triton::uint32 b = (*((triton::uint32*)(this->spsr)));
1018 (*((triton::uint32*)(this->spsr))) = !value.is_zero() ? b | (1 << 29) : b & ~(1 << 29);
1019 break;
1020 }
1021 case triton::arch::ID_REG_AARCH64_V: {
1022 triton::uint32 b = (*((triton::uint32*)(this->spsr)));
1023 (*((triton::uint32*)(this->spsr))) = !value.is_zero() ? b | (1 << 28) : b & ~(1 << 28);
1024 break;
1025 }
1026 case triton::arch::ID_REG_AARCH64_Q0: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q0); break;
1027 case triton::arch::ID_REG_AARCH64_Q1: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q1); break;
1028 case triton::arch::ID_REG_AARCH64_Q2: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q2); break;
1029 case triton::arch::ID_REG_AARCH64_Q3: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q3); break;
1030 case triton::arch::ID_REG_AARCH64_Q4: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q4); break;
1031 case triton::arch::ID_REG_AARCH64_Q5: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q5); break;
1032 case triton::arch::ID_REG_AARCH64_Q6: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q6); break;
1033 case triton::arch::ID_REG_AARCH64_Q7: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q7); break;
1034 case triton::arch::ID_REG_AARCH64_Q8: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q8); break;
1035 case triton::arch::ID_REG_AARCH64_Q9: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q9); break;
1036 case triton::arch::ID_REG_AARCH64_Q10: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q10); break;
1037 case triton::arch::ID_REG_AARCH64_Q11: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q11); break;
1038 case triton::arch::ID_REG_AARCH64_Q12: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q12); break;
1039 case triton::arch::ID_REG_AARCH64_Q13: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q13); break;
1040 case triton::arch::ID_REG_AARCH64_Q14: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q14); break;
1041 case triton::arch::ID_REG_AARCH64_Q15: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q15); break;
1042 case triton::arch::ID_REG_AARCH64_Q16: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q16); break;
1043 case triton::arch::ID_REG_AARCH64_Q17: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q17); break;
1044 case triton::arch::ID_REG_AARCH64_Q18: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q18); break;
1045 case triton::arch::ID_REG_AARCH64_Q19: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q19); break;
1046 case triton::arch::ID_REG_AARCH64_Q20: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q20); break;
1047 case triton::arch::ID_REG_AARCH64_Q21: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q21); break;
1048 case triton::arch::ID_REG_AARCH64_Q22: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q22); break;
1049 case triton::arch::ID_REG_AARCH64_Q23: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q23); break;
1050 case triton::arch::ID_REG_AARCH64_Q24: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q24); break;
1051 case triton::arch::ID_REG_AARCH64_Q25: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q25); break;
1052 case triton::arch::ID_REG_AARCH64_Q26: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q26); break;
1053 case triton::arch::ID_REG_AARCH64_Q27: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q27); break;
1054 case triton::arch::ID_REG_AARCH64_Q28: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q28); break;
1055 case triton::arch::ID_REG_AARCH64_Q29: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q29); break;
1056 case triton::arch::ID_REG_AARCH64_Q30: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q30); break;
1057 case triton::arch::ID_REG_AARCH64_Q31: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q31); break;
1058
1059 case triton::arch::ID_REG_AARCH64_V0: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q0); break;
1060 case triton::arch::ID_REG_AARCH64_V1: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q1); break;
1061 case triton::arch::ID_REG_AARCH64_V2: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q2); break;
1062 case triton::arch::ID_REG_AARCH64_V3: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q3); break;
1063 case triton::arch::ID_REG_AARCH64_V4: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q4); break;
1064 case triton::arch::ID_REG_AARCH64_V5: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q5); break;
1065 case triton::arch::ID_REG_AARCH64_V6: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q6); break;
1066 case triton::arch::ID_REG_AARCH64_V7: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q7); break;
1067 case triton::arch::ID_REG_AARCH64_V8: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q8); break;
1068 case triton::arch::ID_REG_AARCH64_V9: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q9); break;
1069 case triton::arch::ID_REG_AARCH64_V10: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q10); break;
1070 case triton::arch::ID_REG_AARCH64_V11: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q11); break;
1071 case triton::arch::ID_REG_AARCH64_V12: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q12); break;
1072 case triton::arch::ID_REG_AARCH64_V13: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q13); break;
1073 case triton::arch::ID_REG_AARCH64_V14: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q14); break;
1074 case triton::arch::ID_REG_AARCH64_V15: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q15); break;
1075 case triton::arch::ID_REG_AARCH64_V16: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q16); break;
1076 case triton::arch::ID_REG_AARCH64_V17: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q17); break;
1077 case triton::arch::ID_REG_AARCH64_V18: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q18); break;
1078 case triton::arch::ID_REG_AARCH64_V19: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q19); break;
1079 case triton::arch::ID_REG_AARCH64_V20: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q20); break;
1080 case triton::arch::ID_REG_AARCH64_V21: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q21); break;
1081 case triton::arch::ID_REG_AARCH64_V22: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q22); break;
1082 case triton::arch::ID_REG_AARCH64_V23: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q23); break;
1083 case triton::arch::ID_REG_AARCH64_V24: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q24); break;
1084 case triton::arch::ID_REG_AARCH64_V25: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q25); break;
1085 case triton::arch::ID_REG_AARCH64_V26: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q26); break;
1086 case triton::arch::ID_REG_AARCH64_V27: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q27); break;
1087 case triton::arch::ID_REG_AARCH64_V28: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q28); break;
1088 case triton::arch::ID_REG_AARCH64_V29: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q29); break;
1089 case triton::arch::ID_REG_AARCH64_V30: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q30); break;
1090 case triton::arch::ID_REG_AARCH64_V31: triton::utils::fromUintToBuffer(static_cast<triton::uint128>(value), this->q31); break;
1091
1092 case triton::arch::ID_REG_AARCH64_D0: (*((triton::uint64*)(this->q0))) = static_cast<triton::uint64>(value); break;
1093 case triton::arch::ID_REG_AARCH64_D1: (*((triton::uint64*)(this->q1))) = static_cast<triton::uint64>(value); break;
1094 case triton::arch::ID_REG_AARCH64_D2: (*((triton::uint64*)(this->q2))) = static_cast<triton::uint64>(value); break;
1095 case triton::arch::ID_REG_AARCH64_D3: (*((triton::uint64*)(this->q3))) = static_cast<triton::uint64>(value); break;
1096 case triton::arch::ID_REG_AARCH64_D4: (*((triton::uint64*)(this->q4))) = static_cast<triton::uint64>(value); break;
1097 case triton::arch::ID_REG_AARCH64_D5: (*((triton::uint64*)(this->q5))) = static_cast<triton::uint64>(value); break;
1098 case triton::arch::ID_REG_AARCH64_D6: (*((triton::uint64*)(this->q6))) = static_cast<triton::uint64>(value); break;
1099 case triton::arch::ID_REG_AARCH64_D7: (*((triton::uint64*)(this->q7))) = static_cast<triton::uint64>(value); break;
1100 case triton::arch::ID_REG_AARCH64_D8: (*((triton::uint64*)(this->q8))) = static_cast<triton::uint64>(value); break;
1101 case triton::arch::ID_REG_AARCH64_D9: (*((triton::uint64*)(this->q9))) = static_cast<triton::uint64>(value); break;
1102 case triton::arch::ID_REG_AARCH64_D10: (*((triton::uint64*)(this->q10))) = static_cast<triton::uint64>(value); break;
1103 case triton::arch::ID_REG_AARCH64_D11: (*((triton::uint64*)(this->q11))) = static_cast<triton::uint64>(value); break;
1104 case triton::arch::ID_REG_AARCH64_D12: (*((triton::uint64*)(this->q12))) = static_cast<triton::uint64>(value); break;
1105 case triton::arch::ID_REG_AARCH64_D13: (*((triton::uint64*)(this->q13))) = static_cast<triton::uint64>(value); break;
1106 case triton::arch::ID_REG_AARCH64_D14: (*((triton::uint64*)(this->q14))) = static_cast<triton::uint64>(value); break;
1107 case triton::arch::ID_REG_AARCH64_D15: (*((triton::uint64*)(this->q15))) = static_cast<triton::uint64>(value); break;
1108 case triton::arch::ID_REG_AARCH64_D16: (*((triton::uint64*)(this->q16))) = static_cast<triton::uint64>(value); break;
1109 case triton::arch::ID_REG_AARCH64_D17: (*((triton::uint64*)(this->q17))) = static_cast<triton::uint64>(value); break;
1110 case triton::arch::ID_REG_AARCH64_D18: (*((triton::uint64*)(this->q18))) = static_cast<triton::uint64>(value); break;
1111 case triton::arch::ID_REG_AARCH64_D19: (*((triton::uint64*)(this->q19))) = static_cast<triton::uint64>(value); break;
1112 case triton::arch::ID_REG_AARCH64_D20: (*((triton::uint64*)(this->q20))) = static_cast<triton::uint64>(value); break;
1113 case triton::arch::ID_REG_AARCH64_D21: (*((triton::uint64*)(this->q21))) = static_cast<triton::uint64>(value); break;
1114 case triton::arch::ID_REG_AARCH64_D22: (*((triton::uint64*)(this->q22))) = static_cast<triton::uint64>(value); break;
1115 case triton::arch::ID_REG_AARCH64_D23: (*((triton::uint64*)(this->q23))) = static_cast<triton::uint64>(value); break;
1116 case triton::arch::ID_REG_AARCH64_D24: (*((triton::uint64*)(this->q24))) = static_cast<triton::uint64>(value); break;
1117 case triton::arch::ID_REG_AARCH64_D25: (*((triton::uint64*)(this->q25))) = static_cast<triton::uint64>(value); break;
1118 case triton::arch::ID_REG_AARCH64_D26: (*((triton::uint64*)(this->q26))) = static_cast<triton::uint64>(value); break;
1119 case triton::arch::ID_REG_AARCH64_D27: (*((triton::uint64*)(this->q27))) = static_cast<triton::uint64>(value); break;
1120 case triton::arch::ID_REG_AARCH64_D28: (*((triton::uint64*)(this->q28))) = static_cast<triton::uint64>(value); break;
1121 case triton::arch::ID_REG_AARCH64_D29: (*((triton::uint64*)(this->q29))) = static_cast<triton::uint64>(value); break;
1122 case triton::arch::ID_REG_AARCH64_D30: (*((triton::uint64*)(this->q30))) = static_cast<triton::uint64>(value); break;
1123 case triton::arch::ID_REG_AARCH64_D31: (*((triton::uint64*)(this->q31))) = static_cast<triton::uint64>(value); break;
1124
1125 case triton::arch::ID_REG_AARCH64_S0: (*((triton::uint32*)(this->q0))) = static_cast<triton::uint32>(value); break;
1126 case triton::arch::ID_REG_AARCH64_S1: (*((triton::uint32*)(this->q1))) = static_cast<triton::uint32>(value); break;
1127 case triton::arch::ID_REG_AARCH64_S2: (*((triton::uint32*)(this->q2))) = static_cast<triton::uint32>(value); break;
1128 case triton::arch::ID_REG_AARCH64_S3: (*((triton::uint32*)(this->q3))) = static_cast<triton::uint32>(value); break;
1129 case triton::arch::ID_REG_AARCH64_S4: (*((triton::uint32*)(this->q4))) = static_cast<triton::uint32>(value); break;
1130 case triton::arch::ID_REG_AARCH64_S5: (*((triton::uint32*)(this->q5))) = static_cast<triton::uint32>(value); break;
1131 case triton::arch::ID_REG_AARCH64_S6: (*((triton::uint32*)(this->q6))) = static_cast<triton::uint32>(value); break;
1132 case triton::arch::ID_REG_AARCH64_S7: (*((triton::uint32*)(this->q7))) = static_cast<triton::uint32>(value); break;
1133 case triton::arch::ID_REG_AARCH64_S8: (*((triton::uint32*)(this->q8))) = static_cast<triton::uint32>(value); break;
1134 case triton::arch::ID_REG_AARCH64_S9: (*((triton::uint32*)(this->q9))) = static_cast<triton::uint32>(value); break;
1135 case triton::arch::ID_REG_AARCH64_S10: (*((triton::uint32*)(this->q10))) = static_cast<triton::uint32>(value); break;
1136 case triton::arch::ID_REG_AARCH64_S11: (*((triton::uint32*)(this->q11))) = static_cast<triton::uint32>(value); break;
1137 case triton::arch::ID_REG_AARCH64_S12: (*((triton::uint32*)(this->q12))) = static_cast<triton::uint32>(value); break;
1138 case triton::arch::ID_REG_AARCH64_S13: (*((triton::uint32*)(this->q13))) = static_cast<triton::uint32>(value); break;
1139 case triton::arch::ID_REG_AARCH64_S14: (*((triton::uint32*)(this->q14))) = static_cast<triton::uint32>(value); break;
1140 case triton::arch::ID_REG_AARCH64_S15: (*((triton::uint32*)(this->q15))) = static_cast<triton::uint32>(value); break;
1141 case triton::arch::ID_REG_AARCH64_S16: (*((triton::uint32*)(this->q16))) = static_cast<triton::uint32>(value); break;
1142 case triton::arch::ID_REG_AARCH64_S17: (*((triton::uint32*)(this->q17))) = static_cast<triton::uint32>(value); break;
1143 case triton::arch::ID_REG_AARCH64_S18: (*((triton::uint32*)(this->q18))) = static_cast<triton::uint32>(value); break;
1144 case triton::arch::ID_REG_AARCH64_S19: (*((triton::uint32*)(this->q19))) = static_cast<triton::uint32>(value); break;
1145 case triton::arch::ID_REG_AARCH64_S20: (*((triton::uint32*)(this->q20))) = static_cast<triton::uint32>(value); break;
1146 case triton::arch::ID_REG_AARCH64_S21: (*((triton::uint32*)(this->q21))) = static_cast<triton::uint32>(value); break;
1147 case triton::arch::ID_REG_AARCH64_S22: (*((triton::uint32*)(this->q22))) = static_cast<triton::uint32>(value); break;
1148 case triton::arch::ID_REG_AARCH64_S23: (*((triton::uint32*)(this->q23))) = static_cast<triton::uint32>(value); break;
1149 case triton::arch::ID_REG_AARCH64_S24: (*((triton::uint32*)(this->q24))) = static_cast<triton::uint32>(value); break;
1150 case triton::arch::ID_REG_AARCH64_S25: (*((triton::uint32*)(this->q25))) = static_cast<triton::uint32>(value); break;
1151 case triton::arch::ID_REG_AARCH64_S26: (*((triton::uint32*)(this->q26))) = static_cast<triton::uint32>(value); break;
1152 case triton::arch::ID_REG_AARCH64_S27: (*((triton::uint32*)(this->q27))) = static_cast<triton::uint32>(value); break;
1153 case triton::arch::ID_REG_AARCH64_S28: (*((triton::uint32*)(this->q28))) = static_cast<triton::uint32>(value); break;
1154 case triton::arch::ID_REG_AARCH64_S29: (*((triton::uint32*)(this->q29))) = static_cast<triton::uint32>(value); break;
1155 case triton::arch::ID_REG_AARCH64_S30: (*((triton::uint32*)(this->q30))) = static_cast<triton::uint32>(value); break;
1156 case triton::arch::ID_REG_AARCH64_S31: (*((triton::uint32*)(this->q31))) = static_cast<triton::uint32>(value); break;
1157
1158 case triton::arch::ID_REG_AARCH64_H0: (*((triton::uint16*)(this->q0))) = static_cast<triton::uint16>(value); break;
1159 case triton::arch::ID_REG_AARCH64_H1: (*((triton::uint16*)(this->q1))) = static_cast<triton::uint16>(value); break;
1160 case triton::arch::ID_REG_AARCH64_H2: (*((triton::uint16*)(this->q2))) = static_cast<triton::uint16>(value); break;
1161 case triton::arch::ID_REG_AARCH64_H3: (*((triton::uint16*)(this->q3))) = static_cast<triton::uint16>(value); break;
1162 case triton::arch::ID_REG_AARCH64_H4: (*((triton::uint16*)(this->q4))) = static_cast<triton::uint16>(value); break;
1163 case triton::arch::ID_REG_AARCH64_H5: (*((triton::uint16*)(this->q5))) = static_cast<triton::uint16>(value); break;
1164 case triton::arch::ID_REG_AARCH64_H6: (*((triton::uint16*)(this->q6))) = static_cast<triton::uint16>(value); break;
1165 case triton::arch::ID_REG_AARCH64_H7: (*((triton::uint16*)(this->q7))) = static_cast<triton::uint16>(value); break;
1166 case triton::arch::ID_REG_AARCH64_H8: (*((triton::uint16*)(this->q8))) = static_cast<triton::uint16>(value); break;
1167 case triton::arch::ID_REG_AARCH64_H9: (*((triton::uint16*)(this->q9))) = static_cast<triton::uint16>(value); break;
1168 case triton::arch::ID_REG_AARCH64_H10: (*((triton::uint16*)(this->q10))) = static_cast<triton::uint16>(value); break;
1169 case triton::arch::ID_REG_AARCH64_H11: (*((triton::uint16*)(this->q11))) = static_cast<triton::uint16>(value); break;
1170 case triton::arch::ID_REG_AARCH64_H12: (*((triton::uint16*)(this->q12))) = static_cast<triton::uint16>(value); break;
1171 case triton::arch::ID_REG_AARCH64_H13: (*((triton::uint16*)(this->q13))) = static_cast<triton::uint16>(value); break;
1172 case triton::arch::ID_REG_AARCH64_H14: (*((triton::uint16*)(this->q14))) = static_cast<triton::uint16>(value); break;
1173 case triton::arch::ID_REG_AARCH64_H15: (*((triton::uint16*)(this->q15))) = static_cast<triton::uint16>(value); break;
1174 case triton::arch::ID_REG_AARCH64_H16: (*((triton::uint16*)(this->q16))) = static_cast<triton::uint16>(value); break;
1175 case triton::arch::ID_REG_AARCH64_H17: (*((triton::uint16*)(this->q17))) = static_cast<triton::uint16>(value); break;
1176 case triton::arch::ID_REG_AARCH64_H18: (*((triton::uint16*)(this->q18))) = static_cast<triton::uint16>(value); break;
1177 case triton::arch::ID_REG_AARCH64_H19: (*((triton::uint16*)(this->q19))) = static_cast<triton::uint16>(value); break;
1178 case triton::arch::ID_REG_AARCH64_H20: (*((triton::uint16*)(this->q20))) = static_cast<triton::uint16>(value); break;
1179 case triton::arch::ID_REG_AARCH64_H21: (*((triton::uint16*)(this->q21))) = static_cast<triton::uint16>(value); break;
1180 case triton::arch::ID_REG_AARCH64_H22: (*((triton::uint16*)(this->q22))) = static_cast<triton::uint16>(value); break;
1181 case triton::arch::ID_REG_AARCH64_H23: (*((triton::uint16*)(this->q23))) = static_cast<triton::uint16>(value); break;
1182 case triton::arch::ID_REG_AARCH64_H24: (*((triton::uint16*)(this->q24))) = static_cast<triton::uint16>(value); break;
1183 case triton::arch::ID_REG_AARCH64_H25: (*((triton::uint16*)(this->q25))) = static_cast<triton::uint16>(value); break;
1184 case triton::arch::ID_REG_AARCH64_H26: (*((triton::uint16*)(this->q26))) = static_cast<triton::uint16>(value); break;
1185 case triton::arch::ID_REG_AARCH64_H27: (*((triton::uint16*)(this->q27))) = static_cast<triton::uint16>(value); break;
1186 case triton::arch::ID_REG_AARCH64_H28: (*((triton::uint16*)(this->q28))) = static_cast<triton::uint16>(value); break;
1187 case triton::arch::ID_REG_AARCH64_H29: (*((triton::uint16*)(this->q29))) = static_cast<triton::uint16>(value); break;
1188 case triton::arch::ID_REG_AARCH64_H30: (*((triton::uint16*)(this->q30))) = static_cast<triton::uint16>(value); break;
1189 case triton::arch::ID_REG_AARCH64_H31: (*((triton::uint16*)(this->q31))) = static_cast<triton::uint16>(value); break;
1190
1191 case triton::arch::ID_REG_AARCH64_B0: (*((triton::uint8*)(this->q0))) = static_cast<triton::uint8>(value); break;
1192 case triton::arch::ID_REG_AARCH64_B1: (*((triton::uint8*)(this->q1))) = static_cast<triton::uint8>(value); break;
1193 case triton::arch::ID_REG_AARCH64_B2: (*((triton::uint8*)(this->q2))) = static_cast<triton::uint8>(value); break;
1194 case triton::arch::ID_REG_AARCH64_B3: (*((triton::uint8*)(this->q3))) = static_cast<triton::uint8>(value); break;
1195 case triton::arch::ID_REG_AARCH64_B4: (*((triton::uint8*)(this->q4))) = static_cast<triton::uint8>(value); break;
1196 case triton::arch::ID_REG_AARCH64_B5: (*((triton::uint8*)(this->q5))) = static_cast<triton::uint8>(value); break;
1197 case triton::arch::ID_REG_AARCH64_B6: (*((triton::uint8*)(this->q6))) = static_cast<triton::uint8>(value); break;
1198 case triton::arch::ID_REG_AARCH64_B7: (*((triton::uint8*)(this->q7))) = static_cast<triton::uint8>(value); break;
1199 case triton::arch::ID_REG_AARCH64_B8: (*((triton::uint8*)(this->q8))) = static_cast<triton::uint8>(value); break;
1200 case triton::arch::ID_REG_AARCH64_B9: (*((triton::uint8*)(this->q9))) = static_cast<triton::uint8>(value); break;
1201 case triton::arch::ID_REG_AARCH64_B10: (*((triton::uint8*)(this->q10))) = static_cast<triton::uint8>(value); break;
1202 case triton::arch::ID_REG_AARCH64_B11: (*((triton::uint8*)(this->q11))) = static_cast<triton::uint8>(value); break;
1203 case triton::arch::ID_REG_AARCH64_B12: (*((triton::uint8*)(this->q12))) = static_cast<triton::uint8>(value); break;
1204 case triton::arch::ID_REG_AARCH64_B13: (*((triton::uint8*)(this->q13))) = static_cast<triton::uint8>(value); break;
1205 case triton::arch::ID_REG_AARCH64_B14: (*((triton::uint8*)(this->q14))) = static_cast<triton::uint8>(value); break;
1206 case triton::arch::ID_REG_AARCH64_B15: (*((triton::uint8*)(this->q15))) = static_cast<triton::uint8>(value); break;
1207 case triton::arch::ID_REG_AARCH64_B16: (*((triton::uint8*)(this->q16))) = static_cast<triton::uint8>(value); break;
1208 case triton::arch::ID_REG_AARCH64_B17: (*((triton::uint8*)(this->q17))) = static_cast<triton::uint8>(value); break;
1209 case triton::arch::ID_REG_AARCH64_B18: (*((triton::uint8*)(this->q18))) = static_cast<triton::uint8>(value); break;
1210 case triton::arch::ID_REG_AARCH64_B19: (*((triton::uint8*)(this->q19))) = static_cast<triton::uint8>(value); break;
1211 case triton::arch::ID_REG_AARCH64_B20: (*((triton::uint8*)(this->q20))) = static_cast<triton::uint8>(value); break;
1212 case triton::arch::ID_REG_AARCH64_B21: (*((triton::uint8*)(this->q21))) = static_cast<triton::uint8>(value); break;
1213 case triton::arch::ID_REG_AARCH64_B22: (*((triton::uint8*)(this->q22))) = static_cast<triton::uint8>(value); break;
1214 case triton::arch::ID_REG_AARCH64_B23: (*((triton::uint8*)(this->q23))) = static_cast<triton::uint8>(value); break;
1215 case triton::arch::ID_REG_AARCH64_B24: (*((triton::uint8*)(this->q24))) = static_cast<triton::uint8>(value); break;
1216 case triton::arch::ID_REG_AARCH64_B25: (*((triton::uint8*)(this->q25))) = static_cast<triton::uint8>(value); break;
1217 case triton::arch::ID_REG_AARCH64_B26: (*((triton::uint8*)(this->q26))) = static_cast<triton::uint8>(value); break;
1218 case triton::arch::ID_REG_AARCH64_B27: (*((triton::uint8*)(this->q27))) = static_cast<triton::uint8>(value); break;
1219 case triton::arch::ID_REG_AARCH64_B28: (*((triton::uint8*)(this->q28))) = static_cast<triton::uint8>(value); break;
1220 case triton::arch::ID_REG_AARCH64_B29: (*((triton::uint8*)(this->q29))) = static_cast<triton::uint8>(value); break;
1221 case triton::arch::ID_REG_AARCH64_B30: (*((triton::uint8*)(this->q30))) = static_cast<triton::uint8>(value); break;
1222 case triton::arch::ID_REG_AARCH64_B31: (*((triton::uint8*)(this->q31))) = static_cast<triton::uint8>(value); break;
1223
1225 #define SYS_REG_SPEC(UPPER_NAME, LOWER_NAME, _2, _3, _4, _5) \
1226 case triton::arch::ID_REG_AARCH64_##UPPER_NAME: (*((triton::uint64*)(this->LOWER_NAME))) = static_cast<triton::uint64>(value); break;
1227 #define REG_SPEC(_1, _2, _3, _4, _5, _6)
1228 #define REG_SPEC_NO_CAPSTONE(_1, _2, _3, _4, _5, _6)
1229 #include "triton/aarch64.spec"
1230
1231 default:
1232 throw triton::exceptions::Cpu("AArch64Cpu:setConcreteRegisterValue(): Invalid register.");
1233 }
1234 }
1235
1236
1237 bool AArch64Cpu::isThumb(void) const {
1238 /* There is no thumb mode in aarch64 */
1239 return false;
1240 }
1241
1242
1243 void AArch64Cpu::setThumb(bool state) {
1244 /* There is no thumb mode in aarch64 */
1245 }
1246
1247
1249 triton::uint64 base = mem.getAddress();
1250
1251 for (triton::usize index = 0; index < mem.getSize(); index++) {
1252 if (this->exclusiveMemoryTags.find(base + index) != this->exclusiveMemoryTags.end()) {
1253 return true;
1254 }
1255 }
1256
1257 return false;
1258 }
1259
1260
1262 triton::uint64 base = mem.getAddress();
1263
1264 for (triton::usize index = 0; index < mem.getSize(); index++) {
1265 if (tag == true) {
1266 this->exclusiveMemoryTags.insert(base + index);
1267 }
1268 else {
1269 this->exclusiveMemoryTags.erase(base + index);
1270 }
1271 }
1272 }
1273
1274
1278
1279
1281 for (triton::usize index = 0; index < size; index++) {
1282 if (this->memory.find(baseAddr + index) == this->memory.end())
1283 return false;
1284 }
1285 return true;
1286 }
1287
1288
1292
1293
1295 for (triton::usize index = 0; index < size; index++) {
1296 if (this->memory.find(baseAddr + index) != this->memory.end()) {
1297 this->memory.erase(baseAddr + index);
1298 }
1299 }
1300 }
1301
1302 }; /* aarch64 namespace */
1303 }; /* arm namespace */
1304 }; /* arch namespace */
1305}; /* triton namespace */
TRITON_EXPORT triton::uint512 getMaxValue(void) const
Returns the max possible value of the bitvector.
TRITON_EXPORT void setBits(triton::uint32 high, triton::uint32 low)
Sets the bits (high, low) position.
This class is used to represent an immediate.
Definition immediate.hpp:37
This class is used to represent an instruction.
TRITON_EXPORT void setUpdateFlag(bool state)
Sets the updateFlag of the instruction.
TRITON_EXPORT triton::uint32 getSize(void) const
Returns the size of the instruction.
TRITON_EXPORT void setDisassembly(const std::string &str)
Sets the disassembly of the instruction.
TRITON_EXPORT const triton::uint8 * getOpcode(void) const
Returns the opcode of the instruction.
TRITON_EXPORT void setType(triton::uint32 type)
Sets the type of the instruction.
TRITON_EXPORT void setAddress(triton::uint64 addr)
Sets the address of the instruction.
TRITON_EXPORT triton::uint32 getType(void) const
Returns the type of the instruction.
TRITON_EXPORT void setArchitecture(triton::arch::architecture_e arch)
Sets the instruction's architecture.
TRITON_EXPORT void setWriteBack(bool state)
Sets the writeBack flag of the instruction.
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.
TRITON_EXPORT void setCodeCondition(triton::arch::arm::condition_e codeCondition)
Sets the code condition of the instruction (mainly for AArch64).
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 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::uint32 getBitSize(void) const
Returns the size (in bits) of the register.
Definition register.cpp:63
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
TRITON_EXPORT void setVectorIndex(triton::sint32 index)
Sets the vector index.
TRITON_EXPORT void setVASType(triton::arch::arm::vas_e type)
Sets the type of vector arrangement specifier.
TRITON_EXPORT void setShiftType(triton::arch::arm::shift_e type)
Sets the type of the shift.
TRITON_EXPORT void setExtendedSize(triton::uint32 dstSize)
Sets the extended size (in bits) after extension.
TRITON_EXPORT void setExtendType(triton::arch::arm::extend_e type)
Sets the type of the extend.
TRITON_EXPORT void setShiftValue(triton::uint32 imm)
Sets the value of the shift immediate.
This class is used to describe the ARM (64-bits) spec.
triton::uint8 q30[triton::size::dqword]
Concrete value of q30.
triton::uint8 q9[triton::size::dqword]
Concrete value of q9.
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.
triton::uint8 x11[triton::size::qword]
Concrete value of x11.
TRITON_EXPORT void clear(void)
Clears the architecture states (registers and memory).
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.
triton::uint8 x28[triton::size::qword]
Concrete value of x28.
triton::uint8 x23[triton::size::qword]
Concrete value of x23.
TRITON_EXPORT void clearConcreteMemoryValue(const triton::arch::MemoryAccess &mem)
Clears concrete values assigned to the memory cells.
triton::uint8 x3[triton::size::qword]
Concrete value of x3.
TRITON_EXPORT bool isVectorRegister(triton::arch::register_e regId) const
Returns true if regId is a vector register.
triton::uint8 x29[triton::size::qword]
Concrete value of x29.
TRITON_EXPORT triton::uint32 numberOfRegisters(void) const
Returns the number of registers according to the CPU architecture.
triton::uint8 x2[triton::size::qword]
Concrete value of x2.
triton::uint8 q4[triton::size::dqword]
Concrete value of q4.
triton::uint8 x20[triton::size::qword]
Concrete value of x20.
triton::uint8 x18[triton::size::qword]
Concrete value of x18.
triton::uint8 q29[triton::size::dqword]
Concrete value of q29.
TRITON_EXPORT bool isRegisterValid(triton::arch::register_e regId) const
Returns true if the register ID is valid.
triton::uint8 x8[triton::size::qword]
Concrete value of x8.
TRITON_EXPORT const triton::arch::Register & getStackPointer(void) const
Returns the stack pointer register.
triton::uint8 q14[triton::size::dqword]
Concrete value of q14.
triton::uint8 x10[triton::size::qword]
Concrete value of x10.
TRITON_EXPORT AArch64Cpu & operator=(const AArch64Cpu &other)
Copies a AArch64Cpu class.
triton::uint8 x27[triton::size::qword]
Concrete value of x27.
triton::uint8 q12[triton::size::dqword]
Concrete value of q12.
TRITON_EXPORT bool isSystemRegister(triton::arch::register_e regId) const
Returns true if regId is a system register.
TRITON_EXPORT const std::unordered_map< triton::arch::register_e, const triton::arch::Register > & getAllRegisters(void) const
Returns all registers.
TRITON_EXPORT triton::uint512 getConcreteMemoryValue(const triton::arch::MemoryAccess &mem, bool execCallbacks=true) const
Returns the concrete value of memory cells.
triton::uint8 q27[triton::size::dqword]
Concrete value of q27.
TRITON_EXPORT const triton::arch::Register & getProgramCounter(void) const
Returns the program counter register.
triton::uint8 x30[triton::size::qword]
Concrete value of x30.
triton::uint8 q28[triton::size::dqword]
Concrete value of q28.
TRITON_EXPORT bool isMemoryExclusive(const triton::arch::MemoryAccess &mem) const
Returns true if the given memory access is tagged as exclusive. Only valid for Arm32 and AArch64.
triton::uint8 q1[triton::size::dqword]
Concrete value of q1.
TRITON_EXPORT std::set< const triton::arch::Register * > getParentRegisters(void) const
Returns all parent registers.
triton::uint8 x1[triton::size::qword]
Concrete value of x1.
TRITON_EXPORT bool isGPR(triton::arch::register_e regId) const
Returns true if regId is a GRP.
TRITON_EXPORT AArch64Cpu(triton::callbacks::Callbacks *callbacks=nullptr)
Constructor.
triton::uint8 q20[triton::size::dqword]
Concrete value of q20.
triton::uint8 x5[triton::size::qword]
Concrete value of x5.
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.
TRITON_EXPORT bool isRegister(triton::arch::register_e regId) const
Returns true if the register ID is a register.
triton::uint8 q18[triton::size::dqword]
Concrete value of q18.
triton::uint8 q15[triton::size::dqword]
Concrete value of q15.
TRITON_EXPORT const triton::arch::Register & getRegister(triton::arch::register_e id) const
Returns register from id.
TRITON_EXPORT triton::uint32 gprBitSize(void) const
Returns the bit in bit of the General Purpose Registers.
triton::uint8 q10[triton::size::dqword]
Concrete value of q10.
TRITON_EXPORT bool isThumb(void) const
Returns true if the execution mode is Thumb. Only useful for Arm32.
triton::uint8 x0[triton::size::qword]
Concrete value of x0.
triton::uint8 q31[triton::size::dqword]
Concrete value of q31.
triton::uint8 q7[triton::size::dqword]
Concrete value of q7.
TRITON_EXPORT void setThumb(bool state)
Sets CPU state to Thumb mode.
TRITON_EXPORT const triton::arch::Register & getParentRegister(const triton::arch::Register &reg) const
Returns parent register from a given one.
std::unordered_map< triton::uint64, triton::uint8, IdentityHash< triton::uint64 > > memory
map of address -> concrete value
TRITON_EXPORT bool isConcreteMemoryValueDefined(const triton::arch::MemoryAccess &mem) const
Returns true if memory cells have a defined concrete value.
triton::uint8 q22[triton::size::dqword]
Concrete value of q22.
triton::uint8 x6[triton::size::qword]
Concrete value of x6.
triton::uint8 spsr[triton::size::dword]
Concrete value of spsr.
triton::uint8 sp[triton::size::qword]
Concrete value of sp.
TRITON_EXPORT void disassembly(triton::arch::Instruction &inst)
Disassembles the instruction according to the architecture.
triton::uint8 x12[triton::size::qword]
Concrete value of x12.
triton::uint8 x15[triton::size::qword]
Concrete value of x15.
virtual TRITON_EXPORT ~AArch64Cpu()
Destructor.
triton::uint8 q25[triton::size::dqword]
Concrete value of q25.
triton::uint8 x7[triton::size::qword]
Concrete value of x7.
TRITON_EXPORT triton::uint32 gprSize(void) const
Returns the bit in byte of the General Purpose Registers.
triton::uint8 q0[triton::size::dqword]
Concrete value of q0.
TRITON_EXPORT bool isScalarRegister(triton::arch::register_e regId) const
Returns true if regId is a scalar register.
triton::uint8 q26[triton::size::dqword]
Concrete value of q26.
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.
triton::uint8 q17[triton::size::dqword]
Concrete value of q17.
triton::uint8 x26[triton::size::qword]
Concrete value of x26.
triton::uint8 x22[triton::size::qword]
Concrete value of x22.
triton::uint8 q8[triton::size::dqword]
Concrete value of q8.
TRITON_EXPORT bool isFlag(triton::arch::register_e regId) const
Returns true if the register ID is a flag.
triton::uint8 x24[triton::size::qword]
Concrete value of x24.
TRITON_EXPORT triton::arch::endianness_e getEndianness(void) const
Returns the kind of endianness as triton::arch::endianness_e.
triton::uint8 q23[triton::size::dqword]
Concrete value of q23.
triton::uint8 q6[triton::size::dqword]
Concrete value of q6.
triton::uint8 x19[triton::size::qword]
Concrete value of x19.
TRITON_EXPORT triton::uint512 getConcreteRegisterValue(const triton::arch::Register &reg, bool execCallbacks=true) const
Returns the concrete value of a register.
triton::uint8 q13[triton::size::dqword]
Concrete value of q13.
TRITON_EXPORT const std::unordered_map< triton::uint64, triton::uint8, IdentityHash< triton::uint64 > > & getConcreteMemory(void) const
Return all memory.
triton::uint8 q2[triton::size::dqword]
Concrete value of q2.
triton::uint8 x17[triton::size::qword]
Concrete value of x17.
TRITON_EXPORT void setMemoryExclusiveTag(const triton::arch::MemoryAccess &mem, bool tag)
Sets exclusive memory access tag. Only valid for Arm32 and AArch64.
triton::uint8 q21[triton::size::dqword]
Concrete value of q21.
triton::uint8 x9[triton::size::qword]
Concrete value of x9.
triton::uint8 q11[triton::size::dqword]
Concrete value of q11.
triton::uint8 x13[triton::size::qword]
Concrete value of x13.
triton::uint8 x21[triton::size::qword]
Concrete value of x21.
triton::uint8 q3[triton::size::dqword]
Concrete value of q3.
triton::uint8 q5[triton::size::dqword]
Concrete value of q5.
triton::uint8 q19[triton::size::dqword]
Concrete value of q19.
triton::uint8 x14[triton::size::qword]
Concrete value of x14.
triton::uint8 x4[triton::size::qword]
Concrete value of x4.
triton::uint8 x25[triton::size::qword]
Concrete value of x25.
triton::uint8 x16[triton::size::qword]
Concrete value of x16.
triton::uint8 q24[triton::size::dqword]
Concrete value of q24.
triton::uint8 q16[triton::size::dqword]
Concrete value of q16.
triton::uint8 pc[triton::size::qword]
Concrete value of pc.
The AArch64Specifications class defines specifications about the AArch64 CPU.
TRITON_EXPORT triton::uint32 getMemoryOperandSpecialSize(triton::uint32 id) const
Returns memory access size if it is specified by instruction.
TRITON_EXPORT triton::arch::arm::vas_e capstoneVASToTritonVAS(triton::uint32 id) const
Converts a capstone's vas id to a triton's vas id.
TRITON_EXPORT triton::arch::arm::condition_e capstoneConditionToTritonCondition(triton::uint32 id) const
Converts a capstone's condition id to a triton's condition id.
TRITON_EXPORT triton::arch::arm::shift_e capstoneShiftToTritonShift(triton::uint32 id) const
Converts a capstone's shift id to a triton's shift id.
TRITON_EXPORT triton::arch::register_e capstoneRegisterToTritonRegister(triton::uint32 id) const
Converts a capstone's register id to a triton's register id.
TRITON_EXPORT triton::arch::arm::extend_e capstoneExtendToTritonExtend(triton::uint32 id) const
Converts a capstone's extend id to a triton's extend id.
TRITON_EXPORT triton::uint32 capstoneInstructionToTritonInstruction(triton::uint32 id) const
Converts a capstone's instruction id to a triton's instruction id.
std::unordered_map< triton::arch::register_e, const triton::arch::Register > id2reg
List of registers specification available for this architecture.
The callbacks class.
Definition callbacks.hpp:79
TRITON_EXPORT triton::ast::SharedAbstractNode processCallbacks(triton::callbacks::callback_e kind, triton::ast::SharedAbstractNode node)
Processes callbacks according to the kind and the C++ polymorphism.
The exception class used by all CPUs.
The exception class used by the disassembler.
The exception class used by register operands.
register_e
Types of register.
Definition archEnums.hpp:64
@ ID_REG_LAST_ITEM
must be the last item
Definition archEnums.hpp:84
constexpr triton::uint32 byte
byte size in bit
Definition cpuSize.hpp:60
constexpr triton::uint32 qword
qword size in bit
Definition cpuSize.hpp:66
constexpr triton::uint32 dqword
dqword size in bit
Definition cpuSize.hpp:70
constexpr triton::uint32 dqqword
dqqword size in byte
Definition cpuSize.hpp:44
constexpr triton::uint32 byte
byte size in byte
Definition cpuSize.hpp:30
constexpr triton::uint32 qword
qword size in byte
Definition cpuSize.hpp:36
math::wide_integer::uint128_t uint128
unsigned 128-bits
std::int32_t sint32
signed 32-bits
std::uint16_t uint16
unisgned 16-bits
std::size_t usize
unsigned MAX_INT 32 or 64 bits according to the CPU.
std::uint64_t uint64
unisgned 64-bits
math::wide_integer::uint512_t uint512
unsigned 512-bits
std::uint32_t uint32
unisgned 32-bits
std::uint8_t uint8
unisgned 8-bits
TRITON_EXPORT void fromUintToBuffer(triton::uint80 value, triton::uint8 *buffer)
Inject the value into the buffer. Make sure that the buffer contains at least 10 allocated bytes.
Definition coreUtils.cpp:16
The Triton namespace.