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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Crashpad Authors. All rights reserved. 1 // Copyright 2015 The Crashpad Authors. All rights reserved.
Mark Mentovai 2015/09/16 02:57:19 In the change description, BUG=chromium:531663 so
scottmg 2015/09/16 18:05:06 Done.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 out->dr7 = context.Dr7; 62 out->dr7 = context.Dr7;
63 63
64 static_assert(sizeof(out->fxsave) == sizeof(context.FltSave), 64 static_assert(sizeof(out->fxsave) == sizeof(context.FltSave),
65 "types must be equivalent"); 65 "types must be equivalent");
66 memcpy(&out->fxsave, &context.FltSave.ControlWord, sizeof(out->fxsave)); 66 memcpy(&out->fxsave, &context.FltSave.ControlWord, sizeof(out->fxsave));
67 } 67 }
68 68
69 #else // ARCH_CPU_64_BITS 69 #else // ARCH_CPU_64_BITS
70 70
71 void InitializeX86Context(const CONTEXT& context, CPUContextX86* out) { 71 void InitializeX86Context(const CONTEXT& context, CPUContextX86* out) {
72 CHECK(false) << "TODO(scottmg) InitializeX86Context()"; 72 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.
73 out->ebx = context.Ebx;
74 out->ecx = context.Ecx;
75 out->edx = context.Edx;
76 out->edi = context.Edi;
77 out->esi = context.Esi;
78 out->ebp = context.Ebp;
79 out->esp = context.Esp;
80 out->eip = context.Eip;
81 out->eflags = context.EFlags;
82 out->cs = static_cast<uint16_t>(context.SegCs);
83 out->ds = static_cast<uint16_t>(context.SegDs);
84 out->es = static_cast<uint16_t>(context.SegEs);
85 out->fs = static_cast<uint16_t>(context.SegFs);
86 out->gs = static_cast<uint16_t>(context.SegGs);
87 out->ss = static_cast<uint16_t>(context.SegSs);
88
89 out->dr0 = context.Dr0;
90 out->dr1 = context.Dr1;
91 out->dr2 = context.Dr2;
92 out->dr3 = context.Dr3;
93 // DR4 and DR5 are obsolete synonyms for DR6 and DR7, see
94 // 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.
95 out->dr4 = context.Dr6;
96 out->dr5 = context.Dr7;
97 out->dr6 = context.Dr6;
98 out->dr7 = context.Dr7;
99
100 static_assert(sizeof(out->fxsave) == sizeof(context.ExtendedRegisters),
101 "types must be equivalent");
102 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.
73 } 103 }
74 104
75 #endif // ARCH_CPU_64_BITS 105 #endif // ARCH_CPU_64_BITS
76 106
77 } // namespace crashpad 107 } // namespace crashpad
OLDNEW
« 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