diff --git a/target-i386/exec.h b/target-i386/exec.h index f6d05e03582f86545decdd1e7997ccc1cfdef593..f48462aaa1f2bd4bb5a3011c29595c311b38b8c2 100644 --- a/target-i386/exec.h +++ b/target-i386/exec.h @@ -190,6 +190,7 @@ void helper_divq_EAX_T0(void); void helper_idivq_EAX_T0(void); void helper_bswapq_T0(void); void helper_cmpxchg8b(void); +void helper_single_step(void); void helper_cpuid(void); void helper_enter_level(int level, int data32); void helper_enter64_level(int level, int data64); diff --git a/target-i386/helper.c b/target-i386/helper.c index 951fdc57325b254a7699e1ff8e9d8a55b7cff9dd..3c051b9ea3c41c55309c5f66cc0c2035e0b49bb7 100644 --- a/target-i386/helper.c +++ b/target-i386/helper.c @@ -1622,6 +1622,12 @@ void helper_cmpxchg8b(void) CC_SRC = eflags; } +void helper_single_step() +{ + env->dr[6] |= 0x4000; + raise_exception(EXCP01_SSTP); +} + void helper_cpuid(void) { uint32_t index; diff --git a/target-i386/op.c b/target-i386/op.c index a8cfce271b53869f9db104a1598a72624e5cb252..ea8aec6b51e1894970c2d495857c69f18babe93d 100644 --- a/target-i386/op.c +++ b/target-i386/op.c @@ -730,6 +730,11 @@ void OPPROTO op_cmpxchg8b(void) helper_cmpxchg8b(); } +void OPPROTO op_single_step(void) +{ + helper_single_step(); +} + void OPPROTO op_movl_T0_0(void) { T0 = 0; diff --git a/target-i386/translate.c b/target-i386/translate.c index 393db0d65e369ca049d207d938c674506fe5dc98..15bfef5cbf910c5da57c81aac72c4d5332dc2c48 100644 --- a/target-i386/translate.c +++ b/target-i386/translate.c @@ -2277,7 +2277,7 @@ static void gen_eob(DisasContext *s) if (s->singlestep_enabled) { gen_op_debug(); } else if (s->tf) { - gen_op_raise_exception(EXCP01_SSTP); + gen_op_single_step(); } else { gen_op_movl_T0_0(); gen_op_exit_tb();