Sunday, 23 July 2017

Reduce the CPU load when using the E2B Menu

You may have noticed that when you boot to the E2B menu, your CPU fan speed may start to increase and get quite noisy. This can also occur when booting to the E2B menu under a Virtual Machine such as with Virtual Box.

The reason is that grub4dos is continually calling the BIOS to detect a menu key press from the user and so the CPU is running at full speed.

Most operating systems use an interrupt-driven approach. The CPU is in an idle state when not required, until the user presses a key and causes a CPU interrupt from the keyboard controller which then wakes up the CPU.

e.g. (in x86 code)...
sti           (enable interrupts)
hlt           (stop CPU until it gets an interrupt)

Grub4dos can also use such an interrupt-driven approach if you patch it...

In the \_ISO\Sample_MyE2B.cfg file you will see the lines:

# Use HLT instruction to reduce CPU cycles whilst waiting for keypress (stops CPU from getting too hot)
### write --bytes=1 0x8205 0x20 > nul

Simply uncomment the 2nd line by removing the three ### symbols and add it to your \_ISO\MyE2B.cfg file:

!BAT
# Use HLT instruction to reduce CPU cycles whilst waiting for keypress (stops CPU from getting too hot)
write --bytes=1 0x8205 0x20 > nul

As this patch may cause problems on some systems, it is not included by default in E2B. You may find it useful if you use E2B with a VM a lot.

You can remove or comment out the line to go back to the normal grub4dos behaviour if it causes you any problems (let me know if it does!).