[fpc-devel] Feature announcement: Extension of TThread's interface

Ewald ewald at yellowcouch.org
Fri Dec 28 16:11:17 CET 2012


Once upon a time, on 12/28/2012 06:46 AM to be precise,
microcode at zoho.com said:
> On Thu, Dec 27, 2012 at 07:01:08PM +0000, Mark Morgan Lloyd wrote:
>> Ewald wrote:
>>
>>> Now, for the implementation of ProcessorCount I've got code here that
>>> reads the amount of processor cores from `/proc/cpuinfo` (linux only I
>>> think) and some assembly code [asmmode att] (tested on x86_64 and i386)
>>> that *tries* to get the amount of cpu cores by the use of CPUID. The
>> In the general case, you have to be careful with this since (a)
>> every architecture puts different info in /proc/cpuinfo and (b) the
>> processor numbering and affinity vectors can have gaps.
> In the general case how is his x86 asm supposed to ever work on anything but
> Intel or AMD boxes?
It isn't, it will need to be rewritten. But that shouldn't be a problem
since most cpu's will have instuctions for
- Add
- Compare
- Jump
- Shift
- Binary And
- CPUID (probably not under this name, but I beleive most modern CPU's
have got some kind of equivalent)

The same thing goes for platform specific code by the way, you can't
expect code that uses baseunix to compile without modification on a non
unix box (e.g. windows).

-- 
Ewald




More information about the fpc-devel mailing list