ReXGlue SDK
Loading...
Searching...
No Matches
context.h
Go to the documentation of this file.
1
10
11/*
12 * Parts of the PPCContext infrastructure are based on XenonRecomp and UnleashedRecomp.
13 */
14
15#pragma once
16
17#include <atomic>
18#include <bit>
19#include <cmath>
20#include <cstddef>
21#include <cstdint>
22#include <cstring>
23#include <simde/x86/sse2.h>
24
26#include <rex/types.h>
27#include <rex/platform.h>
28
29#ifndef _MM_DENORMALS_ZERO_MASK
30#define _MM_DENORMALS_ZERO_MASK 0x0040
31#endif
32
33namespace rex::ppc {
34
35#if defined(__x86_64__) || defined(_M_X64)
36
38struct FPSCRPlatform {
39 static constexpr size_t kRoundShift = 13;
40 static constexpr size_t kRoundMaskVal = SIMDE_MM_ROUND_MASK;
42 static constexpr size_t kFlushMask = SIMDE_MM_FLUSH_ZERO_MASK | _MM_DENORMALS_ZERO_MASK;
44 static constexpr u32 kExceptionMask =
45 (1 << 7) | (1 << 8) | (1 << 9) | (1 << 10) | (1 << 11) | (1 << 12);
47 static constexpr u32 kExceptionsMasked = kExceptionMask;
49 static constexpr size_t kGuestToHost[] = {SIMDE_MM_ROUND_NEAREST, SIMDE_MM_ROUND_TOWARD_ZERO,
50 SIMDE_MM_ROUND_UP, SIMDE_MM_ROUND_DOWN};
52 static constexpr u32 kHostToGuest[] = {0, 3, 2, 1};
53
55 static u32 GetCSR() noexcept { return simde_mm_getcsr(); }
56
58 static void SetCSR(u32 csr) noexcept { simde_mm_setcsr(csr); }
59
65 static void InitHostExceptions(u32& csr) noexcept { csr |= kExceptionMask; }
66};
67
68#elif defined(__aarch64__) || defined(_M_ARM64)
69
71struct FPSCRPlatform {
72 static constexpr size_t kRoundShift = 22;
73 static constexpr size_t kRoundMaskVal = 3 << kRoundShift;
74 static constexpr size_t kFlushMask = 1 << 24;
76 static constexpr size_t kGuestToHost[] = {0 << kRoundShift, 3 << kRoundShift, 1 << kRoundShift,
77 2 << kRoundShift};
79 static constexpr u32 kHostToGuest[] = {0, 2, 3, 1};
81 static constexpr u32 kExceptionMask =
82 (1 << 8) | (1 << 9) | (1 << 10) | (1 << 11) | (1 << 12) | (1 << 15);
84 static constexpr u32 kExceptionsMasked = 0;
85
87 static inline u32 GetCSR() noexcept {
88 u64 csr;
89 __asm__ __volatile__("mrs %0, fpcr" : "=r"(csr));
90 return static_cast<u32>(csr);
91 }
92
94 static inline void SetCSR(u32 csr) noexcept {
95 __asm__ __volatile__("msr fpcr, %0" : : "r"(static_cast<u64>(csr)));
96 }
97
103 static inline void InitHostExceptions(u32& csr) noexcept { csr &= ~kExceptionMask; }
104};
105
106#else
107#error "Missing implementation for FPSCR."
108#endif
109
110} // namespace rex::ppc
111
112namespace rex::kernel {
113class ThreadState;
114} // namespace rex::kernel
115
116namespace rex::ppc::detail {
117struct DetourFrame;
118} // namespace rex::ppc::detail
119
120namespace rex::ppc {
121
122union Register {
123 i8 s8;
124 uint8_t u8;
125 i16 s16;
126 uint16_t u16;
127 i32 s32;
128 uint32_t u32;
129 i64 s64;
130 uint64_t u64;
131 float f32;
132 double f64;
133};
134
137 u8 so;
138 u8 ov;
139 u8 ca;
140};
141
144 u8 lt;
145 u8 gt;
146 u8 eq;
147 union {
148 u8 so;
149 u8 un;
150 };
151
153 u32 GetRaw() const noexcept { return (lt << 3) | (gt << 2) | (eq << 1) | so; }
154
160 void SetRaw(u32 value) noexcept {
161 lt = (value >> 3) & 1;
162 gt = (value >> 2) & 1;
163 eq = (value >> 1) & 1;
164 so = value & 1;
165 }
166
172 template <typename T>
173 void Compare(T left, T right, const XERRegister& xer) noexcept {
174 lt = left < right;
175 gt = left > right;
176 eq = left == right;
177 so = xer.so;
178 }
179
181 void Compare(f64 left, f64 right) noexcept {
182 un = std::isnan(left) || std::isnan(right);
183 lt = !un && (left < right);
184 gt = !un && (left > right);
185 eq = !un && (left == right);
186 }
187
195 void SetFromMask(simde__m128 mask, int imm) noexcept {
196 int m = simde_mm_movemask_ps(mask);
197 lt = m == imm;
198 gt = 0;
199 eq = m == 0;
200 so = 0;
201 }
202
210 void SetFromMask(simde__m128i mask, int imm) noexcept {
211 int m = simde_mm_movemask_epi8(mask);
212 lt = m == imm;
213 gt = 0;
214 eq = m == 0;
215 so = 0;
216 }
217};
218
219union alignas(0x10) VRegister {
220 i8 s8[16];
221 uint8_t u8[16];
222 i16 s16[8];
223 uint16_t u16[8];
224 i32 s32[4];
225 uint32_t u32[4];
226 i64 s64[2];
227 uint64_t u64[2];
228 float f32[4];
229 double f64[2];
230};
231
232constexpr u32 kRoundNearest = 0x00;
233constexpr u32 kRoundTowardZero = 0x01;
234constexpr u32 kRoundUp = 0x02;
235constexpr u32 kRoundDown = 0x03;
236constexpr u32 kRoundMask = 0x03;
237
240 u32 csr;
241
243 using Platform = FPSCRPlatform;
245 static constexpr size_t kRoundShift = Platform::kRoundShift;
247 static constexpr size_t kRoundMaskVal = Platform::kRoundMaskVal;
249 static constexpr size_t kFlushMask = Platform::kFlushMask;
250
251 static_assert(
252 [] {
253 for (u32 rn = 0; rn <= kRoundMask; ++rn) {
254 if (Platform::kHostToGuest[(Platform::kGuestToHost[rn] & kRoundMaskVal) >> kRoundShift] !=
255 rn) {
256 return false;
257 }
258 }
259 return true;
260 }(),
261 "kHostToGuest must invert kGuestToHost");
262
264 static constexpr u32 kGuestMask = static_cast<u32>(kRoundMaskVal) | static_cast<u32>(kFlushMask);
265
269 u32 GetCSR() noexcept { return Platform::GetCSR(); }
270
276 void SetCSR(u32 value) noexcept { Platform::SetCSR(value); }
277
279 void RestoreGuestBits(u32 saved) noexcept {
280 csr = (GetCSR() & ~kGuestMask) | (saved & kGuestMask);
281 SetCSR(csr);
282 }
283
289 u32 LoadFromHost() noexcept {
290 csr = GetCSR();
291 return Platform::kHostToGuest[(csr & kRoundMaskVal) >> kRoundShift];
292 }
293
299 void StoreToHost(u32 value) noexcept {
301 csr |= Platform::kGuestToHost[value & kRoundMask];
302 SetCSR(csr);
303 }
304
307 csr |= kFlushMask;
308 SetCSR(csr);
309 }
310
313 csr &= ~kFlushMask;
314 SetCSR(csr);
315 }
316
318 void EnableFlushMode() noexcept {
319 if ((csr & kFlushMask) != kFlushMask) [[unlikely]] {
320 csr |= kFlushMask;
321 SetCSR(csr);
322 }
323 }
324
326 void DisableFlushMode() noexcept {
327 if ((csr & kFlushMask) != 0) [[unlikely]] {
328 csr &= ~kFlushMask;
329 SetCSR(csr);
330 }
331 }
332
338 void SetFlushMode(bool enable) noexcept {
339 if (enable) {
341 } else {
343 }
344 }
345
347 void InitHost() noexcept {
348 csr = GetCSR();
349 Platform::InitHostExceptions(csr);
350 SetCSR(csr);
351 }
352};
353
356 u8 sat = 0;
357 u8 nj = 0;
358
364 u32 Read() const noexcept { return static_cast<u32>(sat) | (static_cast<u32>(nj) << 16); }
365
371 void Write(u32 word) noexcept {
372 sat = static_cast<u8>(word & 1);
373 nj = static_cast<u8>((word >> 16) & 1);
374 }
375};
376
377} // namespace rex::ppc
378
379using PPCRegister = rex::ppc::Register;
380using PPCXERRegister = rex::ppc::XERRegister;
381using PPCCRRegister = rex::ppc::CRRegister;
382using PPCVRegister = rex::ppc::VRegister;
383using PPCFPSCRRegister = rex::ppc::FPSCRRegister;
384using PPCVSCRRegister = rex::ppc::VSCRRegister;
385
387struct alignas(0x40) PPCContext {
389 PPCRegister r3;
395 PPCRegister r0;
396 PPCRegister r1;
397 PPCRegister r2;
398 PPCRegister r4;
399 PPCRegister r5;
400 PPCRegister r6;
401 PPCRegister r7;
402 PPCRegister r8;
403 PPCRegister r9;
404 PPCRegister r10;
405 PPCRegister r11;
406 PPCRegister r12;
407 PPCRegister r13;
408 PPCRegister r14;
409 PPCRegister r15;
410 PPCRegister r16;
411 PPCRegister r17;
412 PPCRegister r18;
413 PPCRegister r19;
414 PPCRegister r20;
415 PPCRegister r21;
416 PPCRegister r22;
417 PPCRegister r23;
418 PPCRegister r24;
419 PPCRegister r25;
420 PPCRegister r26;
421 PPCRegister r27;
422 PPCRegister r28;
423 PPCRegister r29;
424 PPCRegister r30;
425 PPCRegister r31;
427
428 u64 lr;
429 PPCRegister ctr;
430 PPCXERRegister xer;
432 PPCRegister reserved;
434 u32 msr = 0x200A000;
435 PPCCRRegister cr0;
436 PPCCRRegister cr1;
437 PPCCRRegister cr2;
438 PPCCRRegister cr3;
439 PPCCRRegister cr4;
440 PPCCRRegister cr5;
441 PPCCRRegister cr6;
442 PPCCRRegister cr7;
443 PPCFPSCRRegister fpscr;
444 PPCVSCRRegister vscr;
445
448
451
453 rex::ppc::detail::DetourFrame* detour_frame = nullptr;
454
460 PPCRegister f0;
461 PPCRegister f1;
462 PPCRegister f2;
463 PPCRegister f3;
464 PPCRegister f4;
465 PPCRegister f5;
466 PPCRegister f6;
467 PPCRegister f7;
468 PPCRegister f8;
469 PPCRegister f9;
470 PPCRegister f10;
471 PPCRegister f11;
472 PPCRegister f12;
473 PPCRegister f13;
474 PPCRegister f14;
475 PPCRegister f15;
476 PPCRegister f16;
477 PPCRegister f17;
478 PPCRegister f18;
479 PPCRegister f19;
480 PPCRegister f20;
481 PPCRegister f21;
482 PPCRegister f22;
483 PPCRegister f23;
484 PPCRegister f24;
485 PPCRegister f25;
486 PPCRegister f26;
487 PPCRegister f27;
488 PPCRegister f28;
489 PPCRegister f29;
490 PPCRegister f30;
491 PPCRegister f31;
493
498 PPCVRegister v0;
499 PPCVRegister v1;
500 PPCVRegister v2;
501 PPCVRegister v3;
502 PPCVRegister v4;
503 PPCVRegister v5;
504 PPCVRegister v6;
505 PPCVRegister v7;
506 PPCVRegister v8;
507 PPCVRegister v9;
508 PPCVRegister v10;
509 PPCVRegister v11;
510 PPCVRegister v12;
511 PPCVRegister v13;
512 PPCVRegister v14;
513 PPCVRegister v15;
514 PPCVRegister v16;
515 PPCVRegister v17;
516 PPCVRegister v18;
517 PPCVRegister v19;
518 PPCVRegister v20;
519 PPCVRegister v21;
520 PPCVRegister v22;
521 PPCVRegister v23;
522 PPCVRegister v24;
523 PPCVRegister v25;
524 PPCVRegister v26;
525 PPCVRegister v27;
526 PPCVRegister v28;
527 PPCVRegister v29;
528 PPCVRegister v30;
529 PPCVRegister v31;
535 PPCVRegister v32;
536 PPCVRegister v33;
537 PPCVRegister v34;
538 PPCVRegister v35;
539 PPCVRegister v36;
540 PPCVRegister v37;
541 PPCVRegister v38;
542 PPCVRegister v39;
543 PPCVRegister v40;
544 PPCVRegister v41;
545 PPCVRegister v42;
546 PPCVRegister v43;
547 PPCVRegister v44;
548 PPCVRegister v45;
549 PPCVRegister v46;
550 PPCVRegister v47;
551 PPCVRegister v48;
552 PPCVRegister v49;
553 PPCVRegister v50;
554 PPCVRegister v51;
555 PPCVRegister v52;
556 PPCVRegister v53;
557 PPCVRegister v54;
558 PPCVRegister v55;
559 PPCVRegister v56;
560 PPCVRegister v57;
561 PPCVRegister v58;
562 PPCVRegister v59;
563 PPCVRegister v60;
564 PPCVRegister v61;
565 PPCVRegister v62;
566 PPCVRegister v63;
567 PPCVRegister v64;
568 PPCVRegister v65;
569 PPCVRegister v66;
570 PPCVRegister v67;
571 PPCVRegister v68;
572 PPCVRegister v69;
573 PPCVRegister v70;
574 PPCVRegister v71;
575 PPCVRegister v72;
576 PPCVRegister v73;
577 PPCVRegister v74;
578 PPCVRegister v75;
579 PPCVRegister v76;
580 PPCVRegister v77;
581 PPCVRegister v78;
582 PPCVRegister v79;
583 PPCVRegister v80;
584 PPCVRegister v81;
585 PPCVRegister v82;
586 PPCVRegister v83;
587 PPCVRegister v84;
588 PPCVRegister v85;
589 PPCVRegister v86;
590 PPCVRegister v87;
591 PPCVRegister v88;
592 PPCVRegister v89;
593 PPCVRegister v90;
594 PPCVRegister v91;
595 PPCVRegister v92;
596 PPCVRegister v93;
597 PPCVRegister v94;
598 PPCVRegister v95;
599 PPCVRegister v96;
600 PPCVRegister v97;
601 PPCVRegister v98;
602 PPCVRegister v99;
603 PPCVRegister v100;
604 PPCVRegister v101;
605 PPCVRegister v102;
606 PPCVRegister v103;
607 PPCVRegister v104;
608 PPCVRegister v105;
609 PPCVRegister v106;
610 PPCVRegister v107;
611 PPCVRegister v108;
612 PPCVRegister v109;
613 PPCVRegister v110;
614 PPCVRegister v111;
615 PPCVRegister v112;
616 PPCVRegister v113;
617 PPCVRegister v114;
618 PPCVRegister v115;
619 PPCVRegister v116;
620 PPCVRegister v117;
621 PPCVRegister v118;
622 PPCVRegister v119;
623 PPCVRegister v120;
624 PPCVRegister v121;
625 PPCVRegister v122;
626 PPCVRegister v123;
627 PPCVRegister v124;
628 PPCVRegister v125;
629 PPCVRegister v126;
630 PPCVRegister v127;
632
634 const std::atomic<bool>* stop_requested = nullptr;
635
641 rex::u32 GetCR() const noexcept {
642 return (cr0.GetRaw() << 28) | (cr1.GetRaw() << 24) | (cr2.GetRaw() << 20) |
643 (cr3.GetRaw() << 16) | (cr4.GetRaw() << 12) | (cr5.GetRaw() << 8) | (cr6.GetRaw() << 4) |
644 cr7.GetRaw();
645 }
646
652 void SetCR(rex::u32 value) noexcept {
653 cr0.SetRaw(value >> 28);
654 cr1.SetRaw(value >> 24);
655 cr2.SetRaw(value >> 20);
656 cr3.SetRaw(value >> 16);
657 cr4.SetRaw(value >> 12);
658 cr5.SetRaw(value >> 8);
659 cr6.SetRaw(value >> 4);
660 cr7.SetRaw(value);
661 }
662
664 static constexpr size_t kNonVolatileCRCount = 4;
665
670 static constexpr size_t kNonVolatileSaveSize =
671 18 * sizeof(PPCRegister) + 18 * sizeof(PPCRegister) + 18 * sizeof(PPCVRegister) +
672 64 * sizeof(PPCVRegister) + kNonVolatileCRCount * sizeof(PPCCRRegister) +
673 sizeof(PPCFPSCRRegister);
674
676 void SaveNonVolatiles(u8* dst) const {
677 std::memcpy(dst, &r14, 18 * sizeof(PPCRegister));
678 dst += 18 * sizeof(PPCRegister);
679 std::memcpy(dst, &f14, 18 * sizeof(PPCRegister));
680 dst += 18 * sizeof(PPCRegister);
681 std::memcpy(dst, &v14, 18 * sizeof(PPCVRegister));
682 dst += 18 * sizeof(PPCVRegister);
683 std::memcpy(dst, &v64, 64 * sizeof(PPCVRegister));
684 dst += 64 * sizeof(PPCVRegister);
685 std::memcpy(dst, &cr2, kNonVolatileCRCount * sizeof(PPCCRRegister));
686 dst += kNonVolatileCRCount * sizeof(PPCCRRegister);
687 std::memcpy(dst, &fpscr, sizeof(PPCFPSCRRegister));
688 }
689
696 void RestoreNonVolatiles(const u8* src) {
697 std::memcpy(&r14, src, 18 * sizeof(PPCRegister));
698 src += 18 * sizeof(PPCRegister);
699 std::memcpy(&f14, src, 18 * sizeof(PPCRegister));
700 src += 18 * sizeof(PPCRegister);
701 std::memcpy(&v14, src, 18 * sizeof(PPCVRegister));
702 src += 18 * sizeof(PPCVRegister);
703 std::memcpy(&v64, src, 64 * sizeof(PPCVRegister));
704 src += 64 * sizeof(PPCVRegister);
705 std::memcpy(&cr2, src, kNonVolatileCRCount * sizeof(PPCCRRegister));
706 src += kNonVolatileCRCount * sizeof(PPCCRRegister);
707 PPCFPSCRRegister saved_fpscr;
708 std::memcpy(&saved_fpscr, src, sizeof(PPCFPSCRRegister));
709 fpscr.RestoreGuestBits(saved_fpscr.csr);
710 }
711};
712static_assert(offsetof(PPCContext, cr5) - offsetof(PPCContext, cr2) ==
713 (PPCContext::kNonVolatileCRCount - 1) * sizeof(PPCCRRegister),
714 "cr2 to cr5 must be contiguous for the non volatile save area");
715
716namespace rex::ppc {
717
723
729
730namespace detail {
731
738#ifndef NDEBUG
739REX_PPC_API void CheckHookContext(const PPCContext& ctx, const char* name);
740#else
741inline void CheckHookContext(const PPCContext&, const char*) {}
742#endif
743
744} // namespace detail
745
746} // namespace rex::ppc
Definition thread_state.h:40
Definition export.h:24
Definition title_runtime.h:33
REX_PPC_API BoundThread GetBoundThread()
constexpr u32 kRoundDown
Definition context.h:235
constexpr u32 kRoundUp
Definition context.h:234
Platform flags, packing macros and export markers.
#define REX_PPC_API
Definition platform.h:194
Definition context.h:387
PPCCRRegister cr1
Definition context.h:436
PPCVRegister v20
Definition context.h:518
PPCRegister f6
Definition context.h:466
PPCCRRegister cr4
Definition context.h:439
PPCVRegister v48
Definition context.h:551
PPCVRegister v17
Definition context.h:515
PPCRegister r11
Definition context.h:405
PPCVRegister v124
Definition context.h:627
PPCRegister f21
Definition context.h:481
static constexpr size_t kNonVolatileCRCount
Definition context.h:664
PPCCRRegister cr7
Definition context.h:442
PPCVRegister v108
Definition context.h:611
PPCVRegister v72
Definition context.h:575
const std::atomic< bool > * stop_requested
Definition context.h:634
PPCVRegister v52
Definition context.h:555
PPCVRegister v91
Definition context.h:594
PPCVRegister v95
Definition context.h:598
void SaveNonVolatiles(u8 *dst) const
Definition context.h:676
PPCRegister f30
Definition context.h:490
PPCRegister f17
Definition context.h:477
PPCRegister f20
Definition context.h:480
PPCRegister f18
Definition context.h:478
PPCVRegister v69
Definition context.h:572
PPCRegister r22
Definition context.h:416
PPCVRegister v97
Definition context.h:600
PPCVRegister v98
Definition context.h:601
PPCCRRegister cr5
Definition context.h:440
PPCVRegister v46
Definition context.h:549
PPCVRegister v42
Definition context.h:545
PPCVRegister v66
Definition context.h:569
PPCRegister f1
Definition context.h:461
PPCRegister r14
Definition context.h:408
PPCRegister f19
Definition context.h:479
PPCRegister f16
Definition context.h:476
PPCVRegister v79
Definition context.h:582
PPCRegister r0
Definition context.h:395
PPCVRegister v119
Definition context.h:622
PPCRegister r24
Definition context.h:418
PPCVRegister v38
Definition context.h:541
u64 lr
Definition context.h:428
PPCVRegister v50
Definition context.h:553
PPCVRegister v87
Definition context.h:590
PPCVRegister v111
Definition context.h:614
PPCVRegister v53
Definition context.h:556
PPCVRegister v112
Definition context.h:615
PPCRegister r23
Definition context.h:417
PPCVRegister v34
Definition context.h:537
PPCRegister f31
Definition context.h:491
PPCVRegister v29
Definition context.h:527
PPCRegister f4
Definition context.h:464
PPCVRegister v59
Definition context.h:562
PPCRegister f15
Definition context.h:475
PPCVRegister v121
Definition context.h:624
static constexpr size_t kNonVolatileSaveSize
Definition context.h:670
PPCVRegister v86
Definition context.h:589
PPCVRegister v4
Definition context.h:502
PPCVRegister v125
Definition context.h:628
PPCVRegister v78
Definition context.h:581
PPCVRegister v120
Definition context.h:623
PPCVRegister v85
Definition context.h:588
PPCVRegister v71
Definition context.h:574
u32 msr
Definition context.h:434
PPCVRegister v81
Definition context.h:584
PPCRegister r30
Definition context.h:424
PPCVRegister v44
Definition context.h:547
PPCXERRegister xer
Definition context.h:430
PPCRegister reserved
Definition context.h:432
PPCVRegister v10
Definition context.h:508
PPCVRegister v94
Definition context.h:597
PPCVRegister v24
Definition context.h:522
PPCRegister r9
Definition context.h:403
PPCVRegister v14
Definition context.h:512
PPCVRegister v6
Definition context.h:504
PPCRegister r15
Definition context.h:409
PPCVRegister v114
Definition context.h:617
PPCVRegister v64
Definition context.h:567
PPCRegister f10
Definition context.h:470
PPCVRegister v99
Definition context.h:602
PPCVRegister v75
Definition context.h:578
PPCVRegister v28
Definition context.h:526
PPCVRegister v11
Definition context.h:509
PPCVRegister v103
Definition context.h:606
PPCVRegister v100
Definition context.h:603
rex::u32 GetCR() const noexcept
Definition context.h:641
PPCVRegister v68
Definition context.h:571
PPCVRegister v37
Definition context.h:540
PPCVRegister v19
Definition context.h:517
rex::kernel::ThreadState * thread_state
Definition context.h:450
PPCVRegister v21
Definition context.h:519
PPCVRegister v80
Definition context.h:583
PPCVRegister v117
Definition context.h:620
PPCRegister f2
Definition context.h:462
PPCVRegister v77
Definition context.h:580
PPCRegister f0
Definition context.h:460
PPCVRegister v73
Definition context.h:576
PPCRegister f29
Definition context.h:489
PPCRegister r18
Definition context.h:412
PPCVRegister v105
Definition context.h:608
PPCVRegister v31
Definition context.h:529
PPCVRegister v101
Definition context.h:604
PPCVRegister v33
Definition context.h:536
PPCVRegister v60
Definition context.h:563
PPCRegister f7
Definition context.h:467
PPCVRegister v35
Definition context.h:538
PPCRegister r2
Definition context.h:397
u32 last_indirect_target
Definition context.h:447
PPCRegister r21
Definition context.h:415
PPCRegister f14
Definition context.h:474
PPCRegister f28
Definition context.h:488
PPCRegister r7
Definition context.h:401
PPCRegister f13
Definition context.h:473
PPCRegister f25
Definition context.h:485
PPCRegister f23
Definition context.h:483
PPCVRegister v2
Definition context.h:500
PPCVRegister v126
Definition context.h:629
PPCRegister r3
Definition context.h:389
PPCVRegister v43
Definition context.h:546
PPCVRegister v23
Definition context.h:521
PPCRegister r10
Definition context.h:404
PPCVRegister v51
Definition context.h:554
PPCVRegister v12
Definition context.h:510
PPCVRegister v88
Definition context.h:591
PPCVRegister v92
Definition context.h:595
void RestoreNonVolatiles(const u8 *src)
Definition context.h:696
PPCCRRegister cr0
Definition context.h:435
PPCVRegister v104
Definition context.h:607
PPCRegister r17
Definition context.h:411
PPCVRegister v54
Definition context.h:557
PPCRegister f22
Definition context.h:482
PPCVRegister v123
Definition context.h:626
PPCVRegister v107
Definition context.h:610
PPCVRegister v45
Definition context.h:548
PPCVRegister v16
Definition context.h:514
PPCRegister ctr
Definition context.h:429
PPCVRegister v9
Definition context.h:507
PPCVRegister v116
Definition context.h:619
PPCRegister r8
Definition context.h:402
PPCVRegister v61
Definition context.h:564
PPCVRegister v30
Definition context.h:528
PPCVRegister v27
Definition context.h:525
PPCVRegister v26
Definition context.h:524
PPCRegister r5
Definition context.h:399
PPCVRegister v76
Definition context.h:579
PPCVRegister v102
Definition context.h:605
rex::ppc::detail::DetourFrame * detour_frame
Definition context.h:453
PPCRegister r31
Definition context.h:425
PPCCRRegister cr6
Definition context.h:441
PPCVRegister v25
Definition context.h:523
PPCVRegister v127
Definition context.h:630
PPCVRegister v70
Definition context.h:573
PPCVRegister v1
Definition context.h:499
PPCRegister r29
Definition context.h:423
PPCVRegister v8
Definition context.h:506
PPCVRegister v115
Definition context.h:618
PPCVRegister v15
Definition context.h:513
PPCVRegister v47
Definition context.h:550
PPCVRegister v36
Definition context.h:539
PPCRegister r28
Definition context.h:422
PPCVRegister v62
Definition context.h:565
PPCRegister f3
Definition context.h:463
PPCVRegister v109
Definition context.h:612
PPCRegister r25
Definition context.h:419
PPCRegister f5
Definition context.h:465
PPCRegister r27
Definition context.h:421
PPCVRegister v7
Definition context.h:505
PPCVRegister v84
Definition context.h:587
PPCRegister r4
Definition context.h:398
PPCRegister r13
Definition context.h:407
PPCRegister f27
Definition context.h:487
PPCVRegister v58
Definition context.h:561
PPCVRegister v22
Definition context.h:520
PPCVRegister v32
Definition context.h:535
PPCVRegister v18
Definition context.h:516
PPCRegister r12
Definition context.h:406
PPCVRegister v106
Definition context.h:609
PPCVRegister v89
Definition context.h:592
PPCVRegister v41
Definition context.h:544
PPCVRegister v55
Definition context.h:558
PPCVRegister v110
Definition context.h:613
PPCVRegister v57
Definition context.h:560
PPCRegister f11
Definition context.h:471
PPCVRegister v40
Definition context.h:543
PPCVRegister v83
Definition context.h:586
PPCVRegister v90
Definition context.h:593
PPCVRegister v0
Definition context.h:498
PPCRegister r6
Definition context.h:400
PPCVRegister v13
Definition context.h:511
PPCRegister r19
Definition context.h:413
PPCVRegister v93
Definition context.h:596
PPCVRegister v39
Definition context.h:542
PPCVRegister v3
Definition context.h:501
PPCCRRegister cr2
Definition context.h:437
PPCVRegister v82
Definition context.h:585
PPCCRRegister cr3
Definition context.h:438
PPCVRegister v113
Definition context.h:616
PPCRegister f12
Definition context.h:472
PPCVRegister v74
Definition context.h:577
PPCRegister f26
Definition context.h:486
PPCRegister f8
Definition context.h:468
PPCRegister r20
Definition context.h:414
PPCVRegister v56
Definition context.h:559
PPCVRegister v49
Definition context.h:552
PPCRegister f9
Definition context.h:469
PPCVRegister v122
Definition context.h:625
PPCVRegister v5
Definition context.h:503
PPCVRegister v63
Definition context.h:566
PPCVRegister v65
Definition context.h:568
PPCVRegister v67
Definition context.h:570
PPCRegister r1
Definition context.h:396
PPCRegister f24
Definition context.h:484
PPCRegister r26
Definition context.h:420
void SetCR(rex::u32 value) noexcept
Definition context.h:652
PPCVRegister v96
Definition context.h:599
PPCRegister r16
Definition context.h:410
PPCVRegister v118
Definition context.h:621
Definition context.h:719
PPCContext * ctx
Definition context.h:720
u8 * base
Definition context.h:721
Definition context.h:143
u8 gt
Definition context.h:145
void SetFromMask(simde__m128i mask, int imm) noexcept
Definition context.h:210
void SetRaw(u32 value) noexcept
Definition context.h:160
void Compare(T left, T right, const XERRegister &xer) noexcept
Definition context.h:173
u8 eq
Definition context.h:146
u32 GetRaw() const noexcept
Definition context.h:153
void SetFromMask(simde__m128 mask, int imm) noexcept
Definition context.h:195
void Compare(f64 left, f64 right) noexcept
Definition context.h:181
u8 lt
Definition context.h:144
Definition context.h:239
static constexpr size_t kFlushMask
Definition context.h:249
static constexpr size_t kRoundShift
Definition context.h:245
void SetFlushMode(bool enable) noexcept
Definition context.h:338
void RestoreGuestBits(u32 saved) noexcept
Definition context.h:279
u32 LoadFromHost() noexcept
Definition context.h:289
void EnableFlushMode() noexcept
Definition context.h:318
void DisableFlushMode() noexcept
Definition context.h:326
static constexpr u32 kGuestMask
Definition context.h:264
u32 csr
Definition context.h:240
void EnableFlushModeUnconditional() noexcept
Definition context.h:306
FPSCRPlatform Platform
Definition context.h:243
static constexpr size_t kRoundMaskVal
Definition context.h:247
void StoreToHost(u32 value) noexcept
Definition context.h:299
void SetCSR(u32 value) noexcept
Definition context.h:276
void DisableFlushModeUnconditional() noexcept
Definition context.h:312
void InitHost() noexcept
Definition context.h:347
u32 GetCSR() noexcept
Definition context.h:269
Definition context.h:355
u8 nj
Definition context.h:357
u8 sat
Definition context.h:356
u32 Read() const noexcept
Definition context.h:364
void Write(u32 word) noexcept
Definition context.h:371
Definition context.h:136
u8 ov
Definition context.h:138
u8 ca
Definition context.h:139
u8 so
Definition context.h:137
Integer types, byte order wrappers and size literals.
Definition context.h:122
Definition context.h:219