Re: How to use cpuid?
Re: How to use cpuid?
- Subject: Re: How to use cpuid?
- From: Duane Murphy <email@hidden>
- Date: Fri, 23 Apr 2010 10:55:15 -0700
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Thank you Shantonu. That helps.
I'm trying to test for support of a specific CPU instruction feature.
In this case instructions that is only available in the latest CPUs.
I've noticed that Gestalt(gestaltX86Features) and
Gestalt(gestaltX86AdditionalFeatures) are the userland equivalent of
cpuid(). I'm hoping they are transparent and just return the raw
results.
Ah, machdeps.cpu.feature_bits and extfeature_bits might be even easier.
Thanks!
On Apr 23, 2010, at 10:46 AM, Shantonu Sen wrote:
> No, they really aren't. For one thing, the inline assembly assumes
> you have access to ëx as a free register, which isn't the case for
> userspace code.
>
> What are you really trying to do? I'd recommend "sysctl
> machdep.cpu" (or the equivalent sysctlbyname(3)) to get most feature
> information.
>
> Shantonu Sen
> email@hidden
>
> Sent from my Mac Pro
>
> On Apr 23, 2010, at 10:14 AM, Duane Murphy wrote:
>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA256
>>
>> While I usually agree with that, the do_cpuid and cpuid functions are
>> in-line and don't require linking. That's why I asked.
>>
>> These functions should be legit from either userland or from the
>> kernel.
>>
>> On Apr 23, 2010, at 9:45 AM, Brian Bergstrand wrote:
>>
>>> You don't. The symbols in the Kernel framework are only exported by
>>> the Kernel. They are not exported by any userland libraries. There
>>> are of course symbol names shared by kernel and userland, but that
>>> is by name only.
>>>
>>> On Apr 23, 2010, at 7:36 PM, Duane Murphy wrote:
>>>
>>>> -----BEGIN PGP SIGNED MESSAGE-----
>>>> Hash: SHA256
>>>>
>>>> I'd like to use the do_cpuid() function in i386/cpuid.h of the
>>>> Kernel
>>>> framework in a user land application as well as in a kext.
>>>>
>>>> The kext I can get compiling, but getting the userland include file
>>>> working isn't playing nice. I added the Kernel framework to the
>>>> Xcode
>>>> project, but that doesn't really help because the internal header
>>>> files don't use the Kernel prefix.
>>>>
>>>> How do I go about using do_cpuid() from a user land application?
>>>>
>>>> Thanks,
>>>>
>>>> ...Duane
>>>>
>>>
>>>
>>>
>>
>> ...Duane
>>
>>
>>
>>
>> -----BEGIN PGP SIGNATURE-----
>> Version: PGP Desktop 9.10.0 (Build 500)
>> Charset: US-ASCII
>>
>> wsBVAwUBS9HVaUrg9acQ4r2CAQiHLAgAvh4lk0iraccHUmhIzeVfn1tCZoNPu4t8
>> OHNzNK6qWZHqkFA/i4QVhRZVA3vAke3A9VtI1E6CamwLobp+B3KDmcACGQGI8rZf
>> ehoSpg81NkPRbRT5WsVcGR1HVOiHFctaTKCphXPqObfPD1Y09Jbyqvowv+0WBxkN
>> zvchIUxFjoQPTUBl4/ZUOkv46Byys8J/Aea9x0Z/R/iJL0kvQ507HO2HkuJRd9nw
>> rv16FpgrxZ6mcROses/fiYH0QGa/c8rTYBQQvia5DfmfQq/zwcMdvPv9yUfZRVky
>> PT0Qol+wgdoFcVbXvBvwwWrqqTQj5IBWPqw2ed57QshAz2ZKDxTwSg==
>> =C5TJ
>> -----END PGP SIGNATURE-----
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Darwin-dev mailing list (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden
>
...Duane
-----BEGIN PGP SIGNATURE-----
Version: PGP Desktop 9.10.0 (Build 500)
Charset: US-ASCII
wsBVAwUBS9HfI0rg9acQ4r2CAQgvMQgAuYDXbZwOBf0y3RGYmOJLkvlzfNQvS4Ig
7dscTaC53T07FO4sOyk0GdFu+SBk1ZViA97cg0eyyvGWOtj2oSkNqmv+ibEsR2xf
2floytRZrizUXMW7/rxX/6felSSXl7PJN/SYrTfP4VYw38aIlv1qTuOSKyghgOic
YBWLFmhf98IVYRsKmJd9GmQmO95uplM47npxYLq+kp8JrY9L8q1gpgT73eC6IrUk
W0l8oXRr+xpbN2Q97uOFgOOOrl41jKH/C8wxDIvGZmRVXM6ldMn2WSXmmZKSZt+7
TINukZHHCAWdIdr8OK9Xd/CpFfYgDRwwPdFg+FltX1WFiamxPq9E3g==
=yQeZ
-----END PGP SIGNATURE-----
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden