Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
2 | <HTML> | |
3 | <HEAD> | |
4 | <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=iso-8859-1"> | |
5 | <TITLE></TITLE> | |
6 | <META NAME="GENERATOR" CONTENT="StarOffice 8 (Solaris Sparc)"> | |
7 | <META NAME="CREATED" CONTENT="20060130;15381900"> | |
8 | <META NAME="CHANGEDBY" CONTENT="Alex Tsirfa"> | |
9 | <META NAME="CHANGED" CONTENT="20070530;12161400"> | |
10 | <STYLE> | |
11 | <!-- | |
12 | @page { size: 8.5in 11in; margin: 0.79in } | |
13 | P { margin-bottom: 0.08in } | |
14 | --> | |
15 | </STYLE> | |
16 | </HEAD> | |
17 | <BODY LANG="en-US" DIR="LTR"> | |
18 | <P STYLE="margin-bottom: 0in"><FONT SIZE=5><B>SPARC Architectural | |
19 | Model : VCPU Interface</B> </FONT> | |
20 | </P> | |
21 | <P STYLE="margin-bottom: 0in"><FONT SIZE=4><B>Introduction</B></FONT></P> | |
22 | <P STYLE="margin-bottom: 0in">Vcpu hides the details of the cpu | |
23 | specific implementation. | |
24 | </P> | |
25 | <P STYLE="margin-bottom: 0in">It presents an abstract interface to | |
26 | the "virtual cpu" - for cpu with multiple strands, it | |
27 | represents each strand; for cpu without strands, it represent the | |
28 | cpu.</P> | |
29 | <P STYLE="margin-bottom: 0in">A few instances of cpu objects could be | |
30 | created; each cpu object may have a few cpu cores, each core may have | |
31 | a few strands. | |
32 | </P> | |
33 | <P STYLE="margin-bottom: 0in">CPU cores could run on separate threads | |
34 | of the host machine. | |
35 | </P> | |
36 | <P STYLE="margin-bottom: 0in">The interface is defined in vcpu.h | |
37 | file. It allows a hook up for an external source level debugger or | |
38 | user interface frontend module. Cpu module is built as a shared | |
39 | library. Vcpu interface has the following components, see <A HREF="#interface" TARGET="_top">Figure | |
40 | 1</A> below. | |
41 | </P> | |
42 | <P>- control interface<BR>- system interface (Memory and IO)<BR>- | |
43 | trace interface</P> | |
44 | <P STYLE="margin-bottom: 0in">Exported interface – routines in | |
45 | the CPU module which is called from outside of the module. Pointers | |
46 | to the routines exposed by the CPU module are defined in | |
47 | VCPU_ExInterface structure.</P> | |
48 | <P STYLE="margin-bottom: 0in">Imported interface – routines | |
49 | which CPU module calls to get access to the rest of the system. | |
50 | </P> | |
51 | <P STYLE="margin-bottom: 0in">It is defined by VCPU_ImpIntf structure | |
52 | - set of pointers that CPU module uses to send a request to the | |
53 | system modules.</P> | |
54 | <P STYLE="margin-bottom: 0in">Control interface constitute an | |
55 | exported interface; system and trace interfaces constitute an | |
56 | imported interface. | |
57 | </P> | |
58 | <P STYLE="margin-bottom: 0in">Memory is represented by an abstract | |
59 | interface to allow it to model different levels of memory hierarchy, | |
60 | including L2/L3 caches. Cache models are not included. | |
61 | </P> | |
62 | <P STYLE="margin-bottom: 0in">Currently, there are sparse memory | |
63 | models and flat memory models. Due to performance consideration, the | |
64 | memory model option is defined at build time instead of at run time. | |
65 | </P> | |
66 | <P STYLE="margin-bottom: 0in">Tracer is represented by an abstract | |
67 | interface which allows hook up of different analyzers and performance | |
68 | models. Vtracer interface is defined in vtracer.h header file. | |
69 | </P> | |
70 | <P STYLE="margin-bottom: 0in; font-weight: medium">The Cpu model | |
71 | calls Vtracer methods to output complete information about the | |
72 | architecture state change for every instruction. The information for | |
73 | every instruction is accumulated in VCPU_Instruction structure. Trap | |
74 | information is collected in VCPU_Trap structure, VCPU_TLB is for tlb | |
75 | information. | |
76 | </P> | |
77 | <P STYLE="margin-bottom: 0in"><IMG SRC="vcpu_html_21db4c1f.gif" NAME="graphics1" ALIGN=LEFT WIDTH=645 HEIGHT=867 BORDER=0><BR CLEAR=LEFT><BR> | |
78 | </P> | |
79 | <P STYLE="margin-bottom: 0in"><A NAME="overview"></A><FONT SIZE=4><B>VCPU | |
80 | Interface Overview.</B></FONT></P> | |
81 | <P STYLE="margin-bottom: 0in"><B>Cpu module instantiation.</B> | |
82 | </P> | |
83 | <P STYLE="margin-bottom: 0in"><BR> | |
84 | </P> | |
85 | <UL> | |
86 | <LI><P STYLE="margin-bottom: 0in"><A HREF="#ex_interface">get_ex_interface</A></P> | |
87 | <LI><P STYLE="margin-bottom: 0in"><A HREF="#create">create</A></P> | |
88 | <LI><P STYLE="margin-bottom: 0in"><A HREF="#destroy">destroy</A></P> | |
89 | <LI><P STYLE="margin-bottom: 0in"><A HREF="#reset">reset</A></P> | |
90 | <LI><P STYLE="margin-bottom: 0in"><A HREF="#save">save</A></P> | |
91 | <LI><P STYLE="margin-bottom: 0in"><A HREF="#restore">restore</A></P> | |
92 | </UL> | |
93 | <P STYLE="margin-bottom: 0in"><B>Control interface. </B> | |
94 | </P> | |
95 | <UL> | |
96 | <LI><P STYLE="margin-bottom: 0in"><A HREF="#vcpu id">id</A></P> | |
97 | <LI><P STYLE="margin-bottom: 0in"><A HREF="#stepi">step</A></P> | |
98 | <LI><P STYLE="margin-bottom: 0in"><A HREF="#stick" NAME="update stick">update | |
99 | stick</A></P> | |
100 | <LI><P STYLE="margin-bottom: 0in"><A HREF="#interrupt">interrupt</A></P> | |
101 | <LI><P STYLE="margin-bottom: 0in"><A HREF="#ireg">access integer | |
102 | register</A></P> | |
103 | <LI><P STYLE="margin-bottom: 0in"><A HREF="#freg">access floating | |
104 | point register</A></P> | |
105 | <LI><P STYLE="margin-bottom: 0in"><A HREF="#preg">access privileged | |
106 | register</A></P> | |
107 | <LI><P STYLE="margin-bottom: 0in"><A HREF="#asr">access ancillary | |
108 | register</A></P> | |
109 | <LI><P STYLE="margin-bottom: 0in"><A HREF="#trapreg">access trap | |
110 | specific register</A></P> | |
111 | <LI><P STYLE="margin-bottom: 0in"><A HREF="#hpreg">access hyper | |
112 | privileged register</A></P> | |
113 | <LI><P STYLE="margin-bottom: 0in"><A HREF="#read mem">read_mem</A></P> | |
114 | <LI><P STYLE="margin-bottom: 0in"><A HREF="#write mem">write_mem</A></P> | |
115 | <LI><P STYLE="margin-bottom: 0in"><A HREF="#set break">set | |
116 | breakpoint</A></P> | |
117 | <LI><P STYLE="margin-bottom: 0in"><A HREF="#delete break">delete | |
118 | breakpoint</A></P> | |
119 | <LI><P STYLE="margin-bottom: 0in"><A HREF="#reconfig">reconfig</A></P> | |
120 | </UL> | |
121 | <P STYLE="margin-bottom: 0in"><B>Memory interface. </B> | |
122 | </P> | |
123 | <UL> | |
124 | <LI><P STYLE="margin-bottom: 0in"><A HREF="#mem">mem</A></P> | |
125 | </UL> | |
126 | <P STYLE="margin-bottom: 0in"><B>Physical IO interface.</B> | |
127 | </P> | |
128 | <UL> | |
129 | <LI><P STYLE="margin-bottom: 0in"><A HREF="#access io">access_io</A></P> | |
130 | <LI><P STYLE="margin-bottom: 0in"><A HREF="#access asi">access_asi</A></P> | |
131 | <LI><P STYLE="margin-bottom: 0in"><A HREF="#access serial">access_serial</A></P> | |
132 | </UL> | |
133 | <P STYLE="margin-bottom: 0in"><B>Tracer interface. </B> | |
134 | </P> | |
135 | <UL> | |
136 | <LI><P STYLE="margin-bottom: 0in"><A HREF="#instr">instr</A></P> | |
137 | <LI><P STYLE="margin-bottom: 0in"><A HREF="#trap">trap</A></P> | |
138 | </UL> | |
139 | <P STYLE="margin-bottom: 0in"><BR> | |
140 | </P> | |
141 | <P STYLE="margin-bottom: 0in"><BR> | |
142 | </P> | |
143 | <P STYLE="margin-bottom: 0in; page-break-before: always"><A NAME="ex_interface"></A> | |
144 | <FONT SIZE=4 STYLE="font-size: 16pt"><U>get_ex_interface</U></FONT></P> | |
145 | <P STYLE="margin-bottom: 0in"><B>NAME</B></P> | |
146 | <P STYLE="margin-bottom: 0in">get_ex_interface - Get exported | |
147 | interface from the cpu module</P> | |
148 | <P STYLE="margin-bottom: 0in"><B>SYNOPSIS</B></P> | |
149 | <P STYLE="margin-bottom: 0in">#include “vcpu.h” | |
150 | </P> | |
151 | <P STYLE="margin-bottom: 0in">extern "C" int | |
152 | get_ex_interface | |
153 | </P> | |
154 | <P STYLE="margin-bottom: 0in">( | |
155 | </P> | |
156 | <P STYLE="margin-bottom: 0in">VCPU_ExInterface *intf // pointer to | |
157 | the interface structure</P> | |
158 | <P STYLE="margin-bottom: 0in">);</P> | |
159 | <P STYLE="margin-bottom: 0in">typedef int (*VCPU_GetIntfFn )( | |
160 | VCPU_ExInterface *intf ); | |
161 | </P> | |
162 | <P STYLE="margin-bottom: 0in"><B>DESCRIBTION</B></P> | |
163 | <P STYLE="margin-bottom: 0in">To get exported interface from the cpu | |
164 | shared library get_ ex_interface () method should be used. It takes a | |
165 | pointer to the VCPU_ExInterface structure and assigns the function | |
166 | pointers inside this structure to the addresses of the corresponding | |
167 | routines implemented in the CPU module. | |
168 | </P> | |
169 | <P STYLE="margin-bottom: 0in"><B>RETURN VALUES</B></P> | |
170 | <P STYLE="margin-bottom: 0in">0 - success; | |
171 | </P> | |
172 | <P STYLE="margin-bottom: 0in">1 – fail.</P> | |
173 | <P STYLE="margin-bottom: 0in"><B>USAGE</B></P> | |
174 | <P STYLE="margin-bottom: 0in">// open shared library, lib_name is the | |
175 | name of cpu shared libriry. | |
176 | </P> | |
177 | <P STYLE="margin-bottom: 0in">void *cpu_lib_handle = dlopen | |
178 | (lib_name, RTLD_LAZY|RTLD_GLOBAL|RTLD_PARENT);</P> | |
179 | <P STYLE="margin-bottom: 0in">// extract cpu lib exported interface | |
180 | </P> | |
181 | <P STYLE="margin-bottom: 0in">VCPU_GetIntfFn get_interface = | |
182 | (VCPU_GetIntfFn)dlsym ( cpu_lib_handle, "get_ex_interface" | |
183 | );</P> | |
184 | <P STYLE="margin-bottom: 0in">// obtain exported cpu interface</P> | |
185 | <P STYLE="margin-bottom: 0in">VCPU_ExInterface g_cpu_ex_intf;</P> | |
186 | <P STYLE="margin-bottom: 0in">get_interface ( &g_cpu_ex_intf);</P> | |
187 | <P STYLE="margin-bottom: 0in">//Create a vcpu instance</P> | |
188 | <P STYLE="margin-bottom: 0in">Vcpu * vcpu = | |
189 | (Vcpu*)g_cpu_ex_intf.create( &config_info, imp_intf ); | |
190 | </P> | |
191 | <P STYLE="margin-bottom: 0in"><B>SEE ALSO</B></P> | |
192 | <P STYLE="margin-bottom: 0in"><A HREF="#overview">back to overview</A></P> | |
193 | <P STYLE="margin-bottom: 0in; page-break-before: always"><A NAME="create"></A> | |
194 | <FONT SIZE=4 STYLE="font-size: 16pt"><U><B>VCPU_ExInterface::create</B></U></FONT></P> | |
195 | <P STYLE="margin-bottom: 0in"><B>NAME</B></P> | |
196 | <P STYLE="margin-bottom: 0in">create - Create and configure a vcpu | |
197 | instance. | |
198 | </P> | |
199 | <P STYLE="margin-bottom: 0in"><B>SYNOPSIS</B></P> | |
200 | <P STYLE="margin-bottom: 0in">#include “vcpu.h”</P> | |
201 | <P STYLE="margin-bottom: 0in">void * (*create ) // new cpu module</P> | |
202 | <P STYLE="margin-bottom: 0in">( | |
203 | </P> | |
204 | <P STYLE="margin-bottom: 0in">VCPU_Config *cinfo, // cpu config | |
205 | params | |
206 | </P> | |
207 | <P STYLE="margin-bottom: 0in">VCPU_ImpIntf *intf // interface to the | |
208 | system | |
209 | </P> | |
210 | <P STYLE="margin-bottom: 0in">);</P> | |
211 | <P STYLE="margin-bottom: 0in"><B>DESCRIPTION</B></P> | |
212 | <P STYLE="margin-bottom: 0in">This function pointer is a member of | |
213 | VCPU_ExInterface structure. | |
214 | </P> | |
215 | <P STYLE="margin-bottom: 0in">Pointer to the routine to create and | |
216 | configure a vcpu instance. | |
217 | </P> | |
218 | <P STYLE="margin-bottom: 0in">The routine takes a pointer to the set | |
219 | of vcpu parameters and a pointer to the imported interface structure. | |
220 | </P> | |
221 | <P STYLE="margin-bottom: 0in"><B>RETURN VALUES</B></P> | |
222 | <P STYLE="margin-bottom: 0in">return a pointer to the vcpu class. | |
223 | </P> | |
224 | <P STYLE="margin-bottom: 0in">NULL if fail.</P> | |
225 | <P STYLE="margin-bottom: 0in"><B>USAGE</B></P> | |
226 | <P STYLE="margin-bottom: 0in">Create a vcpu instance. Cpu module | |
227 | implementation may choose to create all core/strand objects at once | |
228 | and this call may simply return a pointer to the next available vcpu | |
229 | object. | |
230 | </P> | |
231 | <P STYLE="margin-bottom: 0in">This call should be made only once for | |
232 | each vcpu</P> | |
233 | <P STYLE="margin-bottom: 0in">A set of parameters describing vcpu | |
234 | configuration options are defined in | |
235 | </P> | |
236 | <P STYLE="margin-bottom: 0in">VCPU_Config structure. | |
237 | </P> | |
238 | <P STYLE="margin-bottom: 0in">Vcpu * vcpu = | |
239 | (Vcpu*)g_cpu_ex_intf.create( &config_info, imp_intf ); | |
240 | </P> | |
241 | <P STYLE="margin-bottom: 0in">After vcpu instance is created vcpu id | |
242 | is assigned in sequential order – in the order create() calls | |
243 | are made, starting from 0.</P> | |
244 | <P STYLE="margin-bottom: 0in">From this point vcpu methods which are | |
245 | defined by Vcpu abstract class could be used. | |
246 | </P> | |
247 | <P STYLE="margin-bottom: 0in"><B>SEE ALSO</B></P> | |
248 | <P STYLE="margin-bottom: 0in"><A HREF="#overview">back to overview</A></P> | |
249 | <P STYLE="margin-bottom: 0in; page-break-before: always"><A NAME="destroy"></A> | |
250 | <FONT SIZE=4 STYLE="font-size: 16pt"><U><B>VCPU_ExInterface::destroy</B></U></FONT></P> | |
251 | <P STYLE="margin-bottom: 0in"><B>NAME</B></P> | |
252 | <P STYLE="margin-bottom: 0in">destroy - Destroy all vcpu instances. | |
253 | </P> | |
254 | <P STYLE="margin-bottom: 0in"><B>SYNOPSIS</B></P> | |
255 | <P STYLE="margin-bottom: 0in">#include “vcpu.h”</P> | |
256 | <P STYLE="margin-bottom: 0in">int (*destroy ) ();</P> | |
257 | <P STYLE="margin-bottom: 0in"><B>DESCRIPTION</B></P> | |
258 | <P STYLE="margin-bottom: 0in">This function pointer is a member of | |
259 | VCPU_ExInterface structure. | |
260 | </P> | |
261 | <P STYLE="margin-bottom: 0in">Pointer to the routine to destroy all | |
262 | vcpu instances. | |
263 | </P> | |
264 | <P STYLE="margin-bottom: 0in"><B>RETURN VALUES</B></P> | |
265 | <P STYLE="margin-bottom: 0in">1 – success;</P> | |
266 | <P STYLE="margin-bottom: 0in">0 - fail.</P> | |
267 | <P STYLE="margin-bottom: 0in"><B>USAGE</B></P> | |
268 | <P STYLE="margin-bottom: 0in">int status = g_cpu_ex_intf.destroy(); | |
269 | </P> | |
270 | <P STYLE="margin-bottom: 0in"><B>SEE ALSO</B></P> | |
271 | <P STYLE="margin-bottom: 0in"><A HREF="#overview">back to overview</A></P> | |
272 | <P STYLE="margin-bottom: 0in; page-break-before: always"><A NAME="reset"></A> | |
273 | <FONT SIZE=4 STYLE="font-size: 16pt"><U><B>VCPU_ExInterface::reset</B></U></FONT></P> | |
274 | <P STYLE="margin-bottom: 0in"><B>NAME</B></P> | |
275 | <P STYLE="margin-bottom: 0in">reset - Reset cpu module. | |
276 | </P> | |
277 | <P STYLE="margin-bottom: 0in"><B>SYNOPSIS</B></P> | |
278 | <P STYLE="margin-bottom: 0in">#include “vcpu.h”</P> | |
279 | <P STYLE="margin-bottom: 0in">int (*reset ) ();</P> | |
280 | <P STYLE="margin-bottom: 0in"><B>DESCRIPTION</B></P> | |
281 | <P STYLE="margin-bottom: 0in">This function pointer is a member of | |
282 | VCPU_ExInterface structure. | |
283 | </P> | |
284 | <P STYLE="margin-bottom: 0in">Pointer to the routine to reset | |
285 | architecture visible CPU state. | |
286 | </P> | |
287 | <P STYLE="margin-bottom: 0in"><B>RETURN VALUES</B></P> | |
288 | <P STYLE="margin-bottom: 0in">1 – success;</P> | |
289 | <P STYLE="margin-bottom: 0in">0 - fail.</P> | |
290 | <P STYLE="margin-bottom: 0in"><B>USAGE</B></P> | |
291 | <P STYLE="margin-bottom: 0in">int status = g_cpu_ex_intf.reset(); | |
292 | </P> | |
293 | <P STYLE="margin-bottom: 0in"><B>SEE ALSO</B></P> | |
294 | <P STYLE="margin-bottom: 0in"><A HREF="#overview">back to overview</A></P> | |
295 | <P STYLE="margin-bottom: 0in; page-break-before: always"><A NAME="save"></A> | |
296 | <FONT SIZE=4 STYLE="font-size: 16pt"><U><B>VCPU_ExInterface::save</B></U></FONT></P> | |
297 | <P STYLE="margin-bottom: 0in"><B>NAME</B></P> | |
298 | <P STYLE="margin-bottom: 0in">save - Save complete simulation state | |
299 | for the cpu module. | |
300 | </P> | |
301 | <P STYLE="margin-bottom: 0in"><B>SYNOPSIS</B></P> | |
302 | <P STYLE="margin-bottom: 0in">#include “vcpu.h”</P> | |
303 | <P STYLE="margin-bottom: 0in">int (*save ) (char *dir_name);</P> | |
304 | <P STYLE="margin-bottom: 0in"><B>DESCRIPTION</B></P> | |
305 | <P STYLE="margin-bottom: 0in">This function pointer is a member of | |
306 | VCPU_ExInterface structure. | |
307 | </P> | |
308 | <P STYLE="margin-bottom: 0in">Pointer to the routine to save complete | |
309 | simulation state for the CPU module. | |
310 | </P> | |
311 | <P STYLE="margin-bottom: 0in">The state is saved to the directory | |
312 | dir_name.</P> | |
313 | <P STYLE="margin-bottom: 0in"><B>RETURN VALUES</B></P> | |
314 | <P STYLE="margin-bottom: 0in">1 – success;</P> | |
315 | <P STYLE="margin-bottom: 0in">0 - fail.</P> | |
316 | <P STYLE="margin-bottom: 0in"><B>USAGE</B></P> | |
317 | <P STYLE="margin-bottom: 0in">int status = | |
318 | g_cpu_ex_intf.save(dir_name); | |
319 | </P> | |
320 | <P STYLE="margin-bottom: 0in"><B>SEE ALSO</B></P> | |
321 | <P STYLE="margin-bottom: 0in"><A HREF="#overview">back to overview</A></P> | |
322 | <P STYLE="margin-bottom: 0in; page-break-before: always"><A NAME="restore"></A> | |
323 | <FONT SIZE=4 STYLE="font-size: 16pt"><U><B>VCPU_ExInterface::restore</B></U></FONT></P> | |
324 | <P STYLE="margin-bottom: 0in"><B>NAME</B></P> | |
325 | <P STYLE="margin-bottom: 0in">restore - Restore complete simulation | |
326 | state for the cpu module. | |
327 | </P> | |
328 | <P STYLE="margin-bottom: 0in"><B>SYNOPSIS</B></P> | |
329 | <P STYLE="margin-bottom: 0in">#include “vcpu.h”</P> | |
330 | <P STYLE="margin-bottom: 0in">int (*restore ) (char *dir_name);</P> | |
331 | <P STYLE="margin-bottom: 0in"><B>DESCRIPTION</B></P> | |
332 | <P STYLE="margin-bottom: 0in">This function pointer is a member of | |
333 | VCPU_ExInterface structure. | |
334 | </P> | |
335 | <P STYLE="margin-bottom: 0in">Pointer to the routine to restore | |
336 | complete simulation state for the CPU module. | |
337 | </P> | |
338 | <P STYLE="margin-bottom: 0in">The state is restored from the | |
339 | directory dir_name.</P> | |
340 | <P STYLE="margin-bottom: 0in"><B>RETURN VALUES</B></P> | |
341 | <P STYLE="margin-bottom: 0in">1 – success;</P> | |
342 | <P STYLE="margin-bottom: 0in">0 - fail.</P> | |
343 | <P STYLE="margin-bottom: 0in"><B>USAGE</B></P> | |
344 | <P STYLE="margin-bottom: 0in">int status = | |
345 | g_cpu_ex_intf.restore(dir_name); | |
346 | </P> | |
347 | <P STYLE="margin-bottom: 0in"><B>SEE ALSO</B></P> | |
348 | <P STYLE="margin-bottom: 0in"><A HREF="#overview">back to overview</A></P> | |
349 | <P STYLE="margin-bottom: 0in; page-break-before: always"><A NAME="vcpu id"></A> | |
350 | <FONT SIZE=4 STYLE="font-size: 16pt"><U><B>Vcpu:: id</B></U></FONT></P> | |
351 | <P STYLE="margin-bottom: 0in"><B>NAME</B></P> | |
352 | <P STYLE="margin-bottom: 0in">Vcpu::id - Get vcpu id</P> | |
353 | <P STYLE="margin-bottom: 0in"><B>SYNOPSIS</B></P> | |
354 | <P STYLE="margin-bottom: 0in">#include “vcpu.h” | |
355 | </P> | |
356 | <P STYLE="margin-bottom: 0in">virtual int Vcpu::id();</P> | |
357 | <P STYLE="margin-bottom: 0in"><B>DESCRIPTION</B></P> | |
358 | <P STYLE="margin-bottom: 0in">Virtual method of Vcpu class which is | |
359 | used to get vcpu id. The id is used as an argument to other routines | |
360 | to identify the vcpu instance. | |
361 | </P> | |
362 | <P STYLE="margin-bottom: 0in"> "Unique" platform dependent | |
363 | id of a cpu. The id is the one that is to be used for cpu cross calls | |
364 | and identifying cpu target for device interrupts. Typically function | |
365 | Vcpu *get_vcpu(int id), defined in cpu_interface.h is used to get the | |
366 | target Vcpu pointer given its id. The id's may or may not by | |
367 | sequential, they are defined by cpu sysconf cpu parameter "id". | |
368 | If the parameter is not present on cpu config line, id's are assigned | |
369 | in sequential order. | |
370 | </P> | |
371 | <P STYLE="margin-bottom: 0in"><B>RETURN VALUES</B></P> | |
372 | <P STYLE="margin-bottom: 0in">vcpu id value</P> | |
373 | <P STYLE="margin-bottom: 0in"><B>USAGE</B></P> | |
374 | <P STYLE="margin-bottom: 0in">Create a vcpu instance, this call | |
375 | should be made only once for each vcpu</P> | |
376 | <P STYLE="margin-bottom: 0in">Vcpu * vcpu = | |
377 | (Vcpu*)g_cpu_ex_intf.create( &config_info, imp_intf ); | |
378 | </P> | |
379 | <P STYLE="margin-bottom: 0in">After vcpu instance is created the id | |
380 | is assigned in sequential order – in the order create() calls | |
381 | are made, starting from 0.</P> | |
382 | <P STYLE="margin-bottom: 0in">From this point vcpu methods which are | |
383 | defined by Vcpu abstract class could be used. | |
384 | </P> | |
385 | <P STYLE="margin-bottom: 0in">...</P> | |
386 | <P STYLE="margin-bottom: 0in">printf(“vcpu id is : %i \n”) | |
387 | vcpu->id(); | |
388 | </P> | |
389 | <P STYLE="margin-bottom: 0in"><B>SEE ALSO</B></P> | |
390 | <P STYLE="margin-bottom: 0in"><A HREF="#overview">back to overview</A></P> | |
391 | <P STYLE="margin-bottom: 0in; page-break-before: always"><A NAME="stepi"></A> | |
392 | <FONT SIZE=4 STYLE="font-size: 16pt"><U><B>Vcpu::stepi</B></U></FONT></P> | |
393 | <P STYLE="margin-bottom: 0in"><B>NAME</B></P> | |
394 | <P STYLE="margin-bottom: 0in">Vcpu::stepi - Step n number of | |
395 | instructions | |
396 | </P> | |
397 | <P STYLE="margin-bottom: 0in"><B>SYNOPSIS</B></P> | |
398 | <P STYLE="margin-bottom: 0in">#include “vcpu.h”</P> | |
399 | <P STYLE="margin-bottom: 0in">virtual int Vcpu::stepi ( int64_t n=1 | |
400 | );</P> | |
401 | <P STYLE="margin-bottom: 0in"><B>DESCRIPTION</B></P> | |
402 | <P STYLE="margin-bottom: 0in">Virtual method of Vcpu class - step n | |
403 | number of instructions.</P> | |
404 | <P STYLE="margin-bottom: 0in">Each Vcpu can be called from a separate | |
405 | working thread of the host machine. Vcpu's that belong to the same | |
406 | core may need to be on the same working thread to reduce needs of | |
407 | locking for MT safaty | |
408 | </P> | |
409 | <P STYLE="margin-bottom: 0in"><B>RETURN VALUES</B></P> | |
410 | <P STYLE="margin-bottom: 0in">1 – success; | |
411 | </P> | |
412 | <P STYLE="margin-bottom: 0in">0 – fail.</P> | |
413 | <P STYLE="margin-bottom: 0in"><B>USAGE</B></P> | |
414 | <P STYLE="margin-bottom: 0in">....</P> | |
415 | <P STYLE="margin-bottom: 0in">Step 100 number of instructions</P> | |
416 | <P STYLE="margin-bottom: 0in">int n = 100; | |
417 | </P> | |
418 | <P STYLE="margin-bottom: 0in">vcpu->stepi(n); | |
419 | </P> | |
420 | <P STYLE="margin-bottom: 0in"><B>SEE ALSO</B></P> | |
421 | <P STYLE="margin-bottom: 0in"><A HREF="#overview">back to overview</A></P> | |
422 | <P STYLE="margin-bottom: 0in; page-break-before: always"><BR> | |
423 | </P> | |
424 | <P STYLE="margin-bottom: 0in; page-break-before: always"><A NAME="delete break11"></A> | |
425 | <FONT SIZE=4 STYLE="font-size: 16pt"><U><B>Vcpu::update_stick</B></U></FONT></P> | |
426 | <P STYLE="margin-bottom: 0in"><B>NAME</B></P> | |
427 | <P STYLE="margin-bottom: 0in">Vcpu::update_stick– increment | |
428 | stick reg value; | |
429 | </P> | |
430 | <P STYLE="margin-bottom: 0in"><B>SYNOPSIS</B></P> | |
431 | <P STYLE="margin-bottom: 0in">#include “vcpu.h”</P> | |
432 | <P STYLE="margin-bottom: 0in">virtual void Vcpu::update_stick(int64_t | |
433 | stickincr);</P> | |
434 | <P STYLE="margin-bottom: 0in"><B>DESCRIPTION</B></P> | |
435 | <P STYLE="margin-bottom: 0in">Virtual methods of Vcpu class to | |
436 | increment stick reg value by stickincr amount. | |
437 | </P> | |
438 | <P STYLE="margin-bottom: 0in"><B>RETURN VALUES</B></P> | |
439 | <P STYLE="margin-bottom: 0in">none</P> | |
440 | <P STYLE="margin-bottom: 0in"><B>USAGE</B></P> | |
441 | <P STYLE="margin-bottom: 0in">// increment stick reg value by 10</P> | |
442 | <P STYLE="margin-bottom: 0in">g_vcpu[cpu_id]->update_stick(10);</P> | |
443 | <P STYLE="margin-bottom: 0in"><B>SEE ALSO</B></P> | |
444 | <P STYLE="margin-bottom: 0in"><FONT SIZE=4 STYLE="font-size: 16pt"><U><A HREF="#overview"><SPAN STYLE="font-weight: medium"><FONT SIZE=3>back | |
445 | to overview</FONT></SPAN></A></U></FONT></P> | |
446 | <P STYLE="margin-bottom: 0in"><BR> | |
447 | </P> | |
448 | <P STYLE="margin-bottom: 0in"><BR> | |
449 | </P> | |
450 | <P STYLE="margin-bottom: 0in"><BR> | |
451 | </P> | |
452 | <P STYLE="margin-bottom: 0in"><A NAME="interrupt"></A><FONT SIZE=4 STYLE="font-size: 16pt"><B><U>Vcpu::interrupt</U> | |
453 | </B></FONT> | |
454 | </P> | |
455 | <P STYLE="margin-bottom: 0in"><B>NAME</B></P> | |
456 | <P STYLE="margin-bottom: 0in">Vcpu::interrupt - Signal an interrupt | |
457 | </P> | |
458 | <P STYLE="margin-bottom: 0in"><B>SYNOPSIS</B></P> | |
459 | <P STYLE="margin-bottom: 0in">#include “vcpu.h”</P> | |
460 | <P STYLE="margin-bottom: 0in">virtual int Vcpu::interrupt ( | |
461 | VCPU_InterruptRequest *signal );</P> | |
462 | <P STYLE="margin-bottom: 0in"><B>DESCRIPTION</B></P> | |
463 | <P STYLE="margin-bottom: 0in">Virtual method of Vcpu class to signal | |
464 | an interrupt. The interrupt message is described by the structure | |
465 | VCPU_InterruptRequest</P> | |
466 | <P STYLE="margin-bottom: 0in"><B>RETURN VALUES</B></P> | |
467 | <P STYLE="margin-bottom: 0in">1 – success; | |
468 | </P> | |
469 | <P STYLE="margin-bottom: 0in">0 – fail.</P> | |
470 | <P STYLE="margin-bottom: 0in"><B>USAGE</B></P> | |
471 | <P STYLE="margin-bottom: 0in">VCPU_InterruptRequest signal;</P> | |
472 | <P STYLE="margin-bottom: 0in">signal.isid = src_aid;</P> | |
473 | <P STYLE="margin-bottom: 0in">signal.itid = dst_aid;</P> | |
474 | <P STYLE="margin-bottom: 0in">signal.data[0] = idata[0]; | |
475 | </P> | |
476 | <P STYLE="margin-bottom: 0in">vcpu->interrupt(&signal); | |
477 | </P> | |
478 | <P STYLE="margin-bottom: 0in"><B>SEE ALSO</B></P> | |
479 | <P STYLE="margin-bottom: 0in"><A HREF="#overview">back to overview</A></P> | |
480 | <P STYLE="margin-bottom: 0in; page-break-before: always"><A NAME="ireg"></A> | |
481 | <FONT SIZE=4 STYLE="font-size: 16pt"><U><B>Vcpu:: access integer | |
482 | register </B></U></FONT> | |
483 | </P> | |
484 | <P STYLE="margin-bottom: 0in"><B>NAME</B></P> | |
485 | <P STYLE="margin-bottom: 0in">Vcpu::get_ireg - Read integer register</P> | |
486 | <P STYLE="margin-bottom: 0in">Vcpu::set_ireg - Write integer register</P> | |
487 | <P STYLE="margin-bottom: 0in"><BR> | |
488 | </P> | |
489 | <P STYLE="margin-bottom: 0in"><B>SYNOPSIS</B></P> | |
490 | <P STYLE="margin-bottom: 0in">#include “vcpu.h”</P> | |
491 | <P STYLE="margin-bottom: 0in">virtual int Vcpu::get_ireg (int wp, int | |
492 | regnum, uint64_t & regvalue);</P> | |
493 | <P STYLE="margin-bottom: 0in">virtual int Vcpu::set_ireg (int wp, int | |
494 | regnum, uint64_t value);</P> | |
495 | <P STYLE="margin-bottom: 0in"><B>DESCRIPTION</B></P> | |
496 | <P STYLE="margin-bottom: 0in">Virtual methods of Vcpu class to | |
497 | read/write an integer register. | |
498 | </P> | |
499 | <P STYLE="margin-bottom: 0in">For SPARC V9 registers access</P> | |
500 | <P STYLE="margin-bottom: 0in">regnum = 0-7 (globals); wp = 0 (normal) | |
501 | , 1 (alternate) , 2 (mmu), 3 (interrupt)</P> | |
502 | <P STYLE="margin-bottom: 0in">regnum = 8-31; wp = -1 (current), wp >= | |
503 | 0 (window number)</P> | |
504 | <P STYLE="margin-bottom: 0in"><B>RETURN VALUES</B></P> | |
505 | <P STYLE="margin-bottom: 0in">1 – success; | |
506 | </P> | |
507 | <P STYLE="margin-bottom: 0in">0 – fail.</P> | |
508 | <P STYLE="margin-bottom: 0in"><B>USAGE</B></P> | |
509 | <P STYLE="margin-bottom: 0in">int reg_idx = 16;</P> | |
510 | <P STYLE="margin-bottom: 0in">uint64_t value = 0;</P> | |
511 | <P STYLE="margin-bottom: 0in">vcpu->get_ireg(VCPU_ACC_CUR , | |
512 | reg_idx, value);</P> | |
513 | <P STYLE="margin-bottom: 0in">value &= 0xff;</P> | |
514 | <P STYLE="margin-bottom: 0in">vcpu->set_ireg(VCPU_ACC_CUR , | |
515 | reg_idx, value);</P> | |
516 | <P STYLE="margin-bottom: 0in"><B>SEE ALSO</B></P> | |
517 | <P STYLE="margin-bottom: 0in"><A HREF="#overview">back to overview</A></P> | |
518 | <P STYLE="margin-bottom: 0in; page-break-before: always"><A NAME="freg"></A> | |
519 | <FONT SIZE=4 STYLE="font-size: 16pt"><U><B>Vcpu:: access floating | |
520 | point register</B></U></FONT></P> | |
521 | <P STYLE="margin-bottom: 0in"><B>NAME</B></P> | |
522 | <P STYLE="margin-bottom: 0in">Vcpu::get_freg - Read floating point | |
523 | register</P> | |
524 | <P STYLE="margin-bottom: 0in">Vcpu::set_freg - Write floating point | |
525 | register</P> | |
526 | <P STYLE="margin-bottom: 0in"><B>SYNOPSIS</B></P> | |
527 | <P STYLE="margin-bottom: 0in">#include “vcpu.h”</P> | |
528 | <P STYLE="margin-bottom: 0in">virtual int Vcpu::get_freg (int | |
529 | issingle, int regnum, uint64_t & regvalue);</P> | |
530 | <P STYLE="margin-bottom: 0in">virtual int Vcpu::set_freg (int | |
531 | issingle, int regnum, uint64_t value);</P> | |
532 | <P STYLE="margin-bottom: 0in"><B>DESCRIPTION</B></P> | |
533 | <P STYLE="margin-bottom: 0in">Virtual methods of Vcpu class to | |
534 | read/write a floating point register. | |
535 | </P> | |
536 | <P STYLE="margin-bottom: 0in">If issingle == 1 – single | |
537 | precision 32 bit floating point register; | |
538 | </P> | |
539 | <P STYLE="margin-bottom: 0in">issingle == 0 – double precision | |
540 | 64 bit floating point register;</P> | |
541 | <P STYLE="margin-bottom: 0in">regnum is defined according to SPARC V9 | |
542 | and core specific implementation.</P> | |
543 | <P STYLE="margin-bottom: 0in"><B>RETURN VALUES</B></P> | |
544 | <P STYLE="margin-bottom: 0in">1 – success; | |
545 | </P> | |
546 | <P STYLE="margin-bottom: 0in">0 – fail.</P> | |
547 | <P STYLE="margin-bottom: 0in"><B>USAGE</B></P> | |
548 | <P STYLE="margin-bottom: 0in">int reg_idx = 16;</P> | |
549 | <P STYLE="margin-bottom: 0in">uint32_t value32 = 0;</P> | |
550 | <P STYLE="margin-bottom: 0in">// single precision value</P> | |
551 | <P STYLE="margin-bottom: 0in">vcpu->get_freg(1, reg_idx, value32);</P> | |
552 | <P STYLE="margin-bottom: 0in">// double precision value</P> | |
553 | <P STYLE="margin-bottom: 0in">#define SWAP_BIT_5_0(I) ((( (I) & | |
554 | 0x01e ) | ( ((I) & 0x020) >> 5 )) & 0x1f)</P> | |
555 | <P STYLE="margin-bottom: 0in">uint64_t value64 = 0;</P> | |
556 | <P STYLE="margin-bottom: 0in">vcpu->get_freg(0, | |
557 | SWAP_BIT_5_0(reg_idx), value64);</P> | |
558 | <P STYLE="margin-bottom: 0in"><B>SEE ALSO</B></P> | |
559 | <P STYLE="margin-bottom: 0in"><A HREF="#overview">back to overview</A></P> | |
560 | <P STYLE="margin-bottom: 0in; page-break-before: always"><A NAME="preg"></A> | |
561 | <FONT SIZE=4 STYLE="font-size: 16pt"><U><B>Vcpu:: access privileged | |
562 | register</B></U></FONT></P> | |
563 | <P STYLE="margin-bottom: 0in"><B>NAME</B></P> | |
564 | <P STYLE="margin-bottom: 0in">Vcpu::get_pr - Read privileged register</P> | |
565 | <P STYLE="margin-bottom: 0in">Vcpu::set_pr - Write privileged | |
566 | register</P> | |
567 | <P STYLE="margin-bottom: 0in"><B>SYNOPSIS</B></P> | |
568 | <P STYLE="margin-bottom: 0in">#include “vcpu.h”</P> | |
569 | <P STYLE="margin-bottom: 0in">virtual int Vcpu::get_pr(int regnum, | |
570 | uint64_t & value);</P> | |
571 | <P STYLE="margin-bottom: 0in">virtual int Vcpu::set_pr(int regnum, | |
572 | uint64_t value);</P> | |
573 | <P STYLE="margin-bottom: 0in"><B>DESCRIPTION</B></P> | |
574 | <P STYLE="margin-bottom: 0in">Virtual methods of Vcpu class to | |
575 | read/write a privileged register. | |
576 | </P> | |
577 | <P STYLE="margin-bottom: 0in">For trap-level specific registers, | |
578 | get/set_pr functions use the current trap_level.</P> | |
579 | <P STYLE="margin-bottom: 0in">regnum = 0...31, it is defined | |
580 | according to SPARC V9 and core specific implementation. | |
581 | </P> | |
582 | <P STYLE="margin-bottom: 0in"><B>RETURN VALUES</B></P> | |
583 | <P STYLE="margin-bottom: 0in">1 – success; | |
584 | </P> | |
585 | <P STYLE="margin-bottom: 0in">0 – fail.</P> | |
586 | <P STYLE="margin-bottom: 0in"><B>USAGE</B></P> | |
587 | <P STYLE="margin-bottom: 0in">uint64_t value = 0;</P> | |
588 | <P STYLE="margin-bottom: 0in">vcpu->get_pr(VCPU_PR_PSTATE, value);</P> | |
589 | <P STYLE="margin-bottom: 0in">printf (“PSTATE = %llx”, | |
590 | value);</P> | |
591 | <P STYLE="margin-bottom: 0in">vcpu->get_pr(VCPU_PR_CWP, value);</P> | |
592 | <P STYLE="margin-bottom: 0in">printf(“CWP = %llx”, | |
593 | value);</P> | |
594 | <P STYLE="margin-bottom: 0in"><B>SEE ALSO</B></P> | |
595 | <P STYLE="margin-bottom: 0in"><A HREF="#overview">back to overview</A></P> | |
596 | <P STYLE="margin-bottom: 0in; page-break-before: always"><A NAME="asr"></A> | |
597 | <FONT SIZE=4 STYLE="font-size: 16pt"><U><B>Vcpu:: access ancillary | |
598 | register</B></U></FONT></P> | |
599 | <P STYLE="margin-bottom: 0in"><B>NAME</B></P> | |
600 | <P STYLE="margin-bottom: 0in">Vcpu::get_acr - Read ancillary register</P> | |
601 | <P STYLE="margin-bottom: 0in">Vcpu::set_asr - Write ancillary | |
602 | register</P> | |
603 | <P STYLE="margin-bottom: 0in"><B>SYNOPSIS</B></P> | |
604 | <P STYLE="margin-bottom: 0in">#include “vcpu.h”</P> | |
605 | <P STYLE="margin-bottom: 0in">virtual int Vcpu::get_asr(int regnum, | |
606 | uint64_t & value);</P> | |
607 | <P STYLE="margin-bottom: 0in">virtual int Vcpu::set_asr(int regnum, | |
608 | uint64_t value);</P> | |
609 | <P STYLE="margin-bottom: 0in"><B>DESCRIPTION</B></P> | |
610 | <P STYLE="margin-bottom: 0in">Virtual methods of Vcpu class to | |
611 | read/write an ancillary register. | |
612 | </P> | |
613 | <P STYLE="margin-bottom: 0in">regnum is defined according to SPARC V9 | |
614 | and core specific implementation.</P> | |
615 | <P STYLE="margin-bottom: 0in"><B>RETURN VALUES</B></P> | |
616 | <P STYLE="margin-bottom: 0in">1 – success; | |
617 | </P> | |
618 | <P STYLE="margin-bottom: 0in">0 – fail.</P> | |
619 | <P STYLE="margin-bottom: 0in"><B>USAGE</B></P> | |
620 | <P STYLE="margin-bottom: 0in">uint64_t value = 0;</P> | |
621 | <P STYLE="margin-bottom: 0in">vcpu->get_asr(VCPU_ASR_PC, value)</P> | |
622 | <P STYLE="margin-bottom: 0in">printf (“PC = %llx”, | |
623 | value);</P> | |
624 | <P STYLE="margin-bottom: 0in">vcpu->get_asr(VCPU_ASR_ASI, value);</P> | |
625 | <P STYLE="margin-bottom: 0in">printf(“ASI = %llx”, | |
626 | value);</P> | |
627 | <P STYLE="margin-bottom: 0in"><B>SEE ALSO</B></P> | |
628 | <P STYLE="margin-bottom: 0in"><A HREF="#overview">back to overview</A></P> | |
629 | <P STYLE="margin-bottom: 0in; page-break-before: always"><A NAME="trapreg"></A> | |
630 | <FONT SIZE=4 STYLE="font-size: 16pt"><U><B>Vcpu:: access trap | |
631 | specific registers</B></U></FONT></P> | |
632 | <P STYLE="margin-bottom: 0in"><B>NAME</B></P> | |
633 | <P STYLE="margin-bottom: 0in">Vcpu::get_trapreg - Read trap-level | |
634 | specific register</P> | |
635 | <P STYLE="margin-bottom: 0in">Vcpu::set_trapreg - Write trap-level | |
636 | specific register</P> | |
637 | <P STYLE="margin-bottom: 0in"><B>SYNOPSIS</B></P> | |
638 | <P STYLE="margin-bottom: 0in">#include “vcpu.h”</P> | |
639 | <P STYLE="margin-bottom: 0in">virtual int Vcpu::get_trapreg(int tl, | |
640 | int regnum, uint64_t & value);</P> | |
641 | <P STYLE="margin-bottom: 0in">virtual int Vcpu::set_trapreg(int tl, | |
642 | int regnum, uint64_t value);</P> | |
643 | <P STYLE="margin-bottom: 0in"><B>DESCRIPTION</B></P> | |
644 | <P STYLE="margin-bottom: 0in">Virtual methods of Vcpu class to | |
645 | read/write a trap-level specific register, | |
646 | </P> | |
647 | <P STYLE="margin-bottom: 0in">where tl is a trap level;</P> | |
648 | <P STYLE="margin-bottom: 0in">regnum could be one of | |
649 | </P> | |
650 | <P STYLE="margin-bottom: 0in">VCPU_PR_TPC = 0x0, | |
651 | </P> | |
652 | <P STYLE="margin-bottom: 0in">VCPU_PR_TNPC = 0x1,</P> | |
653 | <P STYLE="margin-bottom: 0in">VCPU_PR_TSTATE = 0x2,</P> | |
654 | <P STYLE="margin-bottom: 0in">VCPU_PR_TT = 0x3.</P> | |
655 | <P STYLE="margin-bottom: 0in"><B>RETURN VALUES</B></P> | |
656 | <P STYLE="margin-bottom: 0in">1 – success; | |
657 | </P> | |
658 | <P STYLE="margin-bottom: 0in">0 – fail.</P> | |
659 | <P STYLE="margin-bottom: 0in"><B>USAGE</B></P> | |
660 | <P STYLE="margin-bottom: 0in">uint64_t value = 0;</P> | |
661 | <P STYLE="margin-bottom: 0in">int tl = 1; | |
662 | </P> | |
663 | <P STYLE="margin-bottom: 0in">vcpu->get_trapreg(1, VCPU_PR_TPC, | |
664 | value)</P> | |
665 | <P STYLE="margin-bottom: 0in">printf (“trap level = %i, tpc = | |
666 | %llx”, tl, value);</P> | |
667 | <P STYLE="margin-bottom: 0in"><B>SEE ALSO</B></P> | |
668 | <P STYLE="margin-bottom: 0in"><A HREF="#overview">back to overview</A></P> | |
669 | <P STYLE="margin-bottom: 0in; page-break-before: always"><A NAME="hpreg"></A> | |
670 | <FONT SIZE=4 STYLE="font-size: 16pt"><U><B>Vcpu:: access hyper | |
671 | privileged register</B></U></FONT></P> | |
672 | <P STYLE="margin-bottom: 0in"><B>NAME</B></P> | |
673 | <P STYLE="margin-bottom: 0in">Vcpu::get_hpr - Read hyper privileged | |
674 | register</P> | |
675 | <P STYLE="margin-bottom: 0in">Vcpu::set_hpr - Write hyper privileged | |
676 | register</P> | |
677 | <P STYLE="margin-bottom: 0in"><B>SYNOPSIS</B></P> | |
678 | <P STYLE="margin-bottom: 0in">#include “vcpu.h”</P> | |
679 | <P STYLE="margin-bottom: 0in">virtual int Vcpu::get_hpr(int regnum, | |
680 | uint64_t & value);</P> | |
681 | <P STYLE="margin-bottom: 0in">virtual int Vcpu::set_hpr(int regnum, | |
682 | uint64_t value);</P> | |
683 | <P STYLE="margin-bottom: 0in"><B>DESCRIPTION</B></P> | |
684 | <P STYLE="margin-bottom: 0in">Virtual methods of Vcpu class to | |
685 | read/write a hyper privileged register. | |
686 | </P> | |
687 | <P STYLE="margin-bottom: 0in">regnum is defined according to core | |
688 | specific implementation.</P> | |
689 | <P STYLE="margin-bottom: 0in"><B>RETURN VALUES</B></P> | |
690 | <P STYLE="margin-bottom: 0in">1 – success; | |
691 | </P> | |
692 | <P STYLE="margin-bottom: 0in">0 – fail.</P> | |
693 | <P STYLE="margin-bottom: 0in"><B>USAGE</B></P> | |
694 | <P STYLE="margin-bottom: 0in">uint64_t value = 0;</P> | |
695 | <P STYLE="margin-bottom: 0in">vcpu->get_hpr(VCPU_HPR_HPSTATE, | |
696 | value);</P> | |
697 | <P STYLE="margin-bottom: 0in">printf (“HPSTATE = %llx”, | |
698 | value);</P> | |
699 | <P STYLE="margin-bottom: 0in"><B>SEE ALSO</B></P> | |
700 | <P STYLE="margin-bottom: 0in"><A HREF="#overview">back to overview</A></P> | |
701 | <P STYLE="margin-bottom: 0in; page-break-before: always"><A NAME="read mem"></A> | |
702 | <FONT SIZE=4 STYLE="font-size: 16pt"><U><B>Vcpu::read_mem</B></U></FONT></P> | |
703 | <P STYLE="margin-bottom: 0in"><B>NAME</B></P> | |
704 | <P STYLE="margin-bottom: 0in">Vcpu::read_mem – Read memory in | |
705 | the current CPU state</P> | |
706 | <P STYLE="margin-bottom: 0in"><B>SYNOPSIS</B></P> | |
707 | <P STYLE="margin-bottom: 0in">#include “vcpu.h”</P> | |
708 | <P STYLE="margin-bottom: 0in">virtual int Vcpu::read_mem | |
709 | </P> | |
710 | <P STYLE="margin-bottom: 0in">( | |
711 | </P> | |
712 | <P STYLE="margin-bottom: 0in">uint64_t addr, // byte address</P> | |
713 | <P STYLE="margin-bottom: 0in">uint64_t *value, // value to load | |
714 | </P> | |
715 | <P STYLE="margin-bottom: 0in">int size, // number of bytes</P> | |
716 | <P STYLE="margin-bottom: 0in">int asi= 0x82, // ASI_PRIMARY_NO_FAULT</P> | |
717 | <P STYLE="margin-bottom: 0in">int is_physical=0 // 1-physical | |
718 | address, 0-virtual address</P> | |
719 | <P STYLE="margin-bottom: 0in">);</P> | |
720 | <P STYLE="margin-bottom: 0in"><B>DESCRIPTION</B></P> | |
721 | <P STYLE="margin-bottom: 0in">Virtual methods of Vcpu class to read | |
722 | memory is used if caches or write buffer are present;</P> | |
723 | <P STYLE="margin-bottom: 0in">address could be virtuall or physical; | |
724 | </P> | |
725 | <P STYLE="margin-bottom: 0in">little or big endian access is defined | |
726 | by current state; | |
727 | </P> | |
728 | <P STYLE="margin-bottom: 0in"><B>RETURN VALUES</B></P> | |
729 | <P STYLE="margin-bottom: 0in">1 – success; | |
730 | </P> | |
731 | <P STYLE="margin-bottom: 0in">0 – fail.</P> | |
732 | <P STYLE="margin-bottom: 0in"><B>USAGE</B></P> | |
733 | <P STYLE="margin-bottom: 0in">// read from the double word aligned | |
734 | address</P> | |
735 | <P STYLE="margin-bottom: 0in">uint64_t addr8 = addr & | |
736 | ~uint64_t(7);</P> | |
737 | <P STYLE="margin-bottom: 0in">uint64_t value = 0;</P> | |
738 | <P STYLE="margin-bottom: 0in">if ( g_vcpu[cpu_id]->read_mem(addr8, | |
739 | &value, 8) != 0 )</P> | |
740 | <P STYLE="margin-bottom: 0in">{</P> | |
741 | <P STYLE="margin-bottom: 0in">reply_error (1); | |
742 | </P> | |
743 | <P STYLE="margin-bottom: 0in">return 1;</P> | |
744 | <P STYLE="margin-bottom: 0in">}</P> | |
745 | <P STYLE="margin-bottom: 0in"><B>SEE ALSO</B></P> | |
746 | <P STYLE="margin-bottom: 0in"><A HREF="#overview">back to overview</A></P> | |
747 | <P STYLE="margin-bottom: 0in; page-break-before: always"><A NAME="write mem"></A> | |
748 | <FONT SIZE=4 STYLE="font-size: 16pt"><U><B>Vcpu::write_mem</B></U></FONT></P> | |
749 | <P STYLE="margin-bottom: 0in"><BR> | |
750 | </P> | |
751 | <P STYLE="margin-bottom: 0in"><B>NAME</B></P> | |
752 | <P STYLE="margin-bottom: 0in">Vcpu::write_mem – Write memory in | |
753 | the current CPU state</P> | |
754 | <P STYLE="margin-bottom: 0in"><B>SYNOPSIS</B></P> | |
755 | <P STYLE="margin-bottom: 0in">#include “vcpu.h”</P> | |
756 | <P STYLE="margin-bottom: 0in">virtual int Vcpu::write_mem | |
757 | </P> | |
758 | <P STYLE="margin-bottom: 0in">( | |
759 | </P> | |
760 | <P STYLE="margin-bottom: 0in">uint64_t addr, // byte address</P> | |
761 | <P STYLE="margin-bottom: 0in">uint64_t value, // value to write | |
762 | </P> | |
763 | <P STYLE="margin-bottom: 0in">int size, // number of bytes</P> | |
764 | <P STYLE="margin-bottom: 0in">int asi= 0x82, // ASI_PRIMARY_NO_FAULT</P> | |
765 | <P STYLE="margin-bottom: 0in">int is_physical=0 // 1-physical | |
766 | address, 0-virtual address</P> | |
767 | <P STYLE="margin-bottom: 0in">);</P> | |
768 | <P STYLE="margin-bottom: 0in"><B>DESCRIPTION</B></P> | |
769 | <P STYLE="margin-bottom: 0in">Virtual methods of Vcpu class to write | |
770 | memory is used if caches or write buffer are present;</P> | |
771 | <P STYLE="margin-bottom: 0in">address could be virtuall or physical; | |
772 | </P> | |
773 | <P STYLE="margin-bottom: 0in">little or big endian access is defined | |
774 | by current state; | |
775 | </P> | |
776 | <P STYLE="margin-bottom: 0in"><B>RETURN VALUES</B></P> | |
777 | <P STYLE="margin-bottom: 0in">1 – success; | |
778 | </P> | |
779 | <P STYLE="margin-bottom: 0in">0 – fail.</P> | |
780 | <P STYLE="margin-bottom: 0in"><B>USAGE</B></P> | |
781 | <P STYLE="margin-bottom: 0in">// write 0 value to the double word | |
782 | aligned address</P> | |
783 | <P STYLE="margin-bottom: 0in">uint64_t addr8 = addr & | |
784 | ~uint64_t(7);</P> | |
785 | <P STYLE="margin-bottom: 0in">uint64_t value = 0;</P> | |
786 | <P STYLE="margin-bottom: 0in">if ( g_vcpu[cpu_id]->write_mem(addr8, | |
787 | value, 8) != 0 )</P> | |
788 | <P STYLE="margin-bottom: 0in">{</P> | |
789 | <P STYLE="margin-bottom: 0in">reply_error (1); | |
790 | </P> | |
791 | <P STYLE="margin-bottom: 0in">return 1;</P> | |
792 | <P STYLE="margin-bottom: 0in">}</P> | |
793 | <P STYLE="margin-bottom: 0in"><B>SEE ALSO</B></P> | |
794 | <P STYLE="margin-bottom: 0in"><A HREF="#overview">back to overview</A></P> | |
795 | <P STYLE="margin-bottom: 0in; page-break-before: always"><A NAME="set break"></A> | |
796 | <FONT SIZE=4 STYLE="font-size: 16pt"><U><B>Vcpu::set_breakpoint</B></U></FONT></P> | |
797 | <P STYLE="margin-bottom: 0in"><B>NAME</B></P> | |
798 | <P STYLE="margin-bottom: 0in">Vcpu::set_breakpoint – Set a | |
799 | breakpoint</P> | |
800 | <P STYLE="margin-bottom: 0in"><B>SYNOPSIS</B></P> | |
801 | <P STYLE="margin-bottom: 0in">#include “vcpu.h”</P> | |
802 | <P STYLE="margin-bottom: 0in">typedef int (*VCPU_BpActionFn)( int | |
803 | bp_id, int vcpu_id );</P> | |
804 | <P STYLE="margin-bottom: 0in">virtual int Vcpu::set_breakpoint | |
805 | </P> | |
806 | <P STYLE="margin-bottom: 0in">( | |
807 | </P> | |
808 | <P STYLE="margin-bottom: 0in">int *bp_id, // return breakpoint id; | |
809 | </P> | |
810 | <P STYLE="margin-bottom: 0in">VCPU_BpType type, // breakpoint type</P> | |
811 | <P STYLE="margin-bottom: 0in">uint64_t value, // opcode, instruction | |
812 | or data address</P> | |
813 | <P STYLE="margin-bottom: 0in">VCPU_BpActionFn action, // call this | |
814 | function on breakpoint hit</P> | |
815 | <P STYLE="margin-bottom: 0in">uint64_t mask= ~(uint64_t(0)) // | |
816 | optional data or addr mask | |
817 | </P> | |
818 | <P STYLE="margin-bottom: 0in">); | |
819 | </P> | |
820 | <P STYLE="margin-bottom: 0in"><B>DESCRIPTION</B></P> | |
821 | <P STYLE="margin-bottom: 0in">Virtual methods of Vcpu class to set of | |
822 | breakpoint of specified type.</P> | |
823 | <P STYLE="margin-bottom: 0in">Address could be virtuall or physical. | |
824 | Action() routine is called by cpu module when breakpoint is reached, | |
825 | current instruction is not committed</P> | |
826 | <P STYLE="margin-bottom: 0in">Breakpoint type | |
827 | </P> | |
828 | <P STYLE="margin-bottom: 0in">typedef enum</P> | |
829 | <P STYLE="margin-bottom: 0in">{ | |
830 | </P> | |
831 | <P STYLE="margin-bottom: 0in">VCPU_BP_INSTR_ADDR = 0,</P> | |
832 | <P STYLE="margin-bottom: 0in">VCPU_BP_DATA_READ_ADDR,</P> | |
833 | <P STYLE="margin-bottom: 0in">VCPU_BP_DATA_WRITE_ADDR,</P> | |
834 | <P STYLE="margin-bottom: 0in">VCPU_BP_OPCODE, | |
835 | </P> | |
836 | <P STYLE="margin-bottom: 0in">VCPU_N_BP_TYPES</P> | |
837 | <P STYLE="margin-bottom: 0in">} VCPU_BpType; | |
838 | </P> | |
839 | <P STYLE="margin-bottom: 0in"><B>RETURN VALUES</B></P> | |
840 | <P STYLE="margin-bottom: 0in">1 – success; | |
841 | </P> | |
842 | <P STYLE="margin-bottom: 0in">0 – fail.</P> | |
843 | <P STYLE="margin-bottom: 0in"><B>USAGE</B></P> | |
844 | <P STYLE="margin-bottom: 0in">VCPU_BpType type = VCPU_BP_INSTR_ADDR;</P> | |
845 | <P STYLE="margin-bottom: 0in">uint64_t addr = 0xfff00000;</P> | |
846 | <P STYLE="margin-bottom: 0in">int bp_id; | |
847 | </P> | |
848 | <P STYLE="margin-bottom: 0in">extern int bp_action ( int bp_id, int | |
849 | vcpu_id );</P> | |
850 | <P STYLE="margin-bottom: 0in">vcpu->set_breakpoint( &bp_id,type, | |
851 | addr, bp_action ); | |
852 | </P> | |
853 | <P STYLE="margin-bottom: 0in"><B>SEE ALSO</B></P> | |
854 | <P STYLE="margin-bottom: 0in"><A HREF="#overview">back to overview</A></P> | |
855 | <P STYLE="margin-bottom: 0in; page-break-before: always"><A NAME="delete break"></A> | |
856 | <FONT SIZE=4 STYLE="font-size: 16pt"><U><B>Vcpu::delete_breakpoint</B></U></FONT></P> | |
857 | <P STYLE="margin-bottom: 0in"><B>NAME</B></P> | |
858 | <P STYLE="margin-bottom: 0in">Vcpu::delete_breakpoint – Delete | |
859 | a breakpoint</P> | |
860 | <P STYLE="margin-bottom: 0in"><B>SYNOPSIS</B></P> | |
861 | <P STYLE="margin-bottom: 0in">#include “vcpu.h”</P> | |
862 | <P STYLE="margin-bottom: 0in">virtual int Vcpu::delete_breakpoint ( | |
863 | int bp_id = ~(0) );</P> | |
864 | <P STYLE="margin-bottom: 0in"><B>DESCRIPTION</B></P> | |
865 | <P STYLE="margin-bottom: 0in">Virtual methods of Vcpu class to remote | |
866 | breakpoint with bp_id.</P> | |
867 | <P STYLE="margin-bottom: 0in">If bp_id is ~(0) - remove all | |
868 | breakpoints.</P> | |
869 | <P STYLE="margin-bottom: 0in"><B>RETURN VALUES</B></P> | |
870 | <P STYLE="margin-bottom: 0in">1 – success; | |
871 | </P> | |
872 | <P STYLE="margin-bottom: 0in">0 – fail.</P> | |
873 | <P STYLE="margin-bottom: 0in"><B>USAGE</B></P> | |
874 | <P STYLE="margin-bottom: 0in">// remove all breakpoints</P> | |
875 | <P STYLE="margin-bottom: 0in">g_vcpu[cpu_id]->delete_breakpoint();</P> | |
876 | <P STYLE="margin-bottom: 0in"><B>SEE ALSO</B></P> | |
877 | <P STYLE="margin-bottom: 0in"><A HREF="#overview">back to overview</A></P> | |
878 | <P STYLE="margin-bottom: 0in; page-break-before: always"><BR> | |
879 | </P> | |
880 | <P STYLE="margin-bottom: 0in; page-break-before: always"><FONT SIZE=4 STYLE="font-size: 16pt"><U><B>Vcpu::reconfig</B></U></FONT></P> | |
881 | <P STYLE="margin-bottom: 0in"><B>NAME</B></P> | |
882 | <P STYLE="margin-bottom: 0in">Vcpu::reconfig– set new | |
883 | parameters for vcpu configuration; | |
884 | </P> | |
885 | <P STYLE="margin-bottom: 0in"><B>SYNOPSIS</B></P> | |
886 | <P STYLE="margin-bottom: 0in">#include “vcpu.h”</P> | |
887 | <P STYLE="margin-bottom: 0in">virtual int Vcpu::reconfig(VCPU_Config | |
888 | conf );</P> | |
889 | <P STYLE="margin-bottom: 0in"><B>DESCRIPTION</B></P> | |
890 | <P STYLE="margin-bottom: 0in">Virtual methods of Vcpu class to change | |
891 | cpu configuration parameters. | |
892 | </P> | |
893 | <P STYLE="margin-bottom: 0in"><B>RETURN VALUES</B></P> | |
894 | <P STYLE="margin-bottom: 0in">1 – success; | |
895 | </P> | |
896 | <P STYLE="margin-bottom: 0in">0 – fail.</P> | |
897 | <P STYLE="margin-bottom: 0in"><B>USAGE</B></P> | |
898 | <P STYLE="margin-bottom: 0in">// update cpu config parameters</P> | |
899 | <P STYLE="margin-bottom: 0in">g_vcpu[cpu_id]->reconfig(new_conf);</P> | |
900 | <P STYLE="margin-bottom: 0in"><B>SEE ALSO</B></P> | |
901 | <P STYLE="margin-bottom: 0in"><FONT SIZE=4 STYLE="font-size: 16pt"><U><A HREF="#overview"><SPAN STYLE="font-weight: medium"><FONT SIZE=3>back | |
902 | to overview</FONT></SPAN></A></U></FONT></P> | |
903 | <P STYLE="margin-bottom: 0in"><BR> | |
904 | </P> | |
905 | <P STYLE="margin-bottom: 0in"><BR> | |
906 | </P> | |
907 | <P STYLE="margin-bottom: 0in"><FONT SIZE=4 STYLE="font-size: 16pt"><U><B>VCPU_ImpIntf::mem</B></U></FONT></P> | |
908 | <P STYLE="margin-bottom: 0in"><B>NAME</B></P> | |
909 | <P STYLE="margin-bottom: 0in">mem - Pointer to the memory object. | |
910 | </P> | |
911 | <P STYLE="margin-bottom: 0in"><B>SYNOPSIS</B></P> | |
912 | <P STYLE="margin-bottom: 0in">#include “vcpu.h”</P> | |
913 | <P STYLE="margin-bottom: 0in">#include “Memory.h”</P> | |
914 | <P STYLE="margin-bottom: 0in">class SMemory *mem;</P> | |
915 | <P STYLE="margin-bottom: 0in"><B>DESCRIPTION</B></P> | |
916 | <P STYLE="margin-bottom: 0in"><BR> | |
917 | </P> | |
918 | <P STYLE="margin-bottom: 0in">This pointer is a member of | |
919 | VCPU_ImpIntf structure. | |
920 | </P> | |
921 | <P STYLE="margin-bottom: 0in">CPU module uses this pointer internally | |
922 | to access physical memory. | |
923 | </P> | |
924 | <P STYLE="margin-bottom: 0in">Currently we support two types of | |
925 | simulated memory – flat memory and sparse memory. | |
926 | </P> | |
927 | <P STYLE="margin-bottom: 0in">For speed consideration the type of the | |
928 | memory is defined at build time. | |
929 | </P> | |
930 | <P STYLE="margin-bottom: 0in"><BR> | |
931 | </P> | |
932 | <P STYLE="margin-bottom: 0in"><B>USAGE</B></P> | |
933 | <P STYLE="margin-bottom: 0in"><BR> | |
934 | </P> | |
935 | <P STYLE="margin-bottom: 0in">The SMemory object should be | |
936 | instantiated outside the CPU module and the pointer to the object is | |
937 | assigned in VCPU_ImpIntf structure and passed to the create() vcpu | |
938 | routine. | |
939 | </P> | |
940 | <P STYLE="margin-bottom: 0in"><B>SEE ALSO</B></P> | |
941 | <P STYLE="margin-bottom: 0in"><A HREF="#overview">back to overview</A></P> | |
942 | <P STYLE="margin-bottom: 0in; page-break-before: always"><FONT SIZE=4 STYLE="font-size: 16pt"><U><B>VCPU_ImpIntf::access_io</B></U></FONT></P> | |
943 | <P STYLE="margin-bottom: 0in"><B>NAME</B></P> | |
944 | <P STYLE="margin-bottom: 0in">access_io - Access physical IO | |
945 | </P> | |
946 | <P STYLE="margin-bottom: 0in"><B>SYNOPSIS</B></P> | |
947 | <P STYLE="margin-bottom: 0in">#include “vcpu.h”</P> | |
948 | <P STYLE="margin-bottom: 0in">int (*access_io) | |
949 | </P> | |
950 | <P STYLE="margin-bottom: 0in">( | |
951 | </P> | |
952 | <P STYLE="margin-bottom: 0in">int vcpu_id, // cpu id</P> | |
953 | <P STYLE="margin-bottom: 0in">int operation, // operation code- load, | |
954 | store and etc</P> | |
955 | <P STYLE="margin-bottom: 0in">uint64_t paddr, // physical address</P> | |
956 | <P STYLE="margin-bottom: 0in">uint32_t size, // access size</P> | |
957 | <P STYLE="margin-bottom: 0in">uint64_t &data, // 64 bit value to | |
958 | read/write</P> | |
959 | <P STYLE="margin-bottom: 0in">uint64_t bytemask // access byte mask</P> | |
960 | <P STYLE="margin-bottom: 0in">); | |
961 | </P> | |
962 | <P STYLE="margin-bottom: 0in"><B>DESCRIPTION</B></P> | |
963 | <P STYLE="margin-bottom: 0in">This function pointer is a member of | |
964 | VCPU_ImpIntf structure. | |
965 | </P> | |
966 | <P STYLE="margin-bottom: 0in">Pointer to the routine to access | |
967 | physical io space from the CPU module. | |
968 | </P> | |
969 | <P STYLE="margin-bottom: 0in">Parameter operation is defined in | |
970 | VCPU_Operation.</P> | |
971 | <P STYLE="margin-bottom: 0in">CPU module uses this pointer internally | |
972 | to access physical IO space.</P> | |
973 | <P STYLE="margin-bottom: 0in"><B>RETURN VALUES</B></P> | |
974 | <P STYLE="margin-bottom: 0in">1 – success;</P> | |
975 | <P STYLE="margin-bottom: 0in">0 - fail.</P> | |
976 | <P STYLE="margin-bottom: 0in"><B>USAGE</B></P> | |
977 | <P STYLE="margin-bottom: 0in">The routine should be defined outside | |
978 | the CPU module and the pointer to the routine is assigned in | |
979 | VCPU_ImpIntf structure and passed to the Create vcpu routine. | |
980 | </P> | |
981 | <P STYLE="margin-bottom: 0in"><B>SEE ALSO</B></P> | |
982 | <P STYLE="margin-bottom: 0in"><A HREF="#overview">back to overview</A></P> | |
983 | <P STYLE="margin-bottom: 0in; page-break-before: always"><FONT SIZE=4 STYLE="font-size: 16pt"><U><B>VCPU_ImpIntf::access_asi</B></U></FONT></P> | |
984 | <P STYLE="margin-bottom: 0in"><B>NAME</B></P> | |
985 | <P STYLE="margin-bottom: 0in">access_asi - Optional interface to | |
986 | access devices that mapped to asi ring | |
987 | </P> | |
988 | <P STYLE="margin-bottom: 0in"><B>SYNOPSIS</B></P> | |
989 | <P STYLE="margin-bottom: 0in">#include “vcpu.h”</P> | |
990 | <P STYLE="margin-bottom: 0in">int (*access_asi) | |
991 | </P> | |
992 | <P STYLE="margin-bottom: 0in">(</P> | |
993 | <P STYLE="margin-bottom: 0in">int vcpu_id, // cpu id | |
994 | </P> | |
995 | <P STYLE="margin-bottom: 0in">int operation, // operation code- | |
996 | load,store and etc.</P> | |
997 | <P STYLE="margin-bottom: 0in">uint32_t asi, // asi value</P> | |
998 | <P STYLE="margin-bottom: 0in">uint64_t vaddr, // virtual address</P> | |
999 | <P STYLE="margin-bottom: 0in">int32_t size, // access size</P> | |
1000 | <P STYLE="margin-bottom: 0in">uint64_t &buf // 64 bit data value</P> | |
1001 | <P STYLE="margin-bottom: 0in">);</P> | |
1002 | <P STYLE="margin-bottom: 0in"><B>DESCRIPTION</B></P> | |
1003 | <P STYLE="margin-bottom: 0in">This function pointer is a member of | |
1004 | VCPU_ImpIntf structure. | |
1005 | </P> | |
1006 | <P STYLE="margin-bottom: 0in">Pointer to the routine to access device | |
1007 | control registers mapped to the asi ring from the CPU module. | |
1008 | Parameter operation is defined in VCPU_Operation.</P> | |
1009 | <P STYLE="margin-bottom: 0in">CPU module uses this pointer internally | |
1010 | to access asi mapped address space.</P> | |
1011 | <P STYLE="margin-bottom: 0in"><B>RETURN VALUES</B></P> | |
1012 | <P STYLE="margin-bottom: 0in">1 – success;</P> | |
1013 | <P STYLE="margin-bottom: 0in">0 - fail.</P> | |
1014 | <P STYLE="margin-bottom: 0in"><B>USAGE</B></P> | |
1015 | <P STYLE="margin-bottom: 0in">The routine should be defined outside | |
1016 | the CPU module and the pointer to the routine is assigned in | |
1017 | VCPU_ImpIntf structure and passed to the Create vcpu routine. | |
1018 | </P> | |
1019 | <P STYLE="margin-bottom: 0in">NULL if not used. | |
1020 | </P> | |
1021 | <P STYLE="margin-bottom: 0in"><B>SEE ALSO</B></P> | |
1022 | <P STYLE="margin-bottom: 0in"><A HREF="#overview">back to overview</A></P> | |
1023 | <P STYLE="margin-bottom: 0in; page-break-before: always"><FONT SIZE=4 STYLE="font-size: 16pt"><U><B>VCPU_ImpIntf::access_serial</B></U></FONT></P> | |
1024 | <P STYLE="margin-bottom: 0in"><B>NAME</B></P> | |
1025 | <P STYLE="margin-bottom: 0in">access_serial - Optional interface to | |
1026 | access serial devices | |
1027 | </P> | |
1028 | <P STYLE="margin-bottom: 0in"><B>SYNOPSIS</B></P> | |
1029 | <P STYLE="margin-bottom: 0in">#include “vcpu.h”</P> | |
1030 | <P STYLE="margin-bottom: 0in">// | |
1031 | </P> | |
1032 | <P STYLE="margin-bottom: 0in">int (*access_serial)</P> | |
1033 | <P STYLE="margin-bottom: 0in">(</P> | |
1034 | <P STYLE="margin-bottom: 0in">uint8_t *c, // character to read/write</P> | |
1035 | <P STYLE="margin-bottom: 0in">bool_t wr // 0 - read, 1 - write</P> | |
1036 | <P STYLE="margin-bottom: 0in">);</P> | |
1037 | <P STYLE="margin-bottom: 0in"><B>DESCRIPTION</B></P> | |
1038 | <P STYLE="margin-bottom: 0in">This function pointer is a member of | |
1039 | VCPU_ImpIntf structure. | |
1040 | </P> | |
1041 | <P STYLE="margin-bottom: 0in">Pointer to the routine to access serial | |
1042 | device for software bring up and debugging from the CPU module. CPU | |
1043 | module uses this pointer internally to access simulated serial | |
1044 | device.</P> | |
1045 | <P STYLE="margin-bottom: 0in"><B>RETURN VALUES</B></P> | |
1046 | <P STYLE="margin-bottom: 0in">1 – success;</P> | |
1047 | <P STYLE="margin-bottom: 0in">0 - fail.</P> | |
1048 | <P STYLE="margin-bottom: 0in"><B>USAGE</B></P> | |
1049 | <P STYLE="margin-bottom: 0in">The routine should be defined outside | |
1050 | the CPU module and the pointer to the routine is assigned in | |
1051 | VCPU_ImpIntf structure and passed to the Create vcpu routine. | |
1052 | </P> | |
1053 | <P STYLE="margin-bottom: 0in">NULL if not used. | |
1054 | </P> | |
1055 | <P STYLE="margin-bottom: 0in"><B>SEE ALSO</B></P> | |
1056 | <P STYLE="margin-bottom: 0in"><A HREF="#overview">back to overview</A></P> | |
1057 | <P STYLE="margin-bottom: 0in; page-break-before: always"><FONT SIZE=4 STYLE="font-size: 16pt"><U><B>VCPU_ImpIntf::vtrace</B></U></FONT></P> | |
1058 | <P STYLE="margin-bottom: 0in"><B>NAME</B></P> | |
1059 | <P STYLE="margin-bottom: 0in">vtrace - Pointer to the vtracer object. | |
1060 | </P> | |
1061 | <P STYLE="margin-bottom: 0in"><B>SYNOPSIS</B></P> | |
1062 | <P STYLE="margin-bottom: 0in">#include “vcpu.h”</P> | |
1063 | <P STYLE="margin-bottom: 0in">#include “vtracer.h”</P> | |
1064 | <P STYLE="margin-bottom: 0in">class VTracer *vtrace; | |
1065 | </P> | |
1066 | <P STYLE="margin-bottom: 0in"><B>DESCRIPTION</B></P> | |
1067 | <P STYLE="margin-bottom: 0in">This pointer is a member of | |
1068 | VCPU_ImpIntf structure. | |
1069 | </P> | |
1070 | <P STYLE="margin-bottom: 0in">CPU module uses this pointer internally | |
1071 | to output instruction trace. | |
1072 | </P> | |
1073 | <P STYLE="margin-bottom: 0in">VTracer is an abstract class | |
1074 | representing any analyzer which could be hooked up the CPU module. | |
1075 | Cpu model calles Vtracer methods to output a complete information | |
1076 | about architecture state change for every instruction. The | |
1077 | information for every instruction is accumulated in VCPU_Instruction | |
1078 | structure. | |
1079 | </P> | |
1080 | <P STYLE="margin-bottom: 0in; font-weight: medium">Trap information | |
1081 | is collected in VCPU_Trap structure, VCPU_TLB is for tlb information. | |
1082 | </P> | |
1083 | <P STYLE="margin-bottom: 0in"><B>USAGE</B></P> | |
1084 | <P STYLE="margin-bottom: 0in">The Vtracer object should be | |
1085 | instantiated outside the CPU module, pointer to the object is | |
1086 | assigned in VCPU_ImpIntf structure and passed to the Create vcpu | |
1087 | routine. | |
1088 | </P> | |
1089 | <P STYLE="margin-bottom: 0in; font-weight: medium">A tracer module | |
1090 | must NOT define a static vtracer object. The</P> | |
1091 | <P STYLE="margin-bottom: 0in; font-weight: medium">vtracer object | |
1092 | must be created by the vtracer_init() function</P> | |
1093 | <P STYLE="margin-bottom: 0in; font-weight: medium">provided by the | |
1094 | module code and called by the simulator. Also, the</P> | |
1095 | <P STYLE="margin-bottom: 0in; font-weight: medium">module must | |
1096 | provide a function called vtracer_fini() which should</P> | |
1097 | <P STYLE="margin-bottom: 0in; font-weight: medium">clean up before | |
1098 | the module is unloaded (un-register ui commands, free</P> | |
1099 | <P STYLE="margin-bottom: 0in; font-weight: medium">memory etc.)</P> | |
1100 | <P STYLE="margin-bottom: 0in; font-weight: medium">Instruction | |
1101 | information VCPU_Instruction - provides information | |
1102 | </P> | |
1103 | <P STYLE="margin-bottom: 0in; font-weight: medium">about the | |
1104 | instruction been executed.</P> | |
1105 | <P STYLE="margin-bottom: 0in; font-weight: medium">Fields in this | |
1106 | structure are arranged according to the | |
1107 | </P> | |
1108 | <P STYLE="margin-bottom: 0in; font-weight: medium">order in which | |
1109 | they are used during instruction lifetime.</P> | |
1110 | <P STYLE="margin-bottom: 0in"><B>SEE ALSO</B></P> | |
1111 | <P STYLE="margin-bottom: 0in"><A HREF="#overview">back to overview</A></P> | |
1112 | <P STYLE="margin-bottom: 0in; page-break-before: always"><FONT SIZE=4 STYLE="font-size: 16pt"><U><B>Vtracer::instr</B></U></FONT></P> | |
1113 | <P STYLE="margin-bottom: 0in"><B>NAME</B></P> | |
1114 | <P STYLE="margin-bottom: 0in">Vtracer::instr - Send an instruction | |
1115 | info message. | |
1116 | </P> | |
1117 | <P STYLE="margin-bottom: 0in"><B>SYNOPSIS</B></P> | |
1118 | <P STYLE="margin-bottom: 0in">#include “vcpu.h”</P> | |
1119 | <P STYLE="margin-bottom: 0in">#include “vtracer.h”</P> | |
1120 | <P STYLE="margin-bottom: 0in; font-weight: medium">virtual int | |
1121 | Vtracer::instr ( VCPU_Instruction *i );</P> | |
1122 | <P STYLE="margin-bottom: 0in"><B>DESCRIPTION</B></P> | |
1123 | <P STYLE="margin-bottom: 0in">Virtual method of Vtracer class – | |
1124 | output an instruction information. | |
1125 | </P> | |
1126 | <P STYLE="margin-bottom: 0in">VTracer is an abstract class | |
1127 | representing any analyzer which could be hooked up the CPU module. | |
1128 | VCPU_Instruction - provides information about the instruction been | |
1129 | executed.</P> | |
1130 | <P STYLE="margin-bottom: 0in; font-weight: medium">Fields in this | |
1131 | structure are arranged according to the | |
1132 | </P> | |
1133 | <P STYLE="margin-bottom: 0in; font-weight: medium">order in which | |
1134 | they are used during instruction lifetime.</P> | |
1135 | <P STYLE="margin-bottom: 0in"><B>USAGE</B></P> | |
1136 | <P STYLE="margin-bottom: 0in; font-weight: medium">// collect trace | |
1137 | record</P> | |
1138 | <P STYLE="margin-bottom: 0in; font-weight: medium">VCPU_Instruction | |
1139 | *i;</P> | |
1140 | <P STYLE="margin-bottom: 0in; font-weight: medium">i->nregs = 0;</P> | |
1141 | <P STYLE="margin-bottom: 0in; font-weight: medium">i->ld_num = 0; | |
1142 | </P> | |
1143 | <P STYLE="margin-bottom: 0in; font-weight: medium">i->st_num = 0;</P> | |
1144 | <P STYLE="margin-bottom: 0in; font-weight: medium">i->itype = | |
1145 | VCPU_UNKNOWN_ITYPE; | |
1146 | </P> | |
1147 | <P STYLE="margin-bottom: 0in; font-weight: medium">i->cpuid = | |
1148 | cpuid; | |
1149 | </P> | |
1150 | <P STYLE="margin-bottom: 0in; font-weight: medium">i->pc_va = | |
1151 | pc_va; | |
1152 | </P> | |
1153 | <P STYLE="margin-bottom: 0in; font-weight: medium">i->pc_pa = | |
1154 | pc_pa; | |
1155 | </P> | |
1156 | <P STYLE="margin-bottom: 0in; font-weight: medium">i->npc_va = | |
1157 | npc_va; | |
1158 | </P> | |
1159 | <P STYLE="margin-bottom: 0in; font-weight: medium">i->opcode = iw; | |
1160 | </P> | |
1161 | <P STYLE="margin-bottom: 0in; font-weight: medium">i->annul = an; | |
1162 | </P> | |
1163 | <P STYLE="margin-bottom: 0in; font-weight: medium">i->taken = | |
1164 | (npc_va != (pc_va + 4)); | |
1165 | </P> | |
1166 | <P STYLE="margin-bottom: 0in; font-weight: medium">// call tracer</P> | |
1167 | <P STYLE="margin-bottom: 0in; font-weight: medium">g_ni_vcpu[cpuid]->sys_intf.vtrace->instr(i);</P> | |
1168 | <P STYLE="margin-bottom: 0in"><B>SEE ALSO</B></P> | |
1169 | <P STYLE="margin-bottom: 0in"><A HREF="#overview">back to overview</A></P> | |
1170 | <P STYLE="margin-bottom: 0in; page-break-before: always"><FONT SIZE=4 STYLE="font-size: 16pt"><U><B>Vtracer::trap</B></U></FONT></P> | |
1171 | <P STYLE="margin-bottom: 0in"><B>NAME</B></P> | |
1172 | <P STYLE="margin-bottom: 0in">Vtracer::instr - Send a trap info | |
1173 | message. | |
1174 | </P> | |
1175 | <P STYLE="margin-bottom: 0in"><B>SYNOPSIS</B></P> | |
1176 | <P STYLE="margin-bottom: 0in">#include “vcpu.h”</P> | |
1177 | <P STYLE="margin-bottom: 0in">#include “vtracer.h”</P> | |
1178 | <P STYLE="margin-bottom: 0in; font-weight: medium">virtual int | |
1179 | Vtracer::trap ( VCPU_Trap *t );</P> | |
1180 | <P STYLE="margin-bottom: 0in"><B>DESCRIPTION</B></P> | |
1181 | <P STYLE="margin-bottom: 0in">Virtual method of Vtracer class – | |
1182 | output trap information. | |
1183 | </P> | |
1184 | <P STYLE="margin-bottom: 0in; font-weight: medium">VCPU_Trap - | |
1185 | provides information about the trap been taken.</P> | |
1186 | <P STYLE="margin-bottom: 0in"><B>USAGE</B></P> | |
1187 | <P STYLE="margin-bottom: 0in; font-weight: medium">Sam::VCPU_Trap *t;</P> | |
1188 | <P STYLE="margin-bottom: 0in; font-weight: medium">t->pc_va = | |
1189 | tr_pc;</P> | |
1190 | <P STYLE="margin-bottom: 0in; font-weight: medium">t->npc_va = | |
1191 | tr_npc;</P> | |
1192 | <P STYLE="margin-bottom: 0in; font-weight: medium">t->tno = tno; | |
1193 | </P> | |
1194 | <P STYLE="margin-bottom: 0in; font-weight: medium">t->cpuid = id; | |
1195 | </P> | |
1196 | <P STYLE="margin-bottom: 0in; font-weight: medium">//call tracer</P> | |
1197 | <P STYLE="margin-bottom: 0in; font-weight: medium">g_ni_vcpu[id]->sys_intf.vtrace->trap(t);</P> | |
1198 | <P STYLE="margin-bottom: 0in"><B>SEE ALSO</B></P> | |
1199 | <P STYLE="margin-bottom: 0in"><A HREF="#overview">back to overview</A></P> | |
1200 | </BODY> | |
1201 | </HTML> |