]> git.proxmox.com Git - qemu.git/blame - qemu-doc.texi
x86_64 fixes
[qemu.git] / qemu-doc.texi
CommitLineData
386405f7
FB
1\input texinfo @c -*- texinfo -*-
2
0806e3f6 3@iftex
1f673135 4@settitle QEMU CPU Emulator User Documentation
386405f7
FB
5@titlepage
6@sp 7
1f673135 7@center @titlefont{QEMU CPU Emulator User Documentation}
386405f7
FB
8@sp 3
9@end titlepage
0806e3f6 10@end iftex
386405f7
FB
11
12@chapter Introduction
13
322d0c66 14@section Features
386405f7 15
1f673135
FB
16QEMU is a FAST! processor emulator using dynamic translation to
17achieve good emulation speed.
1eb20527
FB
18
19QEMU has two operating modes:
0806e3f6
FB
20
21@itemize @minus
22
23@item
1f673135
FB
24Full system emulation. In this mode, QEMU emulates a full system (for
25example a PC), including a processor and various peripherials. It can
26be used to launch different Operating Systems without rebooting the
27PC or to debug system code.
1eb20527 28
0806e3f6 29@item
1f673135
FB
30User mode emulation (Linux host only). In this mode, QEMU can launch
31Linux processes compiled for one CPU on another CPU. It can be used to
32launch the Wine Windows API emulator (@url{http://www.winehq.org}) or
33to ease cross-compilation and cross-debugging.
1eb20527
FB
34
35@end itemize
36
7c3fc84d 37QEMU can run without an host kernel driver and yet gives acceptable
6f2f2b24 38performance.
322d0c66 39
52c00a5f
FB
40For system emulation, the following hardware targets are supported:
41@itemize
42@item PC (x86 processor)
43@item PREP (PowerPC processor)
15a34c63 44@item PowerMac (PowerPC processor, in progress)
52c00a5f 45@end itemize
386405f7 46
1f673135 47For user emulation, x86, PowerPC, ARM, and SPARC CPUs are supported.
0806e3f6 48
5b9f457a
FB
49@chapter Installation
50
15a34c63
FB
51If you want to compile QEMU yourself, see @ref{compilation}.
52
1f673135
FB
53@section Linux
54
7c3fc84d
FB
55If a precompiled package is available for your distribution - you just
56have to install it. Otherwise, see @ref{compilation}.
5b9f457a 57
1f673135 58@section Windows
8cd0ac2f 59
15a34c63
FB
60Download the experimental binary installer at
61@url{http://www.freeoszoo.org/download.php}.
d691f669 62
1f673135 63@section Mac OS X
d691f669 64
15a34c63
FB
65Download the experimental binary installer at
66@url{http://www.freeoszoo.org/download.php}.
df0f11a0 67
52c00a5f 68@chapter QEMU PC System emulator invocation
1eb20527 69
0806e3f6
FB
70@section Introduction
71
72@c man begin DESCRIPTION
73
7c3fc84d
FB
74The QEMU System emulator simulates the
75following PC peripherials:
0806e3f6
FB
76
77@itemize @minus
15a34c63
FB
78@item
79i440FX host PCI bridge and PIIX3 PCI to ISA bridge
0806e3f6 80@item
15a34c63
FB
81Cirrus CLGD 5446 PCI VGA card or dummy VGA card with Bochs VESA
82extensions (hardware level, including all non standard modes).
0806e3f6
FB
83@item
84PS/2 mouse and keyboard
85@item
15a34c63 862 PCI IDE interfaces with hard disk and CD-ROM support
1f673135
FB
87@item
88Floppy disk
0806e3f6 89@item
15a34c63 90NE2000 PCI network adapters
0806e3f6 91@item
05d5818c
FB
92Serial ports
93@item
181f1558 94Soundblaster 16 card
0806e3f6
FB
95@end itemize
96
15a34c63
FB
97QEMU uses the PC BIOS from the Bochs project and the Plex86/Bochs LGPL
98VGA BIOS.
99
0806e3f6
FB
100@c man end
101
1eb20527
FB
102@section Quick Start
103
285dc330 104Download and uncompress the linux image (@file{linux.img}) and type:
0806e3f6
FB
105
106@example
285dc330 107qemu linux.img
0806e3f6
FB
108@end example
109
110Linux should boot and give you a prompt.
111
ec410fc9
FB
112@section Invocation
113
114@example
0806e3f6
FB
115@c man begin SYNOPSIS
116usage: qemu [options] [disk_image]
117@c man end
ec410fc9
FB
118@end example
119
0806e3f6 120@c man begin OPTIONS
9d4520d0 121@var{disk_image} is a raw hard disk image for IDE hard disk 0.
ec410fc9
FB
122
123General options:
124@table @option
2be3bc02
FB
125@item -fda file
126@item -fdb file
be3edd95
FB
127Use @var{file} as floppy disk 0/1 image (@xref{disk_images}). You can
128use the host floppy by using @file{/dev/fd0} as filename.
2be3bc02 129
ec410fc9
FB
130@item -hda file
131@item -hdb file
181f1558
FB
132@item -hdc file
133@item -hdd file
2be3bc02 134Use @var{file} as hard disk 0, 1, 2 or 3 image (@xref{disk_images}).
1f47a922 135
181f1558
FB
136@item -cdrom file
137Use @var{file} as CD-ROM image (you cannot use @option{-hdc} and and
be3edd95
FB
138@option{-cdrom} at the same time). You can use the host CD-ROM by
139using @file{/dev/cdrom} as filename.
181f1558 140
1f673135
FB
141@item -boot [a|c|d]
142Boot on floppy (a), hard disk (c) or CD-ROM (d). Hard disk boot is
2be3bc02 143the default.
1f47a922 144
181f1558 145@item -snapshot
1f47a922
FB
146Write to temporary files instead of disk image files. In this case,
147the raw disk image you use is not written back. You can however force
148the write back by pressing @key{C-a s} (@xref{disk_images}).
ec410fc9
FB
149
150@item -m megs
15a34c63 151Set virtual RAM size to @var{megs} megabytes. Default is 128 MB.
ec410fc9 152
0806e3f6
FB
153@item -nographic
154
155Normally, QEMU uses SDL to display the VGA output. With this option,
156you can totally disable graphical output so that QEMU is a simple
157command line application. The emulated serial port is redirected on
158the console. Therefore, you can still use QEMU to debug a Linux kernel
159with a serial console.
160
3d11d0eb
FB
161@item -k language
162
163Use keyboard layout @var{language} (for example @code{fr} for
164French). This option is only needed where it is not easy to get raw PC
165keycodes (e.g. on Macs or with some X11 servers). You don't need to
166use it on PC/Linux or PC/Windows hosts.
167
168The available layouts are:
169@example
170ar de-ch es fo fr-ca hu ja mk no pt-br sv
171da en-gb et fr fr-ch is lt nl pl ru th
172de en-us fi fr-be hr it lv nl-be pt sl tr
173@end example
174
175The default is @code{en-us}.
176
a8c490cd
FB
177@item -enable-audio
178
179The SB16 emulation is disabled by default as it may give problems with
180Windows. You can enable it manually with this option.
181
15a34c63
FB
182@item -localtime
183Set the real time clock to local time (the default is to UTC
184time). This option is needed to have correct date in MS-DOS or
185Windows.
186
d63d307f
FB
187@item -full-screen
188Start in full screen.
189
f7cce898
FB
190@item -pidfile file
191Store the QEMU process PID in @var{file}. It is useful if you launch QEMU
192from a script.
193
0806e3f6
FB
194@end table
195
1f673135
FB
196Network options:
197
198@table @option
199
200@item -n script
52c00a5f
FB
201Set TUN/TAP network init script [default=/etc/qemu-ifup]. This script
202is launched to configure the host network interface (usually tun0)
1f673135
FB
203corresponding to the virtual NE2000 card.
204
1f673135
FB
205@item -macaddr addr
206
207Set the mac address of the first interface (the format is
208aa:bb:cc:dd:ee:ff in hexa). The mac address is incremented for each
209new network interface.
210
52c00a5f
FB
211@item -tun-fd fd
212Assumes @var{fd} talks to a tap/tun host network interface and use
213it. Read @url{http://bellard.org/qemu/tetrinet.html} to have an
214example of its use.
215
216@item -user-net
15a34c63
FB
217Use the user mode network stack. This is the default if no tun/tap
218network init script is found.
52c00a5f 219
9bf05444
FB
220@item -tftp prefix
221When using the user mode network stack, activate a built-in TFTP
222server. All filenames beginning with @var{prefix} can be downloaded
223from the host to the guest using a TFTP client. The TFTP client on the
224guest must be configured in binary mode (use the command @code{bin} of
225the Unix TFTP client). The host IP address on the guest is as usual
22610.0.2.2.
227
2518bd0d
FB
228@item -smb dir
229When using the user mode network stack, activate a built-in SMB
230server so that Windows OSes can access to the host files in @file{dir}
231transparently.
232
233In the guest Windows OS, the line:
234@example
23510.0.2.4 smbserver
236@end example
237must be added in the file @file{C:\WINDOWS\LMHOSTS} (for windows 9x/Me)
238or @file{C:\WINNT\SYSTEM32\DRIVERS\ETC\LMHOSTS} (Windows NT/2000).
239
240Then @file{dir} can be accessed in @file{\\smbserver\qemu}.
241
242Note that a SAMBA server must be installed on the host OS in
243@file{/usr/sbin/smbd}. QEMU was tested succesfully with smbd version
2442.2.7a from the Red Hat 9.
245
9bf05444
FB
246@item -redir [tcp|udp]:host-port:[guest-host]:guest-port
247
248When using the user mode network stack, redirect incoming TCP or UDP
249connections to the host port @var{host-port} to the guest
250@var{guest-host} on guest port @var{guest-port}. If @var{guest-host}
251is not specified, its value is 10.0.2.15 (default address given by the
252built-in DHCP server).
253
254For example, to redirect host X11 connection from screen 1 to guest
255screen 0, use the following:
256
257@example
258# on the host
259qemu -redir tcp:6001::6000 [...]
260# this host xterm should open in the guest X11 server
261xterm -display :1
262@end example
263
264To redirect telnet connections from host port 5555 to telnet port on
265the guest, use the following:
266
267@example
268# on the host
269qemu -redir tcp:5555::23 [...]
270telnet localhost 5555
271@end example
272
273Then when you use on the host @code{telnet localhost 5555}, you
274connect to the guest telnet server.
275
52c00a5f 276@item -dummy-net
15a34c63 277Use the dummy network stack: no packet will be received by the network
52c00a5f 278cards.
1f673135
FB
279
280@end table
281
282Linux boot specific. When using this options, you can use a given
283Linux kernel without installing it in the disk image. It can be useful
284for easier testing of various kernels.
285
0806e3f6
FB
286@table @option
287
288@item -kernel bzImage
289Use @var{bzImage} as kernel image.
290
291@item -append cmdline
292Use @var{cmdline} as kernel command line
293
294@item -initrd file
295Use @var{file} as initial ram disk.
296
ec410fc9
FB
297@end table
298
15a34c63 299Debug/Expert options:
ec410fc9 300@table @option
a0a821a4
FB
301
302@item -serial dev
303Redirect the virtual serial port to host device @var{dev}. Available
304devices are:
305@table @code
306@item vc
307Virtual console
308@item pty
309[Linux only] Pseudo TTY (a new PTY is automatically allocated)
310@item null
311void device
312@item stdio
313[Unix only] standard input/output
314@end table
315The default device is @code{vc} in graphical mode and @code{stdio} in
316non graphical mode.
317
05d5818c
FB
318This option can be used several times to simulate up to 4 serials
319ports.
320
a0a821a4
FB
321@item -monitor dev
322Redirect the monitor to host device @var{dev} (same devices as the
323serial port).
324The default device is @code{vc} in graphical mode and @code{stdio} in
325non graphical mode.
326
ec410fc9 327@item -s
0806e3f6 328Wait gdb connection to port 1234 (@xref{gdb_usage}).
ec410fc9
FB
329@item -p port
330Change gdb connection port.
52c00a5f
FB
331@item -S
332Do not start CPU at startup (you must type 'c' in the monitor).
ec410fc9 333@item -d
9d4520d0 334Output log in /tmp/qemu.log
46d4767d
FB
335@item -hdachs c,h,s,[,t]
336Force hard disk 0 physical geometry (1 <= @var{c} <= 16383, 1 <=
337@var{h} <= 16, 1 <= @var{s} <= 63) and optionally force the BIOS
338translation mode (@var{t}=none, lba or auto). Usually QEMU can guess
339all thoses parameters. This option is useful for old MS-DOS disk
340images.
7c3fc84d 341
15a34c63
FB
342@item -isa
343Simulate an ISA-only system (default is PCI system).
344@item -std-vga
345Simulate a standard VGA card with Bochs VBE extensions (default is
346Cirrus Logic GD5446 PCI VGA)
d63d307f
FB
347@item -loadvm file
348Start right away with a saved state (@code{loadvm} in monitor)
ec410fc9
FB
349@end table
350
3e11db9a
FB
351@c man end
352
353@section Keys
354
355@c man begin OPTIONS
356
a1b74fe8
FB
357During the graphical emulation, you can use the following keys:
358@table @key
f9859310 359@item Ctrl-Alt-f
a1b74fe8 360Toggle full screen
a0a821a4 361
f9859310 362@item Ctrl-Alt-n
a0a821a4
FB
363Switch to virtual console 'n'. Standard console mappings are:
364@table @emph
365@item 1
366Target system display
367@item 2
368Monitor
369@item 3
370Serial port
a1b74fe8
FB
371@end table
372
f9859310 373@item Ctrl-Alt
a0a821a4
FB
374Toggle mouse and keyboard grab.
375@end table
376
3e11db9a
FB
377In the virtual consoles, you can use @key{Ctrl-Up}, @key{Ctrl-Down},
378@key{Ctrl-PageUp} and @key{Ctrl-PageDown} to move in the back log.
379
a0a821a4
FB
380During emulation, if you are using the @option{-nographic} option, use
381@key{Ctrl-a h} to get terminal commands:
ec410fc9
FB
382
383@table @key
a1b74fe8 384@item Ctrl-a h
ec410fc9 385Print this help
a1b74fe8 386@item Ctrl-a x
ec410fc9 387Exit emulatior
a1b74fe8 388@item Ctrl-a s
1f47a922 389Save disk data back to file (if -snapshot)
a1b74fe8 390@item Ctrl-a b
1f673135 391Send break (magic sysrq in Linux)
a1b74fe8 392@item Ctrl-a c
1f673135 393Switch between console and monitor
a1b74fe8
FB
394@item Ctrl-a Ctrl-a
395Send Ctrl-a
ec410fc9 396@end table
0806e3f6
FB
397@c man end
398
399@ignore
400
401@setfilename qemu
402@settitle QEMU System Emulator
403
1f673135
FB
404@c man begin SEEALSO
405The HTML documentation of QEMU for more precise information and Linux
406user mode emulator invocation.
407@c man end
408
409@c man begin AUTHOR
410Fabrice Bellard
411@c man end
412
413@end ignore
414
415@end ignore
416
1f673135
FB
417@section QEMU Monitor
418
419The QEMU monitor is used to give complex commands to the QEMU
420emulator. You can use it to:
421
422@itemize @minus
423
424@item
425Remove or insert removable medias images
426(such as CD-ROM or floppies)
427
428@item
429Freeze/unfreeze the Virtual Machine (VM) and save or restore its state
430from a disk file.
431
432@item Inspect the VM state without an external debugger.
433
434@end itemize
435
436@subsection Commands
437
438The following commands are available:
439
440@table @option
441
442@item help or ? [cmd]
443Show the help for all commands or just for command @var{cmd}.
444
445@item commit
446Commit changes to the disk images (if -snapshot is used)
447
448@item info subcommand
449show various information about the system state
450
451@table @option
452@item info network
453show the network state
454@item info block
455show the block devices
456@item info registers
457show the cpu registers
458@item info history
459show the command line history
460@end table
461
462@item q or quit
463Quit the emulator.
464
465@item eject [-f] device
466Eject a removable media (use -f to force it).
467
468@item change device filename
469Change a removable media.
470
471@item screendump filename
472Save screen into PPM image @var{filename}.
473
474@item log item1[,...]
475Activate logging of the specified items to @file{/tmp/qemu.log}.
476
477@item savevm filename
478Save the whole virtual machine state to @var{filename}.
479
480@item loadvm filename
481Restore the whole virtual machine state from @var{filename}.
482
483@item stop
484Stop emulation.
485
486@item c or cont
487Resume emulation.
488
489@item gdbserver [port]
490Start gdbserver session (default port=1234)
491
492@item x/fmt addr
493Virtual memory dump starting at @var{addr}.
494
495@item xp /fmt addr
496Physical memory dump starting at @var{addr}.
497
498@var{fmt} is a format which tells the command how to format the
499data. Its syntax is: @option{/@{count@}@{format@}@{size@}}
500
501@table @var
502@item count
503is the number of items to be dumped.
504
505@item format
506can be x (hexa), d (signed decimal), u (unsigned decimal), o (octal),
507c (char) or i (asm instruction).
508
509@item size
52c00a5f
FB
510can be b (8 bits), h (16 bits), w (32 bits) or g (64 bits). On x86,
511@code{h} or @code{w} can be specified with the @code{i} format to
512respectively select 16 or 32 bit code instruction size.
1f673135
FB
513
514@end table
515
516Examples:
517@itemize
518@item
519Dump 10 instructions at the current instruction pointer:
520@example
521(qemu) x/10i $eip
5220x90107063: ret
5230x90107064: sti
5240x90107065: lea 0x0(%esi,1),%esi
5250x90107069: lea 0x0(%edi,1),%edi
5260x90107070: ret
5270x90107071: jmp 0x90107080
5280x90107073: nop
5290x90107074: nop
5300x90107075: nop
5310x90107076: nop
532@end example
533
534@item
535Dump 80 16 bit values at the start of the video memory.
536@example
537(qemu) xp/80hx 0xb8000
5380x000b8000: 0x0b50 0x0b6c 0x0b65 0x0b78 0x0b38 0x0b36 0x0b2f 0x0b42
5390x000b8010: 0x0b6f 0x0b63 0x0b68 0x0b73 0x0b20 0x0b56 0x0b47 0x0b41
5400x000b8020: 0x0b42 0x0b69 0x0b6f 0x0b73 0x0b20 0x0b63 0x0b75 0x0b72
5410x000b8030: 0x0b72 0x0b65 0x0b6e 0x0b74 0x0b2d 0x0b63 0x0b76 0x0b73
5420x000b8040: 0x0b20 0x0b30 0x0b35 0x0b20 0x0b4e 0x0b6f 0x0b76 0x0b20
5430x000b8050: 0x0b32 0x0b30 0x0b30 0x0b33 0x0720 0x0720 0x0720 0x0720
5440x000b8060: 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720
5450x000b8070: 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720
5460x000b8080: 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720
5470x000b8090: 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720
548@end example
549@end itemize
550
551@item p or print/fmt expr
552
553Print expression value. Only the @var{format} part of @var{fmt} is
554used.
0806e3f6 555
a3a91a35
FB
556@item sendkey keys
557
558Send @var{keys} to the emulator. Use @code{-} to press several keys
559simultaneously. Example:
560@example
561sendkey ctrl-alt-f1
562@end example
563
564This command is useful to send keys that your graphical user interface
565intercepts at low level, such as @code{ctrl-alt-f1} in X Window.
566
15a34c63
FB
567@item system_reset
568
569Reset the system.
570
1f673135 571@end table
0806e3f6 572
1f673135
FB
573@subsection Integer expressions
574
575The monitor understands integers expressions for every integer
576argument. You can use register names to get the value of specifics
577CPU registers by prefixing them with @emph{$}.
ec410fc9 578
1f47a922
FB
579@node disk_images
580@section Disk Images
581
acd935ef
FB
582Since version 0.6.1, QEMU supports many disk image formats, including
583growable disk images (their size increase as non empty sectors are
584written), compressed and encrypted disk images.
1f47a922 585
acd935ef
FB
586@subsection Quick start for disk image creation
587
588You can create a disk image with the command:
1f47a922 589@example
acd935ef 590qemu-img create myimage.img mysize
1f47a922 591@end example
acd935ef
FB
592where @var{myimage.img} is the disk image filename and @var{mysize} is its
593size in kilobytes. You can add an @code{M} suffix to give the size in
594megabytes and a @code{G} suffix for gigabytes.
595
596@xref{qemu_img_invocation} for more information.
1f47a922
FB
597
598@subsection Snapshot mode
599
600If you use the option @option{-snapshot}, all disk images are
601considered as read only. When sectors in written, they are written in
602a temporary file created in @file{/tmp}. You can however force the
acd935ef
FB
603write back to the raw disk images by using the @code{commit} monitor
604command (or @key{C-a s} in the serial console).
1f47a922 605
acd935ef
FB
606@node qemu_img_invocation
607@subsection @code{qemu-img} Invocation
1f47a922 608
acd935ef 609@include qemu-img.texi
05efe46e 610
9d4fb82e
FB
611@section Network emulation
612
613QEMU simulates up to 6 networks cards (NE2000 boards). Each card can
614be connected to a specific host network interface.
615
616@subsection Using tun/tap network interface
617
618This is the standard way to emulate network. QEMU adds a virtual
619network device on your host (called @code{tun0}), and you can then
620configure it as if it was a real ethernet card.
621
622As an example, you can download the @file{linux-test-xxx.tar.gz}
623archive and copy the script @file{qemu-ifup} in @file{/etc} and
624configure properly @code{sudo} so that the command @code{ifconfig}
625contained in @file{qemu-ifup} can be executed as root. You must verify
626that your host kernel supports the TUN/TAP network interfaces: the
627device @file{/dev/net/tun} must be present.
628
629See @ref{direct_linux_boot} to have an example of network use with a
630Linux distribution.
631
632@subsection Using the user mode network stack
633
443f1376
FB
634By using the option @option{-user-net} or if you have no tun/tap init
635script, QEMU uses a completely user mode network stack (you don't need
636root priviledge to use the virtual network). The virtual network
637configuration is the following:
9d4fb82e
FB
638
639@example
640
641QEMU Virtual Machine <------> Firewall/DHCP server <-----> Internet
642 (10.0.2.x) | (10.0.2.2)
643 |
2518bd0d
FB
644 ----> DNS server (10.0.2.3)
645 |
646 ----> SMB server (10.0.2.4)
9d4fb82e
FB
647@end example
648
649The QEMU VM behaves as if it was behind a firewall which blocks all
650incoming connections. You can use a DHCP client to automatically
651configure the network in the QEMU VM.
652
653In order to check that the user mode network is working, you can ping
654the address 10.0.2.2 and verify that you got an address in the range
65510.0.2.x from the QEMU virtual DHCP server.
656
b415a407
FB
657Note that @code{ping} is not supported reliably to the internet as it
658would require root priviledges. It means you can only ping the local
659router (10.0.2.2).
660
9bf05444
FB
661When using the built-in TFTP server, the router is also the TFTP
662server.
663
664When using the @option{-redir} option, TCP or UDP connections can be
665redirected from the host to the guest. It allows for example to
666redirect X11, telnet or SSH connections.
443f1376 667
9d4fb82e
FB
668@node direct_linux_boot
669@section Direct Linux Boot
1f673135
FB
670
671This section explains how to launch a Linux kernel inside QEMU without
672having to make a full bootable image. It is very useful for fast Linux
673kernel testing. The QEMU network configuration is also explained.
674
675@enumerate
676@item
677Download the archive @file{linux-test-xxx.tar.gz} containing a Linux
678kernel and a disk image.
679
680@item Optional: If you want network support (for example to launch X11 examples), you
681must copy the script @file{qemu-ifup} in @file{/etc} and configure
682properly @code{sudo} so that the command @code{ifconfig} contained in
683@file{qemu-ifup} can be executed as root. You must verify that your host
684kernel supports the TUN/TAP network interfaces: the device
685@file{/dev/net/tun} must be present.
686
687When network is enabled, there is a virtual network connection between
688the host kernel and the emulated kernel. The emulated kernel is seen
689from the host kernel at IP address 172.20.0.2 and the host kernel is
690seen from the emulated kernel at IP address 172.20.0.1.
691
692@item Launch @code{qemu.sh}. You should have the following output:
693
694@example
695> ./qemu.sh
696Connected to host network interface: tun0
697Linux 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
698BIOS-provided physical RAM map:
699 BIOS-e801: 0000000000000000 - 000000000009f000 (usable)
700 BIOS-e801: 0000000000100000 - 0000000002000000 (usable)
70132MB LOWMEM available.
702On node 0 totalpages: 8192
703zone(0): 4096 pages.
704zone(1): 4096 pages.
705zone(2): 0 pages.
706Kernel command line: root=/dev/hda sb=0x220,5,1,5 ide2=noprobe ide3=noprobe ide4=noprobe ide5=noprobe console=ttyS0
707ide_setup: ide2=noprobe
708ide_setup: ide3=noprobe
709ide_setup: ide4=noprobe
710ide_setup: ide5=noprobe
711Initializing CPU#0
712Detected 2399.621 MHz processor.
713Console: colour EGA 80x25
714Calibrating delay loop... 4744.80 BogoMIPS
715Memory: 28872k/32768k available (1210k kernel code, 3508k reserved, 266k data, 64k init, 0k highmem)
716Dentry cache hash table entries: 4096 (order: 3, 32768 bytes)
717Inode cache hash table entries: 2048 (order: 2, 16384 bytes)
718Mount cache hash table entries: 512 (order: 0, 4096 bytes)
719Buffer-cache hash table entries: 1024 (order: 0, 4096 bytes)
720Page-cache hash table entries: 8192 (order: 3, 32768 bytes)
721CPU: Intel Pentium Pro stepping 03
722Checking 'hlt' instruction... OK.
723POSIX conformance testing by UNIFIX
724Linux NET4.0 for Linux 2.4
725Based upon Swansea University Computer Society NET3.039
726Initializing RT netlink socket
727apm: BIOS not found.
728Starting kswapd
729Journalled Block Device driver loaded
730Detected PS/2 Mouse Port.
731pty: 256 Unix98 ptys configured
732Serial driver version 5.05c (2001-07-08) with no serial options enabled
733ttyS00 at 0x03f8 (irq = 4) is a 16450
734ne.c:v1.10 9/23/94 Donald Becker (becker@scyld.com)
735Last modified Nov 1, 2000 by Paul Gortmaker
736NE*000 ethercard probe at 0x300: 52 54 00 12 34 56
737eth0: NE2000 found at 0x300, using IRQ 9.
738RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
739Uniform Multi-Platform E-IDE driver Revision: 7.00beta4-2.4
740ide: Assuming 50MHz system bus speed for PIO modes; override with idebus=xx
741hda: QEMU HARDDISK, ATA DISK drive
742ide0 at 0x1f0-0x1f7,0x3f6 on irq 14
743hda: attached ide-disk driver.
744hda: 20480 sectors (10 MB) w/256KiB Cache, CHS=20/16/63
745Partition check:
746 hda:
747Soundblaster audio driver Copyright (C) by Hannu Savolainen 1993-1996
748NET4: Linux TCP/IP 1.0 for NET4.0
749IP Protocols: ICMP, UDP, TCP, IGMP
750IP: routing cache hash table of 512 buckets, 4Kbytes
751TCP: Hash tables configured (established 2048 bind 4096)
752NET4: Unix domain sockets 1.0/SMP for Linux NET4.0.
753EXT2-fs warning: mounting unchecked fs, running e2fsck is recommended
754VFS: Mounted root (ext2 filesystem).
755Freeing unused kernel memory: 64k freed
756
757Linux 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
758
759QEMU Linux test distribution (based on Redhat 9)
760
761Type 'exit' to halt the system
762
763sh-2.05b#
764@end example
765
766@item
767Then you can play with the kernel inside the virtual serial console. You
768can launch @code{ls} for example. Type @key{Ctrl-a h} to have an help
769about the keys you can type inside the virtual serial console. In
770particular, use @key{Ctrl-a x} to exit QEMU and use @key{Ctrl-a b} as
771the Magic SysRq key.
772
773@item
774If the network is enabled, launch the script @file{/etc/linuxrc} in the
775emulator (don't forget the leading dot):
776@example
777. /etc/linuxrc
778@end example
779
780Then enable X11 connections on your PC from the emulated Linux:
781@example
782xhost +172.20.0.2
783@end example
784
785You can now launch @file{xterm} or @file{xlogo} and verify that you have
786a real Virtual Linux system !
787
788@end enumerate
789
790NOTES:
791@enumerate
792@item
793A 2.5.74 kernel is also included in the archive. Just
794replace the bzImage in qemu.sh to try it.
795
1f673135
FB
796@item
797In order to exit cleanly from qemu, you can do a @emph{shutdown} inside
798qemu. qemu will automatically exit when the Linux shutdown is done.
799
800@item
801You can boot slightly faster by disabling the probe of non present IDE
802interfaces. To do so, add the following options on the kernel command
803line:
804@example
805ide1=noprobe ide2=noprobe ide3=noprobe ide4=noprobe ide5=noprobe
806@end example
807
808@item
809The example disk image is a modified version of the one made by Kevin
810Lawton for the plex86 Project (@url{www.plex86.org}).
811
812@end enumerate
813
0806e3f6 814@node gdb_usage
da415d54
FB
815@section GDB usage
816
817QEMU has a primitive support to work with gdb, so that you can do
0806e3f6 818'Ctrl-C' while the virtual machine is running and inspect its state.
da415d54 819
9d4520d0 820In order to use gdb, launch qemu with the '-s' option. It will wait for a
da415d54
FB
821gdb connection:
822@example
6c9bf893 823> qemu -s -kernel arch/i386/boot/bzImage -hda root-2.4.20.img -append "root=/dev/hda"
da415d54
FB
824Connected to host network interface: tun0
825Waiting gdb connection on port 1234
826@end example
827
828Then launch gdb on the 'vmlinux' executable:
829@example
830> gdb vmlinux
831@end example
832
833In gdb, connect to QEMU:
834@example
6c9bf893 835(gdb) target remote localhost:1234
da415d54
FB
836@end example
837
838Then you can use gdb normally. For example, type 'c' to launch the kernel:
839@example
840(gdb) c
841@end example
842
0806e3f6
FB
843Here are some useful tips in order to use gdb on system code:
844
845@enumerate
846@item
847Use @code{info reg} to display all the CPU registers.
848@item
849Use @code{x/10i $eip} to display the code at the PC position.
850@item
851Use @code{set architecture i8086} to dump 16 bit code. Then use
852@code{x/10i $cs*16+*eip} to dump the code at the PC position.
853@end enumerate
854
1a084f3d
FB
855@section Target OS specific information
856
857@subsection Linux
858
15a34c63
FB
859To have access to SVGA graphic modes under X11, use the @code{vesa} or
860the @code{cirrus} X11 driver. For optimal performances, use 16 bit
861color depth in the guest and the host OS.
1a084f3d 862
e3371e62
FB
863When using a 2.6 guest Linux kernel, you should add the option
864@code{clock=pit} on the kernel command line because the 2.6 Linux
865kernels make very strict real time clock checks by default that QEMU
866cannot simulate exactly.
867
7c3fc84d
FB
868When using a 2.6 guest Linux kernel, verify that the 4G/4G patch is
869not activated because QEMU is slower with this patch. The QEMU
870Accelerator Module is also much slower in this case. Earlier Fedora
871Core 3 Linux kernel (< 2.6.9-1.724_FC3) were known to incorporte this
872patch by default. Newer kernels don't have it.
873
1a084f3d
FB
874@subsection Windows
875
876If you have a slow host, using Windows 95 is better as it gives the
877best speed. Windows 2000 is also a good choice.
878
e3371e62
FB
879@subsubsection SVGA graphic modes support
880
881QEMU emulates a Cirrus Logic GD5446 Video
15a34c63
FB
882card. All Windows versions starting from Windows 95 should recognize
883and use this graphic card. For optimal performances, use 16 bit color
884depth in the guest and the host OS.
1a084f3d 885
e3371e62
FB
886@subsubsection CPU usage reduction
887
888Windows 9x does not correctly use the CPU HLT
15a34c63
FB
889instruction. The result is that it takes host CPU cycles even when
890idle. You can install the utility from
891@url{http://www.user.cityline.ru/~maxamn/amnhltm.zip} to solve this
892problem. Note that no such tool is needed for NT, 2000 or XP.
1a084f3d 893
e3371e62
FB
894@subsubsection Windows 2000 disk full problems
895
896Currently (release 0.6.0) QEMU has a bug which gives a @code{disk
897full} error during installation of some releases of Windows 2000. The
898workaround is to stop QEMU as soon as you notice that your disk image
899size is growing too fast (monitor it with @code{ls -ls}). Then
900relaunch QEMU to continue the installation. If you still experience
901the problem, relaunch QEMU again.
902
903Future QEMU releases are likely to correct this bug.
904
905@subsubsection Windows XP security problems
906
907Some releases of Windows XP install correctly but give a security
908error when booting:
909@example
910A problem is preventing Windows from accurately checking the
911license for this computer. Error code: 0x800703e6.
912@end example
913The only known workaround is to boot in Safe mode
914without networking support.
915
916Future QEMU releases are likely to correct this bug.
917
a0a821a4
FB
918@subsection MS-DOS and FreeDOS
919
920@subsubsection CPU usage reduction
921
922DOS does not correctly use the CPU HLT instruction. The result is that
923it takes host CPU cycles even when idle. You can install the utility
924from @url{http://www.vmware.com/software/dosidle210.zip} to solve this
925problem.
926
15a34c63 927@chapter QEMU PowerPC System emulator invocation
1a084f3d 928
15a34c63
FB
929Use the executable @file{qemu-system-ppc} to simulate a complete PREP
930or PowerMac PowerPC system.
1a084f3d 931
15a34c63 932QEMU emulates the following PowerMac peripherials:
1a084f3d 933
15a34c63
FB
934@itemize @minus
935@item
936UniNorth PCI Bridge
937@item
938PCI VGA compatible card with VESA Bochs Extensions
939@item
9402 PMAC IDE interfaces with hard disk and CD-ROM support
941@item
942NE2000 PCI adapters
943@item
944Non Volatile RAM
945@item
946VIA-CUDA with ADB keyboard and mouse.
1a084f3d
FB
947@end itemize
948
52c00a5f
FB
949QEMU emulates the following PREP peripherials:
950
951@itemize @minus
952@item
15a34c63
FB
953PCI Bridge
954@item
955PCI VGA compatible card with VESA Bochs Extensions
956@item
52c00a5f
FB
9572 IDE interfaces with hard disk and CD-ROM support
958@item
959Floppy disk
960@item
15a34c63 961NE2000 network adapters
52c00a5f
FB
962@item
963Serial port
964@item
965PREP Non Volatile RAM
15a34c63
FB
966@item
967PC compatible keyboard and mouse.
52c00a5f
FB
968@end itemize
969
15a34c63
FB
970QEMU uses the Open Hack'Ware Open Firmware Compatible BIOS available at
971@url{http://site.voila.fr/jmayer/OpenHackWare/index.htm}.
972
52c00a5f
FB
973You can read the qemu PC system emulation chapter to have more
974informations about QEMU usage.
975
15a34c63
FB
976@c man begin OPTIONS
977
978The following options are specific to the PowerPC emulation:
979
980@table @option
981
982@item -prep
983Simulate a PREP system (default is PowerMAC)
984
985@item -g WxH[xDEPTH]
986
987Set the initial VGA graphic mode. The default is 800x600x15.
988
989@end table
990
991@c man end
992
993
52c00a5f
FB
994More information is available at
995@url{http://jocelyn.mayer.free.fr/qemu-ppc/}.
996
e80cfcfc
FB
997@chapter Sparc System emulator invocation
998
999Use the executable @file{qemu-system-sparc} to simulate a JavaStation
1000(sun4m architecture). The emulation is far from complete.
1001
1002QEMU emulates the following sun4m peripherials:
1003
1004@itemize @minus
1005@item
1006IOMMU
1007@item
1008TCX Frame buffer
1009@item
1010Lance (Am7990) Ethernet
1011@item
1012Non Volatile RAM M48T08
1013@item
1014Slave I/O: timers, interrupt controllers, Zilog serial ports
1015@end itemize
1016
1017QEMU uses the Proll, a PROM replacement available at
1018@url{http://people.redhat.com/zaitcev/linux/}.
1019
1f673135 1020@chapter QEMU User space emulator invocation
386405f7 1021
1f673135 1022@section Quick Start
df0f11a0 1023
1f673135
FB
1024In order to launch a Linux process, QEMU needs the process executable
1025itself and all the target (x86) dynamic libraries used by it.
386405f7 1026
1f673135 1027@itemize
386405f7 1028
1f673135
FB
1029@item On x86, you can just try to launch any process by using the native
1030libraries:
386405f7 1031
1f673135
FB
1032@example
1033qemu-i386 -L / /bin/ls
1034@end example
386405f7 1035
1f673135
FB
1036@code{-L /} tells that the x86 dynamic linker must be searched with a
1037@file{/} prefix.
386405f7 1038
1f673135 1039@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):
386405f7 1040
1f673135
FB
1041@example
1042qemu-i386 -L / qemu-i386 -L / /bin/ls
1043@end example
386405f7 1044
1f673135
FB
1045@item On non x86 CPUs, you need first to download at least an x86 glibc
1046(@file{qemu-runtime-i386-XXX-.tar.gz} on the QEMU web page). Ensure that
1047@code{LD_LIBRARY_PATH} is not set:
df0f11a0 1048
1f673135
FB
1049@example
1050unset LD_LIBRARY_PATH
1051@end example
1eb87257 1052
1f673135 1053Then you can launch the precompiled @file{ls} x86 executable:
1eb87257 1054
1f673135
FB
1055@example
1056qemu-i386 tests/i386/ls
1057@end example
1058You can look at @file{qemu-binfmt-conf.sh} so that
1059QEMU is automatically launched by the Linux kernel when you try to
1060launch x86 executables. It requires the @code{binfmt_misc} module in the
1061Linux kernel.
1eb87257 1062
1f673135
FB
1063@item The x86 version of QEMU is also included. You can try weird things such as:
1064@example
1065qemu-i386 /usr/local/qemu-i386/bin/qemu-i386 /usr/local/qemu-i386/bin/ls-i386
1066@end example
1eb20527 1067
1f673135 1068@end itemize
1eb20527 1069
1f673135 1070@section Wine launch
1eb20527 1071
1f673135 1072@itemize
386405f7 1073
1f673135
FB
1074@item Ensure that you have a working QEMU with the x86 glibc
1075distribution (see previous section). In order to verify it, you must be
1076able to do:
386405f7 1077
1f673135
FB
1078@example
1079qemu-i386 /usr/local/qemu-i386/bin/ls-i386
1080@end example
386405f7 1081
1f673135
FB
1082@item Download the binary x86 Wine install
1083(@file{qemu-XXX-i386-wine.tar.gz} on the QEMU web page).
386405f7 1084
1f673135
FB
1085@item Configure Wine on your account. Look at the provided script
1086@file{/usr/local/qemu-i386/bin/wine-conf.sh}. Your previous
1087@code{$@{HOME@}/.wine} directory is saved to @code{$@{HOME@}/.wine.org}.
386405f7 1088
1f673135 1089@item Then you can try the example @file{putty.exe}:
386405f7 1090
1f673135
FB
1091@example
1092qemu-i386 /usr/local/qemu-i386/wine/bin/wine /usr/local/qemu-i386/wine/c/Program\ Files/putty.exe
1093@end example
386405f7 1094
1f673135 1095@end itemize
fd429f2f 1096
1f673135 1097@section Command line options
1eb20527 1098
1f673135
FB
1099@example
1100usage: qemu-i386 [-h] [-d] [-L path] [-s size] program [arguments...]
1101@end example
1eb20527 1102
1f673135
FB
1103@table @option
1104@item -h
1105Print the help
1106@item -L path
1107Set the x86 elf interpreter prefix (default=/usr/local/qemu-i386)
1108@item -s size
1109Set the x86 stack size in bytes (default=524288)
386405f7
FB
1110@end table
1111
1f673135 1112Debug options:
386405f7 1113
1f673135
FB
1114@table @option
1115@item -d
1116Activate log (logfile=/tmp/qemu.log)
1117@item -p pagesize
1118Act as if the host page size was 'pagesize' bytes
1119@end table
386405f7 1120
15a34c63
FB
1121@node compilation
1122@chapter Compilation from the sources
1123
7c3fc84d
FB
1124@section Linux/Unix
1125
1126@subsection Compilation
1127
1128First you must decompress the sources:
1129@example
1130cd /tmp
1131tar zxvf qemu-x.y.z.tar.gz
1132cd qemu-x.y.z
1133@end example
1134
1135Then you configure QEMU and build it (usually no options are needed):
1136@example
1137./configure
1138make
1139@end example
1140
1141Then type as root user:
1142@example
1143make install
1144@end example
1145to install QEMU in @file{/usr/local}.
1146
7c3fc84d
FB
1147@subsection Tested tool versions
1148
1149In order to compile QEMU succesfully, it is very important that you
1150have the right tools. The most important one is gcc. I cannot guaranty
1151that QEMU works if you do not use a tested gcc version. Look at
1152'configure' and 'Makefile' if you want to make a different gcc
1153version work.
1154
1155@example
1156host gcc binutils glibc linux distribution
1157----------------------------------------------------------------------
1158x86 3.2 2.13.2 2.1.3 2.4.18
1159 2.96 2.11.93.0.2 2.2.5 2.4.18 Red Hat 7.3
1160 3.2.2 2.13.90.0.18 2.3.2 2.4.20 Red Hat 9
1161
1162PowerPC 3.3 [4] 2.13.90.0.18 2.3.1 2.4.20briq
1163 3.2
1164
1165Alpha 3.3 [1] 2.14.90.0.4 2.2.5 2.2.20 [2] Debian 3.0
1166
1167Sparc32 2.95.4 2.12.90.0.1 2.2.5 2.4.18 Debian 3.0
1168
1169ARM 2.95.4 2.12.90.0.1 2.2.5 2.4.9 [3] Debian 3.0
1170
1171[1] On Alpha, QEMU needs the gcc 'visibility' attribute only available
1172 for gcc version >= 3.3.
1173[2] Linux >= 2.4.20 is necessary for precise exception support
1174 (untested).
1175[3] 2.4.9-ac10-rmk2-np1-cerf2
1176
1177[4] gcc 2.95.x generates invalid code when using too many register
1178variables. You must use gcc 3.x on PowerPC.
1179@end example
15a34c63
FB
1180
1181@section Windows
1182
1183@itemize
1184@item Install the current versions of MSYS and MinGW from
1185@url{http://www.mingw.org/}. You can find detailed installation
1186instructions in the download section and the FAQ.
1187
1188@item Download
1189the MinGW development library of SDL 1.2.x
1190(@file{SDL-devel-1.2.x-mingw32.tar.gz}) from
1191@url{http://www.libsdl.org}. Unpack it in a temporary place, and
1192unpack the archive @file{i386-mingw32msvc.tar.gz} in the MinGW tool
1193directory. Edit the @file{sdl-config} script so that it gives the
1194correct SDL directory when invoked.
1195
1196@item Extract the current version of QEMU.
1197
1198@item Start the MSYS shell (file @file{msys.bat}).
1199
1200@item Change to the QEMU directory. Launch @file{./configure} and
1201@file{make}. If you have problems using SDL, verify that
1202@file{sdl-config} can be launched from the MSYS command line.
1203
1204@item You can install QEMU in @file{Program Files/Qemu} by typing
1205@file{make install}. Don't forget to copy @file{SDL.dll} in
1206@file{Program Files/Qemu}.
1207
1208@end itemize
1209
1210@section Cross compilation for Windows with Linux
1211
1212@itemize
1213@item
1214Install the MinGW cross compilation tools available at
1215@url{http://www.mingw.org/}.
1216
1217@item
1218Install the Win32 version of SDL (@url{http://www.libsdl.org}) by
1219unpacking @file{i386-mingw32msvc.tar.gz}. Set up the PATH environment
1220variable so that @file{i386-mingw32msvc-sdl-config} can be launched by
1221the QEMU configuration script.
1222
1223@item
1224Configure QEMU for Windows cross compilation:
1225@example
1226./configure --enable-mingw32
1227@end example
1228If necessary, you can change the cross-prefix according to the prefix
1229choosen for the MinGW tools with --cross-prefix. You can also use
1230--prefix to set the Win32 install path.
1231
1232@item You can install QEMU in the installation directory by typing
1233@file{make install}. Don't forget to copy @file{SDL.dll} in the
1234installation directory.
1235
1236@end itemize
1237
1238Note: Currently, Wine does not seem able to launch
1239QEMU for Win32.
1240
1241@section Mac OS X
1242
1243The Mac OS X patches are not fully merged in QEMU, so you should look
1244at the QEMU mailing list archive to have all the necessary
1245information.
1246