From 3c209818ae0a0388b466c4e1966558c0ce302cda Mon Sep 17 00:00:00 2001 From: OBattler Date: Fri, 30 Aug 2024 05:18:34 +0200 Subject: [PATCH] P6: Fix the restoration of the A20 state when exiting SMM, fixes #4771. --- src/cpu/386_common.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/cpu/386_common.c b/src/cpu/386_common.c index 1d130cd8a..87d1008cc 100644 --- a/src/cpu/386_common.c +++ b/src/cpu/386_common.c @@ -1016,9 +1016,14 @@ smram_restore_state_p6(uint32_t *saved_state) cpu_state.seg_gs.ar_high = (saved_state[SMRAM_FIELD_P6_GS_SELECTOR_AR] >> 24) & 0xff; smm_seg_load(&cpu_state.seg_gs); - mem_a20_alt = 0x00; - mem_a20_key = saved_state[SMRAM_FIELD_P6_A20M] ? 0x00 : 0x02; - mem_a20_recalc(); + rammask = cpu_16bitbus ? 0xFFFFFF : 0xFFFFFFFF; + if (is6117) + rammask |= 0x3000000; + + if (saved_state[SMRAM_FIEL_P6_A20M] & 0x01) + rammask &= ~0xffefffff; + + flushmmucache(); if (SMM_REVISION_ID & SMM_SMBASE_RELOCATION) smbase = saved_state[SMRAM_FIELD_P6_SMBASE_OFFSET];