QEMU: Difference between revisions

Jump to navigation Jump to search
no edit summary
[unchecked revision][unchecked revision]
m (Add link to QEMU_fw_cfg article)
No edit summary
Line 2:
 
==Features==
* twoTwo operating modes: full system emulation (which interests us) and Linux user process emulation (which interests other people) and is a NxM platform emulator (multiple host, multiple targets).
* itIt is faster than [[Bochs]] because it uses 'just in time' code compilation technique (allowing reuse of previous interpretation)
* providesProvides native [[GDB]] support and you can attach it to [[GDB]]/[[DDD]] by adding the "-s -S" switches to the command line and from the [[GDB]] window start the debugging session with "<code>target remote :1234"</code> if QEMU is waiting on local port 1234.
* lacks technical documentation so far (imho), which probably makes it less suitable for "baby steps".
* supportSupports [[VBE]] 2.0. This can be checked if you use the [[GRUB]] command line and type vbeprobe. The test returns:
* provides native [[GDB]] support and you can attach it to [[GDB]]/[[DDD]] by adding the "-s -S" switches to the command line and from the [[GDB]] window start the debugging session with "target remote :1234" if QEMU is waiting on local port 1234.
* support [[VBE]] 2.0. This can be checked if you use the [[GRUB]] command line and type vbeprobe. The test returns:
 
 
Line 74 ⟶ 73:
 
==Supported Architectures==
* [[:Category:X86|x86]]
* [[X86-64|x86_64]]
* [[:Category:ARM|ARM]]
* [[ARM64]]
* [[LatticeMico32]]
* [[Motorola 68000]]
* [[MicroBlaze]]
* [[MIPS]]
* [[MIPS64]]
* [[Moxie]]
* [[PowerPC]]
* [[PowerPC64]]
* [[RISC-V]]
* [[IBM System/390]]
* [[SuperH]]
* [[:Category:Sparc|SPARC]]
* [[SPARC64]]
* [[TriCore]]
* [[Unicore]]
* [[Xtensa]]
 
==Supported Devices==
Line 112 ⟶ 111:
QEMU is easy to use, it does not have a configuration script like Bochs. To use QEMU with your OS,
 
<source lang="bash">
qemu -L .\ -fda my_disk_image.img -m 32
</source>
 
Or, if you use UNIX,
<source lang="bash">
qemu -fda my_disk_image.img -m 32
</source>
 
The -L tells QEMU where to find its BIOS images, which is not necessary in a standard unix installation. The -m tells how many megabytes of memory to use; the default is 128
Line 134 ⟶ 137:
 
When you hit CTRL-ALT-2 you are placed in the QEMU monitor which is a command-line for querying information about the system while it is running. It does not quite act as a debugger, but, used in combination with GDB-stub, you can get pretty much all the functionality you will need. In Unix hosts, you can even redirect this monitor interface to the standard output using the
<source lang="bash">
-monitor stdio
</source>
command-line option. Some useful commands:
; xp : eXamine Physical memory. Much like GDB's <tt>x</tt> command, but with no address translation.
Line 144 ⟶ 149:
 
===GDB-stub===
{{FirstPerson}}
 
When you supply the <tt>-s</tt> command line option, QEMU will listen on port localhost:1234 for a connection by GDB. If you also supply the <tt>-S</tt> command line option, then QEMU will start as if you set a breakpoint at time zero, and you will need to use the GDB command "continue" to actually begin the simulation.
Line 149 ⟶ 155:
For convenience, I put a file called <tt>.gdbinit</tt> in the current working directory which automatically runs certain commands when you start GDB without the <tt>-n</tt> option. For example:
 
<source lang="gdb">
file <my-kernel-binary>
target remote localhost:1234
</source>
 
will load into GDB your kernel and then connect to QEMU. Be sure to compile your kernel with the GCC option <tt>-g</tt> for debugging symbols. (If you find that the debugger can't find local variables, try using the <tt>-fno-omit-frame-pointer</tt> option when compiling, or disable optimizations.) Now you may debug your kernel as a C program.
Line 158 ⟶ 166:
 
Most of the QEMU source code has commented lines of the form:
<source lang="c">
 
// #define DEBUG_*
</source>
 
If you are willing to edit and recompile QEMU, then you can get a good deal of debugging info output to stdout by uncommenting those lines at the top of the files that implement the pieces of the simulation you need more info about.
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Navigation menu