Bochs: Difference between revisions

91 bytes added ,  29 days ago
m
Bot: Replace deprecated source tag with syntaxhighlight
[unchecked revision][unchecked revision]
m (Compiling Bochs from Source: Use SDL2 instead of 1.2)
m (Bot: Replace deprecated source tag with syntaxhighlight)
 
(One intermediate revision by one other user not shown)
Line 14:
The CPU didn't manage to invoke an exception handler and would normally [[Triple Fault|triple fault]]. This is probably due to a bad [[Interrupt Descriptor Table|IDT]] register content, or a bad IDT descriptor. Sometimes (but less likely), it can also be due to a severe bug in your exception handler code. Check your exception works with "illegal" asm instructions like <tt>idiv 0</tt>, or
 
<sourcesyntaxhighlight lang="asm">
push 0xf001
pop ds ; 0xf001 is no valid segment,
mov ax, ~[ds:0x12345678] ; let's see if we get the GPF
</syntaxhighlight>
</source>
 
In several cases, there are other error messages prior to this one which can provide more details in the error. Some common messages that might be displayed:
Line 99:
Some useful macros when Bochs is compiled with the I/O debug ports enabled (<tt>port_e9_hack: enabled=1</tt> if Bochs 2.4 or newer, <tt>configure --port-e9-hack</tt> if not):
 
<sourcesyntaxhighlight lang="c">
//outputs a character to the debug console
#define BochsConsolePrintChar(c) outportb(0xe9, c)
//stops simulation and breaks into the debug console
#define BochsBreak() outportw(0x8A00,0x8A00); outportw(0x8A00,0x08AE0);
</syntaxhighlight>
</source>
 
===Magic Breakpoint===
Line 137:
Bochs has many compile-time configuration options, some of which conflict, and therefore a binary distribution of Bochs may not be suitable for your purposes. I found it was best to compile my own copy of Bochs to be sure I had the features that I needed. Also, you should consider using the CVS snapshot version of Bochs if the released version is old and not working for you. I found this was necessary up until version 2.4 was released, for example. On Ubuntu, you may have to run
 
<sourcesyntaxhighlight lang="bash">
sudo apt-get install libgtk2.0-dev
</syntaxhighlight>
</source>
 
and enter your password. On other linux distros, try the equivalent.
Line 145:
The array of Bochs configuration options can be confusing, and you cannot assume the defaults are going to be sensible. These are the options I use, this can get you started:
 
<sourcesyntaxhighlight lang="bash">
./configure --enable-smp \
--enable-cpu-level=6 \
Line 165:
--disable-docbook \
--with-x --with-x11 --with-term --with-sdl2
</syntaxhighlight>
</source>
 
A few notes:
Line 177:
* The default compile does not support x86-64, --enable-x86-64 will turn it on
* On many Linux distributions it is possible to install Bochs via a package manager. For example, on distributions that use apt-get we can do
<sourcesyntaxhighlight lang="bash">
sudo apt-get install bochs
sudo apt-get install bochs-x
</syntaxhighlight>
</source>
to install Bochs and the X11 plugin (which may crash on ubuntu/linux mint: install the sdl plugin and use sdl instead of x as the display library in this case). Note that there is a big chance that the graphical debugger is not enabled in the binaries from the package manager.
 
Line 192:
===External Links===
*[http://bochs.sourceforge.net Bochs Homepage]
*[http://bochs.sourceforge.net/doc/docbook/user/internal-debugger.html Bochs internal debugger commadscommands documentation]
*[http://www.codeproject.com/system/MakingOS_2.asp CodeProject article on using Bochs]