xref: /openbmc/qemu/target/i386/tcg/bpt_helper.c (revision 2df1eb27)
1 /*
2  *  i386 breakpoint helpers
3  *
4  *  Copyright (c) 2003 Fabrice Bellard
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #include "qemu/osdep.h"
21 #include "cpu.h"
22 #include "exec/helper-proto.h"
23 #include "helper-tcg.h"
24 
25 G_NORETURN void helper_single_step(CPUX86State *env)
26 {
27 #ifndef CONFIG_USER_ONLY
28     check_hw_breakpoints(env, true);
29     env->dr[6] |= DR6_BS;
30 #endif
31     raise_exception(env, EXCP01_DB);
32 }
33 
34 void helper_rechecking_single_step(CPUX86State *env)
35 {
36     if ((env->eflags & TF_MASK) != 0) {
37         helper_single_step(env);
38     }
39 }
40