

# must be a twelve-character ASCII string! Newer versions of Bochs allow you to specify the vendor string in the CPU tag: For both the slowdown and original clock, you need to set the amount of instructions executed per second to the desired value.īochs emulates a CPU, so CPUID will always report back Intel (if emulating a 32-bit system) or AMD (if emulating a 64-bit system) regardless of what is really in your system. Will cause interrupts at real intervals, but may overload the emulated OS with PIT interrupts and overflow the stack (if it's pre-emptible) Using sync=slowdown will also set it to real-time speeds, but with a constant amount of virtual clock cycles between each virtual second. Waiting for 2 second on bochs will let any virtual device that needs 2 seconds to be ready be ready, but that could be just 0.02 seconds for you. (unless you configure it closer to real time). If you fail to enter 16-bit protected mode on a real PC, it will hang, without giving any error indication - no triple fault or anything! If you don't have proper error check/recovery in your bootsector, you're likely to run something that is not your kernel.īochs is flexible about returning to real modeĭespite what Chris Giese's Protected Mode tutorial states, you do not have to be in 16-bit protected mode to clear the PE bit of CR0.

In a physical PC, it's common to issue up to 3 read commands on a sector/track before it can be read fine. it may work on Bochs but not on hardware, or vice versa).

If you're not handling caching or TLB refreshes correctly, behavior may differ in Bochs vs.
RUN BOCHS IN DEBUG CODE
Check your pointers, initialize them, print your code on paper if necessary.īochs does not properly emulate CPU cache/TLBĪlthough Bochs does have these constructs, they do not work the same as a regular CPU cache or TLB and do not change based on which CPU is being emulated. On a normal PC, uninitialized memory tends to contain garbage (most often all-ones) or traces of previous executions. In Bochs, memory is always filled with zero until you (or the BIOS) put something else. Check your code that enables the A20 line and make sure it has no issues with faster hardware. Sometimes there's a BIOS option, sometimes there isn't. But keep away from modifying Bochs' operations! Every time I suspected a bug in Bochs, I was just misunderstanding the Intel Manual.ĭifferences between Bochs and real hardware Bochs enables the A20 line in the BIOS Then, maybe you can add extra information to the message-printing code (like the faulty offset of a segfault, the segment limit, etc).
RUN BOCHS IN DEBUG DOWNLOAD
If you're still stuck, download the Bochs source package and search for the message you received. The CPU will try to look up the descriptor in the LDT, but there's no LDT registered! In most cases, the error comes from some mispairing of push and pop on the stack, which lead to a non-selector value to be loaded in a segment register. This message usually means that your program tried to load a selector with some garbage value, which happened to have the 3rd bit (Table Indicator) set. I do not have an LDT and I read it wasn't mandatory!?". Go back to your chip's data sheet and double-check that your sizes are correct. Reading a byte from port 0x1234 is usually not the same thing as reading a 32-bit value.
