Press "Enter" to skip to content

Bochs Emulator – Config & Build on Windows and OS X

Sinaei 2


Bochs is an x86 – x86-64 multiplatform emulator that provides emulation of CPU Instruction Fetching without using Hypervisor technologies like Intel’s VT-x and AMD-V.

One of the benefits of emulation rather than virtualization is that you can execute instructions of old discontinued CPU structures in modern CPU or run Intel’s instructions on an AMD CPU or vice versa, more than that Bochs developers try to make Bochs devices like virtualization software devices.They provide keyboard, speaker, cdrom, disk, floppy, network device and etc.

Emulation is somehow like high-level programming languages like Java when using its bytecode or .Net Framework when using MSIL.

From IBM :

Java technology implements just-in-time (JIT) compilation to work around some of the inefficiencies, similar to Transmeta and numerous other emulation solutions (including QEMU, another platform emulation solution similar to Bochs). But Bochs also achieves efficient emulation (up to 100 million instructions per second [MIPS] on a modern processor) while also being portable. Bochs was developed purely in the C++ language for interpreted x86 instruction execution and platform emulation.



Because of instructions doesn’t directly execute on a Bochs machine, It is too much slower than CPU on virtualization so Bochs comes at the cost of performance.

Even though Bochs is really slow but it gives us other benefits that worths using the emulator like Instrumenting an operating system kernel which I described in Bochs Emulator – Debug & Instrument.

Bochs is an open-source program and in order to use some features like instrumentation and other optimization you need to compile it by your self, more than that you can edit the source code for researching because Bochs have lots of cool features that can be manipulated in order to better optimize your needs, so I prefer to compile it rather than downloading its binaries.

ok, that’s enough for introduction, let’s see how to “make” it!

In the rest of topic, I’m trying to build bochs-2.9.

Configure & Make in OS X

First, you need to download the project source code, you can find it here.

The documentation uses the following syntax in order to build the Bochs on OS X machines

But it gives me the following error after running “make”:

that’s a weird error! I don’t know why this happens but I simply go to “” file and change the following line:


And simply ignore this problem.

Let’s “make” it again.

That’s too bad! 20 errors.

I googled it and understand that this problem happens because the libraries that it used for it’s GUI is no longer available for OS X, so the problem can be solved using SDL instead.

Now you need to download and install SDL.

Then compile the Bochs using the following syntax.

Even though this problem is reported to Bochs developers but it seems none of them uses OS X, I’m sure this problem will be solved in the future versions of Bochs.

Finally, it compiles without error, but actually, I want to use more features of Bochs like disasm and debug features and instrumentation and etc.

I use the following syntax to compile the Bochs:

If there isn’t any problem, you can now run the Bochs.

This time, when I run Bochs it gives me the following error:

Actually, this problem happens because the CPU architecture that selected in “.bochsrc” file is not available in the current built.

You should run the following command in order to get the supported CPUs:

Then I modified the following line:

change the “core2_penryn_t9600” to e.g “core_duo_t2400_yonah”.

Running bochs again produces such error :

It is because we didn’t configure Bochs for preparing sound device and we use “sound” option in “.bochsrc”, in order to build with sound support you can use one of the “–enable-sb16” or “–enable-es1370” in configuring and “make” again but I rather remove the following line from “.bochsrc” to build it again.

Now it runs without error.

Building Bochs on Windows

To build Bochs for Windows you have multiple options, like building with Cygwin or MinGW but I’d rather build Bochs with Visual Studio instead.

Download ( latest version from here.

Extract the go to vs2013 and open “bochs.sln”.

You need to enable some of the features before building the solution. (It’s like ./configure –enable-x in OS X and Linux)

Go to “config.h” and modify it like this:

In order to enable debugging make sure your config file is :

I also need Instrumentation so changed the following line:

make sure disable BX_SUPPORT_HANDLERS_CHAINING_SPEEDUPS because of some incompatibility issues.

Then trying to build and this time it gives me the following error:

And other such errors which are linking problems.

I add the following line to :

That line solves the linking problems. If there isn’t any error then just build the solution.

Installing Windows on Bochs

Installing an operating system in Bochs is a little tricky, open bochs.exe (from what you built before.) then make sure that it starts without any problem (some systems have problem opening Bochs !).

Bochs uses an image file for the purpose of its hard disk, there is a tool called bximage.exe which creates such file for you.

Open bximage.exe :

Then choose 1 (Create new floppy or hard disk image). In the second step choose hd for device type, growing for the next question and then choose how much space you need to allocate to your emulated machine.

In the last step specify a name and you’re good to go!

A complete result of bximage is like :

After creating the image file, now you need to configure your Bochs machine.

Open the Bochs.exe and edit the memory option.

Set the memory size (megabytes) and host allocated size (megabytes) to a value greater than 32!  I choose 1000.

Then edit CPU option > CPU Configuration to turion64_tyler or whatever supports x86-64, make sure to set a proper value for Emulated instructions per second (IPS). Press OK and edit Disk & Boot > ATA Channel > First HD/CD on channel 0. In this window set Type of ATA device to disk, set path or physical device name to the c.img (the file that is created previously by bximage), Type of disk image to growing, Cylinders to 20317, heads to 16, Sectors per track to 63.

Now go to another tab (Second HD/CD on channel 0) and set the type of disk to cdrom, Path or physical device name to the Windows ISO file.

For the last step go to Boot Options, set Boot drive #1 to disk and Boot drive #2 to cdrom.

That’s it, make sure to save your configuration to avoid doing these steps again and then press start.

Select continue and don’t ask again if a prompt comes to the screen then restart the machine and you should see the Windows installation.

If you see the following picture, then you’re done.


By now, you should’ve configured Bochs, Let’s use more features of Bochs in the next post. (Bochs Emulator – Debug & Instrument).


  1. John Mask John Mask

    I want to run Windows 7 HDD image on the Bochs. But I have occurred a problem like below:

    $ ./bochs.exe -f ./win.rc -q
    16764064012e[CPU0 ] RDMSR: Unknown register 0x1a0
    16764064019e[CPU0 ] WRMSR: Unknown register 0x1a0
    16764064448e[CPU0 ] WRMSR: Unknown register 0x8b
    16764064496e[CPU0 ] RDMSR: Unknown register 0x8b
    16764073079e[CPU0 ] RDMSR: Unknown register 0x17
    16764073117e[CPU0 ] WRMSR: Unknown register 0x8b
    16764073176e[CPU0 ] RDMSR: Unknown register 0x8b
    16764074341e[CPU0 ] WRMSR: Unknown register 0x8b
    16764074421e[CPU0 ] RDMSR: Unknown register 0x8b
    16764108661i[CPU0 ] WRMSR: write 0x0000000000000000 to MSR_TSC
    21474841174i[IOAPIC] IOAPIC: could not write, IOREGSEL=0x01
    21474841174i[IOAPIC] IOAPIC: could not write, IOREGSEL=0x01
    21474842999i[IOAPIC] IOAPIC: setting id to 0x1
    21474843468i[IOAPIC] IOAPIC: could not write, IOREGSEL=0x01
    21474843468i[IOAPIC] IOAPIC: could not write, IOREGSEL=0x01
    21474843638i[IOAPIC] IOAPIC: could not write, IOREGSEL=0x01
    21474843638i[IOAPIC] IOAPIC: could not write, IOREGSEL=0x01
    21474844051i[IOAPIC] IOAPIC: could not write, IOREGSEL=0x01
    21474844051i[IOAPIC] IOAPIC: could not write, IOREGSEL=0x01
    Then it dies with BSOD.

    At the first stage, I have converted vdi to raw format with below command: “C:\Program Files\Oracle\VirtualBox\VBoxManage.exe” internalcommands converttoraw win7.vdi win7.raw. Then I have used converted raw file as disk image.

    my configuration file:

    memory: host=512, guest=1024
    romimage: file=”C:\Program Files (x86)\Bochs-2.6.9/BIOS-bochs-latest”, address=0x0, options=none
    vgaromimage: file=”C:\Program Files (x86)\Bochs-2.6.9/VGABIOS-lgpl-latest”
    boot: disk
    pci: enabled=1, chipset=i440fx
    vga: extension=vbe, update_freq=5, realtime=1
    cpu: count=1, ips=4294967295, model=corei7_sandy_bridge_2600k, reset_on_triple_fault=1, cpuid_limit_winnt=0, ignore_bad_msrs=1, mwait_is_nop=0
    clock: sync=none, time0=local, rtc_sync=0
    ata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14
    ata1: enabled=1, ioaddr1=0x170, ioaddr2=0x370, irq=15
    ata2: enabled=0, ioaddr1=0x1e8, ioaddr2=0x3e0, irq=11
    ata3: enabled=0, ioaddr1=0x168, ioaddr2=0x360, irq=9
    ata0-master: type=disk, path=”C:\Users\aslr\Documents\pwned\test.raw”, mode=flat

    • Sinaei Sinaei

      Well, Actually I didn’t see anything like this before but the errors seem to be structure-related so try to change model=corei7_sandy_bridge_2600k and lower the count of ips=4294967295…
      you can also increase guest=1024 and test it again.

Leave a Reply

Your email address will not be published. Required fields are marked *