From: Wei Liu <wei.liu2@citrix.com>
To: Xen-devel <xen-devel@lists.xenproject.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
Wei Liu <wei.liu2@citrix.com>,
Ian Jackson <ian.jackson@eu.citrix.com>,
Jan Beulich <jbeulich@suse.com>
Subject: [PATCH v3 4/7] x86emul/test: factor out emul_test_get_fpu
Date: Mon, 12 Dec 2016 09:28:29 +0000 [thread overview]
Message-ID: <1481534912-1101-5-git-send-email-wei.liu2@citrix.com> (raw)
In-Reply-To: <1481534912-1101-1-git-send-email-wei.liu2@citrix.com>
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
---
tools/tests/x86_emulator/test_x86_emulator.c | 27 +--------------------------
tools/tests/x86_emulator/x86_emulate.c | 25 +++++++++++++++++++++++++
tools/tests/x86_emulator/x86_emulate.h | 6 ++++++
3 files changed, 32 insertions(+), 26 deletions(-)
diff --git a/tools/tests/x86_emulator/test_x86_emulator.c b/tools/tests/x86_emulator/test_x86_emulator.c
index e40f0ea..04b8ca6 100644
--- a/tools/tests/x86_emulator/test_x86_emulator.c
+++ b/tools/tests/x86_emulator/test_x86_emulator.c
@@ -92,31 +92,6 @@ static int cmpxchg(
return X86EMUL_OKAY;
}
-int get_fpu(
- void (*exception_callback)(void *, struct cpu_user_regs *),
- void *exception_callback_arg,
- enum x86_emulate_fpu_type type,
- struct x86_emulate_ctxt *ctxt)
-{
- switch ( type )
- {
- case X86EMUL_FPU_fpu:
- break;
- case X86EMUL_FPU_mmx:
- if ( cpu_has_mmx )
- break;
- case X86EMUL_FPU_xmm:
- if ( cpu_has_sse )
- break;
- case X86EMUL_FPU_ymm:
- if ( cpu_has_avx )
- break;
- default:
- return X86EMUL_UNHANDLEABLE;
- }
- return X86EMUL_OKAY;
-}
-
static struct x86_emulate_ops emulops = {
.read = read,
.insn_fetch = fetch,
@@ -124,7 +99,7 @@ static struct x86_emulate_ops emulops = {
.cmpxchg = cmpxchg,
.cpuid = emul_test_cpuid,
.read_cr = emul_test_read_cr,
- .get_fpu = get_fpu,
+ .get_fpu = emul_test_get_fpu,
};
int main(int argc, char **argv)
diff --git a/tools/tests/x86_emulator/x86_emulate.c b/tools/tests/x86_emulator/x86_emulate.c
index 8b70580..a666a32 100644
--- a/tools/tests/x86_emulator/x86_emulate.c
+++ b/tools/tests/x86_emulator/x86_emulate.c
@@ -77,4 +77,29 @@ int emul_test_read_cr(
return X86EMUL_UNHANDLEABLE;
}
+int emul_test_get_fpu(
+ void (*exception_callback)(void *, struct cpu_user_regs *),
+ void *exception_callback_arg,
+ enum x86_emulate_fpu_type type,
+ struct x86_emulate_ctxt *ctxt)
+{
+ switch ( type )
+ {
+ case X86EMUL_FPU_fpu:
+ break;
+ case X86EMUL_FPU_mmx:
+ if ( cpu_has_mmx )
+ break;
+ case X86EMUL_FPU_xmm:
+ if ( cpu_has_sse )
+ break;
+ case X86EMUL_FPU_ymm:
+ if ( cpu_has_avx )
+ break;
+ default:
+ return X86EMUL_UNHANDLEABLE;
+ }
+ return X86EMUL_OKAY;
+}
+
#include "x86_emulate/x86_emulate.c"
diff --git a/tools/tests/x86_emulator/x86_emulate.h b/tools/tests/x86_emulator/x86_emulate.h
index 4cc3f72..b4d1555 100644
--- a/tools/tests/x86_emulator/x86_emulate.h
+++ b/tools/tests/x86_emulator/x86_emulate.h
@@ -109,3 +109,9 @@ int emul_test_read_cr(
unsigned int reg,
unsigned long *val,
struct x86_emulate_ctxt *ctxt);
+
+int emul_test_get_fpu(
+ void (*exception_callback)(void *, struct cpu_user_regs *),
+ void *exception_callback_arg,
+ enum x86_emulate_fpu_type type,
+ struct x86_emulate_ctxt *ctxt);
--
2.1.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-12-12 9:28 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-12 9:28 [PATCH v3 0/7] Fuzzing targets for oss-fuzz Wei Liu
2016-12-12 9:28 ` [PATCH v3 1/7] tools/fuzz: introduce libelf target Wei Liu
2016-12-12 9:43 ` Jan Beulich
2016-12-12 9:28 ` [PATCH v3 2/7] x86emul/test: factor out emul_test_make_stack_executable Wei Liu
2016-12-12 9:28 ` [PATCH v3 3/7] x86emul/test: factor out emul_test_{read_cr, cpuid} Wei Liu
2016-12-12 9:45 ` Jan Beulich
2016-12-12 9:51 ` Wei Liu
2016-12-12 9:28 ` Wei Liu [this message]
2016-12-12 9:46 ` [PATCH v3 4/7] x86emul/test: factor out emul_test_get_fpu Jan Beulich
2016-12-12 9:28 ` [PATCH v3 5/7] tools/fuzz: introduce x86 instruction emulator target Wei Liu
2016-12-12 9:58 ` Jan Beulich
2016-12-12 11:19 ` Wei Liu
2016-12-12 11:30 ` Jan Beulich
2016-12-12 11:40 ` Wei Liu
2016-12-12 17:59 ` Ian Jackson
2016-12-12 18:00 ` Wei Liu
2016-12-12 17:51 ` Wei Liu
2016-12-13 7:42 ` Jan Beulich
2016-12-16 9:03 ` George Dunlap
2016-12-12 9:28 ` [PATCH v3 6/7] tools: hook up fuzz directory Wei Liu
2016-12-12 9:28 ` [PATCH v3 7/7] tools/fuzz: add README Wei Liu
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=1481534912-1101-5-git-send-email-wei.liu2@citrix.com \
--to=wei.liu2@citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=jbeulich@suse.com \
--cc=xen-devel@lists.xenproject.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).