From: Jaume Marti Farriol <jaume.martif@gmail.com>
To: qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Jaume Marti Farriol <jaume.martif@gmail.com>,
Richard Henderson <rth@twiddle.net>
Subject: [Qemu-devel] [PATCH v4 1/3] target-i386: x87 exception pointers using TCG.
Date: Sat, 15 Nov 2014 12:30:13 +0100 [thread overview]
Message-ID: <1416051015-21930-2-git-send-email-jaume.martif@gmail.com> (raw)
In-Reply-To: <1416051015-21930-1-git-send-email-jaume.martif@gmail.com>
This adds new fields in the CPUX86State struct to store the x87
exception pointers.
Also it adds a new enum type that encodes the operand size and the
processor operating mode (protected and real mode).
The patch also adds a new option (tcg-exception-pointers) in the
configure script to enable or disable the functionality
implemented in this development.
Signed-off-by: jaume.martif@gmail.com
---
configure | 10 ++++++++++
target-i386/cpu.h | 25 +++++++++++++++++++++++--
target-i386/machine.c | 11 ++++++++++-
3 files changed, 43 insertions(+), 3 deletions(-)
diff --git a/configure b/configure
index 47048f0..62f1979 100755
--- a/configure
+++ b/configure
@@ -264,6 +264,7 @@ debug_tcg="no"
debug="no"
strip_opt="yes"
tcg_interpreter="no"
+tcg_exception_pointers="no"
bigendian="no"
mingw32="no"
gcov="no"
@@ -926,6 +927,10 @@ for opt do
;;
--enable-tcg-interpreter) tcg_interpreter="yes"
;;
+ --disable-tcg-exception-pointers) tcg_exception_pointers="no"
+ ;;
+ --enable-tcg-exception-pointers) tcg_exception_pointers="yes"
+ ;;
--disable-cap-ng) cap_ng="no"
;;
--enable-cap-ng) cap_ng="yes"
@@ -1321,6 +1326,7 @@ Advanced options (experts only):
--disable-rdma disable RDMA-based migration support
--enable-rdma enable RDMA-based migration support
--enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)
+ --enable-tcg-exception-pointers enable exception pointers support for TCG based emmulation
--enable-system enable all system emulation targets
--disable-system disable all system emulation targets
--enable-user enable supported user emulation targets
@@ -4296,6 +4302,7 @@ echo "Install blobs $blobs"
echo "KVM support $kvm"
echo "RDMA support $rdma"
echo "TCG interpreter $tcg_interpreter"
+echo "TCG exception pointers $tcg_exception_pointers"
echo "fdt support $fdt"
echo "preadv support $preadv"
echo "fdatasync $fdatasync"
@@ -4651,6 +4658,9 @@ fi
if test "$tcg_interpreter" = "yes" ; then
echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak
fi
+if test "$tcg_exception_pointers" = "yes" ; then
+ echo "CONFIG_TCG_EXCEPTION_POINTERS=y" >> $config_host_mak
+fi
if test "$fdatasync" = "yes" ; then
echo "CONFIG_FDATASYNC=y" >> $config_host_mak
fi
diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index 015f5b5..69c6222 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -697,6 +697,24 @@ typedef enum {
CC_OP_NB,
} CCOp;
+typedef enum {
+ B8 = 0,
+ B16 = 1,
+ B32 = 2,
+ B64 = 3,
+ BSIZE = 3, /* Mask for the above. */
+
+ RM = 4,
+ PM = 8,
+
+ PM32 = PM | B32,
+ PM16 = PM | B16,
+ RM32 = RM | B32,
+ RM16 = RM | B16,
+} OMode;
+
+#define TO_OMODE(bsize, is_pm) ((bsize & BSIZE) | (1 << (is_pm ? 3 : 2)))
+
typedef struct SegmentCache {
uint32_t selector;
target_ulong base;
@@ -876,10 +894,13 @@ typedef struct CPUX86State {
uint16_t fpuc;
uint8_t fptags[8]; /* 0 = valid, 1 = empty */
FPReg fpregs[8];
- /* KVM-only so far */
- uint16_t fpop;
+ uint32_t fpop;
uint64_t fpip;
uint64_t fpdp;
+#ifdef CONFIG_TCG_EXCEPTION_POINTERS
+ uint32_t fpcs;
+ uint32_t fpds;
+#endif
/* emulator internal variables */
float_status fp_status;
diff --git a/target-i386/machine.c b/target-i386/machine.c
index 1c13b14..8ef0204 100644
--- a/target-i386/machine.c
+++ b/target-i386/machine.c
@@ -427,7 +427,12 @@ static bool fpop_ip_dp_needed(void *opaque)
X86CPU *cpu = opaque;
CPUX86State *env = &cpu->env;
+#ifdef CONFIG_TCG_EXCEPTION_POINTERS
+ return env->fpop != 0 || env->fpip != 0 || env->fpdp != 0
+ || env->fpcs != 0 || env->fpds != 0;
+#else
return env->fpop != 0 || env->fpip != 0 || env->fpdp != 0;
+#endif
}
static const VMStateDescription vmstate_fpop_ip_dp = {
@@ -435,9 +440,13 @@ static const VMStateDescription vmstate_fpop_ip_dp = {
.version_id = 1,
.minimum_version_id = 1,
.fields = (VMStateField[]) {
- VMSTATE_UINT16(env.fpop, X86CPU),
+ VMSTATE_UINT32(env.fpop, X86CPU),
VMSTATE_UINT64(env.fpip, X86CPU),
VMSTATE_UINT64(env.fpdp, X86CPU),
+#ifdef CONFIG_TCG_EXCEPTION_POINTERS
+ VMSTATE_UINT32(env.fpcs, X86CPU),
+ VMSTATE_UINT32(env.fpds, X86CPU),
+#endif
VMSTATE_END_OF_LIST()
}
};
--
2.1.0
next prev parent reply other threads:[~2014-11-15 11:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-15 11:30 [Qemu-devel] [PATCH v4 0/3] target-i386: x87 exception pointers using TCG Jaume Marti Farriol
2014-11-15 11:30 ` Jaume Marti Farriol [this message]
2014-11-15 11:30 ` [Qemu-devel] [PATCH v4 2/3] " Jaume Marti Farriol
2014-11-15 11:30 ` [Qemu-devel] [PATCH v4 3/3] " Jaume Marti Farriol
2014-11-19 18:59 ` Jaume Martí
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=1416051015-21930-2-git-send-email-jaume.martif@gmail.com \
--to=jaume.martif@gmail.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/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).