1 |
.\" $Id: gxemul.1,v 1.21 2005/06/03 23:14:52 debug Exp $ |
2 |
.\" |
3 |
.\" Copyright (C) 2004-2005 Anders Gavare. All rights reserved. |
4 |
.\" |
5 |
.\" Redistribution and use in source and binary forms, with or without |
6 |
.\" modification, are permitted provided that the following conditions are met: |
7 |
.\" |
8 |
.\" 1. Redistributions of source code must retain the above copyright |
9 |
.\" notice, this list of conditions and the following disclaimer. |
10 |
.\" 2. Redistributions in binary form must reproduce the above copyright |
11 |
.\" notice, this list of conditions and the following disclaimer in the |
12 |
.\" documentation and/or other materials provided with the distribution. |
13 |
.\" 3. The name of the author may not be used to endorse or promote products |
14 |
.\" derived from this software without specific prior written permission. |
15 |
.\" |
16 |
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |
17 |
.\" 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 AUTHOR OR CONTRIBUTORS BE LIABLE |
20 |
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
21 |
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
22 |
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
23 |
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
24 |
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
25 |
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
26 |
.\" SUCH DAMAGE. |
27 |
.\" |
28 |
.\" |
29 |
.\" This is a minimal man page for GXemul. Process this file with |
30 |
.\" groff -man -Tascii gxemul.1 or nroff -man gxemul.1 |
31 |
.\" |
32 |
.Dd JUNE 2005 |
33 |
.Dt GXEMUL 1 |
34 |
.Os |
35 |
.Sh NAME |
36 |
.Nm gxemul |
37 |
.Nd an experimental machine emulator |
38 |
.Sh SYNOPSIS |
39 |
.Nm |
40 |
.Op machine, other, and general options |
41 |
.Op file Ar ... |
42 |
.Nm |
43 |
.Op general options |
44 |
.Op Ar @configfile ... |
45 |
.Nm |
46 |
.Op userland, other, and general options |
47 |
.Ar file Op Ar args ... |
48 |
.Sh DESCRIPTION |
49 |
.Nm |
50 |
is an experimental instruction-level machine emulator. It can be used |
51 |
to run binary code for (among others) MIPS-based machines. |
52 |
Several emulation modes are available. For some emulation modes, processors |
53 |
and surrounding hardware components are emulated well enough to let |
54 |
unmodified operating systems (eg. NetBSD) run as if they were running on a |
55 |
real machine. |
56 |
.Pp |
57 |
There are three ways to invoke the emulator. When emulating a |
58 |
complete machine, settings can be entered directly on the command line, or |
59 |
they can be read from a configuration file. When emulating a userland |
60 |
environment (syscall-only emulation, not emulating complete machines), |
61 |
then the program name and its argument should be given on the command |
62 |
line. |
63 |
.Pp |
64 |
The easiest way to use the emulator is to supply settings directly on the |
65 |
command line. The most important thing you need to supply is the |
66 |
file argument. This is the name of a binary file (an ELF, a.out, ECOFF, |
67 |
SREC, or a raw binary image) which you wish to run in the emulator. This file |
68 |
might be an operating system kernel, or perhaps a ROM image file. |
69 |
.Pp |
70 |
If more than one filename is supplied, all files are loaded into memory, |
71 |
and the entry point (if available) is taken from the last file. |
72 |
.Pp |
73 |
Apart from the name of a binary file, it is also necessary to select |
74 |
which specific emulation mode to use. For example, a MIPS-based machine |
75 |
from DEC (a DECstation) is very different from a MIPS-based machine |
76 |
from SGI. Use |
77 |
.Nm |
78 |
.Fl H |
79 |
to get a list of available emulation modes. |
80 |
.Pp |
81 |
There are two exceptions to the normal invocation usage mentioned above. |
82 |
The first is for DECstation emulation: if you have a bootable |
83 |
DECstation harddisk or CDROM image, then just supplying the diskimage via |
84 |
the |
85 |
.Fl d |
86 |
option is sufficient. (The filename of the kernel can then be |
87 |
skipped, as the emulator runs the bootblocks from the diskimage directly and |
88 |
doesn't need the kernel as a separate file.) |
89 |
The second is if you supply an ISO9660 CDROM disk image. You may then use |
90 |
the |
91 |
.Fl j |
92 |
option to indicate which file on the CDROM filesystem that should be |
93 |
loaded into emulated memory. |
94 |
.Pp |
95 |
Machine selection options: |
96 |
.Bl -tag -width Ds |
97 |
.It Fl E Ar t |
98 |
Try to emulate machine type |
99 |
.Ar "t". |
100 |
(Use |
101 |
.Fl H |
102 |
to get a list of types.) |
103 |
.It Fl e Ar st |
104 |
Try to emulate machine subtype |
105 |
.Ar "st". |
106 |
Use this together with |
107 |
.Fl E . |
108 |
(This option is not always needed, if a machine type has no subtypes.) |
109 |
.El |
110 |
.Pp |
111 |
Other options: |
112 |
.Bl -tag -width Ds |
113 |
.It Fl B |
114 |
Disable dynamic binary translation completely. By default, bintrans |
115 |
will be turned on if the host architecture supports it. |
116 |
However, in this release (0.3.X), there is no new bintrans system. |
117 |
If you want to enable binary translation, use |
118 |
.Fl "b". |
119 |
.It Fl b |
120 |
Use the OLD binary translation subsystem. (Alpha and i386 hosts only.) |
121 |
.It Fl C Ar x |
122 |
Try to emulate a specific CPU type, |
123 |
.Ar "x". |
124 |
This overrides the default CPU type for the machine being emulated. |
125 |
(Use |
126 |
.Fl H |
127 |
to get a list of available CPU types.) |
128 |
.It Fl d Ar name |
129 |
Add |
130 |
.Ar name |
131 |
as a disk image. By adding one or more modifier characters and then a |
132 |
colon (":") as a prefix to |
133 |
.Ar "name", |
134 |
you can modify the way the disk image is treated. Available modifiers are: |
135 |
.Bl -tag -width Ds |
136 |
.It b |
137 |
Specifies that this is a boot device. |
138 |
.It c |
139 |
CD-ROM. |
140 |
.It d |
141 |
DISK (this is the default). |
142 |
.It f |
143 |
FLOPPY. |
144 |
.It gH;S; |
145 |
Override the default geometry; use H heads and S sectors-per-track. |
146 |
(The number of cylinders is calculated automatically.) |
147 |
.It i |
148 |
IDE. |
149 |
.It r |
150 |
Read-only (don't allow changes to be written to the file). |
151 |
.It s |
152 |
SCSI (this is the default for most machine types). |
153 |
.It t |
154 |
Tape. |
155 |
.It 0-7 |
156 |
Force a specific ID number. |
157 |
.El |
158 |
.Pp |
159 |
Unless otherwise specified, filenames ending with ".iso" are assumed to be |
160 |
CDROM images. Most others are assumed to be disks. Depending on which |
161 |
machine is being emulated, the default for disks can be either SCSI or |
162 |
IDE. Some disk images that are very small are assumed to be floppy disks. |
163 |
(If you are not happy with the way a disk image is detected, then you need |
164 |
to use explicit prefixes to force a specific type.) |
165 |
.Pp |
166 |
For floppies, the gH;S; prefix is ignored. Instead, the number of |
167 |
heads and cylinders are assumed to be 2 and 80, respectively, and the |
168 |
number of sectors per track is calculated automatically. (This works for |
169 |
720KB, 1.2MB, 1.44MB, and 2.88MB floppies.) |
170 |
.It Fl I Ar x |
171 |
Emulate clock interrupts at |
172 |
.Ar x |
173 |
Hz. (This affects emulated clock devices only, not actual runtime speed. |
174 |
This disables automatic clock adjustments, which is otherwise turned on.) |
175 |
(This option is probably only valid for DECstation emulation.) |
176 |
.It Fl i |
177 |
Display each instruction as it is being executed. |
178 |
.It Fl J |
179 |
Disable some speed tricks. |
180 |
.It Fl j Ar n |
181 |
Set the name of the kernel to |
182 |
.Ar "n". |
183 |
When booting from an ISO9660 filesystem, the kernel will try to boot from |
184 |
this file. (In some emulation modes, eg. DECstation, this name is passed |
185 |
along to the boot program. Useful names are "bsd" for OpenBSD/pmax, |
186 |
or "vmunix" for Ultrix.) |
187 |
.It Fl M Ar m |
188 |
Emulate |
189 |
.Ar m |
190 |
MBs of physical RAM. This overrides the default amount of RAM for the |
191 |
selected machine type. |
192 |
.It Fl m Ar nr |
193 |
Run at most |
194 |
.Ar nr |
195 |
instructions (on any cpu). |
196 |
.It Fl N |
197 |
Display nr of instructions/second average, at regular intervals. |
198 |
.It Fl n Ar nr |
199 |
Set nr of CPUs (for SMP experiments). |
200 |
.It Fl O |
201 |
Force a "netboot" (tftp instead of disk), even when a disk image is |
202 |
present (for DECstation, SGI, and ARC emulation). |
203 |
.It Fl o Ar arg |
204 |
Set the boot argument (for DEC, ARC, or SGI emulation). |
205 |
Default |
206 |
.Ar arg |
207 |
for DEC is "-a", for ARC "-aN". |
208 |
.It Fl p Ar pc |
209 |
Add a breakpoint. (Remember to use the "0x" prefix for hex.) |
210 |
.It Fl Q |
211 |
Disable the built-in PROM emulation. This is useful for running raw ROM |
212 |
images from real machines. |
213 |
.It Fl R |
214 |
Use a random bootstrap cpu, instead of CPU nr 0. (For SMP experiments.) |
215 |
.It Fl r |
216 |
Dump register contents for every executed instruction. |
217 |
.It Fl S |
218 |
Initialize the emulated RAM to random data, instead of zeroes. |
219 |
.It Fl T |
220 |
Enter the single-step debugger on unimplemented memory accesses. |
221 |
.It Fl t |
222 |
Show a trace tree of all function calls being made. |
223 |
.It Fl U |
224 |
Enable slow_serial_interrupts_hack_for_linux. |
225 |
.It Fl X |
226 |
Use X11. |
227 |
.It Fl x |
228 |
Open up new xterms for emulated serial ports. (Default is to open up |
229 |
xterms when using configuration files, but not when starting an |
230 |
emulation with settings directly on the command line.) |
231 |
.It Fl Y Ar n |
232 |
Scale down framebuffer windows by |
233 |
.Ar n |
234 |
x |
235 |
.Ar n |
236 |
times. |
237 |
.It Fl y Ar x |
238 |
Set max_random_cycles_per_chunk to |
239 |
.Ar x |
240 |
(experimental). |
241 |
.It Fl Z Ar n |
242 |
Set the number of graphics cards, for emulating a dual-head or tripple-head |
243 |
environment. (Only for DECstation emulation so far.) |
244 |
.It Fl z Ar disp |
245 |
Add |
246 |
.Ar disp |
247 |
as an X11 display to use for framebuffers. |
248 |
.El |
249 |
.Pp |
250 |
Userland options: |
251 |
.Bl -tag -width Ds |
252 |
.It Fl u Ar emul-mode |
253 |
Userland-only (syscall) emulation. (Use |
254 |
.Fl H |
255 |
to get a list of available emulation modes.) Some (but not all) of the |
256 |
options listed under Other options above can also be used with userland |
257 |
emulation. |
258 |
.El |
259 |
.Pp |
260 |
General options: |
261 |
.Bl -tag -width Ds |
262 |
.It Fl D |
263 |
Guarantee fully deterministic behavior. Normally, the emulator calls |
264 |
srandom() with a seed based on the current time at startup. When the |
265 |
.Fl D |
266 |
option is used, the srandom() call is skipped, which should cause two |
267 |
subsequent invocations of the emulator to be identical, if all other |
268 |
settings are identical and no user input is taking place. (If this option |
269 |
is used, then |
270 |
.Fl I |
271 |
must also be used.) |
272 |
.It Fl H |
273 |
Display a list of available CPU types, machine types, and userland |
274 |
emulation modes. (Most of these don't work. Please read the documentation |
275 |
included in the |
276 |
.Nm |
277 |
distribution for details on which modes that actually work.) |
278 |
.It Fl h |
279 |
Display a list of all available command line options. |
280 |
.It Fl K |
281 |
Force the single-step debugger to be entered at the end of a simulation. |
282 |
.It Fl q |
283 |
Quiet mode; this suppresses startup messages. |
284 |
.It Fl s |
285 |
Show opcode usage statistics after the simulation. |
286 |
.It Fl V |
287 |
Start up in the single-step debugger, paused. |
288 |
.It Fl v |
289 |
Verbose debug messages. |
290 |
.El |
291 |
.Pp |
292 |
Configuration file startup: |
293 |
.Bl -tag -width Ds |
294 |
.It @ Ar configfile |
295 |
Start an emulation based on the contents of |
296 |
.Ar "configfile". |
297 |
.El |
298 |
.Pp |
299 |
For more information, please read the documentation in the doc/ |
300 |
subdirectory of the |
301 |
.Nm |
302 |
distribution. |
303 |
.Sh EXAMPLES |
304 |
The following command will start NetBSD/pmax on an emulated DECstation |
305 |
5000/200 (3MAX), with the old bintrans system enabled: |
306 |
.Pp |
307 |
.Dl "gxemul -E dec -e 3max -b -d netbsddisk.img" |
308 |
.Pp |
309 |
netbsddisk.img should be a raw disk image containing a bootable |
310 |
NetBSD/pmax filesystem. |
311 |
.Pp |
312 |
The following command will start an emulation session based on settings in |
313 |
the configuration file "mysession". The -v option tells gxemul to be |
314 |
verbose. |
315 |
.Pp |
316 |
.Dl "gxemul -v @mysession" |
317 |
.Pp |
318 |
If you have compiled the small Hello World program mentioned in the |
319 |
.Nm |
320 |
documentation, the following command will start up an |
321 |
emulated test machine in "paused" mode: |
322 |
.Pp |
323 |
.Dl "gxemul -E testmips -V hello_mips" |
324 |
.Pp |
325 |
(Paused mode means that you enter the interactive single-step debugger |
326 |
directly at startup, instead of launching the Hello World program.) |
327 |
.Pp |
328 |
Please read the documentation for more details. |
329 |
.Sh BUGS |
330 |
There are many bugs. Some of the known bugs are listed in the BUGS |
331 |
file in the |
332 |
.Nm |
333 |
source distribution, some are indirectly mentioned in the TODO file. |
334 |
.Pp |
335 |
There is no new bintrans system in this release, so you will need to add |
336 |
.Fl b |
337 |
to select the old bintrans system, if you want speed. |
338 |
.Pp |
339 |
.Nm |
340 |
does not simulate individual pipe-line stages or penalties caused by |
341 |
branch-prediction misses, so it cannot be used for accurate performance |
342 |
measurement. |
343 |
.Pp |
344 |
.Nm |
345 |
is not timing-accurate. |
346 |
.Sh AUTHOR |
347 |
Anders Gavare <anders@gavare.se> |
348 |
.Pp |
349 |
See http://gavare.se/gxemul/ for more information. |