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:
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.