OLD | NEW |
| (Empty) |
1 // Copyright 2009 The Native Client Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can | |
3 // be found in the LICENSE file. | |
4 | |
5 #pragma once | |
6 | |
7 namespace NaClVsx { | |
8 namespace DebugHelpers { | |
9 | |
10 [System::Runtime::InteropServices::StructLayout( | |
11 System::Runtime::InteropServices::LayoutKind::Sequential)] | |
12 public ref struct RegsX86_64 { | |
13 public: | |
14 System::UInt64 Rax; | |
15 System::UInt64 Rbx; | |
16 System::UInt64 Rcx; | |
17 System::UInt64 Rdx; | |
18 System::UInt64 Rsi; | |
19 System::UInt64 Rdi; | |
20 System::UInt64 Rbp; | |
21 System::UInt64 Rsp; | |
22 System::UInt64 R8; | |
23 System::UInt64 R9; | |
24 System::UInt64 R10; | |
25 System::UInt64 R11; | |
26 System::UInt64 R12; | |
27 System::UInt64 R13; | |
28 System::UInt64 R14; | |
29 System::UInt64 R15; | |
30 System::UInt64 Rip; | |
31 System::UInt32 EFlags; | |
32 System::UInt32 SegCs; | |
33 System::UInt32 SegSs; | |
34 System::UInt32 SegDs; | |
35 System::UInt32 SegEs; | |
36 System::UInt32 SegFs; | |
37 System::UInt32 SegGs; | |
38 System::UInt32 pad; | |
39 | |
40 property System::UInt64 default[int] { | |
41 System::UInt64 get(int index) { | |
42 // DWARF register numbering | |
43 // http://wikis.sun.com/display/SunStudio/Dwarf+Register+Numbering | |
44 switch (index) { | |
45 case 0: | |
46 return Rax; | |
47 case 1: | |
48 return Rdx; | |
49 case 2: | |
50 return Rcx; | |
51 case 3: | |
52 return Rbx; | |
53 case 4: | |
54 return Rsi; | |
55 case 5: | |
56 return Rdi; | |
57 case 6: | |
58 return Rbp; | |
59 case 7: | |
60 return Rsp; | |
61 case 8: | |
62 return R8; | |
63 case 9: | |
64 return R9; | |
65 case 10: | |
66 return R10; | |
67 case 11: | |
68 return R11; | |
69 case 12: | |
70 return R12; | |
71 case 13: | |
72 return R13; | |
73 case 14: | |
74 return R14; | |
75 case 15: | |
76 return R15; | |
77 case 16: | |
78 return Rip; | |
79 case 49: | |
80 return EFlags; | |
81 case 50: | |
82 return SegEs; | |
83 case 51: | |
84 return SegCs; | |
85 case 52: | |
86 return SegSs; | |
87 case 53: | |
88 return SegDs; | |
89 case 54: | |
90 return SegFs; | |
91 case 55: | |
92 return SegGs; | |
93 } | |
94 throw gcnew System::IndexOutOfRangeException("index"); | |
95 } | |
96 void set(int index, System::UInt64 value) { | |
97 // DWARF register numbering | |
98 // http://wikis.sun.com/display/SunStudio/Dwarf+Register+Numbering | |
99 switch (index) { | |
100 case 0: | |
101 Rax = value; | |
102 break; | |
103 case 1: | |
104 Rdx = value; | |
105 break; | |
106 case 2: | |
107 Rcx = value; | |
108 break; | |
109 case 3: | |
110 Rbx = value; | |
111 break; | |
112 case 4: | |
113 Rsi = value; | |
114 break; | |
115 case 5: | |
116 Rdi = value; | |
117 break; | |
118 case 6: | |
119 Rbp = value; | |
120 break; | |
121 case 7: | |
122 Rsp = value; | |
123 break; | |
124 case 8: | |
125 R8 = value; | |
126 break; | |
127 case 9: | |
128 R9 = value; | |
129 break; | |
130 case 10: | |
131 R10 = value; | |
132 break; | |
133 case 11: | |
134 R11 = value; | |
135 break; | |
136 case 12: | |
137 R12 = value; | |
138 break; | |
139 case 13: | |
140 R13 = value; | |
141 break; | |
142 case 14: | |
143 R14 = value; | |
144 break; | |
145 case 15: | |
146 R15 = value; | |
147 break; | |
148 case 16: | |
149 Rip = value; | |
150 break; | |
151 default: | |
152 throw gcnew System::IndexOutOfRangeException("index"); | |
153 } | |
154 } | |
155 } | |
156 }; | |
157 | |
158 } // namespace DebugHelpers | |
159 } // namespace NaClVsx | |
160 | |
OLD | NEW |