Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Unified Diff: snapshot/win/cpu_context_win.cc

Issue 1336823002: win x86: Grab bag of restructuring to get tests working on x86-on-x86 (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: . Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | snapshot/win/cpu_context_win_test.cc » ('j') | snapshot/win/exception_snapshot_win.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | snapshot/win/cpu_context_win_test.cc » ('j') | snapshot/win/exception_snapshot_win.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698