Subject: Re: how to detect at runtime which system you're running on...
To: Chris Gilbert <firstname.lastname@example.org>
From: Ben Harris <email@example.com>
Date: 06/18/2001 11:49:34
On Sun, 17 Jun 2001, Chris Gilbert wrote:
> With the move towards different arch dirs, it's been suggested that archs
> that can merge do, eg EBSA285 and CATS, A7000 and RISCPC. However I'm
> currently unaware of an easy way to do runtime detection of arch. If someone
> knows of one I'm just being ignorant of, please shout up :)
What do you mean by "arch"? Do you mean inside the kernel or outside?
Inside, you can check MACHINE, and if that isn't fine-grained enough, you
should probably check the actual feature you're interested in.
> To deal with this in a generic manner, I'd like to suggest we have an
> arm/arch_type.h header file, into which we have an enum of all the
> arch/platforms. We then have a variable for checking what arch the kernel is
> on. The variable being in arm/arm/cpufunc.c (or some other file decided on)
That seems like overkill for the job at hand. The problem is that you'll
probably end up putting the division between two "arch"es in the wrong
place anyway, and end up needing to distinguish between machines in the
same "arch", and you'll have to invent another mechanism to tell the
difference between _them_. I think a better approach is to have a
variable to indicate the presence of the actual feature you're interested
Ben Harris <firstname.lastname@example.org>
Portmaster, NetBSD/arm26 <URL:http://www.netbsd.org/Ports/arm26/>