From 21f979a748d3f6dd0ccec34465abd5e64674a4d9 Mon Sep 17 00:00:00 2001 From: OBattler Date: Wed, 22 Apr 2020 01:29:14 +0200 Subject: [PATCH] A fix in mem_add_bios() to make non-AT+ machines not segmentation fault the emulator on startup. --- src/mem.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/mem.c b/src/mem.c index be1589b3d..5bfd37fcf 100644 --- a/src/mem.c +++ b/src/mem.c @@ -2192,10 +2192,12 @@ mem_set_mem_state_smm(uint32_t base, uint32_t size, int state) void mem_add_bios(void) { - int temp_cpu_type, temp_cpu_16bitbus; + int temp_cpu_type, temp_cpu_16bitbus = 1; - temp_cpu_type = machines[machine].cpu[cpu_manufacturer].cpus[cpu_effective].cpu_type; - temp_cpu_16bitbus = (temp_cpu_type == CPU_286 || temp_cpu_type == CPU_386SX || temp_cpu_type == CPU_486SLC || temp_cpu_type == CPU_IBM386SLC || temp_cpu_type == CPU_IBM486SLC ); + if (AT) { + temp_cpu_type = machines[machine].cpu[cpu_manufacturer].cpus[cpu_effective].cpu_type; + temp_cpu_16bitbus = (temp_cpu_type == CPU_286 || temp_cpu_type == CPU_386SX || temp_cpu_type == CPU_486SLC || temp_cpu_type == CPU_IBM386SLC || temp_cpu_type == CPU_IBM486SLC ); + } if (biosmask > 0x1ffff) { /* 256k+ BIOS'es only have low mappings at E0000-FFFFF. */