| 72 |
|
|
| 73 |
QEMU full system emulation features: |
QEMU full system emulation features: |
| 74 |
@itemize |
@itemize |
| 75 |
@item Using mmap() system calls to simulate the MMU |
@item QEMU can either use a full software MMU for maximum portability or use the host system call mmap() to simulate the target MMU. |
| 76 |
@end itemize |
@end itemize |
| 77 |
|
|
| 78 |
@section x86 emulation |
@section x86 emulation |
| 110 |
10 byte @code{long double}s of x86 for floating point emulation to get |
10 byte @code{long double}s of x86 for floating point emulation to get |
| 111 |
maximum performances. |
maximum performances. |
| 112 |
|
|
| 113 |
@item Full system emulation only works if no data are mapped above the virtual address |
@item Some priviledged instructions or behaviors are missing, especially for segment protection testing (yet). |
|
0xc0000000 (yet). |
|
|
|
|
|
@item Some priviledged instructions or behaviors are missing. Only the ones |
|
|
needed for proper Linux kernel operation are emulated. |
|
|
|
|
|
@item No memory separation between the kernel and the user processes is done. |
|
|
It will be implemented very soon. |
|
| 114 |
|
|
| 115 |
@end itemize |
@end itemize |
| 116 |
|
|
| 170 |
Then you can launch the precompiled @file{ls} x86 executable: |
Then you can launch the precompiled @file{ls} x86 executable: |
| 171 |
|
|
| 172 |
@example |
@example |
| 173 |
qemu-i386 /usr/local/qemu-i386/bin/ls-i386 |
qemu-i386 tests/i386/ls |
| 174 |
@end example |
@end example |
| 175 |
You can look at @file{/usr/local/qemu-i386/bin/qemu-conf.sh} so that |
You can look at @file{qemu-binfmt-conf.sh} so that |
| 176 |
QEMU is automatically launched by the Linux kernel when you try to |
QEMU is automatically launched by the Linux kernel when you try to |
| 177 |
launch x86 executables. It requires the @code{binfmt_misc} module in the |
launch x86 executables. It requires the @code{binfmt_misc} module in the |
| 178 |
Linux kernel. |
Linux kernel. |
| 251 |
@enumerate |
@enumerate |
| 252 |
|
|
| 253 |
@item |
@item |
| 254 |
@code{qemu} uses the host Memory Management Unit (MMU) to simulate |
@code{qemu-fast} uses the host Memory Management Unit (MMU) to simulate |
| 255 |
the x86 MMU. It is @emph{fast} but has limitations because the whole 4 GB |
the x86 MMU. It is @emph{fast} but has limitations because the whole 4 GB |
| 256 |
address space cannot be used and some memory mapped peripherials |
address space cannot be used and some memory mapped peripherials |
| 257 |
cannot be emulated accurately yet. Therefore, a specific Linux kernel |
cannot be emulated accurately yet. Therefore, a specific Linux kernel |
| 258 |
must be used (@xref{linux_compile}). |
must be used (@xref{linux_compile}). |
| 259 |
|
|
| 260 |
@item |
@item |
| 261 |
@code{qemu-softmmu} uses a software MMU. It is about @emph{two times |
@code{qemu} uses a software MMU. It is about @emph{two times |
| 262 |
slower} but gives a more accurate emulation. (XXX: Linux cannot be ran |
slower} but gives a more accurate emulation. |
|
unpatched yet). |
|
| 263 |
|
|
| 264 |
@end enumerate |
@end enumerate |
| 265 |
|
|
| 288 |
|
|
| 289 |
@section Quick Start |
@section Quick Start |
| 290 |
|
|
| 291 |
Download the linux image (@file{linux.img}) and type: |
Download and uncompress the linux image (@file{linux.img}) and type: |
| 292 |
|
|
| 293 |
@example |
@example |
| 294 |
qemu-softmmu linux.img |
qemu linux.img |
| 295 |
@end example |
@end example |
| 296 |
|
|
| 297 |
Linux should boot and give you a prompt. |
Linux should boot and give you a prompt. |
| 619 |
@node linux_compile |
@node linux_compile |
| 620 |
@section Linux Kernel Compilation |
@section Linux Kernel Compilation |
| 621 |
|
|
| 622 |
You should be able to use any kernel with QEMU provided you make the |
You can use any linux kernel with QEMU. However, if you want to use |
| 623 |
following changes (only 2.4.x and 2.5.x were tested): |
@code{qemu-fast} to get maximum performances, you should make the |
| 624 |
|
following changes to the Linux kernel (only 2.4.x and 2.5.x were |
| 625 |
|
tested): |
| 626 |
|
|
| 627 |
@enumerate |
@enumerate |
| 628 |
@item |
@item |
| 717 |
(gdb) c |
(gdb) c |
| 718 |
@end example |
@end example |
| 719 |
|
|
|
WARNING: breakpoints and single stepping are not yet supported. |
|
|
|
|
| 720 |
Here are some useful tips in order to use gdb on system code: |
Here are some useful tips in order to use gdb on system code: |
| 721 |
|
|
| 722 |
@enumerate |
@enumerate |
| 1011 |
In the directory @file{tests/}, various interesting testing programs |
In the directory @file{tests/}, various interesting testing programs |
| 1012 |
are available. There are used for regression testing. |
are available. There are used for regression testing. |
| 1013 |
|
|
|
@section @file{hello-i386} |
|
|
|
|
|
Very simple statically linked x86 program, just to test QEMU during a |
|
|
port to a new host CPU. |
|
|
|
|
|
@section @file{hello-arm} |
|
|
|
|
|
Very simple statically linked ARM program, just to test QEMU during a |
|
|
port to a new host CPU. |
|
|
|
|
| 1014 |
@section @file{test-i386} |
@section @file{test-i386} |
| 1015 |
|
|
| 1016 |
This program executes most of the 16 bit and 32 bit x86 instructions and |
This program executes most of the 16 bit and 32 bit x86 instructions and |
| 1026 |
Various exceptions are raised to test most of the x86 user space |
Various exceptions are raised to test most of the x86 user space |
| 1027 |
exception reporting. |
exception reporting. |
| 1028 |
|
|
| 1029 |
|
@section @file{linux-test} |
| 1030 |
|
|
| 1031 |
|
This program tests various Linux system calls. It is used to verify |
| 1032 |
|
that the system call parameters are correctly converted between target |
| 1033 |
|
and host CPUs. |
| 1034 |
|
|
| 1035 |
|
@section @file{hello-i386} |
| 1036 |
|
|
| 1037 |
|
Very simple statically linked x86 program, just to test QEMU during a |
| 1038 |
|
port to a new host CPU. |
| 1039 |
|
|
| 1040 |
|
@section @file{hello-arm} |
| 1041 |
|
|
| 1042 |
|
Very simple statically linked ARM program, just to test QEMU during a |
| 1043 |
|
port to a new host CPU. |
| 1044 |
|
|
| 1045 |
@section @file{sha1} |
@section @file{sha1} |
| 1046 |
|
|
| 1047 |
It is a simple benchmark. Care must be taken to interpret the results |
It is a simple benchmark. Care must be taken to interpret the results |