meson.build: tweak sdl-image error message
[qemu/ar7.git] / docs / user / main.rst
blobbd99b0fdbe9bee98e9bf82ae9f056d6983053244
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 Quick Start
49 ~~~~~~~~~~~
51 In order to launch a Linux process, QEMU needs the process executable
52 itself and all the target (x86) dynamic libraries used by it.
54 -  On x86, you can just try to launch any process by using the native
55    libraries::
57       qemu-i386 -L / /bin/ls
59    ``-L /`` tells that the x86 dynamic linker must be searched with a
60    ``/`` prefix.
62 -  Since QEMU is also a linux process, you can launch QEMU with QEMU
63    (NOTE: you can only do that if you compiled QEMU from the sources)::
65       qemu-i386 -L / qemu-i386 -L / /bin/ls
67 -  On non x86 CPUs, you need first to download at least an x86 glibc
68    (``qemu-runtime-i386-XXX-.tar.gz`` on the QEMU web page). Ensure that
69    ``LD_LIBRARY_PATH`` is not set::
71       unset LD_LIBRARY_PATH
73    Then you can launch the precompiled ``ls`` x86 executable::
75       qemu-i386 tests/i386/ls
77    You can look at ``scripts/qemu-binfmt-conf.sh`` so that QEMU is
78    automatically launched by the Linux kernel when you try to launch x86
79    executables. It requires the ``binfmt_misc`` module in the Linux
80    kernel.
82 -  The x86 version of QEMU is also included. You can try weird things
83    such as::
85       qemu-i386 /usr/local/qemu-i386/bin/qemu-i386 \
86                 /usr/local/qemu-i386/bin/ls-i386
88 Wine launch
89 ~~~~~~~~~~~
91 -  Ensure that you have a working QEMU with the x86 glibc distribution
92    (see previous section). In order to verify it, you must be able to
93    do::
95       qemu-i386 /usr/local/qemu-i386/bin/ls-i386
97 -  Download the binary x86 Wine install (``qemu-XXX-i386-wine.tar.gz``
98    on the QEMU web page).
100 -  Configure Wine on your account. Look at the provided script
101    ``/usr/local/qemu-i386/bin/wine-conf.sh``. Your previous
102    ``${HOME}/.wine`` directory is saved to ``${HOME}/.wine.org``.
104 -  Then you can try the example ``putty.exe``::
106       qemu-i386 /usr/local/qemu-i386/wine/bin/wine \
107                 /usr/local/qemu-i386/wine/c/Program\ Files/putty.exe
109 Command line options
110 ~~~~~~~~~~~~~~~~~~~~
114    qemu-i386 [-h] [-d] [-L path] [-s size] [-cpu model] [-g port] [-B offset] [-R size] program [arguments...]
116 ``-h``
117    Print the help
119 ``-L path``
120    Set the x86 elf interpreter prefix (default=/usr/local/qemu-i386)
122 ``-s size``
123    Set the x86 stack size in bytes (default=524288)
125 ``-cpu model``
126    Select CPU model (-cpu help for list and additional feature
127    selection)
129 ``-E var=value``
130    Set environment var to value.
132 ``-U var``
133    Remove var from the environment.
135 ``-B offset``
136    Offset guest address by the specified number of bytes. This is useful
137    when the address region required by guest applications is reserved on
138    the host. This option is currently only supported on some hosts.
140 ``-R size``
141    Pre-allocate a guest virtual address space of the given size (in
142    bytes). \"G\", \"M\", and \"k\" suffixes may be used when specifying
143    the size.
145 Debug options:
147 ``-d item1,...``
148    Activate logging of the specified items (use '-d help' for a list of
149    log items)
151 ``-p pagesize``
152    Act as if the host page size was 'pagesize' bytes
154 ``-g port``
155    Wait gdb connection to port
157 ``-singlestep``
158    Run the emulation in single step mode.
160 Environment variables:
162 QEMU_STRACE
163    Print system calls and arguments similar to the 'strace' program
164    (NOTE: the actual 'strace' program will not work because the user
165    space emulator hasn't implemented ptrace). At the moment this is
166    incomplete. All system calls that don't have a specific argument
167    format are printed with information for six arguments. Many
168    flag-style arguments don't have decoders and will show up as numbers.
170 Other binaries
171 ~~~~~~~~~~~~~~
173 user mode (Alpha)
174 ``qemu-alpha`` TODO.
176 user mode (Arm)
177 ``qemu-armeb`` TODO.
179 user mode (Arm)
180 ``qemu-arm`` is also capable of running Arm \"Angel\" semihosted ELF
181 binaries (as implemented by the arm-elf and arm-eabi Newlib/GDB
182 configurations), and arm-uclinux bFLT format binaries.
184 user mode (ColdFire)
185 user mode (M68K)
186 ``qemu-m68k`` is capable of running semihosted binaries using the BDM
187 (m5xxx-ram-hosted.ld) or m68k-sim (sim.ld) syscall interfaces, and
188 coldfire uClinux bFLT format binaries.
190 The binary format is detected automatically.
192 user mode (Cris)
193 ``qemu-cris`` TODO.
195 user mode (i386)
196 ``qemu-i386`` TODO. ``qemu-x86_64`` TODO.
198 user mode (Microblaze)
199 ``qemu-microblaze`` TODO.
201 user mode (MIPS)
202 ``qemu-mips`` executes 32-bit big endian MIPS binaries (MIPS O32 ABI).
204 ``qemu-mipsel`` executes 32-bit little endian MIPS binaries (MIPS O32
205 ABI).
207 ``qemu-mips64`` executes 64-bit big endian MIPS binaries (MIPS N64 ABI).
209 ``qemu-mips64el`` executes 64-bit little endian MIPS binaries (MIPS N64
210 ABI).
212 ``qemu-mipsn32`` executes 32-bit big endian MIPS binaries (MIPS N32
213 ABI).
215 ``qemu-mipsn32el`` executes 32-bit little endian MIPS binaries (MIPS N32
216 ABI).
218 user mode (NiosII)
219 ``qemu-nios2`` TODO.
221 user mode (PowerPC)
222 ``qemu-ppc64abi32`` TODO. ``qemu-ppc64`` TODO. ``qemu-ppc`` TODO.
224 user mode (SH4)
225 ``qemu-sh4eb`` TODO. ``qemu-sh4`` TODO.
227 user mode (SPARC)
228 ``qemu-sparc`` can execute Sparc32 binaries (Sparc32 CPU, 32 bit ABI).
230 ``qemu-sparc32plus`` can execute Sparc32 and SPARC32PLUS binaries
231 (Sparc64 CPU, 32 bit ABI).
233 ``qemu-sparc64`` can execute some Sparc64 (Sparc64 CPU, 64 bit ABI) and
234 SPARC32PLUS binaries (Sparc64 CPU, 32 bit ABI).
236 BSD User space emulator
237 -----------------------
239 BSD Status
240 ~~~~~~~~~~
242 -  target Sparc64 on Sparc64: Some trivial programs work.
244 Quick Start
245 ~~~~~~~~~~~
247 In order to launch a BSD process, QEMU needs the process executable
248 itself and all the target dynamic libraries used by it.
250 -  On Sparc64, you can just try to launch any process by using the
251    native libraries::
253       qemu-sparc64 /bin/ls
255 Command line options
256 ~~~~~~~~~~~~~~~~~~~~
260    qemu-sparc64 [-h] [-d] [-L path] [-s size] [-bsd type] program [arguments...]
262 ``-h``
263    Print the help
265 ``-L path``
266    Set the library root path (default=/)
268 ``-s size``
269    Set the stack size in bytes (default=524288)
271 ``-ignore-environment``
272    Start with an empty environment. Without this option, the initial
273    environment is a copy of the caller's environment.
275 ``-E var=value``
276    Set environment var to value.
278 ``-U var``
279    Remove var from the environment.
281 ``-bsd type``
282    Set the type of the emulated BSD Operating system. Valid values are
283    FreeBSD, NetBSD and OpenBSD (default).
285 Debug options:
287 ``-d item1,...``
288    Activate logging of the specified items (use '-d help' for a list of
289    log items)
291 ``-p pagesize``
292    Act as if the host page size was 'pagesize' bytes
294 ``-singlestep``
295    Run the emulation in single step mode.