* Bug in x86_64 do_cpuid()
@ 2013-10-30 14:00 Bruce Cran
2013-10-31 16:55 ` Jens Axboe
0 siblings, 1 reply; 2+ messages in thread
From: Bruce Cran @ 2013-10-30 14:00 UTC (permalink / raw)
To: fio@vger.kernel.org
It seems there's a bug in the x86_64 version of do_cpuid() that causes
fio to segfault when built with clang at lower optimization levels:
static inline void do_cpuid(unsigned int *eax, unsigned int *ebx,
unsigned int *ecx, unsigned int *edx)
{
asm volatile("cpuid"
: "=a" (*eax), "=b" (*ebx), "=r" (*ecx), "=d" (*edx)
: "0" (*eax), "2" (*ecx)
: "memory");
}
via Tijl Coosemans:
Should be: "=c" (*ecx)
But you can also use the '+' modifier and remove the input operands:
: "+a" (*eax), "=b" (*ebx), "+c" (*ecx), "=d" (*edx)
:
: "memory"
--
Bruce Cran
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: Bug in x86_64 do_cpuid()
2013-10-30 14:00 Bug in x86_64 do_cpuid() Bruce Cran
@ 2013-10-31 16:55 ` Jens Axboe
0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2013-10-31 16:55 UTC (permalink / raw)
To: Bruce Cran; +Cc: fio@vger.kernel.org
On Wed, Oct 30 2013, Bruce Cran wrote:
> It seems there's a bug in the x86_64 version of do_cpuid() that causes fio
> to segfault when built with clang at lower optimization levels:
>
> static inline void do_cpuid(unsigned int *eax, unsigned int *ebx,
> unsigned int *ecx, unsigned int *edx)
> {
> asm volatile("cpuid"
> : "=a" (*eax), "=b" (*ebx), "=r" (*ecx), "=d" (*edx)
> : "0" (*eax), "2" (*ecx)
> : "memory");
> }
>
> via Tijl Coosemans:
>
> Should be: "=c" (*ecx)
>
> But you can also use the '+' modifier and remove the input operands:
>
> : "+a" (*eax), "=b" (*ebx), "+c" (*ecx), "=d" (*edx)
> :
> : "memory"
+a/+c doesn't work, but =c will do the trick.
--
Jens Axboe
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-10-31 16:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-30 14:00 Bug in x86_64 do_cpuid() Bruce Cran
2013-10-31 16:55 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox