Compare commits
1 commit
| Author | SHA1 | Date | |
|---|---|---|---|
| 109c97f4a3 |
3 changed files with 53 additions and 46 deletions
71
bochsrc
71
bochsrc
|
|
@ -1,40 +1,37 @@
|
|||
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
|
||||
|
||||
# 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
|
||||
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
|
||||
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
|
||||
#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
|
||||
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
|
||||
|
|
|
|||
|
|
@ -20,6 +20,12 @@
|
|||
#define HOST_GS_SELECTOR 0x0C0A
|
||||
#define HOST_TR_SELECTOR 0x0C0C
|
||||
|
||||
#define IO_BITMAP_ADDRESS_A 0x2000
|
||||
#define IO_BITMAP_ADDRESS_B 0x2002
|
||||
#define MSR_BITMAP_ADDRESS 0x2004
|
||||
#define VM_EXIT_MSR_STORE_ADDRESS 0x2006
|
||||
#define VM_EXIT_MSR_LOAD_ADDRESS 0x2008
|
||||
|
||||
#define VMCS_LINK_POINTER 0x2800
|
||||
#define GUEST_IA32_DEBUGCTL 0x2802
|
||||
#define GUEST_IA32_PAT 0x2804
|
||||
|
|
|
|||
16
src/vintel.c
16
src/vintel.c
|
|
@ -39,12 +39,6 @@ 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;
|
||||
|
|
@ -213,8 +207,12 @@ vintel_init_host(void)
|
|||
// Set GDT and IDT
|
||||
checked_vmwrite(HOST_GDTR_BASE, (uintptr_t)pv->host_gdtr.base);
|
||||
checked_vmwrite(HOST_IDTR_BASE, (uintptr_t)pv->host_idtr.base);
|
||||
checked_vmwrite(HOST_FS_BASE, 0);
|
||||
checked_vmwrite(HOST_GS_BASE, 0);
|
||||
checked_vmwrite(HOST_TR_BASE, 0); // TODO proper value
|
||||
|
||||
// Dummy sysenter & sysexit values
|
||||
checked_vmwrite(HOST_SYSENTER_CS, 0x08);
|
||||
checked_vmwrite(HOST_SYSENTER_ESP, 0x4000);
|
||||
checked_vmwrite(HOST_SYSENTER_EIP, 0x4000);
|
||||
}
|
||||
|
|
@ -281,6 +279,12 @@ vintel_enable(void)
|
|||
checked_vmwrite(VM_EXIT_CONTROLS, exitControls);
|
||||
AsciiPrint("VM_EXIT_CONTROLS: %lx\n", exitControls);
|
||||
|
||||
checked_vmwrite(IO_BITMAP_ADDRESS_A, 0);
|
||||
checked_vmwrite(IO_BITMAP_ADDRESS_B, 0);
|
||||
checked_vmwrite(MSR_BITMAP_ADDRESS, 0);
|
||||
checked_vmwrite(VM_EXIT_MSR_STORE_ADDRESS, 0);
|
||||
checked_vmwrite(VM_EXIT_MSR_LOAD_ADDRESS, 0);
|
||||
|
||||
checked_vmwrite(VM_ENTRY_MSR_LOAD_COUNT, 0);
|
||||
checked_vmwrite(VM_ENTRY_INTR_INFO_FIELD, 0);
|
||||
checked_vmwrite(VM_EXIT_MSR_STORE_COUNT, 0);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue