Showing posts with label Emulator. Show all posts
Showing posts with label Emulator. Show all posts

Thursday, June 9, 2011

Turn back to Bochs

After a few days tried to use QEMU as an emulator for studying low-level software, it turned out to me that QEMU doesn't support much for debugging. Things like step-by-step run, set break points,... is unable. Then I went back to have a try with Bochs. It's amazing that Bochs is not that hard as I've ever thought. It even provides very good debugging features.

Here're some of my notes on Bochs installation and use:

  1. Download Bochs source code at http://bochs.sourceforge.net/getcurrent.html

  2. Extract Bochs code
      $ gunzip -c bochs-version.tar.gz | tar -xvf -

  3. Configure to use debugger
      $ ./configure --enable-debugger --enable-disasm

  4. Install
    $ make
    $ sudo make install

  5. There an example Bochs configs file name .bochsrc at extracted dir

Tuesday, May 17, 2011

Some notes on QEMU

I am finding a computer emulator so that I can use to experiment some low-level softwares. There are two prominent free and open-source emulators: Bochs and QEMU. Bochs seems more popular but lacks of documentation. So I have decided to use QEMU because it's quite simple to use and well documented.

1. Installation (on Ubuntu)
    $ sudo apt-get install qemu

2. Start emulator
    $ qemu [options] [disk_image] 
       --> This means start an emulator with specified options and disk_image (usually contains OS)

    Ex:
      $ qemu linux.img
             --> Start an emulator with default options and its hard disk contains linux.img

    There are lots of options which specify how your emulated computer could be such as what type of its cpu, hard disk, video card, sound card,... You can get more details on each option in QEMU documentation.

3. Monitoring
    QEMU provides a way to monitoring your emulator in which you can inspect your emulator, control it, change its devices, query its status,...

    You can switch back and forth between the emulator and its monitor with keystrokes: Ctrl+Alt+2 and Ctrl+Alt+1

    Some monitoring commands:
    (qemu) help or ? [cmd] 
    (qemu) change device setting
    (qemu) x/fmt addr
           Virtual memory dump starting at addr
    (qemu) xp/fmt addr
           Physical memory dump starting at addr 
    ...