* [Qemu-devel] [PATCH v2] tcg/i386: Fix build for systems without working cpuid.h (MacOSX, Win32)
@ 2014-02-20 19:42 Peter Maydell
2014-02-20 21:08 ` Richard Henderson
0 siblings, 1 reply; 3+ messages in thread
From: Peter Maydell @ 2014-02-20 19:42 UTC (permalink / raw)
To: qemu-devel; +Cc: Richard Henderson, patches
Win32 doesn't have a cpuid.h, and MacOSX may have one but without
the __cpuid() function we use, which means that commit 9d2eec20
broke the build for those platforms. Fix this by tightening up
our configure cpuid.h check to test that the functions we need
are present, and adding some missing #ifdef guards in
tcg/i386/tcg-target.c.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
Changes v1->v2: fix typo in commit message, add __cpuid_count()
to the configure test
configure | 13 ++++++++++++-
tcg/i386/tcg-target.c | 4 +++-
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/configure b/configure
index 4648117..79eb54c 100755
--- a/configure
+++ b/configure
@@ -3564,7 +3564,18 @@ cpuid_h=no
cat > $TMPC << EOF
#include <cpuid.h>
int main(void) {
- return 0;
+ unsigned a, b, c, d;
+ int max = __get_cpuid_max(0, 0);
+
+ if (max >= 1) {
+ __cpuid(1, a, b, c, d);
+ }
+
+ if (max >= 7) {
+ __cpuid_count(7, 0, a, b, c, d);
+ }
+
+ return 0;
}
EOF
if compile_prog "" "" ; then
diff --git a/tcg/i386/tcg-target.c b/tcg/i386/tcg-target.c
index fef1717..f832282 100644
--- a/tcg/i386/tcg-target.c
+++ b/tcg/i386/tcg-target.c
@@ -115,7 +115,7 @@ static const int tcg_target_call_oarg_regs[] = {
is available. */
#if TCG_TARGET_REG_BITS == 64
# define have_cmov 1
-#elif defined(CONFIG_CPUID_H)
+#elif defined(CONFIG_CPUID_H) && defined(bit_CMOV)
static bool have_cmov;
#else
# define have_cmov 0
@@ -2295,6 +2295,7 @@ static void tcg_target_qemu_prologue(TCGContext *s)
static void tcg_target_init(TCGContext *s)
{
+#ifdef CONFIG_CPUID_H
unsigned a, b, c, d;
int max = __get_cpuid_max(0, 0);
@@ -2323,6 +2324,7 @@ static void tcg_target_init(TCGContext *s)
have_bmi2 = (b & bit_BMI2) != 0;
#endif
}
+#endif
if (TCG_TARGET_REG_BITS == 64) {
tcg_regset_set32(tcg_target_available_regs[TCG_TYPE_I32], 0, 0xffff);
--
1.8.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH v2] tcg/i386: Fix build for systems without working cpuid.h (MacOSX, Win32)
2014-02-20 19:42 [Qemu-devel] [PATCH v2] tcg/i386: Fix build for systems without working cpuid.h (MacOSX, Win32) Peter Maydell
@ 2014-02-20 21:08 ` Richard Henderson
2014-02-21 11:36 ` Peter Maydell
0 siblings, 1 reply; 3+ messages in thread
From: Richard Henderson @ 2014-02-20 21:08 UTC (permalink / raw)
To: Peter Maydell, qemu-devel; +Cc: patches
On 02/20/2014 01:42 PM, Peter Maydell wrote:
> Win32 doesn't have a cpuid.h, and MacOSX may have one but without
> the __cpuid() function we use, which means that commit 9d2eec20
> broke the build for those platforms. Fix this by tightening up
> our configure cpuid.h check to test that the functions we need
> are present, and adding some missing #ifdef guards in
> tcg/i386/tcg-target.c.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> Changes v1->v2: fix typo in commit message, add __cpuid_count()
> to the configure test
>
> configure | 13 ++++++++++++-
> tcg/i386/tcg-target.c | 4 +++-
> 2 files changed, 15 insertions(+), 2 deletions(-)
Reviewed-by: Richard Henderson <rth@twiddle.net>
r~
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH v2] tcg/i386: Fix build for systems without working cpuid.h (MacOSX, Win32)
2014-02-20 21:08 ` Richard Henderson
@ 2014-02-21 11:36 ` Peter Maydell
0 siblings, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2014-02-21 11:36 UTC (permalink / raw)
To: Richard Henderson; +Cc: QEMU Developers, Patch Tracking
On 20 February 2014 21:08, Richard Henderson <rth@twiddle.net> wrote:
> On 02/20/2014 01:42 PM, Peter Maydell wrote:
>> Win32 doesn't have a cpuid.h, and MacOSX may have one but without
>> the __cpuid() function we use, which means that commit 9d2eec20
>> broke the build for those platforms. Fix this by tightening up
>> our configure cpuid.h check to test that the functions we need
>> are present, and adding some missing #ifdef guards in
>> tcg/i386/tcg-target.c.
>>
>> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
>> ---
>> Changes v1->v2: fix typo in commit message, add __cpuid_count()
>> to the configure test
>>
>> configure | 13 ++++++++++++-
>> tcg/i386/tcg-target.c | 4 +++-
>> 2 files changed, 15 insertions(+), 2 deletions(-)
>
> Reviewed-by: Richard Henderson <rth@twiddle.net>
Thanks; applied to master.
-- PMM
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-02-21 11:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-20 19:42 [Qemu-devel] [PATCH v2] tcg/i386: Fix build for systems without working cpuid.h (MacOSX, Win32) Peter Maydell
2014-02-20 21:08 ` Richard Henderson
2014-02-21 11:36 ` Peter Maydell
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).