[pulseaudio-discuss] [PATCH] core-util, cpu-x86: use __get_cpuid() instead of homegrown assembly

Tanu Kaskinen tanuk at iki.fi
Wed Dec 6 19:28:14 UTC 2017


On Mon, 2017-12-04 at 19:44 +0530, Arun Raghavan wrote:
> On Wed, 22 Nov 2017, at 08:44 PM, Tanu Kaskinen wrote:
> > The get_cpuid() function in cpu-x86.c was buggy on x86-64. When building
> > without optimizations, the homegrown assembly code overwrote the
> > beginning of the function argument list on the stack. That happened to
> > work fine on regular x86-64, but caused crashing with the x32 ABI.
> > 
> > At least GCC and clang provide cpuid.h, which has the __get_cpuid()
> > function that can be used instead of the homegrown assembly.
> 
> Just as a sanity check -- does this introduce any compiler version
> dependencies? The clang header seems to have been updated relatively
> recently for SSE 4.1/4.2 (2016), but the gcc header seems quite old, so
> probably okay.

I haven't checked the history of the compilers, but if there are any
compilers in use that don't support __get_cpuid(), they will hopefully
just skip the cpuid parts since the code is guarded by HAVE_CPUID_H.

> > @@ -3663,11 +3666,13 @@ bool pa_running_in_vm(void) {
> 
> I wonder if the use-case for this is still valid (not being able to run
> tsched in a VM).

I don't know, and I don't plan to find out... If you want to test
tsched in all the VMs, be my guest :)

I suppose the patch is okay to push?

-- 
Tanu

https://www.patreon.com/tanuk


More information about the pulseaudio-discuss mailing list