bellard | 386405f | 2003-03-23 21:28:45 +0000 | [diff] [blame] | 1 | \input texinfo @c -*- texinfo -*- |
| 2 | |
bellard | 0806e3f | 2003-10-01 00:15:32 +0000 | [diff] [blame] | 3 | @iftex |
bellard | 322d0c6 | 2003-06-15 23:29:28 +0000 | [diff] [blame] | 4 | @settitle QEMU CPU Emulator Reference Documentation |
bellard | 386405f | 2003-03-23 21:28:45 +0000 | [diff] [blame] | 5 | @titlepage |
| 6 | @sp 7 |
bellard | 322d0c6 | 2003-06-15 23:29:28 +0000 | [diff] [blame] | 7 | @center @titlefont{QEMU CPU Emulator Reference Documentation} |
bellard | 386405f | 2003-03-23 21:28:45 +0000 | [diff] [blame] | 8 | @sp 3 |
| 9 | @end titlepage |
bellard | 0806e3f | 2003-10-01 00:15:32 +0000 | [diff] [blame] | 10 | @end iftex |
bellard | 386405f | 2003-03-23 21:28:45 +0000 | [diff] [blame] | 11 | |
| 12 | @chapter Introduction |
| 13 | |
bellard | 322d0c6 | 2003-06-15 23:29:28 +0000 | [diff] [blame] | 14 | @section Features |
bellard | 386405f | 2003-03-23 21:28:45 +0000 | [diff] [blame] | 15 | |
bellard | 1eb2052 | 2003-06-25 16:21:49 +0000 | [diff] [blame] | 16 | QEMU is a FAST! processor emulator. By using dynamic translation it |
| 17 | achieves a reasonnable speed while being easy to port on new host |
| 18 | CPUs. |
| 19 | |
| 20 | QEMU has two operating modes: |
bellard | 0806e3f | 2003-10-01 00:15:32 +0000 | [diff] [blame] | 21 | |
| 22 | @itemize @minus |
| 23 | |
| 24 | @item |
| 25 | User mode emulation. In this mode, QEMU can launch Linux processes |
bellard | 1eb2052 | 2003-06-25 16:21:49 +0000 | [diff] [blame] | 26 | compiled for one CPU on another CPU. Linux system calls are converted |
| 27 | because of endianness and 32/64 bit mismatches. The Wine Windows API |
| 28 | emulator (@url{http://www.winehq.org}) and the DOSEMU DOS emulator |
bellard | 2be3bc0 | 2004-01-18 23:14:25 +0000 | [diff] [blame] | 29 | (@url{http://www.dosemu.org}) are the main targets for QEMU. |
bellard | 1eb2052 | 2003-06-25 16:21:49 +0000 | [diff] [blame] | 30 | |
bellard | 0806e3f | 2003-10-01 00:15:32 +0000 | [diff] [blame] | 31 | @item |
| 32 | Full system emulation. In this mode, QEMU emulates a full |
bellard | 1eb2052 | 2003-06-25 16:21:49 +0000 | [diff] [blame] | 33 | system, including a processor and various peripherials. Currently, it |
| 34 | is only used to launch an x86 Linux kernel on an x86 Linux system. It |
| 35 | enables easier testing and debugging of system code. It can also be |
| 36 | used to provide virtual hosting of several virtual PCs on a single |
| 37 | server. |
| 38 | |
| 39 | @end itemize |
| 40 | |
| 41 | As QEMU requires no host kernel patches to run, it is very safe and |
| 42 | easy to use. |
bellard | 322d0c6 | 2003-06-15 23:29:28 +0000 | [diff] [blame] | 43 | |
| 44 | QEMU generic features: |
bellard | 386405f | 2003-03-23 21:28:45 +0000 | [diff] [blame] | 45 | |
| 46 | @itemize |
| 47 | |
bellard | 1eb2052 | 2003-06-25 16:21:49 +0000 | [diff] [blame] | 48 | @item User space only or full system emulation. |
bellard | 386405f | 2003-03-23 21:28:45 +0000 | [diff] [blame] | 49 | |
bellard | fd429f2 | 2003-03-30 20:59:46 +0000 | [diff] [blame] | 50 | @item Using dynamic translation to native code for reasonnable speed. |
bellard | 386405f | 2003-03-23 21:28:45 +0000 | [diff] [blame] | 51 | |
bellard | 1eb2052 | 2003-06-25 16:21:49 +0000 | [diff] [blame] | 52 | @item Working on x86 and PowerPC hosts. Being tested on ARM, Sparc32, Alpha and S390. |
| 53 | |
| 54 | @item Self-modifying code support. |
| 55 | |
bellard | d5a0b50 | 2003-06-27 12:02:03 +0000 | [diff] [blame] | 56 | @item Precise exceptions support. |
bellard | 1eb2052 | 2003-06-25 16:21:49 +0000 | [diff] [blame] | 57 | |
| 58 | @item The virtual CPU is a library (@code{libqemu}) which can be used |
| 59 | in other projects. |
| 60 | |
| 61 | @end itemize |
| 62 | |
| 63 | QEMU user mode emulation features: |
| 64 | @itemize |
bellard | 386405f | 2003-03-23 21:28:45 +0000 | [diff] [blame] | 65 | @item Generic Linux system call converter, including most ioctls. |
| 66 | |
| 67 | @item clone() emulation using native CPU clone() to use Linux scheduler for threads. |
| 68 | |
bellard | 322d0c6 | 2003-06-15 23:29:28 +0000 | [diff] [blame] | 69 | @item Accurate signal handling by remapping host signals to target signals. |
bellard | 1eb2052 | 2003-06-25 16:21:49 +0000 | [diff] [blame] | 70 | @end itemize |
| 71 | @end itemize |
bellard | df0f11a | 2003-05-28 00:27:57 +0000 | [diff] [blame] | 72 | |
bellard | 1eb2052 | 2003-06-25 16:21:49 +0000 | [diff] [blame] | 73 | QEMU full system emulation features: |
| 74 | @itemize |
bellard | 285dc33 | 2003-10-27 23:58:04 +0000 | [diff] [blame] | 75 | @item QEMU can either use a full software MMU for maximum portability or use the host system call mmap() to simulate the target MMU. |
bellard | 322d0c6 | 2003-06-15 23:29:28 +0000 | [diff] [blame] | 76 | @end itemize |
| 77 | |
| 78 | @section x86 emulation |
| 79 | |
| 80 | QEMU x86 target features: |
| 81 | |
| 82 | @itemize |
| 83 | |
| 84 | @item The virtual x86 CPU supports 16 bit and 32 bit addressing with segmentation. |
bellard | 1eb2052 | 2003-06-25 16:21:49 +0000 | [diff] [blame] | 85 | LDT/GDT and IDT are emulated. VM86 mode is also supported to run DOSEMU. |
bellard | 322d0c6 | 2003-06-15 23:29:28 +0000 | [diff] [blame] | 86 | |
bellard | 1eb2052 | 2003-06-25 16:21:49 +0000 | [diff] [blame] | 87 | @item Support of host page sizes bigger than 4KB in user mode emulation. |
bellard | df0f11a | 2003-05-28 00:27:57 +0000 | [diff] [blame] | 88 | |
| 89 | @item QEMU can emulate itself on x86. |
bellard | 1eb8725 | 2003-04-11 01:12:28 +0000 | [diff] [blame] | 90 | |
bellard | 386405f | 2003-03-23 21:28:45 +0000 | [diff] [blame] | 91 | @item An extensive Linux x86 CPU test program is included @file{tests/test-i386}. |
| 92 | It can be used to test other x86 virtual CPUs. |
| 93 | |
| 94 | @end itemize |
| 95 | |
bellard | df0f11a | 2003-05-28 00:27:57 +0000 | [diff] [blame] | 96 | Current QEMU limitations: |
bellard | 386405f | 2003-03-23 21:28:45 +0000 | [diff] [blame] | 97 | |
| 98 | @itemize |
| 99 | |
bellard | 386405f | 2003-03-23 21:28:45 +0000 | [diff] [blame] | 100 | @item No SSE/MMX support (yet). |
| 101 | |
| 102 | @item No x86-64 support. |
| 103 | |
bellard | df0f11a | 2003-05-28 00:27:57 +0000 | [diff] [blame] | 104 | @item IPC syscalls are missing. |
bellard | 386405f | 2003-03-23 21:28:45 +0000 | [diff] [blame] | 105 | |
| 106 | @item The x86 segment limits and access rights are not tested at every |
bellard | 1eb2052 | 2003-06-25 16:21:49 +0000 | [diff] [blame] | 107 | memory access. |
bellard | 386405f | 2003-03-23 21:28:45 +0000 | [diff] [blame] | 108 | |
| 109 | @item On non x86 host CPUs, @code{double}s are used instead of the non standard |
| 110 | 10 byte @code{long double}s of x86 for floating point emulation to get |
| 111 | maximum performances. |
| 112 | |
bellard | 285dc33 | 2003-10-27 23:58:04 +0000 | [diff] [blame] | 113 | @item Some priviledged instructions or behaviors are missing, especially for segment protection testing (yet). |
bellard | 1eb2052 | 2003-06-25 16:21:49 +0000 | [diff] [blame] | 114 | |
bellard | 386405f | 2003-03-23 21:28:45 +0000 | [diff] [blame] | 115 | @end itemize |
| 116 | |
bellard | 322d0c6 | 2003-06-15 23:29:28 +0000 | [diff] [blame] | 117 | @section ARM emulation |
| 118 | |
| 119 | @itemize |
| 120 | |
| 121 | @item ARM emulation can currently launch small programs while using the |
| 122 | generic dynamic code generation architecture of QEMU. |
| 123 | |
| 124 | @item No FPU support (yet). |
| 125 | |
| 126 | @item No automatic regression testing (yet). |
| 127 | |
| 128 | @end itemize |
| 129 | |
bellard | 0806e3f | 2003-10-01 00:15:32 +0000 | [diff] [blame] | 130 | @section SPARC emulation |
| 131 | |
| 132 | The SPARC emulation is currently in development. |
| 133 | |
bellard | 5b9f457 | 2003-10-28 00:49:54 +0000 | [diff] [blame] | 134 | @chapter Installation |
| 135 | |
| 136 | If you want to compile QEMU, please read the @file{README} which gives |
| 137 | the related information. Otherwise just download the binary |
| 138 | distribution (@file{qemu-XXX-i386.tar.gz}) and untar it as root in |
| 139 | @file{/}: |
| 140 | |
| 141 | @example |
| 142 | su |
| 143 | cd / |
| 144 | tar zxvf /tmp/qemu-XXX-i386.tar.gz |
| 145 | @end example |
| 146 | |
bellard | d5a0b50 | 2003-06-27 12:02:03 +0000 | [diff] [blame] | 147 | @chapter QEMU User space emulator invocation |
bellard | 386405f | 2003-03-23 21:28:45 +0000 | [diff] [blame] | 148 | |
bellard | d691f66 | 2003-03-24 21:58:34 +0000 | [diff] [blame] | 149 | @section Quick Start |
| 150 | |
bellard | 386405f | 2003-03-23 21:28:45 +0000 | [diff] [blame] | 151 | In order to launch a Linux process, QEMU needs the process executable |
bellard | d691f66 | 2003-03-24 21:58:34 +0000 | [diff] [blame] | 152 | itself and all the target (x86) dynamic libraries used by it. |
bellard | 386405f | 2003-03-23 21:28:45 +0000 | [diff] [blame] | 153 | |
bellard | d691f66 | 2003-03-24 21:58:34 +0000 | [diff] [blame] | 154 | @itemize |
| 155 | |
| 156 | @item On x86, you can just try to launch any process by using the native |
| 157 | libraries: |
bellard | 386405f | 2003-03-23 21:28:45 +0000 | [diff] [blame] | 158 | |
| 159 | @example |
bellard | 0806e3f | 2003-10-01 00:15:32 +0000 | [diff] [blame] | 160 | qemu-i386 -L / /bin/ls |
bellard | 386405f | 2003-03-23 21:28:45 +0000 | [diff] [blame] | 161 | @end example |
| 162 | |
bellard | d691f66 | 2003-03-24 21:58:34 +0000 | [diff] [blame] | 163 | @code{-L /} tells that the x86 dynamic linker must be searched with a |
| 164 | @file{/} prefix. |
bellard | 386405f | 2003-03-23 21:28:45 +0000 | [diff] [blame] | 165 | |
bellard | 5b9f457 | 2003-10-28 00:49:54 +0000 | [diff] [blame] | 166 | @item Since QEMU is also a linux process, you can launch qemu with qemu (NOTE: you can only do that if you compiled QEMU from the sources): |
bellard | 1eb8725 | 2003-04-11 01:12:28 +0000 | [diff] [blame] | 167 | |
| 168 | @example |
bellard | 0806e3f | 2003-10-01 00:15:32 +0000 | [diff] [blame] | 169 | qemu-i386 -L / qemu-i386 -L / /bin/ls |
bellard | 1eb8725 | 2003-04-11 01:12:28 +0000 | [diff] [blame] | 170 | @end example |
bellard | 386405f | 2003-03-23 21:28:45 +0000 | [diff] [blame] | 171 | |
bellard | d691f66 | 2003-03-24 21:58:34 +0000 | [diff] [blame] | 172 | @item On non x86 CPUs, you need first to download at least an x86 glibc |
bellard | 5b9f457 | 2003-10-28 00:49:54 +0000 | [diff] [blame] | 173 | (@file{qemu-runtime-i386-XXX-.tar.gz} on the QEMU web page). Ensure that |
bellard | 644c433 | 2003-03-24 23:00:36 +0000 | [diff] [blame] | 174 | @code{LD_LIBRARY_PATH} is not set: |
| 175 | |
| 176 | @example |
| 177 | unset LD_LIBRARY_PATH |
| 178 | @end example |
| 179 | |
| 180 | Then you can launch the precompiled @file{ls} x86 executable: |
| 181 | |
bellard | d691f66 | 2003-03-24 21:58:34 +0000 | [diff] [blame] | 182 | @example |
bellard | 285dc33 | 2003-10-27 23:58:04 +0000 | [diff] [blame] | 183 | qemu-i386 tests/i386/ls |
bellard | 386405f | 2003-03-23 21:28:45 +0000 | [diff] [blame] | 184 | @end example |
bellard | 285dc33 | 2003-10-27 23:58:04 +0000 | [diff] [blame] | 185 | You can look at @file{qemu-binfmt-conf.sh} so that |
bellard | 168485b | 2003-03-29 16:57:34 +0000 | [diff] [blame] | 186 | QEMU is automatically launched by the Linux kernel when you try to |
| 187 | launch x86 executables. It requires the @code{binfmt_misc} module in the |
| 188 | Linux kernel. |
| 189 | |
bellard | 1eb8725 | 2003-04-11 01:12:28 +0000 | [diff] [blame] | 190 | @item The x86 version of QEMU is also included. You can try weird things such as: |
| 191 | @example |
bellard | 0806e3f | 2003-10-01 00:15:32 +0000 | [diff] [blame] | 192 | qemu-i386 /usr/local/qemu-i386/bin/qemu-i386 /usr/local/qemu-i386/bin/ls-i386 |
bellard | 1eb8725 | 2003-04-11 01:12:28 +0000 | [diff] [blame] | 193 | @end example |
| 194 | |
bellard | 168485b | 2003-03-29 16:57:34 +0000 | [diff] [blame] | 195 | @end itemize |
| 196 | |
bellard | df0f11a | 2003-05-28 00:27:57 +0000 | [diff] [blame] | 197 | @section Wine launch |
bellard | 168485b | 2003-03-29 16:57:34 +0000 | [diff] [blame] | 198 | |
| 199 | @itemize |
| 200 | |
| 201 | @item Ensure that you have a working QEMU with the x86 glibc |
| 202 | distribution (see previous section). In order to verify it, you must be |
| 203 | able to do: |
| 204 | |
| 205 | @example |
bellard | 0806e3f | 2003-10-01 00:15:32 +0000 | [diff] [blame] | 206 | qemu-i386 /usr/local/qemu-i386/bin/ls-i386 |
bellard | 168485b | 2003-03-29 16:57:34 +0000 | [diff] [blame] | 207 | @end example |
| 208 | |
bellard | fd429f2 | 2003-03-30 20:59:46 +0000 | [diff] [blame] | 209 | @item Download the binary x86 Wine install |
bellard | 1eb8725 | 2003-04-11 01:12:28 +0000 | [diff] [blame] | 210 | (@file{qemu-XXX-i386-wine.tar.gz} on the QEMU web page). |
bellard | 168485b | 2003-03-29 16:57:34 +0000 | [diff] [blame] | 211 | |
bellard | fd429f2 | 2003-03-30 20:59:46 +0000 | [diff] [blame] | 212 | @item Configure Wine on your account. Look at the provided script |
bellard | 168485b | 2003-03-29 16:57:34 +0000 | [diff] [blame] | 213 | @file{/usr/local/qemu-i386/bin/wine-conf.sh}. Your previous |
| 214 | @code{$@{HOME@}/.wine} directory is saved to @code{$@{HOME@}/.wine.org}. |
| 215 | |
| 216 | @item Then you can try the example @file{putty.exe}: |
| 217 | |
| 218 | @example |
bellard | 0806e3f | 2003-10-01 00:15:32 +0000 | [diff] [blame] | 219 | qemu-i386 /usr/local/qemu-i386/wine/bin/wine /usr/local/qemu-i386/wine/c/Program\ Files/putty.exe |
bellard | 168485b | 2003-03-29 16:57:34 +0000 | [diff] [blame] | 220 | @end example |
bellard | d691f66 | 2003-03-24 21:58:34 +0000 | [diff] [blame] | 221 | |
| 222 | @end itemize |
| 223 | |
| 224 | @section Command line options |
| 225 | |
| 226 | @example |
bellard | 0806e3f | 2003-10-01 00:15:32 +0000 | [diff] [blame] | 227 | usage: qemu-i386 [-h] [-d] [-L path] [-s size] program [arguments...] |
bellard | d691f66 | 2003-03-24 21:58:34 +0000 | [diff] [blame] | 228 | @end example |
| 229 | |
bellard | df0f11a | 2003-05-28 00:27:57 +0000 | [diff] [blame] | 230 | @table @option |
bellard | d691f66 | 2003-03-24 21:58:34 +0000 | [diff] [blame] | 231 | @item -h |
| 232 | Print the help |
bellard | d691f66 | 2003-03-24 21:58:34 +0000 | [diff] [blame] | 233 | @item -L path |
| 234 | Set the x86 elf interpreter prefix (default=/usr/local/qemu-i386) |
| 235 | @item -s size |
| 236 | Set the x86 stack size in bytes (default=524288) |
| 237 | @end table |
bellard | 386405f | 2003-03-23 21:28:45 +0000 | [diff] [blame] | 238 | |
bellard | df0f11a | 2003-05-28 00:27:57 +0000 | [diff] [blame] | 239 | Debug options: |
| 240 | |
| 241 | @table @option |
| 242 | @item -d |
| 243 | Activate log (logfile=/tmp/qemu.log) |
| 244 | @item -p pagesize |
| 245 | Act as if the host page size was 'pagesize' bytes |
| 246 | @end table |
| 247 | |
bellard | 1eb2052 | 2003-06-25 16:21:49 +0000 | [diff] [blame] | 248 | @chapter QEMU System emulator invocation |
| 249 | |
bellard | 0806e3f | 2003-10-01 00:15:32 +0000 | [diff] [blame] | 250 | @section Introduction |
| 251 | |
| 252 | @c man begin DESCRIPTION |
| 253 | |
| 254 | The QEMU System emulator simulates a complete PC. It can either boot |
| 255 | directly a Linux kernel (without any BIOS or boot loader) or boot like a |
| 256 | real PC with the included BIOS. |
| 257 | |
| 258 | In order to meet specific user needs, two versions of QEMU are |
| 259 | available: |
| 260 | |
| 261 | @enumerate |
| 262 | |
| 263 | @item |
bellard | 285dc33 | 2003-10-27 23:58:04 +0000 | [diff] [blame] | 264 | @code{qemu-fast} uses the host Memory Management Unit (MMU) to simulate |
bellard | 0806e3f | 2003-10-01 00:15:32 +0000 | [diff] [blame] | 265 | the x86 MMU. It is @emph{fast} but has limitations because the whole 4 GB |
| 266 | address space cannot be used and some memory mapped peripherials |
| 267 | cannot be emulated accurately yet. Therefore, a specific Linux kernel |
| 268 | must be used (@xref{linux_compile}). |
| 269 | |
| 270 | @item |
bellard | 285dc33 | 2003-10-27 23:58:04 +0000 | [diff] [blame] | 271 | @code{qemu} uses a software MMU. It is about @emph{two times |
| 272 | slower} but gives a more accurate emulation. |
bellard | 0806e3f | 2003-10-01 00:15:32 +0000 | [diff] [blame] | 273 | |
| 274 | @end enumerate |
| 275 | |
| 276 | QEMU emulates the following PC peripherials: |
| 277 | |
| 278 | @itemize @minus |
| 279 | @item |
| 280 | VGA (hardware level, including all non standard modes) |
| 281 | @item |
| 282 | PS/2 mouse and keyboard |
| 283 | @item |
bellard | 181f155 | 2003-11-13 01:47:16 +0000 | [diff] [blame] | 284 | 2 IDE interfaces with hard disk and CD-ROM support |
bellard | 0806e3f | 2003-10-01 00:15:32 +0000 | [diff] [blame] | 285 | @item |
| 286 | NE2000 network adapter (port=0x300, irq=9) |
| 287 | @item |
bellard | 181f155 | 2003-11-13 01:47:16 +0000 | [diff] [blame] | 288 | Serial port |
| 289 | @item |
| 290 | Soundblaster 16 card |
bellard | 0806e3f | 2003-10-01 00:15:32 +0000 | [diff] [blame] | 291 | @item |
| 292 | PIC (interrupt controler) |
| 293 | @item |
| 294 | PIT (timers) |
| 295 | @item |
| 296 | CMOS memory |
| 297 | @end itemize |
| 298 | |
| 299 | @c man end |
| 300 | |
bellard | 1eb2052 | 2003-06-25 16:21:49 +0000 | [diff] [blame] | 301 | @section Quick Start |
| 302 | |
bellard | 285dc33 | 2003-10-27 23:58:04 +0000 | [diff] [blame] | 303 | Download and uncompress the linux image (@file{linux.img}) and type: |
bellard | 0806e3f | 2003-10-01 00:15:32 +0000 | [diff] [blame] | 304 | |
| 305 | @example |
bellard | 285dc33 | 2003-10-27 23:58:04 +0000 | [diff] [blame] | 306 | qemu linux.img |
bellard | 0806e3f | 2003-10-01 00:15:32 +0000 | [diff] [blame] | 307 | @end example |
| 308 | |
| 309 | Linux should boot and give you a prompt. |
| 310 | |
| 311 | @section Direct Linux Boot and Network emulation |
| 312 | |
| 313 | This section explains how to launch a Linux kernel inside QEMU without |
| 314 | having to make a full bootable image. It is very useful for fast Linux |
| 315 | kernel testing. The QEMU network configuration is also explained. |
bellard | 1eb2052 | 2003-06-25 16:21:49 +0000 | [diff] [blame] | 316 | |
| 317 | @enumerate |
| 318 | @item |
bellard | 0806e3f | 2003-10-01 00:15:32 +0000 | [diff] [blame] | 319 | Download the archive @file{linux-test-xxx.tar.gz} containing a Linux |
| 320 | kernel and a disk image. |
bellard | 1eb2052 | 2003-06-25 16:21:49 +0000 | [diff] [blame] | 321 | |
| 322 | @item Optional: If you want network support (for example to launch X11 examples), you |
bellard | 0806e3f | 2003-10-01 00:15:32 +0000 | [diff] [blame] | 323 | must copy the script @file{qemu-ifup} in @file{/etc} and configure |
bellard | 1eb2052 | 2003-06-25 16:21:49 +0000 | [diff] [blame] | 324 | properly @code{sudo} so that the command @code{ifconfig} contained in |
bellard | 0806e3f | 2003-10-01 00:15:32 +0000 | [diff] [blame] | 325 | @file{qemu-ifup} can be executed as root. You must verify that your host |
bellard | 1eb2052 | 2003-06-25 16:21:49 +0000 | [diff] [blame] | 326 | kernel supports the TUN/TAP network interfaces: the device |
| 327 | @file{/dev/net/tun} must be present. |
| 328 | |
| 329 | When network is enabled, there is a virtual network connection between |
| 330 | the host kernel and the emulated kernel. The emulated kernel is seen |
| 331 | from the host kernel at IP address 172.20.0.2 and the host kernel is |
| 332 | seen from the emulated kernel at IP address 172.20.0.1. |
| 333 | |
bellard | 0806e3f | 2003-10-01 00:15:32 +0000 | [diff] [blame] | 334 | @item Launch @code{qemu.sh}. You should have the following output: |
bellard | 1eb2052 | 2003-06-25 16:21:49 +0000 | [diff] [blame] | 335 | |
| 336 | @example |
bellard | 0806e3f | 2003-10-01 00:15:32 +0000 | [diff] [blame] | 337 | > ./qemu.sh |
bellard | 181f155 | 2003-11-13 01:47:16 +0000 | [diff] [blame] | 338 | Connected to host network interface: tun0 |
| 339 | Linux version 2.4.21 (bellard@voyager.localdomain) (gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)) #5 Tue Nov 11 18:18:53 CET 2003 |
bellard | 1eb2052 | 2003-06-25 16:21:49 +0000 | [diff] [blame] | 340 | BIOS-provided physical RAM map: |
bellard | 4690764 | 2003-07-07 12:17:46 +0000 | [diff] [blame] | 341 | BIOS-e801: 0000000000000000 - 000000000009f000 (usable) |
| 342 | BIOS-e801: 0000000000100000 - 0000000002000000 (usable) |
bellard | 1eb2052 | 2003-06-25 16:21:49 +0000 | [diff] [blame] | 343 | 32MB LOWMEM available. |
| 344 | On node 0 totalpages: 8192 |
| 345 | zone(0): 4096 pages. |
| 346 | zone(1): 4096 pages. |
| 347 | zone(2): 0 pages. |
bellard | 181f155 | 2003-11-13 01:47:16 +0000 | [diff] [blame] | 348 | Kernel command line: root=/dev/hda sb=0x220,5,1,5 ide2=noprobe ide3=noprobe ide4=noprobe ide5=noprobe console=ttyS0 |
bellard | 4690764 | 2003-07-07 12:17:46 +0000 | [diff] [blame] | 349 | ide_setup: ide2=noprobe |
| 350 | ide_setup: ide3=noprobe |
| 351 | ide_setup: ide4=noprobe |
| 352 | ide_setup: ide5=noprobe |
bellard | 1eb2052 | 2003-06-25 16:21:49 +0000 | [diff] [blame] | 353 | Initializing CPU#0 |
bellard | 181f155 | 2003-11-13 01:47:16 +0000 | [diff] [blame] | 354 | Detected 2399.621 MHz processor. |
| 355 | Console: colour EGA 80x25 |
| 356 | Calibrating delay loop... 4744.80 BogoMIPS |
| 357 | Memory: 28872k/32768k available (1210k kernel code, 3508k reserved, 266k data, 64k init, 0k highmem) |
bellard | 1eb2052 | 2003-06-25 16:21:49 +0000 | [diff] [blame] | 358 | Dentry cache hash table entries: 4096 (order: 3, 32768 bytes) |
| 359 | Inode cache hash table entries: 2048 (order: 2, 16384 bytes) |
bellard | 181f155 | 2003-11-13 01:47:16 +0000 | [diff] [blame] | 360 | Mount cache hash table entries: 512 (order: 0, 4096 bytes) |
bellard | 1eb2052 | 2003-06-25 16:21:49 +0000 | [diff] [blame] | 361 | Buffer-cache hash table entries: 1024 (order: 0, 4096 bytes) |
| 362 | Page-cache hash table entries: 8192 (order: 3, 32768 bytes) |
| 363 | CPU: Intel Pentium Pro stepping 03 |
| 364 | Checking 'hlt' instruction... OK. |
| 365 | POSIX conformance testing by UNIFIX |
| 366 | Linux NET4.0 for Linux 2.4 |
| 367 | Based upon Swansea University Computer Society NET3.039 |
| 368 | Initializing RT netlink socket |
| 369 | apm: BIOS not found. |
| 370 | Starting kswapd |
bellard | 4690764 | 2003-07-07 12:17:46 +0000 | [diff] [blame] | 371 | Journalled Block Device driver loaded |
bellard | 181f155 | 2003-11-13 01:47:16 +0000 | [diff] [blame] | 372 | Detected PS/2 Mouse Port. |
bellard | 1eb2052 | 2003-06-25 16:21:49 +0000 | [diff] [blame] | 373 | pty: 256 Unix98 ptys configured |
| 374 | Serial driver version 5.05c (2001-07-08) with no serial options enabled |
| 375 | ttyS00 at 0x03f8 (irq = 4) is a 16450 |
| 376 | ne.c:v1.10 9/23/94 Donald Becker (becker@scyld.com) |
| 377 | Last modified Nov 1, 2000 by Paul Gortmaker |
| 378 | NE*000 ethercard probe at 0x300: 52 54 00 12 34 56 |
| 379 | eth0: NE2000 found at 0x300, using IRQ 9. |
bellard | 4690764 | 2003-07-07 12:17:46 +0000 | [diff] [blame] | 380 | RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize |
bellard | 181f155 | 2003-11-13 01:47:16 +0000 | [diff] [blame] | 381 | Uniform Multi-Platform E-IDE driver Revision: 7.00beta4-2.4 |
| 382 | ide: Assuming 50MHz system bus speed for PIO modes; override with idebus=xx |
| 383 | hda: QEMU HARDDISK, ATA DISK drive |
| 384 | ide0 at 0x1f0-0x1f7,0x3f6 on irq 14 |
| 385 | hda: attached ide-disk driver. |
| 386 | hda: 20480 sectors (10 MB) w/256KiB Cache, CHS=20/16/63 |
| 387 | Partition check: |
| 388 | hda: |
| 389 | Soundblaster audio driver Copyright (C) by Hannu Savolainen 1993-1996 |
bellard | 1eb2052 | 2003-06-25 16:21:49 +0000 | [diff] [blame] | 390 | NET4: Linux TCP/IP 1.0 for NET4.0 |
| 391 | IP Protocols: ICMP, UDP, TCP, IGMP |
| 392 | IP: routing cache hash table of 512 buckets, 4Kbytes |
bellard | 4690764 | 2003-07-07 12:17:46 +0000 | [diff] [blame] | 393 | TCP: Hash tables configured (established 2048 bind 4096) |
bellard | 1eb2052 | 2003-06-25 16:21:49 +0000 | [diff] [blame] | 394 | NET4: Unix domain sockets 1.0/SMP for Linux NET4.0. |
bellard | 4690764 | 2003-07-07 12:17:46 +0000 | [diff] [blame] | 395 | EXT2-fs warning: mounting unchecked fs, running e2fsck is recommended |
bellard | 1eb2052 | 2003-06-25 16:21:49 +0000 | [diff] [blame] | 396 | VFS: Mounted root (ext2 filesystem). |
bellard | 181f155 | 2003-11-13 01:47:16 +0000 | [diff] [blame] | 397 | Freeing unused kernel memory: 64k freed |
| 398 | |
| 399 | Linux version 2.4.21 (bellard@voyager.localdomain) (gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)) #5 Tue Nov 11 18:18:53 CET 2003 |
| 400 | |
| 401 | QEMU Linux test distribution (based on Redhat 9) |
| 402 | |
| 403 | Type 'exit' to halt the system |
| 404 | |
| 405 | sh-2.05b# |
bellard | 1eb2052 | 2003-06-25 16:21:49 +0000 | [diff] [blame] | 406 | @end example |
| 407 | |
| 408 | @item |
| 409 | Then you can play with the kernel inside the virtual serial console. You |
| 410 | can launch @code{ls} for example. Type @key{Ctrl-a h} to have an help |
| 411 | about the keys you can type inside the virtual serial console. In |
bellard | d5a0b50 | 2003-06-27 12:02:03 +0000 | [diff] [blame] | 412 | particular, use @key{Ctrl-a x} to exit QEMU and use @key{Ctrl-a b} as |
| 413 | the Magic SysRq key. |
bellard | 1eb2052 | 2003-06-25 16:21:49 +0000 | [diff] [blame] | 414 | |
| 415 | @item |
| 416 | If the network is enabled, launch the script @file{/etc/linuxrc} in the |
| 417 | emulator (don't forget the leading dot): |
| 418 | @example |
| 419 | . /etc/linuxrc |
| 420 | @end example |
| 421 | |
| 422 | Then enable X11 connections on your PC from the emulated Linux: |
| 423 | @example |
| 424 | xhost +172.20.0.2 |
| 425 | @end example |
| 426 | |
| 427 | You can now launch @file{xterm} or @file{xlogo} and verify that you have |
| 428 | a real Virtual Linux system ! |
| 429 | |
| 430 | @end enumerate |
| 431 | |
bellard | d5a0b50 | 2003-06-27 12:02:03 +0000 | [diff] [blame] | 432 | NOTES: |
| 433 | @enumerate |
| 434 | @item |
bellard | 0806e3f | 2003-10-01 00:15:32 +0000 | [diff] [blame] | 435 | A 2.5.74 kernel is also included in the archive. Just |
| 436 | replace the bzImage in qemu.sh to try it. |
bellard | d5a0b50 | 2003-06-27 12:02:03 +0000 | [diff] [blame] | 437 | |
| 438 | @item |
bellard | 9d4520d | 2003-10-28 01:38:57 +0000 | [diff] [blame] | 439 | qemu creates a temporary file in @var{$QEMU_TMPDIR} (@file{/tmp} is the |
bellard | d5a0b50 | 2003-06-27 12:02:03 +0000 | [diff] [blame] | 440 | default) containing all the simulated PC memory. If possible, try to use |
| 441 | a temporary directory using the tmpfs filesystem to avoid too many |
| 442 | unnecessary disk accesses. |
| 443 | |
| 444 | @item |
bellard | 9d4520d | 2003-10-28 01:38:57 +0000 | [diff] [blame] | 445 | In order to exit cleanly from qemu, you can do a @emph{shutdown} inside |
| 446 | qemu. qemu will automatically exit when the Linux shutdown is done. |
bellard | 4690764 | 2003-07-07 12:17:46 +0000 | [diff] [blame] | 447 | |
| 448 | @item |
| 449 | You can boot slightly faster by disabling the probe of non present IDE |
| 450 | interfaces. To do so, add the following options on the kernel command |
| 451 | line: |
| 452 | @example |
| 453 | ide1=noprobe ide2=noprobe ide3=noprobe ide4=noprobe ide5=noprobe |
| 454 | @end example |
| 455 | |
| 456 | @item |
| 457 | The example disk image is a modified version of the one made by Kevin |
bellard | 1eb2052 | 2003-06-25 16:21:49 +0000 | [diff] [blame] | 458 | Lawton for the plex86 Project (@url{www.plex86.org}). |
| 459 | |
bellard | d5a0b50 | 2003-06-27 12:02:03 +0000 | [diff] [blame] | 460 | @end enumerate |
| 461 | |
bellard | ec410fc | 2003-06-30 23:16:33 +0000 | [diff] [blame] | 462 | @section Invocation |
| 463 | |
| 464 | @example |
bellard | 0806e3f | 2003-10-01 00:15:32 +0000 | [diff] [blame] | 465 | @c man begin SYNOPSIS |
| 466 | usage: qemu [options] [disk_image] |
| 467 | @c man end |
bellard | ec410fc | 2003-06-30 23:16:33 +0000 | [diff] [blame] | 468 | @end example |
| 469 | |
bellard | 0806e3f | 2003-10-01 00:15:32 +0000 | [diff] [blame] | 470 | @c man begin OPTIONS |
bellard | 9d4520d | 2003-10-28 01:38:57 +0000 | [diff] [blame] | 471 | @var{disk_image} is a raw hard disk image for IDE hard disk 0. |
bellard | ec410fc | 2003-06-30 23:16:33 +0000 | [diff] [blame] | 472 | |
| 473 | General options: |
| 474 | @table @option |
bellard | 2be3bc0 | 2004-01-18 23:14:25 +0000 | [diff] [blame] | 475 | @item -fda file |
| 476 | @item -fdb file |
| 477 | Use @var{file} as floppy disk 0/1 image (@xref{disk_images}). |
| 478 | |
bellard | ec410fc | 2003-06-30 23:16:33 +0000 | [diff] [blame] | 479 | @item -hda file |
| 480 | @item -hdb file |
bellard | 181f155 | 2003-11-13 01:47:16 +0000 | [diff] [blame] | 481 | @item -hdc file |
| 482 | @item -hdd file |
bellard | 2be3bc0 | 2004-01-18 23:14:25 +0000 | [diff] [blame] | 483 | Use @var{file} as hard disk 0, 1, 2 or 3 image (@xref{disk_images}). |
bellard | 181f155 | 2003-11-13 01:47:16 +0000 | [diff] [blame] | 484 | |
| 485 | @item -cdrom file |
| 486 | Use @var{file} as CD-ROM image (you cannot use @option{-hdc} and and |
| 487 | @option{-cdrom} at the same time). |
| 488 | |
bellard | 2be3bc0 | 2004-01-18 23:14:25 +0000 | [diff] [blame] | 489 | @item -boot [a|b|c|d] |
| 490 | Boot on floppy (a, b), hard disk (c) or CD-ROM (d). Hard disk boot is |
| 491 | the default. |
bellard | 1f47a92 | 2003-07-06 19:01:55 +0000 | [diff] [blame] | 492 | |
| 493 | @item -snapshot |
bellard | 1f47a92 | 2003-07-06 19:01:55 +0000 | [diff] [blame] | 494 | Write to temporary files instead of disk image files. In this case, |
| 495 | the raw disk image you use is not written back. You can however force |
| 496 | the write back by pressing @key{C-a s} (@xref{disk_images}). |
bellard | ec410fc | 2003-06-30 23:16:33 +0000 | [diff] [blame] | 497 | |
| 498 | @item -m megs |
| 499 | Set virtual RAM size to @var{megs} megabytes. |
| 500 | |
| 501 | @item -n script |
bellard | 9d4520d | 2003-10-28 01:38:57 +0000 | [diff] [blame] | 502 | Set network init script [default=/etc/qemu-ifup]. This script is |
bellard | ec410fc | 2003-06-30 23:16:33 +0000 | [diff] [blame] | 503 | launched to configure the host network interface (usually tun0) |
| 504 | corresponding to the virtual NE2000 card. |
bellard | 4690764 | 2003-07-07 12:17:46 +0000 | [diff] [blame] | 505 | |
| 506 | @item -initrd file |
bellard | 0806e3f | 2003-10-01 00:15:32 +0000 | [diff] [blame] | 507 | Use @var{file} as initial ram disk. |
| 508 | |
| 509 | @item -tun-fd fd |
| 510 | Assumes @var{fd} talks to tap/tun and use it. Read |
| 511 | @url{http://bellard.org/qemu/tetrinet.html} to have an example of its |
| 512 | use. |
| 513 | |
| 514 | @item -nographic |
| 515 | |
| 516 | Normally, QEMU uses SDL to display the VGA output. With this option, |
| 517 | you can totally disable graphical output so that QEMU is a simple |
| 518 | command line application. The emulated serial port is redirected on |
| 519 | the console. Therefore, you can still use QEMU to debug a Linux kernel |
| 520 | with a serial console. |
| 521 | |
| 522 | @end table |
| 523 | |
| 524 | Linux boot specific (does not require a full PC boot with a BIOS): |
| 525 | @table @option |
| 526 | |
| 527 | @item -kernel bzImage |
| 528 | Use @var{bzImage} as kernel image. |
| 529 | |
| 530 | @item -append cmdline |
| 531 | Use @var{cmdline} as kernel command line |
| 532 | |
| 533 | @item -initrd file |
| 534 | Use @var{file} as initial ram disk. |
| 535 | |
bellard | ec410fc | 2003-06-30 23:16:33 +0000 | [diff] [blame] | 536 | @end table |
| 537 | |
| 538 | Debug options: |
| 539 | @table @option |
| 540 | @item -s |
bellard | 0806e3f | 2003-10-01 00:15:32 +0000 | [diff] [blame] | 541 | Wait gdb connection to port 1234 (@xref{gdb_usage}). |
bellard | ec410fc | 2003-06-30 23:16:33 +0000 | [diff] [blame] | 542 | @item -p port |
| 543 | Change gdb connection port. |
| 544 | @item -d |
bellard | 9d4520d | 2003-10-28 01:38:57 +0000 | [diff] [blame] | 545 | Output log in /tmp/qemu.log |
bellard | ec410fc | 2003-06-30 23:16:33 +0000 | [diff] [blame] | 546 | @end table |
| 547 | |
| 548 | During emulation, use @key{C-a h} to get terminal commands: |
| 549 | |
| 550 | @table @key |
| 551 | @item C-a h |
| 552 | Print this help |
| 553 | @item C-a x |
| 554 | Exit emulatior |
bellard | 1f47a92 | 2003-07-06 19:01:55 +0000 | [diff] [blame] | 555 | @item C-a s |
| 556 | Save disk data back to file (if -snapshot) |
| 557 | @item C-a b |
bellard | ec410fc | 2003-06-30 23:16:33 +0000 | [diff] [blame] | 558 | Send break (magic sysrq) |
bellard | 1f47a92 | 2003-07-06 19:01:55 +0000 | [diff] [blame] | 559 | @item C-a C-a |
bellard | ec410fc | 2003-06-30 23:16:33 +0000 | [diff] [blame] | 560 | Send C-a |
| 561 | @end table |
bellard | 0806e3f | 2003-10-01 00:15:32 +0000 | [diff] [blame] | 562 | @c man end |
bellard | ec410fc | 2003-06-30 23:16:33 +0000 | [diff] [blame] | 563 | |
bellard | 0806e3f | 2003-10-01 00:15:32 +0000 | [diff] [blame] | 564 | @ignore |
| 565 | |
| 566 | @setfilename qemu |
| 567 | @settitle QEMU System Emulator |
| 568 | |
| 569 | @c man begin SEEALSO |
| 570 | The HTML documentation of QEMU for more precise information and Linux |
| 571 | user mode emulator invocation. |
| 572 | @c man end |
| 573 | |
| 574 | @c man begin AUTHOR |
| 575 | Fabrice Bellard |
| 576 | @c man end |
| 577 | |
| 578 | @end ignore |
| 579 | |
| 580 | @end ignore |
bellard | 1f47a92 | 2003-07-06 19:01:55 +0000 | [diff] [blame] | 581 | @node disk_images |
| 582 | @section Disk Images |
| 583 | |
| 584 | @subsection Raw disk images |
| 585 | |
| 586 | The disk images can simply be raw images of the hard disk. You can |
| 587 | create them with the command: |
| 588 | @example |
| 589 | dd if=/dev/zero of=myimage bs=1024 count=mysize |
| 590 | @end example |
| 591 | where @var{myimage} is the image filename and @var{mysize} is its size |
| 592 | in kilobytes. |
| 593 | |
| 594 | @subsection Snapshot mode |
| 595 | |
| 596 | If you use the option @option{-snapshot}, all disk images are |
| 597 | considered as read only. When sectors in written, they are written in |
| 598 | a temporary file created in @file{/tmp}. You can however force the |
| 599 | write back to the raw disk images by pressing @key{C-a s}. |
| 600 | |
| 601 | NOTE: The snapshot mode only works with raw disk images. |
| 602 | |
| 603 | @subsection Copy On Write disk images |
| 604 | |
| 605 | QEMU also supports user mode Linux |
| 606 | (@url{http://user-mode-linux.sourceforge.net/}) Copy On Write (COW) |
| 607 | disk images. The COW disk images are much smaller than normal images |
| 608 | as they store only modified sectors. They also permit the use of the |
| 609 | same disk image template for many users. |
| 610 | |
| 611 | To create a COW disk images, use the command: |
| 612 | |
| 613 | @example |
bellard | 0806e3f | 2003-10-01 00:15:32 +0000 | [diff] [blame] | 614 | qemu-mkcow -f myrawimage.bin mycowimage.cow |
bellard | 1f47a92 | 2003-07-06 19:01:55 +0000 | [diff] [blame] | 615 | @end example |
| 616 | |
| 617 | @file{myrawimage.bin} is a raw image you want to use as original disk |
| 618 | image. It will never be written to. |
| 619 | |
| 620 | @file{mycowimage.cow} is the COW disk image which is created by |
bellard | 0806e3f | 2003-10-01 00:15:32 +0000 | [diff] [blame] | 621 | @code{qemu-mkcow}. You can use it directly with the @option{-hdx} |
bellard | 1f47a92 | 2003-07-06 19:01:55 +0000 | [diff] [blame] | 622 | options. You must not modify the original raw disk image if you use |
| 623 | COW images, as COW images only store the modified sectors from the raw |
| 624 | disk image. QEMU stores the original raw disk image name and its |
| 625 | modified time in the COW disk image so that chances of mistakes are |
| 626 | reduced. |
| 627 | |
bellard | 9d0fe22 | 2003-07-13 22:08:50 +0000 | [diff] [blame] | 628 | If the raw disk image is not read-only, by pressing @key{C-a s} you |
| 629 | can flush the COW disk image back into the raw disk image, as in |
| 630 | snapshot mode. |
bellard | 1f47a92 | 2003-07-06 19:01:55 +0000 | [diff] [blame] | 631 | |
| 632 | COW disk images can also be created without a corresponding raw disk |
| 633 | image. It is useful to have a big initial virtual disk image without |
| 634 | using much disk space. Use: |
| 635 | |
| 636 | @example |
bellard | 0806e3f | 2003-10-01 00:15:32 +0000 | [diff] [blame] | 637 | qemu-mkcow mycowimage.cow 1024 |
bellard | 1f47a92 | 2003-07-06 19:01:55 +0000 | [diff] [blame] | 638 | @end example |
| 639 | |
| 640 | to create a 1 gigabyte empty COW disk image. |
| 641 | |
| 642 | NOTES: |
| 643 | @enumerate |
| 644 | @item |
| 645 | COW disk images must be created on file systems supporting |
| 646 | @emph{holes} such as ext2 or ext3. |
| 647 | @item |
| 648 | Since holes are used, the displayed size of the COW disk image is not |
| 649 | the real one. To know it, use the @code{ls -ls} command. |
| 650 | @end enumerate |
| 651 | |
bellard | 0806e3f | 2003-10-01 00:15:32 +0000 | [diff] [blame] | 652 | @node linux_compile |
bellard | 4690764 | 2003-07-07 12:17:46 +0000 | [diff] [blame] | 653 | @section Linux Kernel Compilation |
bellard | 1eb2052 | 2003-06-25 16:21:49 +0000 | [diff] [blame] | 654 | |
bellard | 285dc33 | 2003-10-27 23:58:04 +0000 | [diff] [blame] | 655 | You can use any linux kernel with QEMU. However, if you want to use |
| 656 | @code{qemu-fast} to get maximum performances, you should make the |
| 657 | following changes to the Linux kernel (only 2.4.x and 2.5.x were |
| 658 | tested): |
bellard | 1eb2052 | 2003-06-25 16:21:49 +0000 | [diff] [blame] | 659 | |
bellard | 4690764 | 2003-07-07 12:17:46 +0000 | [diff] [blame] | 660 | @enumerate |
| 661 | @item |
| 662 | The kernel must be mapped at 0x90000000 (the default is |
| 663 | 0xc0000000). You must modify only two lines in the kernel source: |
| 664 | |
| 665 | In @file{include/asm/page.h}, replace |
bellard | 1eb2052 | 2003-06-25 16:21:49 +0000 | [diff] [blame] | 666 | @example |
| 667 | #define __PAGE_OFFSET (0xc0000000) |
| 668 | @end example |
| 669 | by |
| 670 | @example |
| 671 | #define __PAGE_OFFSET (0x90000000) |
| 672 | @end example |
| 673 | |
bellard | 4690764 | 2003-07-07 12:17:46 +0000 | [diff] [blame] | 674 | And in @file{arch/i386/vmlinux.lds}, replace |
bellard | 1eb2052 | 2003-06-25 16:21:49 +0000 | [diff] [blame] | 675 | @example |
| 676 | . = 0xc0000000 + 0x100000; |
| 677 | @end example |
| 678 | by |
| 679 | @example |
| 680 | . = 0x90000000 + 0x100000; |
| 681 | @end example |
| 682 | |
bellard | 4690764 | 2003-07-07 12:17:46 +0000 | [diff] [blame] | 683 | @item |
| 684 | If you want to enable SMP (Symmetric Multi-Processing) support, you |
| 685 | must make the following change in @file{include/asm/fixmap.h}. Replace |
bellard | 1eb2052 | 2003-06-25 16:21:49 +0000 | [diff] [blame] | 686 | @example |
bellard | 4690764 | 2003-07-07 12:17:46 +0000 | [diff] [blame] | 687 | #define FIXADDR_TOP (0xffffX000UL) |
bellard | 1eb2052 | 2003-06-25 16:21:49 +0000 | [diff] [blame] | 688 | @end example |
bellard | 4690764 | 2003-07-07 12:17:46 +0000 | [diff] [blame] | 689 | by |
| 690 | @example |
| 691 | #define FIXADDR_TOP (0xa7ffX000UL) |
| 692 | @end example |
| 693 | (X is 'e' or 'f' depending on the kernel version). Although you can |
| 694 | use an SMP kernel with QEMU, it only supports one CPU. |
bellard | 1eb2052 | 2003-06-25 16:21:49 +0000 | [diff] [blame] | 695 | |
bellard | 4690764 | 2003-07-07 12:17:46 +0000 | [diff] [blame] | 696 | @item |
bellard | d5a0b50 | 2003-06-27 12:02:03 +0000 | [diff] [blame] | 697 | If you are not using a 2.5 kernel as host kernel but if you use a target |
| 698 | 2.5 kernel, you must also ensure that the 'HZ' define is set to 100 |
| 699 | (1000 is the default) as QEMU cannot currently emulate timers at |
| 700 | frequencies greater than 100 Hz on host Linux systems < 2.5. In |
bellard | 4690764 | 2003-07-07 12:17:46 +0000 | [diff] [blame] | 701 | @file{include/asm/param.h}, replace: |
bellard | d5a0b50 | 2003-06-27 12:02:03 +0000 | [diff] [blame] | 702 | |
| 703 | @example |
| 704 | # define HZ 1000 /* Internal kernel timer frequency */ |
| 705 | @end example |
| 706 | by |
| 707 | @example |
| 708 | # define HZ 100 /* Internal kernel timer frequency */ |
| 709 | @end example |
| 710 | |
bellard | 4690764 | 2003-07-07 12:17:46 +0000 | [diff] [blame] | 711 | @end enumerate |
| 712 | |
| 713 | The file config-2.x.x gives the configuration of the example kernels. |
| 714 | |
| 715 | Just type |
| 716 | @example |
| 717 | make bzImage |
| 718 | @end example |
| 719 | |
| 720 | As you would do to make a real kernel. Then you can use with QEMU |
| 721 | exactly the same kernel as you would boot on your PC (in |
| 722 | @file{arch/i386/boot/bzImage}). |
bellard | da415d5 | 2003-06-27 18:50:50 +0000 | [diff] [blame] | 723 | |
bellard | 0806e3f | 2003-10-01 00:15:32 +0000 | [diff] [blame] | 724 | @node gdb_usage |
bellard | da415d5 | 2003-06-27 18:50:50 +0000 | [diff] [blame] | 725 | @section GDB usage |
| 726 | |
| 727 | QEMU has a primitive support to work with gdb, so that you can do |
bellard | 0806e3f | 2003-10-01 00:15:32 +0000 | [diff] [blame] | 728 | 'Ctrl-C' while the virtual machine is running and inspect its state. |
bellard | da415d5 | 2003-06-27 18:50:50 +0000 | [diff] [blame] | 729 | |
bellard | 9d4520d | 2003-10-28 01:38:57 +0000 | [diff] [blame] | 730 | In order to use gdb, launch qemu with the '-s' option. It will wait for a |
bellard | da415d5 | 2003-06-27 18:50:50 +0000 | [diff] [blame] | 731 | gdb connection: |
| 732 | @example |
bellard | 6c9bf89 | 2004-01-24 13:46:56 +0000 | [diff] [blame^] | 733 | > qemu -s -kernel arch/i386/boot/bzImage -hda root-2.4.20.img -append "root=/dev/hda" |
bellard | da415d5 | 2003-06-27 18:50:50 +0000 | [diff] [blame] | 734 | Connected to host network interface: tun0 |
| 735 | Waiting gdb connection on port 1234 |
| 736 | @end example |
| 737 | |
| 738 | Then launch gdb on the 'vmlinux' executable: |
| 739 | @example |
| 740 | > gdb vmlinux |
| 741 | @end example |
| 742 | |
| 743 | In gdb, connect to QEMU: |
| 744 | @example |
bellard | 6c9bf89 | 2004-01-24 13:46:56 +0000 | [diff] [blame^] | 745 | (gdb) target remote localhost:1234 |
bellard | da415d5 | 2003-06-27 18:50:50 +0000 | [diff] [blame] | 746 | @end example |
| 747 | |
| 748 | Then you can use gdb normally. For example, type 'c' to launch the kernel: |
| 749 | @example |
| 750 | (gdb) c |
| 751 | @end example |
| 752 | |
bellard | 0806e3f | 2003-10-01 00:15:32 +0000 | [diff] [blame] | 753 | Here are some useful tips in order to use gdb on system code: |
| 754 | |
| 755 | @enumerate |
| 756 | @item |
| 757 | Use @code{info reg} to display all the CPU registers. |
| 758 | @item |
| 759 | Use @code{x/10i $eip} to display the code at the PC position. |
| 760 | @item |
| 761 | Use @code{set architecture i8086} to dump 16 bit code. Then use |
| 762 | @code{x/10i $cs*16+*eip} to dump the code at the PC position. |
| 763 | @end enumerate |
| 764 | |
bellard | 386405f | 2003-03-23 21:28:45 +0000 | [diff] [blame] | 765 | @chapter QEMU Internals |
| 766 | |
| 767 | @section QEMU compared to other emulators |
| 768 | |
bellard | 1eb2052 | 2003-06-25 16:21:49 +0000 | [diff] [blame] | 769 | Like bochs [3], QEMU emulates an x86 CPU. But QEMU is much faster than |
| 770 | bochs as it uses dynamic compilation and because it uses the host MMU to |
| 771 | simulate the x86 MMU. The downside is that currently the emulation is |
| 772 | not as accurate as bochs (for example, you cannot currently run Windows |
| 773 | inside QEMU). |
bellard | 386405f | 2003-03-23 21:28:45 +0000 | [diff] [blame] | 774 | |
| 775 | Like Valgrind [2], QEMU does user space emulation and dynamic |
| 776 | translation. Valgrind is mainly a memory debugger while QEMU has no |
bellard | 1eb2052 | 2003-06-25 16:21:49 +0000 | [diff] [blame] | 777 | support for it (QEMU could be used to detect out of bound memory |
| 778 | accesses as Valgrind, but it has no support to track uninitialised data |
bellard | d5a0b50 | 2003-06-27 12:02:03 +0000 | [diff] [blame] | 779 | as Valgrind does). The Valgrind dynamic translator generates better code |
bellard | 1eb2052 | 2003-06-25 16:21:49 +0000 | [diff] [blame] | 780 | than QEMU (in particular it does register allocation) but it is closely |
bellard | d5a0b50 | 2003-06-27 12:02:03 +0000 | [diff] [blame] | 781 | tied to an x86 host and target and has no support for precise exceptions |
bellard | 1eb2052 | 2003-06-25 16:21:49 +0000 | [diff] [blame] | 782 | and system emulation. |
bellard | 386405f | 2003-03-23 21:28:45 +0000 | [diff] [blame] | 783 | |
bellard | 1eb2052 | 2003-06-25 16:21:49 +0000 | [diff] [blame] | 784 | EM86 [4] is the closest project to user space QEMU (and QEMU still uses |
| 785 | some of its code, in particular the ELF file loader). EM86 was limited |
| 786 | to an alpha host and used a proprietary and slow interpreter (the |
| 787 | interpreter part of the FX!32 Digital Win32 code translator [5]). |
bellard | 386405f | 2003-03-23 21:28:45 +0000 | [diff] [blame] | 788 | |
bellard | fd429f2 | 2003-03-30 20:59:46 +0000 | [diff] [blame] | 789 | TWIN [6] is a Windows API emulator like Wine. It is less accurate than |
| 790 | Wine but includes a protected mode x86 interpreter to launch x86 Windows |
| 791 | executables. Such an approach as greater potential because most of the |
| 792 | Windows API is executed natively but it is far more difficult to develop |
| 793 | because all the data structures and function parameters exchanged |
| 794 | between the API and the x86 code must be converted. |
| 795 | |
bellard | 1eb2052 | 2003-06-25 16:21:49 +0000 | [diff] [blame] | 796 | User mode Linux [7] was the only solution before QEMU to launch a Linux |
| 797 | kernel as a process while not needing any host kernel patches. However, |
| 798 | user mode Linux requires heavy kernel patches while QEMU accepts |
| 799 | unpatched Linux kernels. It would be interesting to compare the |
| 800 | performance of the two approaches. |
| 801 | |
| 802 | The new Plex86 [8] PC virtualizer is done in the same spirit as the QEMU |
| 803 | system emulator. It requires a patched Linux kernel to work (you cannot |
| 804 | launch the same kernel on your PC), but the patches are really small. As |
| 805 | it is a PC virtualizer (no emulation is done except for some priveledged |
| 806 | instructions), it has the potential of being faster than QEMU. The |
bellard | d5a0b50 | 2003-06-27 12:02:03 +0000 | [diff] [blame] | 807 | downside is that a complicated (and potentially unsafe) host kernel |
| 808 | patch is needed. |
bellard | 1eb2052 | 2003-06-25 16:21:49 +0000 | [diff] [blame] | 809 | |
bellard | 386405f | 2003-03-23 21:28:45 +0000 | [diff] [blame] | 810 | @section Portable dynamic translation |
| 811 | |
| 812 | QEMU is a dynamic translator. When it first encounters a piece of code, |
| 813 | it converts it to the host instruction set. Usually dynamic translators |
bellard | 322d0c6 | 2003-06-15 23:29:28 +0000 | [diff] [blame] | 814 | are very complicated and highly CPU dependent. QEMU uses some tricks |
bellard | 386405f | 2003-03-23 21:28:45 +0000 | [diff] [blame] | 815 | which make it relatively easily portable and simple while achieving good |
| 816 | performances. |
| 817 | |
| 818 | The basic idea is to split every x86 instruction into fewer simpler |
| 819 | instructions. Each simple instruction is implemented by a piece of C |
| 820 | code (see @file{op-i386.c}). Then a compile time tool (@file{dyngen}) |
| 821 | takes the corresponding object file (@file{op-i386.o}) to generate a |
| 822 | dynamic code generator which concatenates the simple instructions to |
| 823 | build a function (see @file{op-i386.h:dyngen_code()}). |
| 824 | |
| 825 | In essence, the process is similar to [1], but more work is done at |
| 826 | compile time. |
| 827 | |
| 828 | A key idea to get optimal performances is that constant parameters can |
| 829 | be passed to the simple operations. For that purpose, dummy ELF |
| 830 | relocations are generated with gcc for each constant parameter. Then, |
| 831 | the tool (@file{dyngen}) can locate the relocations and generate the |
| 832 | appriopriate C code to resolve them when building the dynamic code. |
| 833 | |
| 834 | That way, QEMU is no more difficult to port than a dynamic linker. |
| 835 | |
| 836 | To go even faster, GCC static register variables are used to keep the |
| 837 | state of the virtual CPU. |
| 838 | |
| 839 | @section Register allocation |
| 840 | |
| 841 | Since QEMU uses fixed simple instructions, no efficient register |
| 842 | allocation can be done. However, because RISC CPUs have a lot of |
| 843 | register, most of the virtual CPU state can be put in registers without |
| 844 | doing complicated register allocation. |
| 845 | |
| 846 | @section Condition code optimisations |
| 847 | |
| 848 | Good CPU condition codes emulation (@code{EFLAGS} register on x86) is a |
| 849 | critical point to get good performances. QEMU uses lazy condition code |
| 850 | evaluation: instead of computing the condition codes after each x86 |
bellard | fd429f2 | 2003-03-30 20:59:46 +0000 | [diff] [blame] | 851 | instruction, it just stores one operand (called @code{CC_SRC}), the |
bellard | 386405f | 2003-03-23 21:28:45 +0000 | [diff] [blame] | 852 | result (called @code{CC_DST}) and the type of operation (called |
| 853 | @code{CC_OP}). |
| 854 | |
| 855 | @code{CC_OP} is almost never explicitely set in the generated code |
| 856 | because it is known at translation time. |
| 857 | |
| 858 | In order to increase performances, a backward pass is performed on the |
| 859 | generated simple instructions (see |
| 860 | @code{translate-i386.c:optimize_flags()}). When it can be proved that |
| 861 | the condition codes are not needed by the next instructions, no |
| 862 | condition codes are computed at all. |
| 863 | |
bellard | fd429f2 | 2003-03-30 20:59:46 +0000 | [diff] [blame] | 864 | @section CPU state optimisations |
bellard | 386405f | 2003-03-23 21:28:45 +0000 | [diff] [blame] | 865 | |
| 866 | The x86 CPU has many internal states which change the way it evaluates |
| 867 | instructions. In order to achieve a good speed, the translation phase |
| 868 | considers that some state information of the virtual x86 CPU cannot |
| 869 | change in it. For example, if the SS, DS and ES segments have a zero |
| 870 | base, then the translator does not even generate an addition for the |
| 871 | segment base. |
| 872 | |
| 873 | [The FPU stack pointer register is not handled that way yet]. |
| 874 | |
| 875 | @section Translation cache |
| 876 | |
| 877 | A 2MByte cache holds the most recently used translations. For |
| 878 | simplicity, it is completely flushed when it is full. A translation unit |
| 879 | contains just a single basic block (a block of x86 instructions |
| 880 | terminated by a jump or by a virtual CPU state change which the |
| 881 | translator cannot deduce statically). |
| 882 | |
bellard | df0f11a | 2003-05-28 00:27:57 +0000 | [diff] [blame] | 883 | @section Direct block chaining |
| 884 | |
| 885 | After each translated basic block is executed, QEMU uses the simulated |
| 886 | Program Counter (PC) and other cpu state informations (such as the CS |
| 887 | segment base value) to find the next basic block. |
| 888 | |
| 889 | In order to accelerate the most common cases where the new simulated PC |
| 890 | is known, QEMU can patch a basic block so that it jumps directly to the |
| 891 | next one. |
| 892 | |
| 893 | The most portable code uses an indirect jump. An indirect jump makes it |
| 894 | easier to make the jump target modification atomic. On some |
| 895 | architectures (such as PowerPC), the @code{JUMP} opcode is directly |
| 896 | patched so that the block chaining has no overhead. |
| 897 | |
| 898 | @section Self-modifying code and translated code invalidation |
| 899 | |
| 900 | Self-modifying code is a special challenge in x86 emulation because no |
| 901 | instruction cache invalidation is signaled by the application when code |
| 902 | is modified. |
| 903 | |
| 904 | When translated code is generated for a basic block, the corresponding |
| 905 | host page is write protected if it is not already read-only (with the |
| 906 | system call @code{mprotect()}). Then, if a write access is done to the |
| 907 | page, Linux raises a SEGV signal. QEMU then invalidates all the |
| 908 | translated code in the page and enables write accesses to the page. |
| 909 | |
| 910 | Correct translated code invalidation is done efficiently by maintaining |
| 911 | a linked list of every translated block contained in a given page. Other |
| 912 | linked lists are also maintained to undo direct block chaining. |
| 913 | |
bellard | 4690764 | 2003-07-07 12:17:46 +0000 | [diff] [blame] | 914 | Although the overhead of doing @code{mprotect()} calls is important, |
bellard | df0f11a | 2003-05-28 00:27:57 +0000 | [diff] [blame] | 915 | most MSDOS programs can be emulated at reasonnable speed with QEMU and |
| 916 | DOSEMU. |
| 917 | |
| 918 | Note that QEMU also invalidates pages of translated code when it detects |
| 919 | that memory mappings are modified with @code{mmap()} or @code{munmap()}. |
bellard | 386405f | 2003-03-23 21:28:45 +0000 | [diff] [blame] | 920 | |
| 921 | @section Exception support |
| 922 | |
| 923 | longjmp() is used when an exception such as division by zero is |
bellard | df0f11a | 2003-05-28 00:27:57 +0000 | [diff] [blame] | 924 | encountered. |
bellard | 386405f | 2003-03-23 21:28:45 +0000 | [diff] [blame] | 925 | |
bellard | df0f11a | 2003-05-28 00:27:57 +0000 | [diff] [blame] | 926 | The host SIGSEGV and SIGBUS signal handlers are used to get invalid |
| 927 | memory accesses. The exact CPU state can be retrieved because all the |
| 928 | x86 registers are stored in fixed host registers. The simulated program |
| 929 | counter is found by retranslating the corresponding basic block and by |
| 930 | looking where the host program counter was at the exception point. |
| 931 | |
| 932 | The virtual CPU cannot retrieve the exact @code{EFLAGS} register because |
| 933 | in some cases it is not computed because of condition code |
| 934 | optimisations. It is not a big concern because the emulated code can |
| 935 | still be restarted in any cases. |
bellard | 386405f | 2003-03-23 21:28:45 +0000 | [diff] [blame] | 936 | |
| 937 | @section Linux system call translation |
| 938 | |
| 939 | QEMU includes a generic system call translator for Linux. It means that |
| 940 | the parameters of the system calls can be converted to fix the |
| 941 | endianness and 32/64 bit issues. The IOCTLs are converted with a generic |
| 942 | type description system (see @file{ioctls.h} and @file{thunk.c}). |
| 943 | |
bellard | df0f11a | 2003-05-28 00:27:57 +0000 | [diff] [blame] | 944 | QEMU supports host CPUs which have pages bigger than 4KB. It records all |
| 945 | the mappings the process does and try to emulated the @code{mmap()} |
| 946 | system calls in cases where the host @code{mmap()} call would fail |
| 947 | because of bad page alignment. |
| 948 | |
bellard | 386405f | 2003-03-23 21:28:45 +0000 | [diff] [blame] | 949 | @section Linux signals |
| 950 | |
| 951 | Normal and real-time signals are queued along with their information |
| 952 | (@code{siginfo_t}) as it is done in the Linux kernel. Then an interrupt |
| 953 | request is done to the virtual CPU. When it is interrupted, one queued |
| 954 | signal is handled by generating a stack frame in the virtual CPU as the |
| 955 | Linux kernel does. The @code{sigreturn()} system call is emulated to return |
| 956 | from the virtual signal handler. |
| 957 | |
| 958 | Some signals (such as SIGALRM) directly come from the host. Other |
| 959 | signals are synthetized from the virtual CPU exceptions such as SIGFPE |
| 960 | when a division by zero is done (see @code{main.c:cpu_loop()}). |
| 961 | |
| 962 | The blocked signal mask is still handled by the host Linux kernel so |
| 963 | that most signal system calls can be redirected directly to the host |
| 964 | Linux kernel. Only the @code{sigaction()} and @code{sigreturn()} system |
| 965 | calls need to be fully emulated (see @file{signal.c}). |
| 966 | |
| 967 | @section clone() system call and threads |
| 968 | |
| 969 | The Linux clone() system call is usually used to create a thread. QEMU |
| 970 | uses the host clone() system call so that real host threads are created |
| 971 | for each emulated thread. One virtual CPU instance is created for each |
| 972 | thread. |
| 973 | |
| 974 | The virtual x86 CPU atomic operations are emulated with a global lock so |
| 975 | that their semantic is preserved. |
| 976 | |
bellard | df0f11a | 2003-05-28 00:27:57 +0000 | [diff] [blame] | 977 | Note that currently there are still some locking issues in QEMU. In |
| 978 | particular, the translated cache flush is not protected yet against |
| 979 | reentrancy. |
| 980 | |
bellard | 1eb8725 | 2003-04-11 01:12:28 +0000 | [diff] [blame] | 981 | @section Self-virtualization |
| 982 | |
bellard | 4690764 | 2003-07-07 12:17:46 +0000 | [diff] [blame] | 983 | QEMU was conceived so that ultimately it can emulate itself. Although |
bellard | 1eb8725 | 2003-04-11 01:12:28 +0000 | [diff] [blame] | 984 | it is not very useful, it is an important test to show the power of the |
| 985 | emulator. |
| 986 | |
| 987 | Achieving self-virtualization is not easy because there may be address |
bellard | 6cd9f35 | 2003-04-29 20:40:35 +0000 | [diff] [blame] | 988 | space conflicts. QEMU solves this problem by being an executable ELF |
| 989 | shared object as the ld-linux.so ELF interpreter. That way, it can be |
| 990 | relocated at load time. |
bellard | 1eb8725 | 2003-04-11 01:12:28 +0000 | [diff] [blame] | 991 | |
bellard | 1eb2052 | 2003-06-25 16:21:49 +0000 | [diff] [blame] | 992 | @section MMU emulation |
| 993 | |
| 994 | For system emulation, QEMU uses the mmap() system call to emulate the |
| 995 | target CPU MMU. It works as long the emulated OS does not use an area |
| 996 | reserved by the host OS (such as the area above 0xc0000000 on x86 |
| 997 | Linux). |
| 998 | |
| 999 | It is planned to add a slower but more precise MMU emulation |
| 1000 | with a software MMU. |
| 1001 | |
bellard | 386405f | 2003-03-23 21:28:45 +0000 | [diff] [blame] | 1002 | @section Bibliography |
| 1003 | |
| 1004 | @table @asis |
| 1005 | |
| 1006 | @item [1] |
| 1007 | @url{http://citeseer.nj.nec.com/piumarta98optimizing.html}, Optimizing |
| 1008 | direct threaded code by selective inlining (1998) by Ian Piumarta, Fabio |
| 1009 | Riccardi. |
| 1010 | |
| 1011 | @item [2] |
| 1012 | @url{http://developer.kde.org/~sewardj/}, Valgrind, an open-source |
| 1013 | memory debugger for x86-GNU/Linux, by Julian Seward. |
| 1014 | |
| 1015 | @item [3] |
| 1016 | @url{http://bochs.sourceforge.net/}, the Bochs IA-32 Emulator Project, |
| 1017 | by Kevin Lawton et al. |
| 1018 | |
| 1019 | @item [4] |
| 1020 | @url{http://www.cs.rose-hulman.edu/~donaldlf/em86/index.html}, the EM86 |
| 1021 | x86 emulator on Alpha-Linux. |
| 1022 | |
| 1023 | @item [5] |
| 1024 | @url{http://www.usenix.org/publications/library/proceedings/usenix-nt97/full_papers/chernoff/chernoff.pdf}, |
| 1025 | DIGITAL FX!32: Running 32-Bit x86 Applications on Alpha NT, by Anton |
| 1026 | Chernoff and Ray Hookway. |
| 1027 | |
bellard | fd429f2 | 2003-03-30 20:59:46 +0000 | [diff] [blame] | 1028 | @item [6] |
| 1029 | @url{http://www.willows.com/}, Windows API library emulation from |
| 1030 | Willows Software. |
| 1031 | |
bellard | 1eb2052 | 2003-06-25 16:21:49 +0000 | [diff] [blame] | 1032 | @item [7] |
| 1033 | @url{http://user-mode-linux.sourceforge.net/}, |
| 1034 | The User-mode Linux Kernel. |
| 1035 | |
| 1036 | @item [8] |
| 1037 | @url{http://www.plex86.org/}, |
| 1038 | The new Plex86 project. |
| 1039 | |
bellard | 386405f | 2003-03-23 21:28:45 +0000 | [diff] [blame] | 1040 | @end table |
| 1041 | |
| 1042 | @chapter Regression Tests |
| 1043 | |
bellard | 322d0c6 | 2003-06-15 23:29:28 +0000 | [diff] [blame] | 1044 | In the directory @file{tests/}, various interesting testing programs |
bellard | 386405f | 2003-03-23 21:28:45 +0000 | [diff] [blame] | 1045 | are available. There are used for regression testing. |
| 1046 | |
bellard | 386405f | 2003-03-23 21:28:45 +0000 | [diff] [blame] | 1047 | @section @file{test-i386} |
| 1048 | |
| 1049 | This program executes most of the 16 bit and 32 bit x86 instructions and |
| 1050 | generates a text output. It can be compared with the output obtained with |
| 1051 | a real CPU or another emulator. The target @code{make test} runs this |
| 1052 | program and a @code{diff} on the generated output. |
| 1053 | |
| 1054 | The Linux system call @code{modify_ldt()} is used to create x86 selectors |
| 1055 | to test some 16 bit addressing and 32 bit with segmentation cases. |
| 1056 | |
bellard | df0f11a | 2003-05-28 00:27:57 +0000 | [diff] [blame] | 1057 | The Linux system call @code{vm86()} is used to test vm86 emulation. |
bellard | 386405f | 2003-03-23 21:28:45 +0000 | [diff] [blame] | 1058 | |
bellard | df0f11a | 2003-05-28 00:27:57 +0000 | [diff] [blame] | 1059 | Various exceptions are raised to test most of the x86 user space |
| 1060 | exception reporting. |
bellard | 386405f | 2003-03-23 21:28:45 +0000 | [diff] [blame] | 1061 | |
bellard | 285dc33 | 2003-10-27 23:58:04 +0000 | [diff] [blame] | 1062 | @section @file{linux-test} |
| 1063 | |
| 1064 | This program tests various Linux system calls. It is used to verify |
| 1065 | that the system call parameters are correctly converted between target |
| 1066 | and host CPUs. |
| 1067 | |
| 1068 | @section @file{hello-i386} |
| 1069 | |
| 1070 | Very simple statically linked x86 program, just to test QEMU during a |
| 1071 | port to a new host CPU. |
| 1072 | |
| 1073 | @section @file{hello-arm} |
| 1074 | |
| 1075 | Very simple statically linked ARM program, just to test QEMU during a |
| 1076 | port to a new host CPU. |
| 1077 | |
bellard | 386405f | 2003-03-23 21:28:45 +0000 | [diff] [blame] | 1078 | @section @file{sha1} |
| 1079 | |
| 1080 | It is a simple benchmark. Care must be taken to interpret the results |
| 1081 | because it mostly tests the ability of the virtual CPU to optimize the |
| 1082 | @code{rol} x86 instruction and the condition code computations. |
| 1083 | |