On 23 Apr, Richard Levitte - VMS Whacker wrote:
> ulf> For BSD/386, FreeBSD and NetBSD there are two entries each:
> ulf> It seems that uname -m always returns i386. That would cause a
> ulf> Pentium to be mistaken for a 386. How do you get the CPU version
> ulf> on BSD?
The value is pulled from the machine field of the utsname struct. This
is almost always a generic hardware platform identifier, and not a CPU
identifier. For the 4.4BSD make environment, "i386" implies an Intel
architecture. The BSD make command sets the MACHINE macro to the
contents of utsname.machine and uses that to build platform specific
code. You can't change the semantics of utsname.machine without
breaking the OS platform-dependent build environment.
> There are talks that FreeBSD will be ported to a couple of other
> achitectures (I currently don't remember whic, Alpha or Sparc or
> something else...).
FreeBSD has been self-hosting on the Alpha for several months now.
If you're willing to do some OS specific tests for the CPU type, on
FreeBSD you can run 'sysctl hw.model' which returns values like:
Pentium/P55C 233 MHz Pentium w/MMX
Pentium II (quarter-micron) 450 MHz P-II
I don't think it's good software design to try to guess these sorts of
optimizations, though. I've always leant towards defaulting for the
conservative case, with overrides available if the user themselves
decides to optimize for a specific architecture. On some systems (Irix
and AIX come to mind), sites can configure the compilers to optimize
for a specific CPU, ABI, or combinations of the two. We shouldn't
second guess those settings. (On machines running the 4.4BSD make, you
can set optimizations via /etc/make.conf.)
My recommendation is to build for the generic case, and document the
optimizations available for each platform, and why someone would want
to (or not want to) use them. Slow and working is always preferable to
a fast crash.
--lyndon
______________________________________________________________________
OpenSSL Project http://www.openssl.org
Development Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]