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