Subject: Re: new sysctl: hw.cpu_isa
To: Simon Burge <simonb@wasabisystems.com>
From: Ben Harris <bjh21@netbsd.org>
List: tech-kern
Date: 11/15/2000 15:31:20
On Tue, 14 Nov 2000, Simon Burge wrote:

> > >So, anyone disagree with this whole idea or have any suggestions of
> > >improvements?
> > 
> > Question:  If the kernel emulates the instructions provided by later ISAs,
> > what should it report?
> 
> As I said, my initial goal is to provide for automatic shared library
> selection.  Since you want the most efficient library choice for the
> current CPU I would say the native ISA.

Sounds fine to me.  I suppose if userland wants to know if a given
instruction is available through emulation, they can always execute it and
see if they get a SIGILL... *grin*

> > >+char cpu_isa[] = "arm2";	/* XXX */
> > > 
> > > /* Our exported CPU info; we can have only one. */
> > > struct cpu_info cpu_info_store;
> > 
> > This would need to be set to "armv2" or "armv2a" in cpu_attach().
> 
> That's cool.  This is how things are done with other architectures that
> support more than one ISA.  Is there a test we can use to determine
> which is which?

This is already done by cpu.c.  Here's the guts of a patch (missing
declarations etc, but should tell you what you need):

--- cpu.c.orig  Tue May  9 21:55:00 2000
+++ cpu.c       Mon Nov 13 15:52:51 2000
@@ -85,18 +85,21 @@
        supported = 0;
        switch (cpu_type & CPU_ID_CPU_MASK) {
        case CPU_ID_ARM2:
+               strcpy(cpu_isa, "armv2");
                printf("ARM2");
 #ifdef CPU_ARM2
                supported = 1;
 #endif
                break;
        case CPU_ID_ARM250:
+               strcpy(cpu_isa, "armv2a");
                printf("ARM250");
 #ifdef CPU_ARM250
                supported = 1;
 #endif
                break;
        case CPU_ID_ARM3:
+               strcpy(cpu_isa, "armv2a");
                printf("ARM3 (rev. %d)", cpu_type & CPU_ID_REVISION_MASK);
 #ifdef CPU_ARM3
                supported = 1;

-- 
Ben Harris                                                   <bjh21@netbsd.org>
Portmaster, NetBSD/arm26               <URL:http://www.netbsd.org/Ports/arm26/>