added VMX .bochsrc option to ctoggle VMX ON/OFF on runtime
This commit is contained in:
parent
e7ed8aca5c
commit
2dee4b12be
@ -260,6 +260,10 @@ cpu: cpuid_limit_winnt=0
|
||||
# When this option is enabled MWAIT will not put the CPU into a sleep state.
|
||||
# This option exists only if Bochs compiled with --enable-monitor-mwait.
|
||||
#
|
||||
# VMX:
|
||||
# Select VMX extensions emulation support.
|
||||
# This option exists only if Bochs compiled with --enable-vmx option.
|
||||
#
|
||||
# VENDOR_STRING:
|
||||
# Set the CPUID vendor string returned by CPUID(0x0). This should be a
|
||||
# twelve-character ASCII string.
|
||||
|
@ -41,6 +41,7 @@ cpuid
|
||||
movbe
|
||||
xsave
|
||||
xsaveopt
|
||||
vmx
|
||||
avx
|
||||
avx_f16c
|
||||
avx_fma
|
||||
|
@ -446,6 +446,13 @@ void bx_init_options()
|
||||
"Don't put CPU to sleep state by MWAIT",
|
||||
0);
|
||||
#endif
|
||||
#if BX_SUPPORT_VMX
|
||||
new bx_param_num_c(cpuid_param,
|
||||
"vmx", "Support for Intel VMX extensions emulation",
|
||||
"Support for Intel VMX extensions emulation",
|
||||
0, BX_SUPPORT_VMX,
|
||||
1);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
cpuid_param->set_options(menu->SHOW_PARENT);
|
||||
@ -2797,6 +2804,10 @@ static int parse_line_formatted(const char *context, int num_params, char *param
|
||||
PARSE_ERR(("%s: cpuid directive malformed.", context));
|
||||
}
|
||||
#endif
|
||||
#if BX_SUPPORT_VMX
|
||||
} else if (!strncmp(params[i], "vmx=", 4)) {
|
||||
SIM->get_param_num(BXPN_CPUID_VMX)->set(atol(¶ms[i][4]));
|
||||
#endif
|
||||
#if BX_SUPPORT_X86_64
|
||||
} else if (!strncmp(params[i], "x86_64=", 7)) {
|
||||
if (parse_param_bool(params[i], 7, BXPN_CPUID_X86_64) < 0) {
|
||||
@ -4152,6 +4163,9 @@ int bx_write_configuration(const char *rc, int overwrite)
|
||||
SIM->get_param_bool(BXPN_CPUID_TBM)->get(),
|
||||
SIM->get_param_bool(BXPN_CPUID_FMA4)->get());
|
||||
#endif
|
||||
#if BX_SUPPORT_VMX
|
||||
fprintf(fp, ", vmx=%d", SIM->get_param_num(BXPN_CPUID_VMX)->get());
|
||||
#endif
|
||||
#if BX_SUPPORT_X86_64
|
||||
fprintf(fp, ", x86_64=%d, 1g_pages=%d, pcid=%d, fsgsbase=%d",
|
||||
SIM->get_param_bool(BXPN_CPUID_X86_64)->get(),
|
||||
|
@ -853,12 +853,15 @@ void bx_generic_cpuid_t::init_isa_extensions_bitmask(void)
|
||||
#endif // BX_SUPPORT_X86_64
|
||||
|
||||
#if BX_SUPPORT_VMX
|
||||
static unsigned vmx_enabled = SIM->get_param_num(BXPN_CPUID_VMX)->get();
|
||||
if (vmx_enabled) {
|
||||
features_bitmask |= BX_ISA_VMX;
|
||||
|
||||
if (! sep_enabled) {
|
||||
BX_PANIC(("PANIC: VMX emulation requires SYSENTER/SYSEXIT support !"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CPU_LEVEL >= 6
|
||||
@ -937,16 +940,20 @@ void bx_generic_cpuid_t::init_cpu_extensions_bitmask(void)
|
||||
#if BX_SUPPORT_VMX
|
||||
void bx_generic_cpuid_t::init_vmx_extensions_bitmask(void)
|
||||
{
|
||||
Bit32u features_bitmask = BX_VMX_VIRTUAL_NMI;
|
||||
Bit32u features_bitmask = 0;
|
||||
|
||||
static unsigned vmx_enabled = SIM->get_param_num(BXPN_CPUID_VMX)->get();
|
||||
if (vmx_enabled) {
|
||||
features_bitmask |= BX_VMX_VIRTUAL_NMI;
|
||||
|
||||
static bx_bool x86_64_enabled = SIM->get_param_bool(BXPN_CPUID_X86_64)->get();
|
||||
if (x86_64_enabled) {
|
||||
features_bitmask |= BX_VMX_TPR_SHADOW;
|
||||
|
||||
features_bitmask |= BX_VMX_APIC_VIRTUALIZATION |
|
||||
features_bitmask |= BX_VMX_TPR_SHADOW |
|
||||
BX_VMX_APIC_VIRTUALIZATION |
|
||||
BX_VMX_WBINVD_VMEXIT;
|
||||
|
||||
#if BX_SUPPORT_VMX >= 2
|
||||
if (vmx_enabled >= 2) {
|
||||
features_bitmask |= BX_VMX_PREEMPTION_TIMER |
|
||||
BX_VMX_PAT |
|
||||
BX_VMX_EFER |
|
||||
@ -960,8 +967,10 @@ void bx_generic_cpuid_t::init_vmx_extensions_bitmask(void)
|
||||
features_bitmask |= BX_VMX_SAVE_DEBUGCTL_DISABLE |
|
||||
/* BX_VMX_MONITOR_TRAP_FLAG | */ // not implemented yet
|
||||
BX_VMX_PERF_GLOBAL_CTRL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
this->vmx_extensions_bitmask = features_bitmask;
|
||||
}
|
||||
|
@ -3095,6 +3095,11 @@ This option exists only if Bochs compiled with --enable-monitor-mwait.
|
||||
When this option is enabled MWAIT will not put the CPU into a sleep state.
|
||||
This option exists only if Bochs compiled with --enable-monitor-mwait.
|
||||
</para>
|
||||
<para><command>vmx</command></para>
|
||||
<para>
|
||||
Select VMX extensions emulation support.
|
||||
This option exists only if Bochs compiled with --enable-vmx option.
|
||||
</para>
|
||||
<para><command>family</command></para>
|
||||
<para>
|
||||
Set family information returned by CPUID. Default family value determined
|
||||
|
@ -304,6 +304,11 @@ mwait_is_nop:
|
||||
When this option is enabled MWAIT will not put the CPU into a sleep state.
|
||||
This option exists only if Bochs compiled with --enable-monitor-mwait.
|
||||
|
||||
vmx:
|
||||
|
||||
Select VMX extensions emulation support.
|
||||
This option exists only if Bochs compiled with --enable-vmx option.
|
||||
|
||||
family:
|
||||
|
||||
Set family information returned by CPUID. Default family value determined
|
||||
|
@ -55,6 +55,7 @@
|
||||
#define BXPN_CPUID_SEP "cpuid.sep"
|
||||
#define BXPN_CPUID_XSAVE "cpuid.xsave"
|
||||
#define BXPN_CPUID_XSAVEOPT "cpuid.xsaveopt"
|
||||
#define BXPN_CPUID_VMX "cpuid.vmx"
|
||||
#define BXPN_CPUID_AVX "cpuid.avx"
|
||||
#define BXPN_CPUID_AVX_F16CVT "cpuid.avx_f16c"
|
||||
#define BXPN_CPUID_AVX_FMA "cpuid.avx_fma"
|
||||
|
Loading…
Reference in New Issue
Block a user