From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: richard.henderson@linaro.org
Subject: [PATCH 05/11] target/i386: implement DR7.GD
Date: Tue, 4 Jun 2024 09:18:27 +0200 [thread overview]
Message-ID: <20240604071833.962574-6-pbonzini@redhat.com> (raw)
In-Reply-To: <20240604071833.962574-1-pbonzini@redhat.com>
DR7.GD triggers a #DB exception on any access to debug registers.
The GD bit is cleared so that the #DB handler itself can access
the debug registers.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
target/i386/tcg/sysemu/bpt_helper.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/target/i386/tcg/sysemu/bpt_helper.c b/target/i386/tcg/sysemu/bpt_helper.c
index 4d96a48a3ca..c1d5fce250c 100644
--- a/target/i386/tcg/sysemu/bpt_helper.c
+++ b/target/i386/tcg/sysemu/bpt_helper.c
@@ -238,6 +238,12 @@ target_ulong helper_get_dr(CPUX86State *env, int reg)
}
}
+ if (env->dr[7] & DR7_GD) {
+ env->dr[7] &= ~DR7_GD;
+ env->dr[6] |= DR6_BD;
+ raise_exception_ra(env, EXCP01_DB, GETPC());
+ }
+
return env->dr[reg];
}
@@ -251,6 +257,12 @@ void helper_set_dr(CPUX86State *env, int reg, target_ulong t0)
}
}
+ if (env->dr[7] & DR7_GD) {
+ env->dr[7] &= ~DR7_GD;
+ env->dr[6] |= DR6_BD;
+ raise_exception_ra(env, EXCP01_DB, GETPC());
+ }
+
if (reg < 4) {
if (hw_breakpoint_enabled(env->dr[7], reg)
&& hw_breakpoint_type(env->dr[7], reg) != DR7_TYPE_IO_RW) {
--
2.45.1
next prev parent reply other threads:[~2024-06-04 7:19 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-04 7:18 [PATCH 00/11] target/i386: fixes for INHIBIT_IRQ, TF and RF Paolo Bonzini
2024-06-04 7:18 ` [PATCH 01/11] target/i386: fix pushed value of EFLAGS.RF Paolo Bonzini
2024-06-04 10:51 ` Richard Henderson
2024-06-04 7:18 ` [PATCH 02/11] target/i386: fix implementation of ICEBP Paolo Bonzini
2024-06-04 13:50 ` Richard Henderson
2024-06-04 7:18 ` [PATCH 03/11] target/i386: cleanup HLT helpers Paolo Bonzini
2024-06-04 10:54 ` Richard Henderson
2024-06-04 7:18 ` [PATCH 04/11] target/i386: cleanup PAUSE helpers Paolo Bonzini
2024-06-04 10:59 ` Richard Henderson
2024-06-04 14:08 ` Paolo Bonzini
2024-06-04 7:18 ` Paolo Bonzini [this message]
2024-06-04 13:22 ` [PATCH 05/11] target/i386: implement DR7.GD Richard Henderson
2024-06-04 7:18 ` [PATCH 06/11] target/i386: disable/enable breakpoints on vmentry/vmexit Paolo Bonzini
2024-06-04 13:24 ` Richard Henderson
2024-06-04 7:18 ` [PATCH 07/11] target/i386: fix INHIBIT_IRQ/TF/RF handling for VMRUN Paolo Bonzini
2024-06-04 13:28 ` Richard Henderson
2024-06-04 7:18 ` [PATCH 08/11] target/i386: fix INHIBIT_IRQ/TF/RF handling for PAUSE Paolo Bonzini
2024-06-04 13:44 ` Richard Henderson
2024-06-04 13:49 ` Richard Henderson
2024-06-04 14:10 ` Paolo Bonzini
2024-06-04 14:14 ` Richard Henderson
2024-06-04 7:18 ` [PATCH 09/11] target/i386: fix TF/RF handling for HLT Paolo Bonzini
2024-06-04 13:46 ` Richard Henderson
2024-06-04 7:18 ` [PATCH 10/11] target/i386: document incorrect semantics of watchpoint following MOV/POP SS Paolo Bonzini
2024-06-04 13:57 ` Richard Henderson
2024-06-04 7:18 ` [PATCH 11/11] target/i386: document use of DISAS_NORETURN Paolo Bonzini
2024-06-04 13:58 ` Richard Henderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240604071833.962574-6-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).