direct-io.hg

view tools/libxc/xc_ptrace.h @ 8381:b5b7a9d9fc56

Add MP debug support to gdbserver.

Signed-off-by: Kip Macy <kip.macy@gmail.com>
author kaf24@firebug.cl.cam.ac.uk
date Thu Dec 15 21:02:21 2005 +0100 (2005-12-15)
parents
children 26eff2448966
line source
1 #ifndef XC_PTRACE_
2 #define XC_PTRACE_
4 #ifdef XC_PTRACE_PRIVATE
5 #define X86_CR0_PE 0x00000001 /* Enable Protected Mode (RW) */
6 #define X86_CR0_PG 0x80000000 /* Paging (RW) */
7 #define BSD_PAGE_MASK (PAGE_SIZE-1)
8 #define PDRSHIFT 22
9 #define PSL_T 0x00000100 /* trace enable bit */
11 char * ptrace_names[] = {
12 "PTRACE_TRACEME",
13 "PTRACE_PEEKTEXT",
14 "PTRACE_PEEKDATA",
15 "PTRACE_PEEKUSER",
16 "PTRACE_POKETEXT",
17 "PTRACE_POKEDATA",
18 "PTRACE_POKEUSER",
19 "PTRACE_CONT",
20 "PTRACE_KILL",
21 "PTRACE_SINGLESTEP",
22 "PTRACE_INVALID",
23 "PTRACE_INVALID",
24 "PTRACE_GETREGS",
25 "PTRACE_SETREGS",
26 "PTRACE_GETFPREGS",
27 "PTRACE_SETFPREGS",
28 "PTRACE_ATTACH",
29 "PTRACE_DETACH",
30 "PTRACE_GETFPXREGS",
31 "PTRACE_SETFPXREGS",
32 "PTRACE_INVALID",
33 "PTRACE_INVALID",
34 "PTRACE_INVALID",
35 "PTRACE_INVALID",
36 "PTRACE_SYSCALL",
37 };
39 struct gdb_regs {
40 long ebx; /* 0 */
41 long ecx; /* 4 */
42 long edx; /* 8 */
43 long esi; /* 12 */
44 long edi; /* 16 */
45 long ebp; /* 20 */
46 long eax; /* 24 */
47 int xds; /* 28 */
48 int xes; /* 32 */
49 int xfs; /* 36 */
50 int xgs; /* 40 */
51 long orig_eax; /* 44 */
52 long eip; /* 48 */
53 int xcs; /* 52 */
54 long eflags; /* 56 */
55 long esp; /* 60 */
56 int xss; /* 64 */
57 };
60 #define printval(x) printf("%s = %lx\n", #x, (long)x);
61 #define SET_PT_REGS(pt, xc) \
62 { \
63 pt.ebx = xc.ebx; \
64 pt.ecx = xc.ecx; \
65 pt.edx = xc.edx; \
66 pt.esi = xc.esi; \
67 pt.edi = xc.edi; \
68 pt.ebp = xc.ebp; \
69 pt.eax = xc.eax; \
70 pt.eip = xc.eip; \
71 pt.xcs = xc.cs; \
72 pt.eflags = xc.eflags; \
73 pt.esp = xc.esp; \
74 pt.xss = xc.ss; \
75 pt.xes = xc.es; \
76 pt.xds = xc.ds; \
77 pt.xfs = xc.fs; \
78 pt.xgs = xc.gs; \
79 }
81 #define SET_XC_REGS(pt, xc) \
82 { \
83 xc.ebx = pt->ebx; \
84 xc.ecx = pt->ecx; \
85 xc.edx = pt->edx; \
86 xc.esi = pt->esi; \
87 xc.edi = pt->edi; \
88 xc.ebp = pt->ebp; \
89 xc.eax = pt->eax; \
90 xc.eip = pt->eip; \
91 xc.cs = pt->xcs; \
92 xc.eflags = pt->eflags; \
93 xc.esp = pt->esp; \
94 xc.ss = pt->xss; \
95 xc.es = pt->xes; \
96 xc.ds = pt->xds; \
97 xc.fs = pt->xfs; \
98 xc.gs = pt->xgs; \
99 }
101 #define vtopdi(va) ((va) >> PDRSHIFT)
102 #define vtopti(va) (((va) >> PAGE_SHIFT) & 0x3ff)
103 #endif
105 typedef void (*thr_ev_handler_t)(long);
107 void xc_register_event_handler(
108 thr_ev_handler_t h,
109 td_event_e e);
111 long xc_ptrace(
112 int xc_handle,
113 enum __ptrace_request request,
114 uint32_t domid,
115 long addr,
116 long data);
118 int xc_waitdomain(
119 int xc_handle,
120 int domain,
121 int *status,
122 int options);
124 #endif /* XC_PTRACE */