Replace winnt_fix by cpuid_level, make configurable
This commit is contained in:
parent
89e5173712
commit
b227b2e45b
|
@ -1030,6 +1030,7 @@
|
|||
settings.cmdline = infos.cmdline;
|
||||
settings.bzimage_initrd_from_filesystem = infos.bzimage_initrd_from_filesystem;
|
||||
settings.mac_address_translation = infos.mac_address_translation;
|
||||
settings.cpuid_level = infos.cpuid_level;
|
||||
|
||||
settings.acpi = (!infos.state && settings.acpi !== undefined) ? settings.acpi : infos.acpi;
|
||||
settings.memory_size = (!infos.state && settings.memory_size) ? settings.memory_size : infos.memory_size;
|
||||
|
@ -1290,6 +1291,7 @@
|
|||
"filesystem": settings.filesystem || {},
|
||||
"disable_speaker": disable_audio,
|
||||
"mac_address_translation": settings.mac_address_translation,
|
||||
"cpuid_level": settings.cpuid_level,
|
||||
|
||||
"autostart": true,
|
||||
});
|
||||
|
|
|
@ -266,6 +266,7 @@ V86Starter.prototype.continue_init = async function(emulator, options)
|
|||
settings.cmdline = options["cmdline"];
|
||||
settings.preserve_mac_from_state_image = options["preserve_mac_from_state_image"];
|
||||
settings.mac_address_translation = options["mac_address_translation"];
|
||||
settings.cpuid_level = options["cpuid_level"];
|
||||
|
||||
if(options["network_adapter"])
|
||||
{
|
||||
|
|
|
@ -263,6 +263,8 @@ CPU.prototype.wasm_patch = function()
|
|||
this.set_tsc = get_import("set_tsc");
|
||||
this.store_current_tsc = get_import("store_current_tsc");
|
||||
|
||||
this.set_cpuid_level = get_import("set_cpuid_level");
|
||||
|
||||
if(DEBUG)
|
||||
{
|
||||
this.jit_force_generate_unsafe = get_optional_import("jit_force_generate_unsafe");
|
||||
|
@ -657,6 +659,8 @@ CPU.prototype.init = function(settings, device_bus)
|
|||
this.create_memory(typeof settings.memory_size === "number" ?
|
||||
settings.memory_size : 1024 * 1024 * 64);
|
||||
|
||||
settings.cpuid_level && this.set_cpuid_level(settings.cpuid_level);
|
||||
|
||||
this.acpi_enabled[0] = +settings.acpi;
|
||||
|
||||
this.reset_cpu();
|
||||
|
|
|
@ -264,6 +264,8 @@ pub const DEBUG: bool = cfg!(debug_assertions);
|
|||
pub const LOOP_COUNTER: i32 = 100_003;
|
||||
pub const TSC_RATE: f64 = 1_000_000.0;
|
||||
|
||||
pub static mut cpuid_level: u32 = 0x16;
|
||||
|
||||
pub static mut jit_block_boundary: bool = false;
|
||||
|
||||
pub static mut rdtsc_imprecision_offset: u64 = 0;
|
||||
|
@ -4188,3 +4190,6 @@ pub unsafe fn reset_cpu() {
|
|||
|
||||
jit::jit_clear_cache(jit::get_jit_state());
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe fn set_cpuid_level(level: u32) { cpuid_level = level }
|
||||
|
|
|
@ -3143,18 +3143,12 @@ pub unsafe fn instr_0FA2() {
|
|||
let mut edx = 0;
|
||||
let mut ebx = 0;
|
||||
|
||||
let winnt_fix = false;
|
||||
let level = read_reg32(EAX) as u32;
|
||||
|
||||
match level {
|
||||
0 => {
|
||||
// maximum supported level
|
||||
if winnt_fix {
|
||||
eax = 2;
|
||||
}
|
||||
else {
|
||||
eax = 0x16;
|
||||
}
|
||||
// maximum supported level (default 0x16, overwritten to 2 as a workaround for Windows NT)
|
||||
eax = cpuid_level as i32;
|
||||
|
||||
ebx = 0x756E6547 | 0; // Genu
|
||||
edx = 0x49656E69 | 0; // ineI
|
||||
|
|
Loading…
Reference in a new issue