Subject: hw.machine under COMPAT_NETBSD32?
To: None <tech-kern@netbsd.org>
From: Quentin Garnier <cube@cubidou.net>
List: tech-kern
Date: 06/16/2005 01:19:00
--qqPCXMeM81mi5CoR
Content-Type: multipart/mixed; boundary="OTIoc9zLs3Wz57k0"
Content-Disposition: inline


--OTIoc9zLs3Wz57k0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi folks,

I don't remember exactly which piece of software I had troubles with in
pkgsrc, but I do remember that having "uname -m" returning "amd64" was
confusing some configuration scripts.

Would anyone object if I committed the attached patch?  I've made sure
it is correct for the sparc64 case, and it has to be in the sh5 as
no value change there.  I can test myself the amd64 case.

The rationale behind that change is to make the kernel appear exactly
as its 32-bits counterpart for that sysctl node, as there is no
valuable interest in giving userland information about the hardware
it is actually running on:  neither sparc64 nor amd64 in 32-bits mode
allow any kind of 64-bits extension (which is not the case for 16-bits
vs. 32-bits on the 80386 processor).

--=20
Quentin Garnier - cube@cubidou.net - cube@NetBSD.org
"When I find the controls, I'll go where I like, I'll know where I want
to be, but maybe for now I'll stay right here on a silent sea."
KT Tunstall, Silent Sea, Eye to the Telescope, 2004.

--OTIoc9zLs3Wz57k0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="n32.diff"
Content-Transfer-Encoding: quoted-printable

Index: compat/netbsd32/netbsd32_sysctl.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/src/sys/compat/netbsd32/netbsd32_sysctl.c,v
retrieving revision 1.15
diff -u -r1.15 netbsd32_sysctl.c
--- compat/netbsd32/netbsd32_sysctl.c	27 Apr 2004 03:49:03 -0000	1.15
+++ compat/netbsd32/netbsd32_sysctl.c	15 Jun 2005 22:56:32 -0000
@@ -105,6 +105,7 @@
 {
 	struct sysctlnode *_root =3D &netbsd32_sysctl_root;
 	extern char machine_arch32[];
+	extern char machine32[];
=20
 	sysctl_createv(clog, 0, &_root, NULL,
 		       CTLFLAG_PERMANENT,
@@ -137,6 +138,11 @@
 		       CTL_HW, CTL_EOL);
 	sysctl_createv(clog, 0, &_root, NULL,
 		       CTLFLAG_PERMANENT,
+		       CTLTYPE_STRING, "machine", NULL,
+		       NULL, 0, machine32, 0,
+		       CTL_HW, HW_MACHINE, CTL_EOL);
+	sysctl_createv(clog, 0, &_root, NULL,
+		       CTLFLAG_PERMANENT,
 		       CTLTYPE_STRING, "machine_arch", NULL,
 		       NULL, 0, machine_arch32, 0,
 		       CTL_HW, HW_MACHINE_ARCH, CTL_EOL);
Index: arch/sh5/sh5/netbsd32_machdep.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/src/sys/arch/sh5/sh5/netbsd32_machdep.c,v
retrieving revision 1.7
diff -u -r1.7 netbsd32_machdep.c
--- arch/sh5/sh5/netbsd32_machdep.c	10 Jun 2005 05:10:12 -0000	1.7
+++ arch/sh5/sh5/netbsd32_machdep.c	15 Jun 2005 22:56:32 -0000
@@ -77,6 +77,7 @@
=20
 #include <sh5/fpu.h>
=20
+char	machine32[] =3D "sh5";
 char	machine_arch32[] =3D "sh5";
=20
 #ifdef COMPAT_16
Index: arch/amd64/amd64/netbsd32_machdep.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/src/sys/arch/amd64/amd64/netbsd32_machdep.c,v
retrieving revision 1.15
diff -u -r1.15 netbsd32_machdep.c
--- arch/amd64/amd64/netbsd32_machdep.c	10 Jun 2005 05:10:12 -0000	1.15
+++ arch/amd64/amd64/netbsd32_machdep.c	15 Jun 2005 22:56:34 -0000
@@ -68,6 +68,7 @@
 #include <compat/netbsd32/netbsd32_syscallargs.h>
=20
 /* Provide a the name of the architecture we're emulating */
+char	machine32[] =3D "i386";
 char	machine_arch32[] =3D "i386";=09
=20
 int process_read_fpregs32(struct lwp *, struct fpreg32 *);
Index: arch/sparc64/sparc64/netbsd32_machdep.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/src/sys/arch/sparc64/sparc64/netbsd32_machdep.c,v
retrieving revision 1.47
diff -u -r1.47 netbsd32_machdep.c
--- arch/sparc64/sparc64/netbsd32_machdep.c	10 Jun 2005 05:10:12 -0000	1.47
+++ arch/sparc64/sparc64/netbsd32_machdep.c	15 Jun 2005 22:56:37 -0000
@@ -78,6 +78,7 @@
 #include <machine/netbsd32_machdep.h>
=20
 /* Provide a the name of the architecture we're emulating */
+char	machine32[] =3D "sparc";=09
 char	machine_arch32[] =3D "sparc";=09
=20
 #if NFIRM_EVENTS > 0

--OTIoc9zLs3Wz57k0--

--qqPCXMeM81mi5CoR
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (NetBSD)

iQEVAwUBQrC3ZNgoQloHrPnoAQLV2wf/dprxldI0H6gCcH2nsmigU5pibasLo5Mk
WpfhwmJ0RdGHFs4DQTLF1JLQD1/7yw7LUuJVBGG1h+S1xp/mvAuY6AP/pZAlYlxi
v+KqOuwQaQ7JkK9UXUq/h1rTLfEH1jlPhJCNoHgNr7QCy9dvNqnhgrVkrj+X+IUf
w5tAyVZ0ITo1lAa0jfAef4xRea0a3I463zjmqud+u1sKf2mYYbZ3uy+7k/5VbZWy
4kmYzvpPVIQ+Hj6v9hDp0UB0z12Ky0ezmbumpsXKtR9NOvVFH6VSFl3V5NnwIV6c
LfOHOxVNC45kXNF5Akd+RfMq5JebFPgpUL7nOIihxdR+gYOy90dUPA==
=Apbx
-----END PGP SIGNATURE-----

--qqPCXMeM81mi5CoR--