CPUInfo goes multi-platform

After some rather extensive rewriting and extending of the code, I managed to get the library to compile in gcc. I’ve compiled it and ran it on my FreeBSD box, which has a Pentium II at 350 MHz. Here are the results:

TestCPUInfo-FreeBSD

Looks pretty good to me. The serial number doesn’t work, because the %I64u formatting string is a Microsoft-only thing. But that’s just a minor glitch. The CPUID and RDTSC wrapping code work fine, they are coded with inline gcc assembly. I haven’t converted the other asm routines yet, but they aren’t that interesting. They are mainly useful for when you don’t have CPUID, but any CPU since the original Pentium has it, as well as some later 486 processors. So that bit of code doesn’t get very high priority from me.

This code should now compile and run on any posix-compatible system with an x86 processor. That should at least include linux and Mac OS X. I have a box with 64-bit FreeBSD, I will give the code a try on that one as well. It should compile for 64-bit as well, but I’ve only tested that in Windows so far, with Visual Studio. I’ll have to see if gcc works as well.

Update: The code was tested on both 64-bit Gentoo Linux and 64-bit FreeBSD 7.2, and worked fine on both OSes.

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

One Response to CPUInfo goes multi-platform

  1. Pingback: Another root exploit for linux | Scali's blog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s