50 uint64_t rax, rcx, rdx, rbx, rsi, rdi, rsp, rbp, r8, r9, r10, r11, r12,
107 SSEVector const &operator[](
size_t index)
const {
108 return _sse[index << 2];
110 SSEVector &operator[](
size_t index) {
return _sse[index << 2]; }
123 AVXVector const &operator[](
size_t index)
const {
124 return _avx[index << 1];
126 AVXVector &operator[](
size_t index) {
return _avx[index << 1]; }
138 uint64_t xfeatures_mask;
158 inline void clear() {
159 std::memset(&gp, 0,
sizeof(gp));
160 std::memset(&x87, 0,
sizeof(x87));
161 std::memset(&xsave_header, 0,
sizeof(xsave_header));
162 std::memset(&eavx, 0,
sizeof(eavx));
163 std::memset(&dr, 0,
sizeof(dr));
164 std::memset(&xcr0, 0,
sizeof(xcr0));
166 std::memset(&linux_gp, 0,
sizeof(linux_gp));
174 inline uint64_t pc()
const {
return gp.rip; }
175 inline void setPC(uint64_t pc) { gp.rip = pc; }
177 inline uint64_t sp()
const {
return gp.rsp; }
178 inline void setSP(uint64_t sp) { gp.rsp = sp; }
180 inline uint64_t retval()
const {
return gp.rax; }
183#define _REGVALUE(REG) \
184 GPRegisterValue { sizeof(gp.REG), gp.REG }
195 inline void getGPState(GPRegisterValueVector ®s)
const {
197 regs.push_back(_REGVALUE(rax));
198 regs.push_back(_REGVALUE(rbx));
199 regs.push_back(_REGVALUE(rcx));
200 regs.push_back(_REGVALUE(rdx));
201 regs.push_back(_REGVALUE(rsi));
202 regs.push_back(_REGVALUE(rdi));
203 regs.push_back(_REGVALUE(rbp));
204 regs.push_back(_REGVALUE(rsp));
205 regs.push_back(_REGVALUE(r8));
206 regs.push_back(_REGVALUE(r9));
207 regs.push_back(_REGVALUE(r10));
208 regs.push_back(_REGVALUE(r11));
209 regs.push_back(_REGVALUE(r12));
210 regs.push_back(_REGVALUE(r13));
211 regs.push_back(_REGVALUE(r14));
212 regs.push_back(_REGVALUE(r15));
213 regs.push_back(_REGVALUE(rip));
214 regs.push_back(_REGVALUE(eflags));
215 regs.push_back(_REGVALUE(cs));
216 regs.push_back(_REGVALUE(ss));
217 regs.push_back(_REGVALUE(ds));
218 regs.push_back(_REGVALUE(es));
219 regs.push_back(_REGVALUE(fs));
220 regs.push_back(_REGVALUE(gs));
223 inline void setGPState(std::vector<uint64_t>
const ®s) {
241 gp.eflags = regs[17];
251 inline void getStopGPState(GPRegisterStopMap ®s,
bool forLLDB)
const {
253#define _SETREG(REG) regs[reg_lldb_##REG] = _REGVALUE(REG)
280#define _SETREG(REG) regs[reg_gdb_##REG] = _REGVALUE(REG)
311 inline bool getLLDBRegisterPtr(
int regno,
void **ptr,
size_t *length)
const {
312#define _GETREG2(T, REG, FLD) \
313 case reg_lldb_##REG: \
314 *ptr = &const_cast<CPUState64 *>(this)->T.FLD, *length = sizeof(T.FLD); \
316#define _GETREG8L(T, REG, FREG) \
317 case reg_lldb_##REG: \
319 reinterpret_cast<uint8_t *>(&const_cast<CPUState64 *>(this)->T.FREG), \
320 *length = sizeof(uint8_t); \
322#define _GETREG8H(T, REG, FREG) \
323 case reg_lldb_##REG: \
325 reinterpret_cast<uint8_t *>(&const_cast<CPUState64 *>(this)->T.FREG) + \
327 *length = sizeof(uint8_t); \
329#define _GETREG16(T, REG, FREG) \
330 case reg_lldb_##REG: \
332 reinterpret_cast<uint16_t *>(&const_cast<CPUState64 *>(this)->T.FREG), \
333 *length = sizeof(uint16_t); \
335#define _GETREG32(T, REG, FREG) \
336 case reg_lldb_##REG: \
338 reinterpret_cast<uint32_t *>(&const_cast<CPUState64 *>(this)->T.FREG), \
339 *length = sizeof(uint32_t); \
341#define _GETREG(T, REG) _GETREG2(T, REG, REG)
369 _GETREG2(x87, st0, regs[0].data);
370 _GETREG2(x87, st1, regs[1].data);
371 _GETREG2(x87, st2, regs[2].data);
372 _GETREG2(x87, st3, regs[3].data);
373 _GETREG2(x87, st4, regs[4].data);
374 _GETREG2(x87, st5, regs[5].data);
375 _GETREG2(x87, st6, regs[6].data);
376 _GETREG2(x87, st7, regs[7].data);
377 _GETREG2(x87, fstat, fstw);
378 _GETREG2(x87, fctrl, fctw);
380 _GETREG2(x87, fiseg, fiseg);
381 _GETREG2(x87, fioff, fioff);
382 _GETREG2(x87, foseg, foseg);
383 _GETREG2(x87, fooff, fooff);
386 _GETREG32(gp, eax, rax);
387 _GETREG32(gp, ebx, rbx);
388 _GETREG32(gp, ecx, rcx);
389 _GETREG32(gp, edx, rdx);
390 _GETREG32(gp, esi, rsi);
391 _GETREG32(gp, edi, rdi);
392 _GETREG32(gp, esp, rsp);
393 _GETREG32(gp, ebp, rbp);
394 _GETREG32(gp, r8d, r8);
395 _GETREG32(gp, r9d, r9);
396 _GETREG32(gp, r10d, r10);
397 _GETREG32(gp, r11d, r11);
398 _GETREG32(gp, r12d, r12);
399 _GETREG32(gp, r13d, r13);
400 _GETREG32(gp, r14d, r14);
401 _GETREG32(gp, r15d, r15);
403 _GETREG16(gp, ax, rax);
404 _GETREG16(gp, bx, rbx);
405 _GETREG16(gp, cx, rcx);
406 _GETREG16(gp, dx, rdx);
407 _GETREG16(gp, si, rsi);
408 _GETREG16(gp, di, rdi);
409 _GETREG16(gp, sp, rsp);
410 _GETREG16(gp, bp, rbp);
411 _GETREG16(gp, r8w, r8);
412 _GETREG16(gp, r9w, r9);
413 _GETREG16(gp, r10w, r10);
414 _GETREG16(gp, r11w, r11);
415 _GETREG16(gp, r12w, r12);
416 _GETREG16(gp, r13w, r13);
417 _GETREG16(gp, r14w, r14);
418 _GETREG16(gp, r15w, r15);
420 _GETREG8L(gp, al, rax);
421 _GETREG8L(gp, bl, rbx);
422 _GETREG8L(gp, cl, rcx);
423 _GETREG8L(gp, dl, rdx);
424 _GETREG8L(gp, sil, rsi);
425 _GETREG8L(gp, dil, rdi);
426 _GETREG8L(gp, spl, rsp);
427 _GETREG8L(gp, bpl, rbp);
428 _GETREG8L(gp, r8l, r8);
429 _GETREG8L(gp, r9l, r9);
430 _GETREG8L(gp, r10l, r10);
431 _GETREG8L(gp, r11l, r11);
432 _GETREG8L(gp, r12l, r12);
433 _GETREG8L(gp, r13l, r13);
434 _GETREG8L(gp, r14l, r14);
435 _GETREG8L(gp, r15l, r15);
437 _GETREG8H(gp, ah, rax);
438 _GETREG8H(gp, bh, rbx);
439 _GETREG8H(gp, ch, rcx);
440 _GETREG8H(gp, dh, rdx);
443 _GETREG(avx, mxcsrmask);
444 _GETREG2(avx, ymm0, regs[0]);
445 _GETREG2(avx, ymm1, regs[1]);
446 _GETREG2(avx, ymm2, regs[2]);
447 _GETREG2(avx, ymm3, regs[3]);
448 _GETREG2(avx, ymm4, regs[4]);
449 _GETREG2(avx, ymm5, regs[5]);
450 _GETREG2(avx, ymm6, regs[6]);
451 _GETREG2(avx, ymm7, regs[7]);
452 _GETREG2(avx, ymm8, regs[8]);
453 _GETREG2(avx, ymm9, regs[9]);
454 _GETREG2(avx, ymm10, regs[10]);
455 _GETREG2(avx, ymm11, regs[11]);
456 _GETREG2(avx, ymm12, regs[12]);
457 _GETREG2(avx, ymm13, regs[13]);
458 _GETREG2(avx, ymm14, regs[14]);
459 _GETREG2(avx, ymm15, regs[15]);
461 _GETREG2(sse, xmm0, regs[16]);
462 _GETREG2(sse, xmm1, regs[17]);
463 _GETREG2(sse, xmm2, regs[18]);
464 _GETREG2(sse, xmm3, regs[19]);
465 _GETREG2(sse, xmm4, regs[20]);
466 _GETREG2(sse, xmm5, regs[21]);
467 _GETREG2(sse, xmm6, regs[22]);
468 _GETREG2(sse, xmm7, regs[23]);
469 _GETREG2(sse, xmm8, regs[24]);
470 _GETREG2(sse, xmm9, regs[25]);
471 _GETREG2(sse, xmm10, regs[26]);
472 _GETREG2(sse, xmm11, regs[27]);
473 _GETREG2(sse, xmm12, regs[28]);
474 _GETREG2(sse, xmm13, regs[29]);
475 _GETREG2(sse, xmm14, regs[30]);
476 _GETREG2(sse, xmm15, regs[31]);
490 inline bool getGDBRegisterPtr(
int regno,
void **ptr,
size_t *length)
const {
491#define _GETREG2(T, REG, FLD) \
492 case reg_gdb_##REG: \
493 *ptr = &const_cast<CPUState64 *>(this)->T.FLD, *length = sizeof(T.FLD); \
495#define _GETREG(T, REG) _GETREG2(T, REG, REG)
523 _GETREG2(x87, st0, regs[0].data);
524 _GETREG2(x87, st1, regs[1].data);
525 _GETREG2(x87, st2, regs[2].data);
526 _GETREG2(x87, st3, regs[3].data);
527 _GETREG2(x87, st4, regs[4].data);
528 _GETREG2(x87, st5, regs[5].data);
529 _GETREG2(x87, st6, regs[6].data);
530 _GETREG2(x87, st7, regs[7].data);
531 _GETREG2(x87, fstat, fstw);
532 _GETREG2(x87, fctrl, fctw);
534 _GETREG2(x87, fiseg, fiseg);
535 _GETREG2(x87, fioff, fioff);
536 _GETREG2(x87, foseg, foseg);
537 _GETREG2(x87, fooff, fooff);
541 _GETREG2(sse, ymm0, regs[0]);
542 _GETREG2(sse, ymm1, regs[1]);
543 _GETREG2(sse, ymm2, regs[2]);
544 _GETREG2(sse, ymm3, regs[3]);
545 _GETREG2(sse, ymm4, regs[4]);
546 _GETREG2(sse, ymm5, regs[5]);
547 _GETREG2(sse, ymm6, regs[6]);
548 _GETREG2(sse, ymm7, regs[7]);
549 _GETREG2(sse, ymm8, regs[8]);
550 _GETREG2(sse, ymm9, regs[9]);
551 _GETREG2(sse, ymm10, regs[10]);
552 _GETREG2(sse, ymm11, regs[11]);
553 _GETREG2(sse, ymm12, regs[12]);
554 _GETREG2(sse, ymm13, regs[13]);
555 _GETREG2(sse, ymm14, regs[14]);
556 _GETREG2(sse, ymm15, regs[15]);
561 _GETREG(linux_gp, orig_rax);