From 8b68de7de2dbd7bbfec72cb642358682de8de6f1 Mon Sep 17 00:00:00 2001 From: Sjoerd van der Berg Date: Sun, 25 Jan 2004 12:53:29 +0000 Subject: [PATCH] Add pmode exceptions for cli/sti/popf Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@1600 --- src/cpu/core_normal/prefix_66.h | 9 +++++++-- src/cpu/core_normal/prefix_none.h | 21 ++++++++++++++++++--- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/src/cpu/core_normal/prefix_66.h b/src/cpu/core_normal/prefix_66.h index 22c7b67a..4b52dfa5 100644 --- a/src/cpu/core_normal/prefix_66.h +++ b/src/cpu/core_normal/prefix_66.h @@ -355,6 +355,11 @@ Push_32(reg_flags); break; CASE_D(0x9d) /* POPFD */ + if ((reg_flags & FLAG_VM) && ((reg_flags & FLAG_IOPL)!=FLAG_IOPL)) { + LEAVECORE;reg_eip-=core.ip_lookup-core.op_start; + CPU_Exception(13,0); + goto decode_start; + } SETFLAGSd(Pop_32()) #if CPU_TRAP_CHECK if (GETFLAG(TF)) { @@ -362,7 +367,7 @@ goto decode_end; } #endif -#ifdef CPU_PIC_CHECK +#if CPU_PIC_CHECK if (GETFLAG(IF) && PIC_IRQCheck) goto decode_end; #endif @@ -499,7 +504,7 @@ return CBRET_NONE; } #endif -#ifdef CPU_PIC_CHECK +#if CPU_PIC_CHECK if (GETFLAG(IF) && PIC_IRQCheck) return CBRET_NONE; #endif //TODO TF check diff --git a/src/cpu/core_normal/prefix_none.h b/src/cpu/core_normal/prefix_none.h index a819fbda..366299d6 100644 --- a/src/cpu/core_normal/prefix_none.h +++ b/src/cpu/core_normal/prefix_none.h @@ -557,6 +557,11 @@ Push_16(reg_flags); break; CASE_W(0x9d) /* POPF */ + if ((reg_flags & FLAG_VM) && ((reg_flags & FLAG_IOPL)!=FLAG_IOPL)) { + LEAVECORE;reg_eip-=core.ip_lookup-core.op_start; + CPU_Exception(13,0); + goto decode_start; + } SETFLAGSw(Pop_16()); #if CPU_TRAP_CHECK if (GETFLAG(TF)) { @@ -564,7 +569,7 @@ goto decode_end; } #endif -#ifdef CPU_PIC_CHECK +#if CPU_PIC_CHECK if (GETFLAG(IF) && PIC_IRQCheck) goto decode_end; #endif break; @@ -787,7 +792,7 @@ { LEAVECORE; CPU_IRET(false); -#ifdef CPU_PIC_CHECK +#if CPU_PIC_CHECK if (GETFLAG(IF) && PIC_IRQCheck) return CBRET_NONE; #endif #if CPU_TRAP_CHECK @@ -1053,11 +1058,21 @@ SETFLAGBIT(CF,true); break; CASE_B(0xfa) /* CLI */ + if (cpu.pmode && (GETFLAG_IOPL