From: Doug Evans <dje@google.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PULL 24/25] target-i386: Fix eflags.TF/#DB handling of syscall/sysret insns
Date: Fri, 23 Dec 2016 19:33:03 +0000 [thread overview]
Message-ID: <f403045e2f8a5b916c0544587499@google.com> (raw)
Paolo Bonzini writes:
> From: Doug Evans <dje@google.com>
>
> The syscall and sysret instructions behave a bit differently:
> TF is checked after the instruction completes.
> This allows the o/s to disable #DB at a syscall by adding TF to FMASK.
> And then when the sysret is executed the #DB is taken "as if" the
> syscall insn just completed.
>
> Signed-off-by: Doug Evans <dje@google.com>
> Message-Id: <94eb2c0bfa1c6a9fec0543057483@google.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> target/i386/bpt_helper.c | 7 +++++++
> target/i386/helper.h | 1 +
> target/i386/translate.c | 29 ++++++++++++++++++++++++-----
> 3 files changed, 32 insertions(+), 5 deletions(-)
>
> ...
> diff --git a/target/i386/translate.c b/target/i386/translate.c
> index 324103c..59e11fc 100644
> --- a/target/i386/translate.c
> +++ b/target/i386/translate.c
> @@ -6423,7 +6435,10 @@ static target_ulong disas_insn(CPUX86State *env,
DisasContext *s,
> tcg_const_i32(s->pc -
s->cs_base));
> set_cc_op(s, CC_OP_EFLAGS);
> }
> - gen_eob(s);
> + /* TF handling for the syscall insn is different. The TF bit is
checked
> + after the syscall insn completes. This allows #DB to not be
> + generated after one has entered CPL0 if TF is set in FMASK.
*/
> + gen_eob_worker(s, false, true);
> break;
> case 0xe8: /* call im */
> {
> @@ -7115,7 +7130,11 @@ static target_ulong disas_insn(CPUX86State *env,
DisasContext *s,
> if (s->lma) {
> set_cc_op(s, CC_OP_EFLAGS);
> }
> - gen_eob(s);
> + /* TF handling for the sysret insn is different. The TF bit
is
> + checked after the sysret insn completes. This allows #DB
to be
> + generated "as if" the syscall insn in userspace has just
> + completed. */
> + gen_eob_worker(s, false, true);
> }
> break;
> #endif
Hi. Just a heads up that this patch got applied wrong (patch does that some
times).
The change to the "syscall" insn got applied to the "iret" instruction
instead.
Working on a fix.
next reply other threads:[~2016-12-23 19:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-23 19:33 Doug Evans [this message]
-- strict thread matches above, loose matches on Subject: below --
2016-12-22 15:22 [Qemu-devel] [PULL 00/25] First round of misc patches for QEMU 2.9 Paolo Bonzini
2016-12-22 15:22 ` [Qemu-devel] [PULL 24/25] target-i386: Fix eflags.TF/#DB handling of syscall/sysret insns Paolo Bonzini
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=f403045e2f8a5b916c0544587499@google.com \
--to=dje@google.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.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).