Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys Provide the correct architecture for HW_MACHINE_ARCH so ...



details:   https://anonhg.NetBSD.org/src/rev/a685cea97cbd
branches:  trunk
changeset: 532770:a685cea97cbd
user:      eeh <eeh%NetBSD.org@localhost>
date:      Fri Jun 14 18:28:19 2002 +0000

description:
Provide the correct architecture for HW_MACHINE_ARCH so things like
"sysctl -p" can tell they are in 32-bit land.

diffstat:

 sys/arch/sparc64/sparc64/netbsd32_machdep.c |   3 ++
 sys/arch/x86_64/x86_64/netbsd32_machdep.c   |   5 +++-
 sys/compat/netbsd32/netbsd32_sysctl.c       |  32 ++++++++++++++++++++++++++--
 3 files changed, 36 insertions(+), 4 deletions(-)

diffs (99 lines):

diff -r 20f9b0ffb6d9 -r a685cea97cbd sys/arch/sparc64/sparc64/netbsd32_machdep.c
--- a/sys/arch/sparc64/sparc64/netbsd32_machdep.c       Fri Jun 14 17:12:05 2002 +0000
+++ b/sys/arch/sparc64/sparc64/netbsd32_machdep.c       Fri Jun 14 18:28:19 2002 +0000
@@ -69,6 +69,9 @@
 #include <machine/vuid_event.h>
 #include <machine/netbsd32_machdep.h>
 
+/* Provide a the name of the architecture we're emulating */
+char   machine_arch32[] = "sparc";     
+
 static int ev_out32 __P((struct firm_event *, int, struct uio *));
 
 /*
diff -r 20f9b0ffb6d9 -r a685cea97cbd sys/arch/x86_64/x86_64/netbsd32_machdep.c
--- a/sys/arch/x86_64/x86_64/netbsd32_machdep.c Fri Jun 14 17:12:05 2002 +0000
+++ b/sys/arch/x86_64/x86_64/netbsd32_machdep.c Fri Jun 14 18:28:19 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_machdep.c,v 1.6 2002/06/12 19:13:28 fvdl Exp $        */
+/*     $NetBSD: netbsd32_machdep.c,v 1.7 2002/06/14 18:28:20 eeh Exp $ */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -59,6 +59,9 @@
 #include <compat/netbsd32/netbsd32.h>
 #include <compat/netbsd32/netbsd32_syscallargs.h>
 
+/* Provide a the name of the architecture we're emulating */
+char   machine_arch32[] = "i386";      
+
 int process_read_fpregs32(struct proc *, struct fpreg32 *);
 int process_read_regs32(struct proc *, struct reg32 *);
 
diff -r 20f9b0ffb6d9 -r a685cea97cbd sys/compat/netbsd32/netbsd32_sysctl.c
--- a/sys/compat/netbsd32/netbsd32_sysctl.c     Fri Jun 14 17:12:05 2002 +0000
+++ b/sys/compat/netbsd32/netbsd32_sysctl.c     Fri Jun 14 18:28:19 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_sysctl.c,v 1.5 2002/02/14 07:08:20 chs Exp $  */
+/*     $NetBSD: netbsd32_sysctl.c,v 1.6 2002/06/14 18:28:19 eeh Exp $  */
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_sysctl.c,v 1.5 2002/02/14 07:08:20 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_sysctl.c,v 1.6 2002/06/14 18:28:19 eeh Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ddb.h"
@@ -61,6 +61,7 @@
 
 int uvm_sysctl32(int *, u_int, void *, size_t *, void *, size_t, struct proc *);
 int kern_sysctl32(int *, u_int, void *, size_t *, void *, size_t, struct proc *);
+int hw_sysctl32(int *, u_int, void *, size_t *, void *, size_t, struct proc *);
 
 /*
  * uvm_sysctl32: sysctl hook into UVM system, handling special 32-bit
@@ -139,6 +140,24 @@
        /* NOTREACHED */
 }
 
+/*
+ * hardware related system variables.
+ */
+int
+hw_sysctl32(int *name, u_int namelen, void *oldp, size_t *oldlenp,
+    void *newp, size_t newlen, struct proc *p)
+{
+       extern char machine_arch32[];
+
+       switch (name[0]) {
+       case HW_MACHINE_ARCH:
+               return (sysctl_rdstring(oldp, oldlenp, newp, machine_arch32));
+       default:
+               return (EOPNOTSUPP);
+       }
+       /* NOTREACHED */
+}
+
 int
 netbsd32___sysctl(p, v, retval)
        struct proc *p;
@@ -195,7 +214,14 @@
                }
                break;
        case CTL_HW:
-               fn = hw_sysctl;
+               switch (name[1]) {
+               case HW_MACHINE_ARCH:
+                       fn = hw_sysctl32;
+                       break;
+               default:
+                       fn = hw_sysctl;
+                       break;
+               }
                break;
        case CTL_VM:
                switch (name[1]) {



Home | Main Index | Thread Index | Old Index