From ff2e20a96bbea3c007dd1c7fed0fbc4495cf56fe Mon Sep 17 00:00:00 2001 From: mahlemiut Date: Wed, 8 Feb 2012 21:26:25 +0000 Subject: [PATCH] i386: Trap flag support [Carl] --- src/emu/cpu/i386/i386.c | 8 ++++++++ src/emu/cpu/i386/i386priv.h | 1 + 2 files changed, 9 insertions(+) diff --git a/src/emu/cpu/i386/i386.c b/src/emu/cpu/i386/i386.c index 2c1c9b22276..91902b265d2 100644 --- a/src/emu/cpu/i386/i386.c +++ b/src/emu/cpu/i386/i386.c @@ -3099,6 +3099,7 @@ static CPU_EXECUTE( i386 ) cpustate->address_prefix = 0; cpustate->ext = 1; + cpustate->old_tf = cpustate->TF; cpustate->segment_prefix = 0; cpustate->prev_eip = cpustate->eip; @@ -3113,6 +3114,13 @@ static CPU_EXECUTE( i386 ) try { I386OP(decode_opcode)(cpustate); + if(cpustate->TF && cpustate->old_tf) + { + cpustate->prev_eip = cpustate->eip; + cpustate->ext = 0; + i386_trap(cpustate,1,0,0); + } + } catch(UINT64 e) { diff --git a/src/emu/cpu/i386/i386priv.h b/src/emu/cpu/i386/i386priv.h index d5cbc75d2f5..3b54f91a90f 100644 --- a/src/emu/cpu/i386/i386priv.h +++ b/src/emu/cpu/i386/i386priv.h @@ -240,6 +240,7 @@ struct _i386_state UINT8 performed_intersegment_jump; UINT8 delayed_interrupt_enable; + UINT8 old_tf; UINT32 cr[5]; // Control registers UINT32 dr[8]; // Debug registers