check io permission for dyncore port access
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@2621
This commit is contained in:
parent
28ffbae6be
commit
458d7e5dee
2 changed files with 55 additions and 21 deletions
|
@ -1209,6 +1209,20 @@ static void dyn_interrupt(Bitu num) {
|
|||
dyn_closeblock();
|
||||
}
|
||||
|
||||
static void dyn_add_iocheck(Bitu access_size) {
|
||||
if (cpu.pmode) {
|
||||
gen_call_function((void *)&CPU_IO_Exception,"%Dw%Id",DREG(EDX),access_size);
|
||||
dyn_check_bool_exception_al();
|
||||
}
|
||||
}
|
||||
|
||||
static void dyn_add_iocheck_var(Bit8u accessed_port,Bitu access_size) {
|
||||
if (cpu.pmode) {
|
||||
gen_call_function((void *)&CPU_IO_Exception,"%Id%Id",accessed_port,access_size);
|
||||
dyn_check_bool_exception_al();
|
||||
}
|
||||
}
|
||||
|
||||
static CacheBlock * CreateCacheBlock(CodePageHandler * codepage,PhysPt start,Bitu max_opcodes) {
|
||||
Bits i;
|
||||
/* Init a load of variables */
|
||||
|
@ -1591,23 +1605,35 @@ restart_prefix:
|
|||
case 0xe2:dyn_loop(LOOP_NONE);goto finish_block;
|
||||
case 0xe3:dyn_loop(LOOP_JCXZ);goto finish_block;
|
||||
//IN AL/AX,imm
|
||||
case 0xe4:gen_call_function((void*)&IO_ReadB,"%Id%Rl",decode_fetchb(),DREG(EAX));break;
|
||||
case 0xe5:
|
||||
case 0xe4: {
|
||||
Bitu port=decode_fetchb();
|
||||
dyn_add_iocheck_var(port,1);
|
||||
gen_call_function((void*)&IO_ReadB,"%Id%Rl",port,DREG(EAX));
|
||||
} break;
|
||||
case 0xe5: {
|
||||
Bitu port=decode_fetchb();
|
||||
dyn_add_iocheck_var(port,decode.big_op?4:2);
|
||||
if (decode.big_op) {
|
||||
gen_call_function((void*)&IO_ReadD,"%Id%Rd",decode_fetchb(),DREG(EAX));
|
||||
gen_call_function((void*)&IO_ReadD,"%Id%Rd",port,DREG(EAX));
|
||||
} else {
|
||||
gen_call_function((void*)&IO_ReadW,"%Id%Rw",decode_fetchb(),DREG(EAX));
|
||||
gen_call_function((void*)&IO_ReadW,"%Id%Rw",port,DREG(EAX));
|
||||
}
|
||||
break;
|
||||
} break;
|
||||
//OUT imm,AL
|
||||
case 0xe6:gen_call_function((void*)&IO_WriteB,"%Id%Dl",decode_fetchb(),DREG(EAX));break;
|
||||
case 0xe7:
|
||||
case 0xe6: {
|
||||
Bitu port=decode_fetchb();
|
||||
dyn_add_iocheck_var(port,1);
|
||||
gen_call_function((void*)&IO_WriteB,"%Id%Dl",port,DREG(EAX));
|
||||
} break;
|
||||
case 0xe7: {
|
||||
Bitu port=decode_fetchb();
|
||||
dyn_add_iocheck_var(port,decode.big_op?4:2);
|
||||
if (decode.big_op) {
|
||||
gen_call_function((void*)&IO_WriteD,"%Id%Dd",decode_fetchb(),DREG(EAX));
|
||||
gen_call_function((void*)&IO_WriteD,"%Id%Dd",port,DREG(EAX));
|
||||
} else {
|
||||
gen_call_function((void*)&IO_WriteW,"%Id%Dw",decode_fetchb(),DREG(EAX));
|
||||
gen_call_function((void*)&IO_WriteW,"%Id%Dw",port,DREG(EAX));
|
||||
}
|
||||
break;
|
||||
} break;
|
||||
case 0xe8: /* CALL Ivx */
|
||||
dyn_call_near_imm();
|
||||
goto finish_block;
|
||||
|
@ -1620,8 +1646,12 @@ restart_prefix:
|
|||
/* Jmp Ibx */
|
||||
case 0xeb:dyn_exit_link((Bit8s)decode_fetchb());goto finish_block;
|
||||
/* IN AL/AX,DX*/
|
||||
case 0xec:gen_call_function((void*)&IO_ReadB,"%Dw%Rl",DREG(EDX),DREG(EAX));break;
|
||||
case 0xec:
|
||||
dyn_add_iocheck(1);
|
||||
gen_call_function((void*)&IO_ReadB,"%Dw%Rl",DREG(EDX),DREG(EAX));
|
||||
break;
|
||||
case 0xed:
|
||||
dyn_add_iocheck(decode.big_op?4:2);
|
||||
if (decode.big_op) {
|
||||
gen_call_function((void*)&IO_ReadD,"%Dw%Rd",DREG(EDX),DREG(EAX));
|
||||
} else {
|
||||
|
@ -1629,14 +1659,20 @@ restart_prefix:
|
|||
}
|
||||
break;
|
||||
/* OUT DX,AL/AX */
|
||||
case 0xee:gen_call_function((void*)&IO_WriteB,"%Dw%Dl",DREG(EDX),DREG(EAX));break;
|
||||
case 0xee:
|
||||
dyn_add_iocheck(1);
|
||||
gen_call_function((void*)&IO_WriteB,"%Dw%Dl",DREG(EDX),DREG(EAX));
|
||||
break;
|
||||
case 0xef:
|
||||
dyn_add_iocheck(decode.big_op?4:2);
|
||||
if (decode.big_op) {
|
||||
gen_call_function((void*)&IO_WriteD,"%Dw%Dd",DREG(EDX),DREG(EAX));
|
||||
} else {
|
||||
gen_call_function((void*)&IO_WriteW,"%Dw%Dw",DREG(EDX),DREG(EAX));
|
||||
}
|
||||
break;
|
||||
case 0xf0: //LOCK
|
||||
break;
|
||||
case 0xf2: //REPNE/NZ
|
||||
decode.rep=REP_NZ;
|
||||
goto restart_prefix;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* $Id: iohandler.cpp,v 1.21 2006-04-11 19:02:33 qbix79 Exp $ */
|
||||
/* $Id: iohandler.cpp,v 1.22 2006-05-01 19:34:41 c2woody Exp $ */
|
||||
|
||||
#include <string.h>
|
||||
#include "dosbox.h"
|
||||
|
@ -162,10 +162,8 @@ static Bits IOFaultCore(void) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
Bitu DEBUG_EnableDebugger();
|
||||
|
||||
void IO_WriteB(Bitu port,Bitu val) {
|
||||
if (GETFLAG(VM) && (CPU_IO_Exception(port,1))) {
|
||||
if (GCC_UNLIKELY(GETFLAG(VM) && (CPU_IO_Exception(port,1)))) {
|
||||
LazyFlags old_lflags;
|
||||
memcpy(&old_lflags,&lflags,sizeof(LazyFlags));
|
||||
CPU_Decoder * old_cpudecoder;
|
||||
|
@ -198,7 +196,7 @@ void IO_WriteB(Bitu port,Bitu val) {
|
|||
};
|
||||
|
||||
void IO_WriteW(Bitu port,Bitu val) {
|
||||
if (GETFLAG(VM) && (CPU_IO_Exception(port,2))) {
|
||||
if (GCC_UNLIKELY(GETFLAG(VM) && (CPU_IO_Exception(port,2)))) {
|
||||
LazyFlags old_lflags;
|
||||
memcpy(&old_lflags,&lflags,sizeof(LazyFlags));
|
||||
CPU_Decoder * old_cpudecoder;
|
||||
|
@ -231,7 +229,7 @@ void IO_WriteW(Bitu port,Bitu val) {
|
|||
};
|
||||
|
||||
void IO_WriteD(Bitu port,Bitu val) {
|
||||
if (GETFLAG(VM) && (CPU_IO_Exception(port,4))) {
|
||||
if (GCC_UNLIKELY(GETFLAG(VM) && (CPU_IO_Exception(port,4)))) {
|
||||
LazyFlags old_lflags;
|
||||
memcpy(&old_lflags,&lflags,sizeof(LazyFlags));
|
||||
CPU_Decoder * old_cpudecoder;
|
||||
|
@ -264,7 +262,7 @@ void IO_WriteD(Bitu port,Bitu val) {
|
|||
};
|
||||
|
||||
Bitu IO_ReadB(Bitu port) {
|
||||
if (GETFLAG(VM) && (CPU_IO_Exception(port,1))) {
|
||||
if (GCC_UNLIKELY(GETFLAG(VM) && (CPU_IO_Exception(port,1)))) {
|
||||
LazyFlags old_lflags;
|
||||
memcpy(&old_lflags,&lflags,sizeof(LazyFlags));
|
||||
CPU_Decoder * old_cpudecoder;
|
||||
|
@ -297,7 +295,7 @@ Bitu IO_ReadB(Bitu port) {
|
|||
};
|
||||
|
||||
Bitu IO_ReadW(Bitu port) {
|
||||
if (GETFLAG(VM) && (CPU_IO_Exception(port,2))) {
|
||||
if (GCC_UNLIKELY(GETFLAG(VM) && (CPU_IO_Exception(port,2)))) {
|
||||
LazyFlags old_lflags;
|
||||
memcpy(&old_lflags,&lflags,sizeof(LazyFlags));
|
||||
CPU_Decoder * old_cpudecoder;
|
||||
|
@ -330,7 +328,7 @@ Bitu IO_ReadW(Bitu port) {
|
|||
};
|
||||
|
||||
Bitu IO_ReadD(Bitu port) {
|
||||
if (GETFLAG(VM) && (CPU_IO_Exception(port,4))) {
|
||||
if (GCC_UNLIKELY(GETFLAG(VM) && (CPU_IO_Exception(port,4)))) {
|
||||
LazyFlags old_lflags;
|
||||
memcpy(&old_lflags,&lflags,sizeof(LazyFlags));
|
||||
CPU_Decoder * old_cpudecoder;
|
||||
|
|
Loading…
Add table
Reference in a new issue