From owner-freebsd-emulation@FreeBSD.ORG Fri Jul 11 11:44:13 2008 Return-Path: Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2B69D1065670 for ; Fri, 11 Jul 2008 11:44:13 +0000 (UTC) (envelope-from freebsd-emulation@m.gmane.org) Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by mx1.freebsd.org (Postfix) with ESMTP id A6ACD8FC18 for ; Fri, 11 Jul 2008 11:44:12 +0000 (UTC) (envelope-from freebsd-emulation@m.gmane.org) Received: from list by ciao.gmane.org with local (Exim 4.43) id 1KHH2l-0008PO-Mc for freebsd-emulation@freebsd.org; Fri, 11 Jul 2008 11:44:07 +0000 Received: from 81.210.247.130 ([81.210.247.130]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 11 Jul 2008 11:44:07 +0000 Received: from saper by 81.210.247.130 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 11 Jul 2008 11:44:07 +0000 X-Injected-Via-Gmane: http://gmane.org/ To: freebsd-emulation@freebsd.org From: Marcin Cieslak Date: Fri, 11 Jul 2008 13:43:55 +0200 Lines: 285 Message-ID: Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-ripemd160; protocol="application/pgp-signature"; boundary="------------enigB9C2465D4B5F6674128C91F7" X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 81.210.247.130 User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.8.1.13) Gecko/20080405 SeaMonkey/1.1.9 Mnenhy/0.7.5.0 X-Enigmail-Version: 0.95.6 Sender: news Subject: linux emulation: Preliminary support for more auxvec's X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Jul 2008 11:44:13 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigB9C2465D4B5F6674128C91F7 Content-Type: multipart/mixed; boundary="------------050802080807070906070205" This is a multi-part message in MIME format. --------------050802080807070906070205 Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: quoted-printable Hello, Attached please find a simple diff to implement additional loader=20 information (for background please see:=20 http://lists.freebsd.org/pipermail/freebsd-emulation/2006-September/00259= 1.html) This patch creates linux_get_machine() making linux_new_uname=20 platform-independent. AT_PLATFORM is not yet implemented, since I need to allocate a string=20 for it on the user stack. I *could* use something on the SPARE_USRSPACE, = but I think we got rid of all such tricks long time ago. A bit better solution might be to change linux_copyout_strings to=20 allocate more space for the AT_PLATFORM (but how do I then pass the=20 pointer to the elf_linux_fixup?) This would also mean to bring the linux_copyout_strings to i386. What's the best way to do this? --Marcin --------------050802080807070906070205 Content-Type: text/x-diff; name="auxvec.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline; filename="auxvec.diff" Index: compat/linux/linux_misc.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: /usr/home/ncvs/src/sys/compat/linux/linux_misc.c,v retrieving revision 1.214.2.1 diff -u -r1.214.2.1 linux_misc.c --- compat/linux/linux_misc.c 29 Feb 2008 14:58:08 -0000 1.214.2.1 +++ compat/linux/linux_misc.c 11 Jul 2008 09:59:10 -0000 @@ -732,34 +732,8 @@ *p =3D '\0'; break; } -#ifdef __i386__ - { - const char *class; - - switch (cpu_class) { - case CPUCLASS_686: - class =3D "i686"; - break; - case CPUCLASS_586: - class =3D "i586"; - break; - case CPUCLASS_486: - class =3D "i486"; - break; - default: - class =3D "i386"; - } - strlcpy(utsname.machine, class, LINUX_MAX_UTSNAME); - } -#elif defined(__amd64__) /* XXX: Linux can change 'personality'. */ -#ifdef COMPAT_LINUX32 - strlcpy(utsname.machine, "i686", LINUX_MAX_UTSNAME); -#else - strlcpy(utsname.machine, "x86_64", LINUX_MAX_UTSNAME); -#endif /* COMPAT_LINUX32 */ -#else /* something other than i386 or amd64 - assume we and Linux agree = */ - strlcpy(utsname.machine, machine, LINUX_MAX_UTSNAME); -#endif /* __i386__ */ + + linux_get_machine(&utsname); strlcpy(utsname.domainname, domainname, LINUX_MAX_UTSNAME); =20 return (copyout(&utsname, args->buf, sizeof(utsname))); Index: i386/include/elf.h =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: /usr/home/ncvs/src/sys/i386/include/elf.h,v retrieving revision 1.17 diff -u -r1.17 elf.h --- i386/include/elf.h 4 Oct 2006 21:37:09 -0000 1.17 +++ i386/include/elf.h 11 Jul 2008 11:20:03 -0000 @@ -104,8 +104,12 @@ #define AT_EUID 12 /* Effective uid. */ #define AT_GID 13 /* Real gid. */ #define AT_EGID 14 /* Effective gid. */ +#define AT_PLATFORM 15 /* CPU identification string. */ +#define AT_HWCAP 16 /* CPU capabilities (arch dependent). */ +#define AT_CLKTCK 17 /* Frequency at which times() increments */ +#define AT_SECURE 23 /* Secure mode */ =20 -#define AT_COUNT 15 /* Count of defined aux entry types. */ +#define AT_COUNT 18 /* Count of defined aux entry types. */ =20 /* * Relocation types. Index: i386/linux/linux.h =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: /usr/home/ncvs/src/sys/i386/linux/linux.h,v retrieving revision 1.78 diff -u -r1.78 linux.h --- i386/linux/linux.h 18 Sep 2007 19:50:33 -0000 1.78 +++ i386/linux/linux.h 11 Jul 2008 09:52:51 -0000 @@ -309,6 +309,7 @@ =20 int linux_to_bsd_sigaltstack(int lsa); int bsd_to_linux_sigaltstack(int bsa); +void linux_get_machine(struct l_new_utsname *utsname); =20 typedef void (*l_handler_t)(l_int); typedef l_ulong l_osigset_t; Index: i386/linux/linux_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: /usr/home/ncvs/src/sys/i386/linux/linux_machdep.c,v retrieving revision 1.78.2.2 diff -u -r1.78.2.2 linux_machdep.c --- i386/linux/linux_machdep.c 14 Feb 2008 18:37:39 -0000 1.78.2.2 +++ i386/linux/linux_machdep.c 11 Jul 2008 09:57:02 -0000 @@ -971,6 +971,27 @@ return (error); } =20 +void +linux_get_machine(struct l_new_utsname *utsname) +{ + const char *class; + + switch (cpu_class) { + case CPUCLASS_686: + class =3D "i686"; + break; + case CPUCLASS_586: + class =3D "i586"; + break; + case CPUCLASS_486: + class =3D "i486"; + break; + default: + class =3D "i386"; + } + strlcpy(utsname->machine, class, LINUX_MAX_UTSNAME); +} + /* * Linux has two extra args, restart and oldmask. We dont use these, * but it seems that "restart" is actually a context pointer that Index: i386/linux/linux_sysvec.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: /usr/home/ncvs/src/sys/i386/linux/linux_sysvec.c,v retrieving revision 1.150.2.1 diff -u -r1.150.2.1 linux_sysvec.c --- i386/linux/linux_sysvec.c 27 Mar 2008 13:46:27 -0000 1.150.2.1 +++ i386/linux/linux_sysvec.c 11 Jul 2008 10:38:55 -0000 @@ -260,6 +260,9 @@ AUXARGS_ENTRY(pos, AT_EUID, imgp->proc->p_ucred->cr_svuid); AUXARGS_ENTRY(pos, AT_GID, imgp->proc->p_ucred->cr_rgid); AUXARGS_ENTRY(pos, AT_EGID, imgp->proc->p_ucred->cr_svgid); + AUXARGS_ENTRY(pos, AT_HWCAP, cpu_feature); + AUXARGS_ENTRY(pos, AT_CLKTCK, hz); + AUXARGS_ENTRY(pos, AT_SECURE, 0); AUXARGS_ENTRY(pos, AT_NULL, 0); =20 free(imgp->auxargs, M_TEMP); Index: amd64/include/elf.h =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: /usr/home/ncvs/src/sys/amd64/include/elf.h,v retrieving revision 1.19 diff -u -r1.19 elf.h --- amd64/include/elf.h 4 Oct 2006 21:37:09 -0000 1.19 +++ amd64/include/elf.h 11 Jul 2008 08:53:56 -0000 @@ -101,8 +101,12 @@ #define AT_EUID 12 /* Effective uid. */ #define AT_GID 13 /* Real gid. */ #define AT_EGID 14 /* Effective gid. */ +#define AT_PLATFORM 15 /* CPU identification string. */ +#define AT_HWCAP 16 /* CPU capabilities (arch dependent). */ +#define AT_CLKTCK 17 /* Frequency at which times() increments */ +#define AT_SECURE 23 /* Secure mode */ =20 -#define AT_COUNT 15 /* Count of defined aux entry types. */ +#define AT_COUNT 18 /* Count of defined aux entry types. */ =20 /* * Relocation types. Index: amd64/linux32/linux.h =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: /usr/home/ncvs/src/sys/amd64/linux32/linux.h,v retrieving revision 1.16 diff -u -r1.16 linux.h --- amd64/linux32/linux.h 18 Sep 2007 19:50:32 -0000 1.16 +++ amd64/linux32/linux.h 11 Jul 2008 09:47:58 -0000 @@ -334,6 +334,7 @@ =20 int linux_to_bsd_sigaltstack(int lsa); int bsd_to_linux_sigaltstack(int bsa); +void linux_get_machine(struct l_new_utsname *utsname); =20 typedef l_uintptr_t l_handler_t; typedef l_ulong l_osigset_t; Index: amd64/linux32/linux32_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: /usr/home/ncvs/src/sys/amd64/linux32/linux32_machdep.c,v retrieving revision 1.45.2.1 diff -u -r1.45.2.1 linux32_machdep.c --- amd64/linux32/linux32_machdep.c 14 Feb 2008 18:37:38 -0000 1.45.2.1 +++ amd64/linux32/linux32_machdep.c 11 Jul 2008 09:51:41 -0000 @@ -103,6 +103,13 @@ return (lsa); } =20 +void +linux_get_machine(struct l_new_utsname *utsname) +{ + /* XXX Linux can change 'personality'. */ + strlcpy(utsname->machine, "i686", LINUX_MAX_UTSNAME); +} + /* * Custom version of exec_copyin_args() so that we can translate * the pointers. Index: amd64/linux32/linux32_sysvec.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: /usr/home/ncvs/src/sys/amd64/linux32/linux32_sysvec.c,v retrieving revision 1.31.2.1 diff -u -r1.31.2.1 linux32_sysvec.c --- amd64/linux32/linux32_sysvec.c 27 Mar 2008 13:46:26 -0000 1.31.2.1 +++ amd64/linux32/linux32_sysvec.c 11 Jul 2008 09:12:56 -0000 @@ -269,6 +269,9 @@ AUXARGS_ENTRY_32(pos, AT_EUID, imgp->proc->p_ucred->cr_svuid); AUXARGS_ENTRY_32(pos, AT_GID, imgp->proc->p_ucred->cr_rgid); AUXARGS_ENTRY_32(pos, AT_EGID, imgp->proc->p_ucred->cr_svgid); + AUXARGS_ENTRY_32(pos, AT_HWCAP, cpu_feature); + AUXARGS_ENTRY_32(pos, AT_CLKTCK, hz); + AUXARGS_ENTRY_32(pos, AT_SECURE, 0); AUXARGS_ENTRY_32(pos, AT_NULL, 0); =20 free(imgp->auxargs, M_TEMP); --------------050802080807070906070205-- --------------enigB9C2465D4B5F6674128C91F7 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQCVAwUBSHdHfj2W2v2wY27ZAQP8/QP/YQgMk155gipKki2BsVqqa1OmIvcE2ra4 0FdRg43tWVxm2VDgrJF1nXu6QcfGOO5jZtABjFYqn11aGbii2TPp77d84B3n8+gf XYLfJgG7mqd4+gFWsFZQuPWrT7jRyIKY5mwd70ZRW4P6YB5ooTEDddPzwnxLgTpA sRBiTNxLoxA= =9I1v -----END PGP SIGNATURE----- --------------enigB9C2465D4B5F6674128C91F7--