Index: snapshot/win/cpu_context_win.cc |
diff --git a/snapshot/win/cpu_context_win.cc b/snapshot/win/cpu_context_win.cc |
index a77ea24798a1d24cbb90af836a74e96d45c46c74..8b1456c1ab2b0aa827e6ac66cf624e3c5b57f305 100644 |
--- a/snapshot/win/cpu_context_win.cc |
+++ b/snapshot/win/cpu_context_win.cc |
@@ -69,7 +69,37 @@ void InitializeX64Context(const CONTEXT& context, CPUContextX86_64* out) { |
#else // ARCH_CPU_64_BITS |
void InitializeX86Context(const CONTEXT& context, CPUContextX86* out) { |
- CHECK(false) << "TODO(scottmg) InitializeX86Context()"; |
+ out->eax = context.Eax; |
Mark Mentovai
2015/09/16 02:57:19
It occurs to me that we should consult context.Con
scottmg
2015/09/16 18:05:06
Done.
|
+ out->ebx = context.Ebx; |
+ out->ecx = context.Ecx; |
+ out->edx = context.Edx; |
+ out->edi = context.Edi; |
+ out->esi = context.Esi; |
+ out->ebp = context.Ebp; |
+ out->esp = context.Esp; |
+ out->eip = context.Eip; |
+ out->eflags = context.EFlags; |
+ out->cs = static_cast<uint16_t>(context.SegCs); |
+ out->ds = static_cast<uint16_t>(context.SegDs); |
+ out->es = static_cast<uint16_t>(context.SegEs); |
+ out->fs = static_cast<uint16_t>(context.SegFs); |
+ out->gs = static_cast<uint16_t>(context.SegGs); |
+ out->ss = static_cast<uint16_t>(context.SegSs); |
+ |
+ out->dr0 = context.Dr0; |
+ out->dr1 = context.Dr1; |
+ out->dr2 = context.Dr2; |
+ out->dr3 = context.Dr3; |
+ // DR4 and DR5 are obsolete synonyms for DR6 and DR7, see |
+ // http://en.wikipedia.org/wiki/X86_debug_register. |
Mark Mentovai
2015/09/16 02:57:19
For here and the x86 funciton: use https in links
scottmg
2015/09/16 18:05:06
Done.
|
+ out->dr4 = context.Dr6; |
+ out->dr5 = context.Dr7; |
+ out->dr6 = context.Dr6; |
+ out->dr7 = context.Dr7; |
+ |
+ static_assert(sizeof(out->fxsave) == sizeof(context.ExtendedRegisters), |
+ "types must be equivalent"); |
+ memcpy(&out->fxsave, &context.ExtendedRegisters, sizeof(out->fxsave)); |
Mark Mentovai
2015/09/16 02:57:19
ExtendedRegisters won’t be valid on a CPU that doe
scottmg
2015/09/16 18:05:06
Ah yes, good point. I CHECKd in that case for now,
scottmg
2015/09/22 18:14:56
I just digested this a little better... fxsave bec
Mark Mentovai
2015/09/22 18:23:15
Yup, that’s right.
|
} |
#endif // ARCH_CPU_64_BITS |