QEMU Monitor: Difference between revisions

[unchecked revision][unchecked revision]
Content deleted Content added
m Bot: Replace deprecated source tag with syntaxhighlight
m Bot: Replace deprecated source tag with syntaxhighlight
Line 2:
 
==Running QEMU Monitor==
Adding the argument <sourcesyntaxhighlight lang="bash" enclose="none">-monitor [dev]</sourcesyntaxhighlight> will start the qemu monitor and start a bash-like shell at the device. For example:
<syntaxhighlight lang="bash">
qemu -hda disk.img -monitor stdio #start monitor at current shell
Line 10:
==Common usage==
===Registers===
<sourcesyntaxhighlight lang="bash" enclose="none">info registers</sourcesyntaxhighlight> will print out the current state of all registers. Besides global regisers (EAX and EIP) it also list information about segments selector and descriptor tables. Below is a snippet of the output:
 
<syntaxhighlight lang="bash">
Line 27:
 
===Memory===
Similar to GDB, <sourcesyntaxhighlight lang="bash" enclose="none">x/Nx [addr]</sourcesyntaxhighlight> will show N words starting at address [addr]. For example, to see what is loaded in memory after ''0x7C00'' (bootloader):
 
<syntaxhighlight lang="bash">
Line 36:
</syntaxhighlight>
 
To inspect an instruction at a certain memory location use <sourcesyntaxhighlight lang="bash" enclose="none">i</sourcesyntaxhighlight> instead. The format is similar: <sourcesyntaxhighlight lang="bash" enclose="none">x/Ni [addr]</sourcesyntaxhighlight>. For example, to see the an instruction at a certain place:
<syntaxhighlight lang="bash">
(qemu) x/i 0x7C00
Line 42:
</syntaxhighlight>
 
'''Note:''' <sourcesyntaxhighlight lang="bash" enclose="none">x</sourcesyntaxhighlight> normally inspects a virtual or linear addresses. In case paging is set up, <sourcesyntaxhighlight lang="bash" enclose="none">xp</sourcesyntaxhighlight> can be used to assure to display the physical address.
 
===Read I/O ports===