[FrontPage] [TitleIndex] [WordIndex

Note: You are looking at a static copy of the former PineWiki site, used for class notes by James Aspnes from 2003 to 2012. Many mathematical formulas are broken, and there are likely to be other bugs as well. These will most likely not be fixed. You may be able to find more up-to-date versions of some of these notes at http://www.cs.yale.edu/homes/aspnes/#classes.

Bochs is a 386 PC emulator that runs on top of a variety of operating systems. Full documentation can be found through the Sourceforge project page. These notes are to get you started with using bochs on the Zoo machines.

1. Basic use

Type bochs in a terminal emulator window. This will pop up a text menu with several options. Unless you have a bochsrc or .bochsrc file in the current directory, you will probably need to specify at minimum a disk image file using Edit Options/Disk Options. You can then run the emulator using Begin simulation from the main menu.

Since having to edit options all the time is annoying, you can save your current options out to a bochsrc file once you have the setup you like. Bochs will load options from a file with this name by default, or you can tell it to load from a different file with the -f option, e.g. bochs -f bochsrc-unusual. For CS422 assignments, we will generally supply you with a standard bochsrc file along with the assignment files.

2. Debugging

Bochs runs in debugging mode if compiled with the appropriate files. Luckily, if you are taking CS422 we have already compiled it for you. Look for common/bin/bochs-debug in your user or group directory; this should run on any recent Intel-architecture Linux machine (e.g., Zoo nodes).

The bochs-debug program works exactly like stock bochs, except that it gives a gdb-style command prompt after initializing. Type help to get a list of commands or see http://bochs.sourceforge.net/doc/docbook/user/internal-debugger.html for documentation. If you just want to run your simulation, type c (for continue).

2.1. Breakpoints and breakpoint gotchas

There are several breakpoint commands in bochs-debug. The most useful early on is probably the stock breakpoint command b, which lets you specify a physical memory address(e.g. b 0x7c00 will set a breakpoint at the start of your bootloader). One annoying feature of bochs as currently implemented appears to be that the step command will not step over a breakpoint! So you may need to delete your breakpoint (e.g. d 1 for the first one you set) before you can start stepping through your program.

3. Alternatives

Qemu is generally faster than bochs and may be more forgiving. Typical usage is qemu -fda ./image. Unfortunately, qemu doesn't come with a debugger, and we won't be testing your software with qemu by default.


CategoryOperatingSystemsNotes


2014-06-17 11:58