MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / syncToException

Function syncToException

platform/windows/platformThreads.cpp:38–150  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36extern U8 xmmCache[8];
37
38void syncToException(struct _EXCEPTION_POINTERS* ep) {
39 CPU* cpu = KThread::currentThread()->cpu;
40#ifdef _M_ARM64
41 for (U32 i = 0; i < 8; i++) {
42 if (regCache[i] != 0xFF) {
43 switch (regCache[i]) {
44 case 0: ep->ContextRecord->X0 = cpu->reg[i].u32; break;
45 case 1: ep->ContextRecord->X1 = cpu->reg[i].u32; break;
46 case 2: ep->ContextRecord->X2 = cpu->reg[i].u32; break;
47 case 3: ep->ContextRecord->X3 = cpu->reg[i].u32; break;
48 case 4: ep->ContextRecord->X4 = cpu->reg[i].u32; break;
49 case 5: ep->ContextRecord->X5 = cpu->reg[i].u32; break;
50 case 6: ep->ContextRecord->X6 = cpu->reg[i].u32; break;
51 case 7: ep->ContextRecord->X7 = cpu->reg[i].u32; break;
52 default:
53 kpanic("Windows ARM64 syncToException");
54 }
55 }
56 }
57 for (U32 i = 0; i < 8; i++) {
58 if (xmmCache[i] != 0xFF) {
59 ep->ContextRecord->V[xmmCache[i]].Low = cpu->xmm[i].pi.u64[0];
60 ep->ContextRecord->V[xmmCache[i]].High = cpu->xmm[i].pi.u64[1];
61 }
62 }
63 ep->ContextRecord->X8 = cpu->flags;
64 ep->ContextRecord->X16 = cpu->src.u32;
65 ep->ContextRecord->X10 = cpu->dst.u32;
66 ep->ContextRecord->X15 = cpu->result.u32;
67 ep->ContextRecord->X11 = cpu->lazyFlagType;
68
69#elif defined(BOXEDWINE_64)
70 for (U32 i = 0; i < 8; i++) {
71 if (regCache[i] != 0xFF) {
72 switch (regCache[i]) {
73 case 0: ep->ContextRecord->Rax = cpu->reg[i].u32; break;
74 case 1: ep->ContextRecord->Rcx = cpu->reg[i].u32; break;
75 case 2: ep->ContextRecord->Rdx = cpu->reg[i].u32; break;
76 case 3: ep->ContextRecord->Rbx = cpu->reg[i].u32; break;
77 case 10: ep->ContextRecord->R10 = cpu->reg[i].u32; break;
78 case 5: ep->ContextRecord->Rbp = cpu->reg[i].u32; break;
79 case 6: ep->ContextRecord->Rsi = cpu->reg[i].u32; break;
80 case 7: ep->ContextRecord->Rdi = cpu->reg[i].u32; break;
81 default:
82 kpanic("Windows x86 syncToException");
83 }
84 }
85 }
86 for (U32 i = 0; i < 8; i++) {
87 if (xmmCache[i] != 0xFF) {
88 switch (xmmCache[i]) {
89 case 0:
90 ep->ContextRecord->Xmm0.Low = cpu->xmm[i].pi.u64[0];
91 ep->ContextRecord->Xmm0.High = cpu->xmm[i].pi.u64[1];
92 break;
93 case 1:
94 ep->ContextRecord->Xmm1.Low = cpu->xmm[i].pi.u64[0];
95 ep->ContextRecord->Xmm1.High = cpu->xmm[i].pi.u64[1];

Callers 1

seh_filterFunction · 0.85

Calls 1

kpanicFunction · 0.85

Tested by

no test coverage detected