| Home | Trees | Indices | Help |
|
|---|
|
|
1 # Copyright (c) 2009, Mario Vilas
2 # All rights reserved.
3 #
4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are met:
6 #
7 # * Redistributions of source code must retain the above copyright notice,
8 # this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above copyright
10 # notice,this list of conditions and the following disclaimer in the
11 # documentation and/or other materials provided with the distribution.
12 # * Neither the name of the copyright holder nor the names of its
13 # contributors may be used to endorse or promote products derived from
14 # this software without specific prior written permission.
15 #
16 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
20 # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 # POSSIBILITY OF SUCH DAMAGE.
27
28 """
29 Debugging API wrappers in ctypes.
30
31 @see: U{http://apps.sourceforge.net/trac/winappdbg/wiki/Win32APIWrappers}
32 """
33
34 __revision__ = "$Id: context_ia64.py 409 2009-09-27 16:51:37Z QvasiModo $"
35
36 from defines import *
37
38 ###############################################################################
39 ## ##
40 ## This is an experimental file for support of Itanum processors. ##
41 ## Since I have no way of testing this -Itanums don't come cheap- ##
42 ## it's very likely to break. ##
43 ## ##
44 ## The file kernel32.py has to be edited for this one to be loaded. ##
45 ## ##
46 ## Try at your own risk. (And tell me how it went!) ##
47 ## ##
48 ###############################################################################
49
50 # The following values specify the type of access in the first parameter
51 # of the exception record whan the exception code specifies an access
52 # violation.
53 EXCEPTION_READ_FAULT = 0 # exception caused by a read
54 EXCEPTION_WRITE_FAULT = 1 # exception caused by a write
55 EXCEPTION_EXECUTE_FAULT = 2 # exception caused by an instruction fetch
56
57 CONTEXT_IA64 = 0x00080000
58
59 CONTEXT_CONTROL = (CONTEXT_IA64 | 0x00000001L)
60 CONTEXT_LOWER_FLOATING_POINT = (CONTEXT_IA64 | 0x00000002L)
61 CONTEXT_HIGHER_FLOATING_POINT = (CONTEXT_IA64 | 0x00000004L)
62 CONTEXT_INTEGER = (CONTEXT_IA64 | 0x00000008L)
63 CONTEXT_DEBUG = (CONTEXT_IA64 | 0x00000010L)
64 CONTEXT_IA32_CONTROL = (CONTEXT_IA64 | 0x00000020L) # Includes StIPSR
65
66
67 CONTEXT_FLOATING_POINT = (CONTEXT_LOWER_FLOATING_POINT | CONTEXT_HIGHER_FLOATING_POINT)
68 CONTEXT_FULL = (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER | CONTEXT_IA32_CONTROL)
69 CONTEXT_ALL = (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER | CONTEXT_DEBUG | CONTEXT_IA32_CONTROL)
70
71 CONTEXT_EXCEPTION_ACTIVE = 0x8000000
72 CONTEXT_SERVICE_ACTIVE = 0x10000000
73 CONTEXT_EXCEPTION_REQUEST = 0x40000000
74 CONTEXT_EXCEPTION_REPORTING = 0x80000000
75
76 # //
77 # // Context Frame
78 # //
79 # // This frame has a several purposes: 1) it is used as an argument to
80 # // NtContinue, 2) it is used to construct a call frame for APC delivery,
81 # // 3) it is used to construct a call frame for exception dispatching
82 # // in user mode, 4) it is used in the user level thread creation
83 # // routines, and 5) it is used to to pass thread state to debuggers.
84 # //
85 # // N.B. Because this record is used as a call frame, it must be EXACTLY
86 # // a multiple of 16 bytes in length and aligned on a 16-byte boundary.
87 # //
88 #
89 # typedef struct _CONTEXT {
90 #
91 # //
92 # // The flags values within this flag control the contents of
93 # // a CONTEXT record.
94 # //
95 # // If the context record is used as an input parameter, then
96 # // for each portion of the context record controlled by a flag
97 # // whose value is set, it is assumed that that portion of the
98 # // context record contains valid context. If the context record
99 # // is being used to modify a thread's context, then only that
100 # // portion of the threads context will be modified.
101 # //
102 # // If the context record is used as an IN OUT parameter to capture
103 # // the context of a thread, then only those portions of the thread's
104 # // context corresponding to set flags will be returned.
105 # //
106 # // The context record is never used as an OUT only parameter.
107 # //
108 #
109 # DWORD ContextFlags;
110 # DWORD Fill1[3]; // for alignment of following on 16-byte boundary
111 #
112 # //
113 # // This section is specified/returned if the ContextFlags word contains
114 # // the flag CONTEXT_DEBUG.
115 # //
116 # // N.B. CONTEXT_DEBUG is *not* part of CONTEXT_FULL.
117 # //
118 #
119 # ULONGLONG DbI0;
120 # ULONGLONG DbI1;
121 # ULONGLONG DbI2;
122 # ULONGLONG DbI3;
123 # ULONGLONG DbI4;
124 # ULONGLONG DbI5;
125 # ULONGLONG DbI6;
126 # ULONGLONG DbI7;
127 #
128 # ULONGLONG DbD0;
129 # ULONGLONG DbD1;
130 # ULONGLONG DbD2;
131 # ULONGLONG DbD3;
132 # ULONGLONG DbD4;
133 # ULONGLONG DbD5;
134 # ULONGLONG DbD6;
135 # ULONGLONG DbD7;
136 #
137 # //
138 # // This section is specified/returned if the ContextFlags word contains
139 # // the flag CONTEXT_LOWER_FLOATING_POINT.
140 # //
141 #
142 # FLOAT128 FltS0;
143 # FLOAT128 FltS1;
144 # FLOAT128 FltS2;
145 # FLOAT128 FltS3;
146 # FLOAT128 FltT0;
147 # FLOAT128 FltT1;
148 # FLOAT128 FltT2;
149 # FLOAT128 FltT3;
150 # FLOAT128 FltT4;
151 # FLOAT128 FltT5;
152 # FLOAT128 FltT6;
153 # FLOAT128 FltT7;
154 # FLOAT128 FltT8;
155 # FLOAT128 FltT9;
156 #
157 # //
158 # // This section is specified/returned if the ContextFlags word contains
159 # // the flag CONTEXT_HIGHER_FLOATING_POINT.
160 # //
161 #
162 # FLOAT128 FltS4;
163 # FLOAT128 FltS5;
164 # FLOAT128 FltS6;
165 # FLOAT128 FltS7;
166 # FLOAT128 FltS8;
167 # FLOAT128 FltS9;
168 # FLOAT128 FltS10;
169 # FLOAT128 FltS11;
170 # FLOAT128 FltS12;
171 # FLOAT128 FltS13;
172 # FLOAT128 FltS14;
173 # FLOAT128 FltS15;
174 # FLOAT128 FltS16;
175 # FLOAT128 FltS17;
176 # FLOAT128 FltS18;
177 # FLOAT128 FltS19;
178 #
179 # FLOAT128 FltF32;
180 # FLOAT128 FltF33;
181 # FLOAT128 FltF34;
182 # FLOAT128 FltF35;
183 # FLOAT128 FltF36;
184 # FLOAT128 FltF37;
185 # FLOAT128 FltF38;
186 # FLOAT128 FltF39;
187 #
188 # FLOAT128 FltF40;
189 # FLOAT128 FltF41;
190 # FLOAT128 FltF42;
191 # FLOAT128 FltF43;
192 # FLOAT128 FltF44;
193 # FLOAT128 FltF45;
194 # FLOAT128 FltF46;
195 # FLOAT128 FltF47;
196 # FLOAT128 FltF48;
197 # FLOAT128 FltF49;
198 #
199 # FLOAT128 FltF50;
200 # FLOAT128 FltF51;
201 # FLOAT128 FltF52;
202 # FLOAT128 FltF53;
203 # FLOAT128 FltF54;
204 # FLOAT128 FltF55;
205 # FLOAT128 FltF56;
206 # FLOAT128 FltF57;
207 # FLOAT128 FltF58;
208 # FLOAT128 FltF59;
209 #
210 # FLOAT128 FltF60;
211 # FLOAT128 FltF61;
212 # FLOAT128 FltF62;
213 # FLOAT128 FltF63;
214 # FLOAT128 FltF64;
215 # FLOAT128 FltF65;
216 # FLOAT128 FltF66;
217 # FLOAT128 FltF67;
218 # FLOAT128 FltF68;
219 # FLOAT128 FltF69;
220 #
221 # FLOAT128 FltF70;
222 # FLOAT128 FltF71;
223 # FLOAT128 FltF72;
224 # FLOAT128 FltF73;
225 # FLOAT128 FltF74;
226 # FLOAT128 FltF75;
227 # FLOAT128 FltF76;
228 # FLOAT128 FltF77;
229 # FLOAT128 FltF78;
230 # FLOAT128 FltF79;
231 #
232 # FLOAT128 FltF80;
233 # FLOAT128 FltF81;
234 # FLOAT128 FltF82;
235 # FLOAT128 FltF83;
236 # FLOAT128 FltF84;
237 # FLOAT128 FltF85;
238 # FLOAT128 FltF86;
239 # FLOAT128 FltF87;
240 # FLOAT128 FltF88;
241 # FLOAT128 FltF89;
242 #
243 # FLOAT128 FltF90;
244 # FLOAT128 FltF91;
245 # FLOAT128 FltF92;
246 # FLOAT128 FltF93;
247 # FLOAT128 FltF94;
248 # FLOAT128 FltF95;
249 # FLOAT128 FltF96;
250 # FLOAT128 FltF97;
251 # FLOAT128 FltF98;
252 # FLOAT128 FltF99;
253 #
254 # FLOAT128 FltF100;
255 # FLOAT128 FltF101;
256 # FLOAT128 FltF102;
257 # FLOAT128 FltF103;
258 # FLOAT128 FltF104;
259 # FLOAT128 FltF105;
260 # FLOAT128 FltF106;
261 # FLOAT128 FltF107;
262 # FLOAT128 FltF108;
263 # FLOAT128 FltF109;
264 #
265 # FLOAT128 FltF110;
266 # FLOAT128 FltF111;
267 # FLOAT128 FltF112;
268 # FLOAT128 FltF113;
269 # FLOAT128 FltF114;
270 # FLOAT128 FltF115;
271 # FLOAT128 FltF116;
272 # FLOAT128 FltF117;
273 # FLOAT128 FltF118;
274 # FLOAT128 FltF119;
275 #
276 # FLOAT128 FltF120;
277 # FLOAT128 FltF121;
278 # FLOAT128 FltF122;
279 # FLOAT128 FltF123;
280 # FLOAT128 FltF124;
281 # FLOAT128 FltF125;
282 # FLOAT128 FltF126;
283 # FLOAT128 FltF127;
284 #
285 # //
286 # // This section is specified/returned if the ContextFlags word contains
287 # // the flag CONTEXT_LOWER_FLOATING_POINT | CONTEXT_HIGHER_FLOATING_POINT | CONTEXT_CONTROL.
288 # //
289 #
290 # ULONGLONG StFPSR; // FP status
291 #
292 # //
293 # // This section is specified/returned if the ContextFlags word contains
294 # // the flag CONTEXT_INTEGER.
295 # //
296 # // N.B. The registers gp, sp, rp are part of the control context
297 # //
298 #
299 # ULONGLONG IntGp; // r1, volatile
300 # ULONGLONG IntT0; // r2-r3, volatile
301 # ULONGLONG IntT1; //
302 # ULONGLONG IntS0; // r4-r7, preserved
303 # ULONGLONG IntS1;
304 # ULONGLONG IntS2;
305 # ULONGLONG IntS3;
306 # ULONGLONG IntV0; // r8, volatile
307 # ULONGLONG IntT2; // r9-r11, volatile
308 # ULONGLONG IntT3;
309 # ULONGLONG IntT4;
310 # ULONGLONG IntSp; // stack pointer (r12), special
311 # ULONGLONG IntTeb; // teb (r13), special
312 # ULONGLONG IntT5; // r14-r31, volatile
313 # ULONGLONG IntT6;
314 # ULONGLONG IntT7;
315 # ULONGLONG IntT8;
316 # ULONGLONG IntT9;
317 # ULONGLONG IntT10;
318 # ULONGLONG IntT11;
319 # ULONGLONG IntT12;
320 # ULONGLONG IntT13;
321 # ULONGLONG IntT14;
322 # ULONGLONG IntT15;
323 # ULONGLONG IntT16;
324 # ULONGLONG IntT17;
325 # ULONGLONG IntT18;
326 # ULONGLONG IntT19;
327 # ULONGLONG IntT20;
328 # ULONGLONG IntT21;
329 # ULONGLONG IntT22;
330 #
331 # ULONGLONG IntNats; // Nat bits for r1-r31
332 # // r1-r31 in bits 1 thru 31.
333 # ULONGLONG Preds; // predicates, preserved
334 #
335 # ULONGLONG BrRp; // return pointer, b0, preserved
336 # ULONGLONG BrS0; // b1-b5, preserved
337 # ULONGLONG BrS1;
338 # ULONGLONG BrS2;
339 # ULONGLONG BrS3;
340 # ULONGLONG BrS4;
341 # ULONGLONG BrT0; // b6-b7, volatile
342 # ULONGLONG BrT1;
343 #
344 # //
345 # // This section is specified/returned if the ContextFlags word contains
346 # // the flag CONTEXT_CONTROL.
347 # //
348 #
349 # // Other application registers
350 # ULONGLONG ApUNAT; // User Nat collection register, preserved
351 # ULONGLONG ApLC; // Loop counter register, preserved
352 # ULONGLONG ApEC; // Epilog counter register, preserved
353 # ULONGLONG ApCCV; // CMPXCHG value register, volatile
354 # ULONGLONG ApDCR; // Default control register (TBD)
355 #
356 # // Register stack info
357 # ULONGLONG RsPFS; // Previous function state, preserved
358 # ULONGLONG RsBSP; // Backing store pointer, preserved
359 # ULONGLONG RsBSPSTORE;
360 # ULONGLONG RsRSC; // RSE configuration, volatile
361 # ULONGLONG RsRNAT; // RSE Nat collection register, preserved
362 #
363 # // Trap Status Information
364 # ULONGLONG StIPSR; // Interruption Processor Status
365 # ULONGLONG StIIP; // Interruption IP
366 # ULONGLONG StIFS; // Interruption Function State
367 #
368 # // iA32 related control registers
369 # ULONGLONG StFCR; // copy of Ar21
370 # ULONGLONG Eflag; // Eflag copy of Ar24
371 # ULONGLONG SegCSD; // iA32 CSDescriptor (Ar25)
372 # ULONGLONG SegSSD; // iA32 SSDescriptor (Ar26)
373 # ULONGLONG Cflag; // Cr0+Cr4 copy of Ar27
374 # ULONGLONG StFSR; // x86 FP status (copy of AR28)
375 # ULONGLONG StFIR; // x86 FP status (copy of AR29)
376 # ULONGLONG StFDR; // x86 FP status (copy of AR30)
377 #
378 # ULONGLONG UNUSEDPACK; // added to pack StFDR to 16-bytes
379 #
380 # } CONTEXT, *PCONTEXT;
381
383 arch = 'ia64'
384
385 _pack_ = 16
386 _fields_ = [
387 ('ContextFlags', DWORD),
388 ('Fill1', DWORD * 3), # alignment
389
390 # CONTEXT_DEBUG
391 ('DbI0', ULONGLONG),
392 ('DbI1', ULONGLONG),
393 ('DbI2', ULONGLONG),
394 ('DbI3', ULONGLONG),
395 ('DbI4', ULONGLONG),
396 ('DbI5', ULONGLONG),
397 ('DbI6', ULONGLONG),
398 ('DbI7', ULONGLONG),
399 ('DbD0', ULONGLONG),
400 ('DbD1', ULONGLONG),
401 ('DbD2', ULONGLONG),
402 ('DbD3', ULONGLONG),
403 ('DbD4', ULONGLONG),
404 ('DbD5', ULONGLONG),
405 ('DbD6', ULONGLONG),
406 ('DbD7', ULONGLONG),
407
408 # CONTEXT_LOWER_FLOATING_POINT
409 ('FltS0', FLOAT128),
410 ('FltS1', FLOAT128),
411 ('FltS2', FLOAT128),
412 ('FltS3', FLOAT128),
413 ('FltT0', FLOAT128),
414 ('FltT1', FLOAT128),
415 ('FltT2', FLOAT128),
416 ('FltT3', FLOAT128),
417 ('FltT4', FLOAT128),
418 ('FltT5', FLOAT128),
419 ('FltT6', FLOAT128),
420 ('FltT7', FLOAT128),
421 ('FltT8', FLOAT128),
422 ('FltT9', FLOAT128),
423
424 # CONTEXT_HIGHER_FLOATING_POINT
425 ('FltS4', FLOAT128),
426 ('FltS5', FLOAT128),
427 ('FltS6', FLOAT128),
428 ('FltS7', FLOAT128),
429 ('FltS8', FLOAT128),
430 ('FltS9', FLOAT128),
431 ('FltS10', FLOAT128),
432 ('FltS11', FLOAT128),
433 ('FltS12', FLOAT128),
434 ('FltS13', FLOAT128),
435 ('FltS14', FLOAT128),
436 ('FltS15', FLOAT128),
437 ('FltS16', FLOAT128),
438 ('FltS17', FLOAT128),
439 ('FltS18', FLOAT128),
440 ('FltS19', FLOAT128),
441 ('FltF32', FLOAT128),
442 ('FltF33', FLOAT128),
443 ('FltF34', FLOAT128),
444 ('FltF35', FLOAT128),
445 ('FltF36', FLOAT128),
446 ('FltF37', FLOAT128),
447 ('FltF38', FLOAT128),
448 ('FltF39', FLOAT128),
449 ('FltF40', FLOAT128),
450 ('FltF41', FLOAT128),
451 ('FltF42', FLOAT128),
452 ('FltF43', FLOAT128),
453 ('FltF44', FLOAT128),
454 ('FltF45', FLOAT128),
455 ('FltF46', FLOAT128),
456 ('FltF47', FLOAT128),
457 ('FltF48', FLOAT128),
458 ('FltF49', FLOAT128),
459 ('FltF50', FLOAT128),
460 ('FltF51', FLOAT128),
461 ('FltF52', FLOAT128),
462 ('FltF53', FLOAT128),
463 ('FltF54', FLOAT128),
464 ('FltF55', FLOAT128),
465 ('FltF56', FLOAT128),
466 ('FltF57', FLOAT128),
467 ('FltF58', FLOAT128),
468 ('FltF59', FLOAT128),
469 ('FltF60', FLOAT128),
470 ('FltF61', FLOAT128),
471 ('FltF62', FLOAT128),
472 ('FltF63', FLOAT128),
473 ('FltF64', FLOAT128),
474 ('FltF65', FLOAT128),
475 ('FltF66', FLOAT128),
476 ('FltF67', FLOAT128),
477 ('FltF68', FLOAT128),
478 ('FltF69', FLOAT128),
479 ('FltF70', FLOAT128),
480 ('FltF71', FLOAT128),
481 ('FltF72', FLOAT128),
482 ('FltF73', FLOAT128),
483 ('FltF74', FLOAT128),
484 ('FltF75', FLOAT128),
485 ('FltF76', FLOAT128),
486 ('FltF77', FLOAT128),
487 ('FltF78', FLOAT128),
488 ('FltF79', FLOAT128),
489 ('FltF80', FLOAT128),
490 ('FltF81', FLOAT128),
491 ('FltF82', FLOAT128),
492 ('FltF83', FLOAT128),
493 ('FltF84', FLOAT128),
494 ('FltF85', FLOAT128),
495 ('FltF86', FLOAT128),
496 ('FltF87', FLOAT128),
497 ('FltF88', FLOAT128),
498 ('FltF89', FLOAT128),
499 ('FltF90', FLOAT128),
500 ('FltF91', FLOAT128),
501 ('FltF92', FLOAT128),
502 ('FltF93', FLOAT128),
503 ('FltF94', FLOAT128),
504 ('FltF95', FLOAT128),
505 ('FltF96', FLOAT128),
506 ('FltF97', FLOAT128),
507 ('FltF98', FLOAT128),
508 ('FltF99', FLOAT128),
509 ('FltF100', FLOAT128),
510 ('FltF101', FLOAT128),
511 ('FltF102', FLOAT128),
512 ('FltF103', FLOAT128),
513 ('FltF104', FLOAT128),
514 ('FltF105', FLOAT128),
515 ('FltF106', FLOAT128),
516 ('FltF107', FLOAT128),
517 ('FltF108', FLOAT128),
518 ('FltF109', FLOAT128),
519 ('FltF110', FLOAT128),
520 ('FltF111', FLOAT128),
521 ('FltF112', FLOAT128),
522 ('FltF113', FLOAT128),
523 ('FltF114', FLOAT128),
524 ('FltF115', FLOAT128),
525 ('FltF116', FLOAT128),
526 ('FltF117', FLOAT128),
527 ('FltF118', FLOAT128),
528 ('FltF119', FLOAT128),
529 ('FltF120', FLOAT128),
530 ('FltF121', FLOAT128),
531 ('FltF122', FLOAT128),
532 ('FltF123', FLOAT128),
533 ('FltF124', FLOAT128),
534 ('FltF125', FLOAT128),
535 ('FltF126', FLOAT128),
536 ('FltF127', FLOAT128),
537
538 # CONTEXT_LOWER_FLOATING_POINT | CONTEXT_HIGHER_FLOATING_POINT | CONTEXT_CONTROL
539 ('StFPSR', ULONGLONG),
540
541 # CONTEXT_INTEGER (except gp, sp, rp)
542 ('IntGp', ULONGLONG), # r1, volatile
543 ('IntT0', ULONGLONG), # r2-r3, volatile
544 ('IntT1', ULONGLONG),
545 ('IntS0', ULONGLONG), # r4-r7, preserved
546 ('IntS1', ULONGLONG),
547 ('IntS2', ULONGLONG),
548 ('IntS3', ULONGLONG),
549 ('IntV0', ULONGLONG), # r8, volatile
550 ('IntT2', ULONGLONG), # r9-r11, volatile
551 ('IntT3', ULONGLONG),
552 ('IntT4', ULONGLONG),
553 ('IntSp', ULONGLONG), # stack pointer (r12), special
554 ('IntTeb', ULONGLONG), # teb (r13), special
555 ('IntT5', ULONGLONG), # r14-r31, volatile
556 ('IntT6', ULONGLONG),
557 ('IntT7', ULONGLONG),
558 ('IntT8', ULONGLONG),
559 ('IntT9', ULONGLONG),
560 ('IntT10', ULONGLONG),
561 ('IntT11', ULONGLONG),
562 ('IntT12', ULONGLONG),
563 ('IntT13', ULONGLONG),
564 ('IntT14', ULONGLONG),
565 ('IntT15', ULONGLONG),
566 ('IntT16', ULONGLONG),
567 ('IntT17', ULONGLONG),
568 ('IntT18', ULONGLONG),
569 ('IntT19', ULONGLONG),
570 ('IntT20', ULONGLONG),
571 ('IntT21', ULONGLONG),
572 ('IntT22', ULONGLONG),
573 ('IntNats', ULONGLONG), # Nat bits for r1-r31
574 # r1-r31 in bits 1 thru 31.
575 ('Preds', ULONGLONG), # predicates, preserved
576
577 ('BrRp', ULONGLONG), # return pointer, b0, preserved
578 ('BrS0', ULONGLONG), # b1-b5, preserved
579 ('BrS1', ULONGLONG),
580 ('BrS2', ULONGLONG),
581 ('BrS3', ULONGLONG),
582 ('BrS4', ULONGLONG),
583 ('BrT0', ULONGLONG), # b6-b7, volatile
584 ('BrT1', ULONGLONG),
585
586 # CONTEXT_CONTROL
587
588 # Other application registers
589 ('ApUNAT', ULONGLONG), # User Nat collection register, preserved
590 ('ApLC', ULONGLONG), # Loop counter register, preserved
591 ('ApEC', ULONGLONG), # Epilog counter register, preserved
592 ('ApCCV', ULONGLONG), # CMPXCHG value register, volatile
593 ('ApDCR', ULONGLONG), # Default control register (TBD)
594
595 # Register stack info
596 ('RsPFS', ULONGLONG), # Previous function state, preserved
597 ('RsBSP', ULONGLONG), # Backing store pointer, preserved
598 ('RsBSPSTORE', ULONGLONG),
599 ('RsRSC', ULONGLONG), # RSE configuration, volatile
600 ('RsRNAT', ULONGLONG), # RSE Nat collection register, preserved
601
602 # Trap Status Information
603 ('StIPSR', ULONGLONG), # Interruption Processor Status
604 ('StIIP', ULONGLONG), # Interruption IP
605 ('StIFS', ULONGLONG), # Interruption Function State
606
607 # iA32 related control registers
608 ('StFCR', ULONGLONG), # copy of Ar21
609 ('Eflag', ULONGLONG), # Eflag copy of Ar24
610 ('SegCSD', ULONGLONG), # iA32 CSDescriptor (Ar25)
611 ('SegSSD', ULONGLONG), # iA32 SSDescriptor (Ar26)
612 ('Cflag', ULONGLONG), # Cr0+Cr4 copy of Ar27
613 ('StFSR', ULONGLONG), # x86 FP status (copy of AR28)
614 ('StFIR', ULONGLONG), # x86 FP status (copy of AR29)
615 ('StFDR', ULONGLONG), # x86 FP status (copy of AR30)
616 ('UNUSEDPACK', ULONGLONG), # added to pack StFDR to 16-bytes
617 ]
618
619 PCONTEXT = POINTER(CONTEXT)
620 LPCONTEXT = PCONTEXT
621
623 """
624 Register context dictionary for the %s architecture.
625 """ % CONTEXT.arch
626 arch = CONTEXT.arch
627
628 # See http://msdn.microsoft.com/en-us/library/cc266544.aspx
629
633 self['IntGp'] = value
634 gp = property(__get_gp, __set_gp)
635
639 self['IntSp'] = value
640 sp = property(__get_sp, __set_sp)
641
645 self['IntRp'] = value
646 rp = property(__get_rp, __set_rp)
647
648 ###############################################################################
649
650 # BOOL WINAPI GetThreadContext(
651 # __in HANDLE hThread,
652 # __inout LPCONTEXT lpContext
653 # );
655 _GetThreadContext = windll.kernel32.GetThreadContext
656 _GetThreadContext.argtypes = [HANDLE, LPCONTEXT]
657 _GetThreadContext.restype = bool
658 _GetThreadContext.errcheck = RaiseIfZero
659
660 if ContextFlags is None:
661 ContextFlags = CONTEXT_ALL
662 lpContext = CONTEXT()
663 lpContext.ContextFlags = ContextFlags
664 _GetThreadContext(hThread, ctypes.byref(lpContext))
665 return lpContext.to_dict()
666
667 # BOOL WINAPI SetThreadContext(
668 # __in HANDLE hThread,
669 # __in const CONTEXT* lpContext
670 # );
672 _SetThreadContext = windll.kernel32.SetThreadContext
673 _SetThreadContext.argtypes = [HANDLE, LPCONTEXT]
674 _SetThreadContext.restype = bool
675 _SetThreadContext.errcheck = RaiseIfZero
676
677 if isinstance(lpContext, dict):
678 lpContext = CONTEXT.from_dict(lpContext)
679 _SetThreadContext(hThread, ctypes.byref(lpContext))
680
| Home | Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0.1 on Fri Feb 12 19:47:47 2010 | http://epydoc.sourceforge.net |