Got OVMF on bochs running, kinda

This commit is contained in:
Thomas Oltmann 2025-12-20 17:12:36 +01:00
parent 4068773b59
commit 43f8cfdd83
2 changed files with 46 additions and 37 deletions

77
bochsrc
View file

@ -1,37 +1,40 @@
# configuration file generated by Bochs
plugin_ctrl: unmapped=1, biosdev=1, speaker=1, extfpuirq=1, parallel=1, serial=1
memory: host=64, guest=64
romimage: file="/usr/share/OVMF/x64/MICROVM.fd", address=0x0, options=none
vgaromimage: file="/usr/share/bochs/VGABIOS-lgpl-latest-cirrus"
boot: floppy
floppy_bootsig_check: disabled=0
# no floppya
# no floppyb
ata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14
ata0-master: type=none
ata0-slave: type=none
ata1: enabled=1, ioaddr1=0x170, ioaddr2=0x370, irq=15
ata1-master: type=none
ata1-slave: type=none
pci: enabled=1, chipset=i440fx, slot1=cirrus
vga: extension=cirrus, update_freq=5, realtime=1
cpu: count=1, ips=4000000, model=bx_generic, reset_on_triple_fault=1, cpuid_limit_winnt=0, ignore_bad_msrs=1, mwait_is_nop=0
cpuid: level=6, stepping=3, model=3, family=6, vendor_string="GenuineIntel", brand_string=" Intel(R) Pentium(R) 4 CPU "
cpuid: mmx=1, apic=xapic, simd=sse2, sse4a=0, misaligned_sse=0, sep=1, movbe=0, adx=0
cpuid: aes=0, sha=0, xsave=0, xsaveopt=0, x86_64=1, 1g_pages=0, pcid=0, fsgsbase=0
#cpuid: smep=0, smap=0, mwait=1, vmx=1
print_timestamps: enabled=0
port_e9_hack: enabled=0
private_colormap: enabled=0
clock: sync=none, time0=local, rtc_sync=0
# no cmosimage
# no loader
log: -
logprefix: %t%e%d
debug: action=ignore
info: action=report
error: action=report
panic: action=ask
keyboard: type=mf, serial_delay=250, paste_delay=100000, user_shortcut=none
mouse: type=ps2, enabled=0, toggle=ctrl+mbutton
com1: enabled=1, mode=null
cpu: model=corei5_lynnfield_750, count=1, reset_on_triple_fault=1
#cpuid: x86_64=1, mmx=1, sep=1, simd=sse4_2, apic=xapic, aes=1, movbe=1, xsave=1
#cpuid: family=6, model=0x1a, stepping=5
memory: guest=1024, host=1024
#romimage: file=$BXSHARE/BIOS-bochs-latest, options=fastboot
#romimage: file=DEBUGX64_OVMF.fd, address=0x0, options=none
#romimage: file=OVMF-pure-efi.fd, address=0x0, options=none
romimage: file=/usr/share/OVMF/x64/OVMF.fd, address=0x0, options=none
#vgaromimage: file=$BXSHARE/VGABIOS-lgpl-latest-cirrus.bin
vgaromimage: file=$BXSHARE/VGABIOS-lgpl-latest.bin
vga: extension=cirrus
mouse: enabled=0
pci: enabled=1, chipset=i440fx, slot1=cirrus
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, mode=flat, path="disk.img", cylinders=1024, heads=1, spt=16
boot: disk
#ata0-master: type=cdrom, path=UefiShell.iso, status=inserted, model="UefiShell.iso"
#boot: cdrom
panic: action=ask
error: action=report
info: action=report
#debug: action=ignore, apic0=report, pic=report, ioapic=report
debug: action=ignore, keyboard=report
#com1: enabled=1, mode=socket-server, dev=localhost:1111
port_e9_hack: enabled=1
log: log.txt

View file

@ -39,6 +39,12 @@ vintel_has_support(char *err, size_t errmax)
return false;
}
/* Bochs does not enable VMX, relying on the BIOS instead.
* OVMF, the UEFI BIOS, only enables VMX if told so through a fw_cfg device,
* which is not emulated by Bochs. As a workaround, we try to enable VMX
* ourselves ... */
writemsr64(IA32_FEATURE_CONTROL, readmsr64(IA32_FEATURE_CONTROL) | 0x5);
if (!vintel_has_bios_support()) {
strlcpy(err, "VT-x support is not enabled in BIOS.", errmax);
return false;