target/mips: Move MUL opcode check from decode_mxu() to decode_legacy()
[qemu/ar7.git] / docs / user / main.rst
blobe08d4be63b711c3d92bc9330c25b51bbcbc91a9a
1 QEMU User space emulator
2 ========================
4 Supported Operating Systems
5 ---------------------------
7 The following OS are supported in user space emulation:
9 -  Linux (referred as qemu-linux-user)
11 -  BSD (referred as qemu-bsd-user)
13 Features
14 --------
16 QEMU user space emulation has the following notable features:
18 **System call translation:**
19    QEMU includes a generic system call translator. This means that the
20    parameters of the system calls can be converted to fix endianness and
21    32/64-bit mismatches between hosts and targets. IOCTLs can be
22    converted too.
24 **POSIX signal handling:**
25    QEMU can redirect to the running program all signals coming from the
26    host (such as ``SIGALRM``), as well as synthesize signals from
27    virtual CPU exceptions (for example ``SIGFPE`` when the program
28    executes a division by zero).
30    QEMU relies on the host kernel to emulate most signal system calls,
31    for example to emulate the signal mask. On Linux, QEMU supports both
32    normal and real-time signals.
34 **Threading:**
35    On Linux, QEMU can emulate the ``clone`` syscall and create a real
36    host thread (with a separate virtual CPU) for each emulated thread.
37    Note that not all targets currently emulate atomic operations
38    correctly. x86 and Arm use a global lock in order to preserve their
39    semantics.
41 QEMU was conceived so that ultimately it can emulate itself. Although it
42 is not very useful, it is an important test to show the power of the
43 emulator.
45 Linux User space emulator
46 -------------------------
48 Command line options
49 ~~~~~~~~~~~~~~~~~~~~
53    qemu-i386 [-h] [-d] [-L path] [-s size] [-cpu model] [-g port] [-B offset] [-R size] program [arguments...]
55 ``-h``
56    Print the help
58 ``-L path``
59    Set the x86 elf interpreter prefix (default=/usr/local/qemu-i386)
61 ``-s size``
62    Set the x86 stack size in bytes (default=524288)
64 ``-cpu model``
65    Select CPU model (-cpu help for list and additional feature
66    selection)
68 ``-E var=value``
69    Set environment var to value.
71 ``-U var``
72    Remove var from the environment.
74 ``-B offset``
75    Offset guest address by the specified number of bytes. This is useful
76    when the address region required by guest applications is reserved on
77    the host. This option is currently only supported on some hosts.
79 ``-R size``
80    Pre-allocate a guest virtual address space of the given size (in
81    bytes). \"G\", \"M\", and \"k\" suffixes may be used when specifying
82    the size.
84 Debug options:
86 ``-d item1,...``
87    Activate logging of the specified items (use '-d help' for a list of
88    log items)
90 ``-p pagesize``
91    Act as if the host page size was 'pagesize' bytes
93 ``-g port``
94    Wait gdb connection to port
96 ``-singlestep``
97    Run the emulation in single step mode.
99 Environment variables:
101 QEMU_STRACE
102    Print system calls and arguments similar to the 'strace' program
103    (NOTE: the actual 'strace' program will not work because the user
104    space emulator hasn't implemented ptrace). At the moment this is
105    incomplete. All system calls that don't have a specific argument
106    format are printed with information for six arguments. Many
107    flag-style arguments don't have decoders and will show up as numbers.
109 Other binaries
110 ~~~~~~~~~~~~~~
112 -  user mode (Alpha)
114    * ``qemu-alpha`` TODO.
116 -  user mode (Arm)
118    * ``qemu-armeb`` TODO.
120    * ``qemu-arm`` is also capable of running Arm \"Angel\" semihosted ELF
121      binaries (as implemented by the arm-elf and arm-eabi Newlib/GDB
122      configurations), and arm-uclinux bFLT format binaries.
124 -  user mode (ColdFire)
126 -  user mode (M68K)
128    * ``qemu-m68k`` is capable of running semihosted binaries using the BDM
129      (m5xxx-ram-hosted.ld) or m68k-sim (sim.ld) syscall interfaces, and
130      coldfire uClinux bFLT format binaries.
132    The binary format is detected automatically.
134 -  user mode (Cris)
136    * ``qemu-cris`` TODO.
138 -  user mode (i386)
140    * ``qemu-i386`` TODO.
141    * ``qemu-x86_64`` TODO.
143 -  user mode (Microblaze)
145    * ``qemu-microblaze`` TODO.
147 -  user mode (MIPS)
149    * ``qemu-mips`` executes 32-bit big endian MIPS binaries (MIPS O32 ABI).
151    * ``qemu-mipsel`` executes 32-bit little endian MIPS binaries (MIPS O32 ABI).
153    * ``qemu-mips64`` executes 64-bit big endian MIPS binaries (MIPS N64 ABI).
155    * ``qemu-mips64el`` executes 64-bit little endian MIPS binaries (MIPS N64
156      ABI).
158    * ``qemu-mipsn32`` executes 32-bit big endian MIPS binaries (MIPS N32 ABI).
160    * ``qemu-mipsn32el`` executes 32-bit little endian MIPS binaries (MIPS N32
161      ABI).
163 -  user mode (NiosII)
165    * ``qemu-nios2`` TODO.
167 -  user mode (PowerPC)
169    * ``qemu-ppc64abi32`` TODO.
170    * ``qemu-ppc64`` TODO.
171    * ``qemu-ppc`` TODO.
173 -  user mode (SH4)
175    * ``qemu-sh4eb`` TODO.
176    * ``qemu-sh4`` TODO.
178 -  user mode (SPARC)
180    * ``qemu-sparc`` can execute Sparc32 binaries (Sparc32 CPU, 32 bit ABI).
182    * ``qemu-sparc32plus`` can execute Sparc32 and SPARC32PLUS binaries
183      (Sparc64 CPU, 32 bit ABI).
185    * ``qemu-sparc64`` can execute some Sparc64 (Sparc64 CPU, 64 bit ABI) and
186      SPARC32PLUS binaries (Sparc64 CPU, 32 bit ABI).
188 BSD User space emulator
189 -----------------------
191 BSD Status
192 ~~~~~~~~~~
194 -  target Sparc64 on Sparc64: Some trivial programs work.
196 Quick Start
197 ~~~~~~~~~~~
199 In order to launch a BSD process, QEMU needs the process executable
200 itself and all the target dynamic libraries used by it.
202 -  On Sparc64, you can just try to launch any process by using the
203    native libraries::
205       qemu-sparc64 /bin/ls
207 Command line options
208 ~~~~~~~~~~~~~~~~~~~~
212    qemu-sparc64 [-h] [-d] [-L path] [-s size] [-bsd type] program [arguments...]
214 ``-h``
215    Print the help
217 ``-L path``
218    Set the library root path (default=/)
220 ``-s size``
221    Set the stack size in bytes (default=524288)
223 ``-ignore-environment``
224    Start with an empty environment. Without this option, the initial
225    environment is a copy of the caller's environment.
227 ``-E var=value``
228    Set environment var to value.
230 ``-U var``
231    Remove var from the environment.
233 ``-bsd type``
234    Set the type of the emulated BSD Operating system. Valid values are
235    FreeBSD, NetBSD and OpenBSD (default).
237 Debug options:
239 ``-d item1,...``
240    Activate logging of the specified items (use '-d help' for a list of
241    log items)
243 ``-p pagesize``
244    Act as if the host page size was 'pagesize' bytes
246 ``-singlestep``
247    Run the emulation in single step mode.