debuggers.hg

view xen/include/asm-x86/hvm/trace.h @ 0:7d21f7218375

Exact replica of unstable on 051908 + README-this
author Mukesh Rathor
date Mon May 19 15:34:57 2008 -0700 (2008-05-19)
parents
children 5c0bf00e371d
line source
1 #ifndef __ASM_X86_HVM_TRACE_H__
2 #define __ASM_X86_HVM_TRACE_H__
4 #include <xen/trace.h>
6 #define DO_TRC_HVM_VMENTRY 1
7 #define DO_TRC_HVM_VMEXIT 1
8 #define DO_TRC_HVM_PF_XEN 1
9 #define DO_TRC_HVM_PF_INJECT 1
10 #define DO_TRC_HVM_INJ_EXC 1
11 #define DO_TRC_HVM_INJ_VIRQ 1
12 #define DO_TRC_HVM_REINJ_VIRQ 1
13 #define DO_TRC_HVM_IO_READ 1
14 #define DO_TRC_HVM_IO_WRITE 1
15 #define DO_TRC_HVM_CR_READ 1
16 #define DO_TRC_HVM_CR_WRITE 1
17 #define DO_TRC_HVM_DR_READ 1
18 #define DO_TRC_HVM_DR_WRITE 1
19 #define DO_TRC_HVM_MSR_READ 1
20 #define DO_TRC_HVM_MSR_WRITE 1
21 #define DO_TRC_HVM_CPUID 1
22 #define DO_TRC_HVM_INTR 1
23 #define DO_TRC_HVM_NMI 1
24 #define DO_TRC_HVM_MCE 1
25 #define DO_TRC_HVM_SMI 1
26 #define DO_TRC_HVM_VMMCALL 1
27 #define DO_TRC_HVM_HLT 1
28 #define DO_TRC_HVM_INVLPG 1
29 #define DO_TRC_HVM_IO_ASSIST 1
30 #define DO_TRC_HVM_MMIO_ASSIST 1
31 #define DO_TRC_HVM_CLTS 1
32 #define DO_TRC_HVM_LMSW 1
34 static inline void hvmtrace_vmexit(struct vcpu *v,
35 unsigned long rip,
36 unsigned long exit_reason)
37 {
38 if ( likely(!tb_init_done) )
39 return;
41 #ifdef __x86_64__
42 if ( hvm_long_mode_enabled(v) )
43 {
44 struct {
45 unsigned did:16, vid:16;
46 unsigned exit_reason:32;
47 u64 rip;
48 } d;
50 d.did = v->domain->domain_id;
51 d.vid = v->vcpu_id;
52 d.exit_reason = exit_reason;
53 d.rip = rip;
54 __trace_var(TRC_HVM_VMEXIT64, 1/*cycles*/, sizeof(d),
55 (unsigned char *)&d);
56 }
57 else
58 #endif
59 {
60 struct {
61 unsigned did:16, vid:16;
62 unsigned exit_reason:32;
63 u32 eip;
64 } d;
66 d.did = v->domain->domain_id;
67 d.vid = v->vcpu_id;
68 d.exit_reason = exit_reason;
69 d.eip = rip;
70 __trace_var(TRC_HVM_VMEXIT, 1/*cycles*/, sizeof(d),
71 (unsigned char *)&d);
72 }
73 }
76 static inline void hvmtrace_vmentry(struct vcpu *v)
77 {
78 struct {
79 unsigned did:16, vid:16;
80 } d;
82 if ( likely(!tb_init_done) )
83 return;
85 d.did = v->domain->domain_id;
86 d.vid = v->vcpu_id;
87 __trace_var(TRC_HVM_VMENTRY, 1/*cycles*/, sizeof(d), (unsigned char *)&d);
88 }
90 static inline void hvmtrace_msr_read(struct vcpu *v, u32 ecx, u64 msr_content)
91 {
92 struct {
93 unsigned did:16, vid:16;
94 u32 ecx;
95 u64 msr_content;
96 } d;
98 if ( likely(!tb_init_done) )
99 return;
101 d.did = v->domain->domain_id;
102 d.vid = v->vcpu_id;
103 d.ecx = ecx;
104 d.msr_content = msr_content;
105 __trace_var(TRC_HVM_MSR_READ, 0/*!cycles*/, sizeof(d),
106 (unsigned char *)&d);
107 }
109 static inline void hvmtrace_msr_write(struct vcpu *v, u32 ecx, u64 msr_content)
110 {
111 struct {
112 unsigned did:16, vid:16;
113 u32 ecx;
114 u64 msr_content;
115 } d;
117 if ( likely(!tb_init_done) )
118 return;
120 d.did = v->domain->domain_id;
121 d.vid = v->vcpu_id;
122 d.ecx = ecx;
123 d.msr_content = msr_content;
124 __trace_var(TRC_HVM_MSR_WRITE, 0/*!cycles*/,sizeof(d),
125 (unsigned char *)&d);
126 }
128 static inline void hvmtrace_pf_xen(struct vcpu *v, unsigned long va,
129 u32 error_code)
130 {
131 if ( likely(!tb_init_done) )
132 return;
134 #ifdef __x86_64__
135 if( hvm_long_mode_enabled(v) )
136 {
137 struct {
138 unsigned did:16, vid:16;
139 u32 error_code;
140 u64 va;
141 } d;
142 d.did = v->domain->domain_id;
143 d.vid = v->vcpu_id;
144 d.error_code = error_code;
145 d.va = va;
146 __trace_var(TRC_HVM_PF_XEN64, 0/*!cycles*/,sizeof(d),
147 (unsigned char *)&d);
148 }
149 else
150 #endif
151 {
152 struct {
153 unsigned did:16, vid:16;
154 u32 error_code;
155 u32 va;
156 } d;
157 d.did = v->domain->domain_id;
158 d.vid = v->vcpu_id;
159 d.error_code = error_code;
160 d.va = va;
161 __trace_var(TRC_HVM_PF_XEN, 0/*!cycles*/,sizeof(d),
162 (unsigned char *)&d);
163 }
164 }
166 #define HVMTRACE_ND(evt, vcpu, count, d1, d2, d3, d4) \
167 do { \
168 if ( unlikely(tb_init_done) && DO_TRC_HVM_ ## evt ) \
169 { \
170 struct { \
171 unsigned did:16, vid:16; \
172 u32 d[4]; \
173 } _d; \
174 _d.did=(vcpu)->domain->domain_id; \
175 _d.vid=(vcpu)->vcpu_id; \
176 _d.d[0]=(d1); \
177 _d.d[1]=(d2); \
178 _d.d[2]=(d3); \
179 _d.d[3]=(d4); \
180 __trace_var(TRC_HVM_ ## evt, 0/*!cycles*/, \
181 sizeof(u32)*count+1, (unsigned char *)&_d); \
182 } \
183 } while(0)
185 #define HVMTRACE_4D(evt, vcpu, d1, d2, d3, d4) HVMTRACE_ND(evt, vcpu, 4, d1, d2, d3, d4)
186 #define HVMTRACE_3D(evt, vcpu, d1, d2, d3) HVMTRACE_ND(evt, vcpu, 3, d1, d2, d3, 0)
187 #define HVMTRACE_2D(evt, vcpu, d1, d2) HVMTRACE_ND(evt, vcpu, 2, d1, d2, 0, 0)
188 #define HVMTRACE_1D(evt, vcpu, d1) HVMTRACE_ND(evt, vcpu, 1, d1, 0, 0, 0)
189 #define HVMTRACE_0D(evt, vcpu) HVMTRACE_ND(evt, vcpu, 0, 0, 0, 0, 0)
191 #endif /* __ASM_X86_HVM_TRACE_H__ */
193 /*
194 * Local variables:
195 * mode: C
196 * c-set-style: "BSD"
197 * c-basic-offset: 4
198 * tab-width: 4
199 * indent-tabs-mode: nil
200 * End:
201 */