/[gxemul]/trunk/man/gxemul.1
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/man/gxemul.1

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 16 by dpavlin, Mon Oct 8 16:19:01 2007 UTC revision 32 by dpavlin, Mon Oct 8 16:20:58 2007 UTC
# Line 1  Line 1 
1  .\" $Id: gxemul.1,v 1.34 2005/10/11 03:53:58 debug Exp $  .\" $Id: gxemul.1,v 1.76 2006/11/04 06:40:20 debug Exp $
2  .\"  .\"
3  .\" Copyright (C) 2004-2005  Anders Gavare.  All rights reserved.  .\" Copyright (C) 2004-2006  Anders Gavare.  All rights reserved.
4  .\"  .\"
5  .\" Redistribution and use in source and binary forms, with or without  .\" Redistribution and use in source and binary forms, with or without
6  .\" modification, are permitted provided that the following conditions are met:  .\" modification, are permitted provided that the following conditions are met:
# Line 29  Line 29 
29  .\" This is a minimal man page for GXemul. Process this file with  .\" This is a minimal man page for GXemul. Process this file with
30  .\"     groff -man -Tascii gxemul.1    or    nroff -man gxemul.1  .\"     groff -man -Tascii gxemul.1    or    nroff -man gxemul.1
31  .\"  .\"
32  .Dd OCTOBER 2005  .Dd NOVEMBER 2006
33  .Dt GXEMUL 1  .Dt GXEMUL 1
34  .Os  .Os
35  .Sh NAME  .Sh NAME
# Line 42  Line 42 
42  .Nm  .Nm
43  .Op general options  .Op general options
44  .Ar @configfile  .Ar @configfile
45  .Nm  .\" TODO: Reenable this once userland emulation works:
46  .Op userland, other, and general options  .\" .Nm
47  .Ar file Op Ar args ...  .\" .Op userland, other, and general options
48    .\" .Ar file Op Ar args ...
49  .Sh DESCRIPTION  .Sh DESCRIPTION
50  .Nm  .Nm
51  is an experimental instruction-level machine emulator. Several  is an experimental instruction-level machine emulator. Several
52  emulation modes are available. In some modes, processors and surrounding  emulation modes are available. In some modes, processors and surrounding
53  hardware components are emulated well enough to let unmodified operating  hardware components are emulated well enough to let unmodified operating
54  systems (e.g. NetBSD) run as if they were running on a real machine.  systems (e.g. NetBSD) run inside the emulator as if they were running on a
55    real machine.
56  .Pp  .Pp
57  The processor architecture best emulated by GXemul is MIPS, but other  Processors (ARM, MIPS, PowerPC, SuperH) are emulated using dynamic translation.
58  architectures are also partially emulated.  However, unlike some other dynamically translating emulators, GXemul does
59    not currently generate native code, only a "runnable intermediate
60    representation", and will thus run on any host architecture, without the
61    need to implement per-architecture backends.
62  .Pp  .Pp
63  There are three ways to invoke the emulator:  The emulator can be invoked in the following ways:
64  .Pp  .Pp
65  1. When emulating a complete machine, configuration options can be entered  1. When emulating a complete machine, configuration options can be entered
66  directly on the command line.  directly on the command line.
67  .Pp  .Pp
68  2. Options can be read from a configuration file.  2. Options can be read from a configuration file.
69  .Pp  .\" .Pp
70  3. When emulating a userland environment (syscall-only emulation, not  .\" 3. When emulating a userland environment (syscall-only emulation, not
71  emulating complete machines), then the program name and its argument  .\" emulating complete machines), then the program name and its argument
72  should be given on the command line. (This mode doesn't really work yet.)  .\" should be given on the command line. (This mode doesn't really work yet,
73    .\" and is disabled for stable release builds.)
74  .Pp  .Pp
75  The easiest way to use the emulator is to supply settings directly on the  The easiest way to use the emulator is to supply settings directly on the
76  command line. The most important thing you need to supply is the  command line. The most important thing you need to supply is the
# Line 97  the Line 103  the
103  option to indicate which file on the CDROM filesystem that should be  option to indicate which file on the CDROM filesystem that should be
104  loaded into emulated memory.  loaded into emulated memory.
105  .Pp  .Pp
106    Gzipped kernels are automatically unzipped, by calling the external gunzip
107    program, both when specifying a gzipped file directly on the command line
108    and when loading such a file using the
109    .Fl j
110    option.
111    .Pp
112  Machine selection options:  Machine selection options:
113  .Bl -tag -width Ds  .Bl -tag -width Ds
114  .It Fl E Ar t  .It Fl E Ar t
# Line 118  Use this together with Line 130  Use this together with
130  .Pp  .Pp
131  Other options:  Other options:
132  .Bl -tag -width Ds  .Bl -tag -width Ds
 .It Fl A  
 Disable load/store alignment checks in some cases. This might give a small  
 increase in performance, but the emulator will not run correctly if the  
 emulated code actually tries to do unaligned loads or stores. (This option  
 is only meaningful when emulating MIPS CPUs, when the host architecture is  
 Alpha or i386, and binary translation is enabled.)  
 .It Fl B  
 Disable dynamic binary translation. By default, bintrans  
 will be turned on if the host+target architecture combination is  
 supported. Currently, the only supported target architecture for bintrans  
 is MIPS, and the supported host architectures are Alpha and i386.  
133  .It Fl C Ar x  .It Fl C Ar x
134  Try to emulate a specific CPU type,  Try to emulate a specific CPU type,
135  .Ar "x".  .Ar "x".
# Line 136  This overrides the default CPU type for Line 137  This overrides the default CPU type for
137  (Use  (Use
138  .Fl H  .Fl H
139  to get a list of available CPU types.)  to get a list of available CPU types.)
140  .It Fl d Ar name  .It Fl d Ar [modifiers:]filename
141  Add  Add
142  .Ar name  .Ar filename
143  as a disk image. By adding one or more modifier characters and then a  as a disk image. By adding one or more modifier characters and then a
144  colon (":") as a prefix to  colon (":") as a prefix to
145  .Ar "name",  .Ar filename,
146  you can modify the way the disk image is treated. Available modifiers are:  you can modify the way the disk image is treated. Available modifiers are:
147  .Bl -tag -width Ds  .Bl -tag -width Ds
148  .It b  .It b
# Line 156  FLOPPY. Line 157  FLOPPY.
157  Override the default geometry; use H heads and S sectors-per-track.  Override the default geometry; use H heads and S sectors-per-track.
158  (The number of cylinders is calculated automatically.)  (The number of cylinders is calculated automatically.)
159  .It i  .It i
160  IDE.  IDE. (This is the default for most machine types.)
161  .It r  .It r
162  Read-only (don't allow changes to be written to the file).  Read-only (don't allow changes to be written to the file).
163  .It s  .It s
164  SCSI (this is the default for most machine types).  SCSI.
165  .It t  .It t
166  Tape.  Tape.
167  .It 0-7  .It 0-7
168  Force a specific ID number.  Force a specific ID number.
169  .El  .El
170  .Pp  .Pp
171    For SCSI devices, the ID number is the SCSI ID. For IDE harddisks, the ID
172    number has the following meaning:
173    .Bl -tag -width Ds
174    .It 0
175    Primary master.
176    .It 1
177    Primary slave.
178    .It 2
179    Secondary master.
180    .It 3
181    Secondary slave.
182    .El
183    .Pp
184  Unless otherwise specified, filenames ending with ".iso" or ".cdr" are  Unless otherwise specified, filenames ending with ".iso" or ".cdr" are
185  assumed to be CDROM images. Most others are assumed to be disks. Depending  assumed to be CDROM images. Most others are assumed to be disks. Depending
186  on which machine is being emulated, the default for disks can be either  on which machine is being emulated, the default for disks can be either
# Line 178  For floppies, the gH;S; prefix is ignore Line 192  For floppies, the gH;S; prefix is ignore
192  heads and cylinders are assumed to be 2 and 80, respectively, and the  heads and cylinders are assumed to be 2 and 80, respectively, and the
193  number of sectors per track is calculated automatically. (This works for  number of sectors per track is calculated automatically. (This works for
194  720KB, 1.2MB, 1.44MB, and 2.88MB floppies.)  720KB, 1.2MB, 1.44MB, and 2.88MB floppies.)
195  .It Fl I Ar x  .It Fl G Ar port
196  Emulate clock interrupts at  Pause at startup, and listen to TCP port
197  .Ar x  .Ar port
198  Hz. (This affects emulated clock devices only, not actual runtime speed.  for incoming remote GDB connections. The emulator starts up in paused
199  This disables automatic clock adjustments, which is otherwise turned on.)  mode, and it is up to the remote GDB instance to start the session.
200  (This option is probably only valid for DECstation emulation.)  .It Fl I Ar hz
201    Set the main CPUs frequency to
202    .Ar hz
203    Hz. This option does not work for all emulated machine modes. It affects
204    the way count/compare interrupts are faked to simulate emulated time =
205    real world time. If the guest operating system relies on RTC interrupts
206    instead of count/compare interrupts, then this option has no effect.
207    .Pp
208    Setting the frequency to zero disables automatic synchronization of
209    emulated time vs real world time, and the count/compare system runs at a
210    fixed rate.
211  .It Fl i  .It Fl i
212  Display each instruction as it is being executed.  Enable instruction trace, i.e. display disassembly of each instruction as
213    it is being executed.
214  .It Fl J  .It Fl J
215  Disable some speed tricks.  Disable instruction combinations in the dynamic translator.
216  .It Fl j Ar n  .It Fl j Ar n
217  Set the name of the kernel to  Set the name of the kernel to
218  .Ar "n".  .Ar "n".
219  When booting from an ISO9660 filesystem, the emulator will try to boot  When booting from an ISO9660 filesystem, the emulator will try to boot
220  using this file. (In some emulation modes, eg. DECstation, this name is passed  using this file. (In some emulation modes, eg. DECstation, this name is passed
221  along to the boot program. Useful names are "bsd" for OpenBSD/pmax,  along to the boot program. Useful names are "bsd" for OpenBSD/pmax,
222  or "vmunix" for Ultrix.)  "vmunix" for Ultrix, or "vmsprite" for Sprite.)
223  .It Fl M Ar m  .It Fl M Ar m
224  Emulate  Emulate
225  .Ar m  .Ar m
226  MBs of physical RAM. This overrides the default amount of RAM for the  MBs of physical RAM. This overrides the default amount of RAM for the
227  selected machine type.  selected machine type.
 .It Fl m Ar nr  
 Run at most  
 .Ar nr  
 instructions (on any cpu).  
228  .It Fl N  .It Fl N
229  Display nr of instructions/second average, at regular intervals.  Display the number of executed instructions per second on average, at
230    regular intervals.
231  .It Fl n Ar nr  .It Fl n Ar nr
232  Set nr of CPUs (for SMP experiments).  Set the number of processors in the machine, for SMP experiments.
233    .Pp
234    Note 1: The emulator allocates quite a lot of virtual memory for
235    per-CPU translation tables. On 64-bit hosts, this is normally not a
236    problem. On 32-bit hosts, this can use up all available virtual userspace
237    memory. The solution is to either run the emulator on a 64-bit host,
238    or limit the number of emulated CPUs to a reasonably low number.
239    .Pp
240    Note 2: SMP simulation is not working very well yet; multiple processors
241    are simulated, but synchronization between the processors does not map
242    very well to how real-world SMP systems work.
243  .It Fl O  .It Fl O
244  Force a "netboot" (tftp instead of disk), even when a disk image is  Force a "netboot" (tftp instead of disk), even when a disk image is
245  present (for DECstation, SGI, and ARC emulation).  present (for DECstation, SGI, and ARC emulation).
# Line 217  Default Line 249  Default
249  .Ar arg  .Ar arg
250  for DEC is "-a", for ARC/SGI it is "-aN", and for CATS it is "-A".  for DEC is "-a", for ARC/SGI it is "-aN", and for CATS it is "-A".
251  .It Fl p Ar pc  .It Fl p Ar pc
252  Add a breakpoint. (Remember to use the "0x" prefix for hex.)  Add a breakpoint.
253    .Ar pc
254    can be a symbol, or a numeric value. (Remember to use the "0x" prefix for
255    hexadecimal values.)
256  .It Fl Q  .It Fl Q
257  Disable the built-in PROM emulation. This is useful for running raw ROM  Disable the built-in (software-only) PROM emulation. This option is useful
258  images from real machines.  for experimenting with running raw ROM images from real machines. The default
259    behaviour of the emulator is to "fake" certain PROM calls used by guest
260    operating systems (e.g. NetBSD), so that no real PROM image is needed.
261  .It Fl R  .It Fl R
262  Use a random bootstrap cpu, instead of CPU nr 0. (For SMP experiments.)  Use a random bootstrap cpu, instead of CPU nr 0. (This option is only
263    meaningful together with the
264    .Fl n
265    option.)
266  .It Fl r  .It Fl r
267  Dump register contents for every executed instruction.  Dump register contents for every executed instruction.
268  .It Fl S  .It Fl S
269  Initialize the emulated RAM to random data, instead of zeroes.  Initialize emulated RAM to random data, instead of zeroes. This option
270  .It Fl T  is useful when trying to trigger bugs in a program that occur because the
271  Enter the single-step debugger on unimplemented memory accesses.  program assumed that uninitialized memory contains zeros. (Use with
272    care.)
273    .It Fl s Ar flags:filename
274    Gather statistics based on the current emulated program counter value,
275    while the program executes. The statistics is actually just a raw dump of
276    all program counter values in sequence, suitable for post-analysis with
277    separate tools. Output is appended to
278    .Ar filename.
279    .Pp
280    The
281    .Ar flags
282    should include one or more of the following type specifiers:
283    .Bl -tag -width Ds
284    .It v
285    Virtual. This means that the program counter value is used.
286    .It p
287    Physical. This means that the physical address of where the program
288    is actually running is used.
289    .It i
290    Instruction call. This type of statistics gathering is practically only
291    useful during development of the emulator itself. The output is a list of
292    addresses of instruction call functions (ic->f), which after some
293    post-processing can be used as a basis for deciding when to implement
294    instruction combinations.
295    .El
296    .Pp
297    The
298    .Ar flags
299    may also include the following optional modifiers:
300    .Bl -tag -width Ds
301    .It d
302    Disabled at startup.
303    .It o
304    Overwrite the file, instead of appending to it.
305    .El
306    .Pp
307    .\" Statistics gathering can be enabled/disabled at runtime by using the
308    .\" "TODO" debugger command.
309    .\" .Pp
310    When gathering instruction statistics using the
311    .Fl s
312    option, instruction combinations are always disabled (i.e.
313    an implicit
314    .Fl J
315    is added to the command line).
316    .Pp
317    If a value is missing (e.g. the end-of-page slot does not really have a
318    known physical address), it is written out as just a dash ("-").
319  .It Fl t  .It Fl t
320  Show a trace tree of all function calls being made.  Show a trace tree of all function calls being made.
321  .It Fl U  .It Fl U
322  Enable slow_serial_interrupts_hack_for_linux.  Enable slow_serial_interrupts_hack_for_linux.
323  .It Fl X  .It Fl X
324  Use X11.  Use X11. This option enables graphical framebuffers.
325  .It Fl x  .It Fl x
326  Open up new xterms for emulated serial ports. (Default is to open up  Open up new xterms for emulated serial ports. The default behaviour is to
327  xterms when using configuration files, but not when starting an  open up xterms when using configuration files, or if X11 is enabled. When
328  emulation with settings directly on the command line.)  starting up a simple emulation session with settings directly on the
329    command line, and neither
330    .Fl X
331    nor
332    .Fl x
333    is used, then all output is confined to the terminal that
334    .Nm
335    started in.
336  .It Fl Y Ar n  .It Fl Y Ar n
337  Scale down framebuffer windows by  Scale down framebuffer windows by
338  .Ar n  .Ar n
339  x  x
340  .Ar n  .Ar n
341  times.  times. This option is useful when emulating a very large framebuffer, and
342  .It Fl y Ar x  the actual display is of lower resolution. If
343  Set max_random_cycles_per_chunk to  .Ar n
344  .Ar x  is negative, then there will be no scaledown, but emulation of certain
345  (experimental).  graphic controllers will be scaled up
346    by
347    .Ar -n
348    times instead. E.g. Using
349    .Ar -2
350    with VGA text mode emulation will result in 80x25 character cells rendered
351    in a 1280x800 window, instead of the normal resolution of 640x400.
352  .It Fl Z Ar n  .It Fl Z Ar n
353  Set the number of graphics cards, for emulating a dual-head or tripple-head  Set the number of graphics cards, for emulating a dual-head or tripple-head
354  environment. (Only for DECstation emulation so far.)  environment. (Only for DECstation emulation so far.)
# Line 258  Add Line 358  Add
358  as an X11 display to use for framebuffers.  as an X11 display to use for framebuffers.
359  .El  .El
360  .Pp  .Pp
361  Userland options:  .\" Userland options:
362  .Bl -tag -width Ds  .\" .Bl -tag -width Ds
363  .It Fl u Ar emul-mode  .\" .It Fl u Ar emul-mode
364  Userland-only (syscall) emulation. (Use  .\" Userland-only (syscall) emulation. (Use
365  .Fl H  .\" .Fl H
366  to get a list of available emulation modes.) Some (but not all) of the  .\" to get a list of available emulation modes.) Some (but not all) of the
367  options listed under Other options above can also be used with userland  .\" options listed under Other options above can also be used with
368  emulation.  .\" userland emulation.
369  .El  .\" .El
370  .Pp  .\" .Pp
371  General options:  General options:
372  .Bl -tag -width Ds  .Bl -tag -width Ds
373    .It Fl c Ar cmd
374    Add
375    .Ar cmd
376    as a command to run before starting the simulation. A similar effect can
377    be achieved by using the
378    .Fl V
379    option, and entering the commands manually.
380  .It Fl D  .It Fl D
381  Guarantee fully deterministic behavior. Normally, the emulator calls  Causes the emulator to skip a call to srandom(). This leads to somewhat
382  srandom() with a seed based on the current time at startup. When the  more deterministic behaviour than running without this option.
383  .Fl D  However, if the emulated machine has clocks or timer interrupt sources,
384  option is used, the srandom() call is skipped, which should cause two  or if user interaction is taking place (e.g. keyboard input at irregular
385  subsequent invocations of the emulator to be identical, if all other  intervals), then this option is meaningless.
 settings are identical and no user input is taking place. (If this option  
 is used, then  
 .Fl I  
 must also be used.)  
386  .It Fl H  .It Fl H
387  Display a list of available CPU types, machine types, and userland  Display a list of available CPU types, machine types, and userland
388  emulation modes. (Most of these don't work. Please read the documentation  emulation modes. (Most of these don't work. Please read the documentation
389  included in the  included in the
390  .Nm  .Nm
391  distribution for details on which modes that actually work.)  distribution for details on which modes that actually work. Userland
392    emulation is not included in stable release builds, since it doesn't work
393    yet.)
394  .It Fl h  .It Fl h
395  Display a list of all available command line options.  Display a list of all available command line options.
396  .It Fl K  .It Fl K
397  Force the single-step debugger to be entered at the end of a simulation.  Force the single-step debugger to be entered at the end of a simulation.
398  .It Fl q  .It Fl q
399  Quiet mode; this suppresses startup messages.  Quiet mode; this suppresses startup messages.
400  .It Fl s  .\".It Fl s
401  Show opcode usage statistics after the simulation.  .\"For MIPS emulation: Show opcode usage statistics after the simulation.
402    .\"For non-MIPS emulation (i.e. using dyntrans): Save statistics to a file
403    .\"at regular intervals of which physical addresses that were executed.
404  .It Fl V  .It Fl V
405  Start up in the single-step debugger, paused.  Start up in the single-step debugger, paused.
406  .It Fl v  .It Fl v
407  Verbose debug messages.  Increase verbosity (show more debug messages). This option can be used
408    multiple times.
409  .El  .El
410  .Pp  .Pp
411  Configuration file startup:  Configuration file startup:
# Line 333  emulated test machine in "paused" mode: Line 441  emulated test machine in "paused" mode:
441  .Pp  .Pp
442  .Dl "gxemul -E testmips -V hello_mips"  .Dl "gxemul -E testmips -V hello_mips"
443  .Pp  .Pp
444  (Paused mode means that you enter the interactive single-step debugger  Paused mode means that you enter the interactive single-step debugger
445  directly at startup, instead of launching the Hello World program.)  directly at startup, instead of launching the Hello World program.
446    .Pp
447    The paused mode is also what should be used when running "unknown" files
448    for the first time in the emulator. E.g. if you have a binary which you
449    think is some kind of MIPS ROM image, then you can try the following:
450    .Pp
451    .Dl "gxemul -vv -E baremips -V 0xbfc00000:image.raw"
452    .Pp
453    You can then use the single-stepping functionality of the built-in
454    debugger to run the code in the ROM image, to see how it behaves. Based on
455    that, you can deduce what machine type it was actually from (the
456    baremips machine is not a real machine), and perhaps try again with
457    another emulation mode.
458    .Pp
459    In general, however, real ROM images require much more emulation detail
460    than GXemul provides, so they can usually not run.
461  .Pp  .Pp
462  Please read the documentation for more details.  Please read the documentation for more details.
463  .Sh BUGS  .Sh BUGS
464  There are many bugs. Some of the known bugs are listed in the BUGS  There are many bugs. Some of the known bugs are mentioned in the TODO
465  file in the  file in the
466  .Nm  .Nm
467  source distribution, some are indirectly mentioned in the TODO file,  source distribution, some are marked as TODO in the source code itself.
 and some are mentioned in the source code itself.  
 .Pp  
 The binary translation subsystem is really terrible, but it is less  
 terrible than running without it.  
468  .Pp  .Pp
469  Userland (syscall-only) emulation doesn't really work yet.  Userland (syscall-only) emulation, i.e. running a userland binary directly
470    without simulating an entire machine, doesn't really work yet.
471  .Pp  .Pp
472  Emulation of MIPS CPUs is done differently from other emulation modes; the  The documentation sometimes only reflects the way things worked with
473  documentation sometimes only reflect the way things work with MIPS  the old MIPS emulation mode (prior to 0.4.0), and it is incorrect when
474  emulation, and it is incorrect when applied to e.g. ARM emulation.  applied to current releases.
475  .Pp  .Pp
476  .Nm  .Nm
477  does not simulate individual pipe-line stages or penalties caused by  is in general not cycle-accurate; it does not simulate individual
478  branch-prediction misses or cache misses, so it cannot be used for  pipe-line stages or penalties caused by branch-prediction misses or
479  accurate simulation of any actual real-world processor.  cache misses, so it cannot be used for accurate simulation of any actual
480    real-world processor.
481  .Pp  .Pp
482  .Nm  .Nm
483  is not timing-accurate.  is in general not timing-accurate. Some emulation modes
484    (DECstation, CATS, NetWinder, MobilePro (hpcmips), Malta (evbmips),
485    Cobalt, Algor, and Dreamcast) try to make the guest
486    operating system's clock run at the same speed as the host clock.
487    However, the number of instructions executed per clock tick can
488    obviously vary, depending on the current CPU load on the host.
489  .Sh AUTHOR  .Sh AUTHOR
490  Anders Gavare <anders@gavare.se>  GXemul is Copyright (C) 2003-2006 Anders Gavare <anders@gavare.se>
491  .Pp  .Pp
492  See http://gavare.se/gxemul/ for more information.  See http://gavare.se/gxemul/ for more information. For other Copyright
493    messages, see the corresponding parts of the source code and/or
494    documentation.

Legend:
Removed from v.16  
changed lines
  Added in v.32

  ViewVC Help
Powered by ViewVC 1.1.26