From fe96629cedb911c1084f18aa77671a1e84a66a2c Mon Sep 17 00:00:00 2001 From: SarahW Date: Mon, 30 Nov 2020 22:29:03 +0000 Subject: [PATCH] SMI : Fix 'NOTFLAT' status when leaving SMI, set oldcpl on enter/leave. --- src/x86seg.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/x86seg.c b/src/x86seg.c index 6703f8f..c44e807 100644 --- a/src/x86seg.c +++ b/src/x86seg.c @@ -3150,6 +3150,8 @@ void x86_smi_enter(void) stack32 = 0; } + oldcpl = 0; + // pclog("x86_smi_enter\n"); } @@ -3240,14 +3242,16 @@ void x86_smi_leave(void) } } } - if (cpu_state.seg_ds.base == 0 && cpu_state.seg_ds.limit_low == 0 && cpu_state.seg_ds.limit_high == 0xffffffff) + if (!(cpu_state.seg_ds.base == 0 && cpu_state.seg_ds.limit_low == 0 && cpu_state.seg_ds.limit_high == 0xffffffff)) cpu_cur_status |= CPU_STATUS_NOTFLATDS; - if (cpu_state.seg_ss.base == 0 && cpu_state.seg_ss.limit_low == 0 && cpu_state.seg_ss.limit_high == 0xffffffff) + if (!(cpu_state.seg_ss.base == 0 && cpu_state.seg_ss.limit_low == 0 && cpu_state.seg_ss.limit_high == 0xffffffff)) cpu_cur_status |= CPU_STATUS_NOTFLATSS; if (smram_disable) smram_disable(); flushmmucache(); + oldcpl = CPL; + // pclog("x86_smi_leave\n"); }