D
DioProcess

QEMU Testing

Pre-built OVMF firmware with embedded DioProcess SMM/DXE drivers ships in efi/ovmf/. Run under QEMU to test SMM code safely without risking real hardware.

Always Test Here First

Every SMM change should be validated in QEMU before touching real firmware. Bricked motherboards require an SPI flash programmer to recover.

Quick Start

cd efi\ovmf
run_qemu.bat

The batch script launches QEMU with SMM support enabled, using the bundled OVMF firmware that already contains DioProcessSmm.efi and DioProcessDxe.efi.

Expected Serial Output

On boot, both drivers announce themselves on the serial console:

=[ DioProcess DXE ]=
[ DXE ] EFI_MM_COMMUNICATION2_PROTOCOL discovered
=[ DioProcess SMM ]=
=[ Ring -2 Memory Operations ]=
[ SMM ] SMM driver invoked by SMM IPL, initializing...
[ SMM ] SMM driver has been initialized

Directory Contents

efi/ovmf/
├── OVMF_CODE.fd     # OVMF firmware with embedded SMM/DXE drivers
├── OVMF_VARS.fd     # NVRAM variables (persist across QEMU runs)
└── run_qemu.bat     # QEMU launch script with SMM support

QEMU Launch Script

The run_qemu.bat script sets up SMM-capable QEMU with the following flags:

qemu-system-x86_64.exe ^
  -machine q35,smm=on,accel=tcg ^
  -global driver=cfi.pflash01,property=secure,value=on ^
  -drive if=pflash,format=raw,unit=0,file=OVMF_CODE.fd,readonly=on ^
  -drive if=pflash,format=raw,unit=1,file=OVMF_VARS.fd ^
  -serial stdio ^
  -m 4G ^
  -cpu qemu64,+smep,+smap ^
  -smp cores=2
  • smm=on — enables the emulated SMM controller
  • secure=on on pflash — locks OVMF_CODE.fd against runtime writes
  • -serial stdio — routes serial output to your terminal
  • accel=tcg — TCG software emulation (KVM/WHPX cannot emulate SMM)

Building OVMF from Source

To rebuild the OVMF image with your own changes to the SMM/DXE drivers:

# Requires EDK2 toolchain at C:\edk2
cd C:\edk2
edksetup.bat

# Build SMM driver
build -a X64 -t VS2022 -p D:/dio/dioprocess-private/efi/DioProcessSmm/DioProcessSmm.dsc -b RELEASE

# Build DXE driver
build -a X64 -t VS2022 -p D:/dio/dioprocess-private/efi/DioProcessDxe/DioProcessDxe.dsc -b RELEASE

# Rebuild OVMF with embedded drivers (SMM_REQUIRE forces SMM inclusion)
build -DSMM_REQUIRE

# Output firmware lives at:
# C:\edk2\Build\OvmfX64\RELEASE_VS2022\FV\OVMF_CODE.fd

Windows Guest Testing

To exercise the full stack (usermode → kernel driver → SMM), install Windows 10 22H2 in the QEMU guest, then install the DioProcess kernel driver as usual. The kernel driver reads the NVRAM buffer address and triggers SMIs — everything works the same as on real hardware, just slower due to TCG emulation.

A WHPX-accelerated QEMU script (run_qemu_whpx.bat) is also included for faster Windows install — however, WHPX cannot emulate SMM, so switch back to the TCG-based run_qemu.bat for actual SMM testing.

Real Hardware Testing

Extreme Risk

Testing SMM on real hardware requires flashing modified UEFI firmware. Do NOT do this without a hardware SPI recovery path.
  • Brick risk — incorrect flash can make the motherboard unbootable
  • Intel Boot Guard — many modern systems verify firmware signatures and refuse unsigned images
  • Recovery — requires an SPI flash programmer (CH341A + SOIC clip) to restore a good image
  • Recommendation — QEMU for development; real hardware only on expendable test machines with backed-up firmware