From owner-freebsd-amd64@FreeBSD.ORG Thu Feb 21 07:59:45 2008 Return-Path: Delivered-To: freebsd-amd64@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C369916A402 for ; Thu, 21 Feb 2008 07:59:45 +0000 (UTC) (envelope-from peterjeremy@optushome.com.au) Received: from mail05.syd.optusnet.com.au (mail05.syd.optusnet.com.au [211.29.132.186]) by mx1.freebsd.org (Postfix) with ESMTP id 5EB7613C502 for ; Thu, 21 Feb 2008 07:59:44 +0000 (UTC) (envelope-from peterjeremy@optushome.com.au) Received: from server.vk2pj.dyndns.org (c220-239-20-82.belrs4.nsw.optusnet.com.au [220.239.20.82]) by mail05.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id m1L7xh7d013979 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 21 Feb 2008 18:59:43 +1100 Received: from server.vk2pj.dyndns.org (localhost.vk2pj.dyndns.org [127.0.0.1]) by server.vk2pj.dyndns.org (8.14.2/8.14.1) with ESMTP id m1L7xgeG044694; Thu, 21 Feb 2008 18:59:42 +1100 (EST) (envelope-from peter@server.vk2pj.dyndns.org) Received: (from peter@localhost) by server.vk2pj.dyndns.org (8.14.2/8.14.2/Submit) id m1L7xggb044693; Thu, 21 Feb 2008 18:59:42 +1100 (EST) (envelope-from peter) Date: Thu, 21 Feb 2008 18:59:42 +1100 From: Peter Jeremy To: navneet Upadhyay Message-ID: <20080221075942.GG51095@server.vk2pj.dyndns.org> References: <1563a4fd0802192216w7d422fd2nf83ddaff038ac9cc@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Km1U/tdNT/EmXiR1" Content-Disposition: inline In-Reply-To: <1563a4fd0802192216w7d422fd2nf83ddaff038ac9cc@mail.gmail.com> X-PGP-Key: http://members.optusnet.com.au/peterjeremy/pubkey.asc User-Agent: Mutt/1.5.17 (2007-11-01) Cc: freebsd-amd64@freebsd.org Subject: Re: 32 bit FreeBSD compiled binary coredumps on 64 bit(amd) FreeBSD X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2008 07:59:45 -0000 --Km1U/tdNT/EmXiR1 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Feb 20, 2008 at 11:46:00AM +0530, navneet Upadhyay wrote: > I am compiling the binary on 32 bit FreeBSD and running it on 64 >(amd64)bit FreeBSD . FreeBSD says it is possible to do so. In general, you can take a FreeBSD/i386 executable and run it on FreeBSD/amd64. I don't believe FreeBSD has ever stated that you can take _any_ FreeBSD/i386 executable and run it on FreeBSD/amd64. > But my application core dumps . I investigated the reason which is = as >follows : >The problem is in the call *retval =3D sysctl(mib, 4, &kp, &sz, NULL, 0);* >where sz is size of kp and where *kp* is a structure of type >*kinfo_proc.*The size of this structure on 32bit system is 768 and on >64 bit system is 1088. If your process grovels around inside kernel data structures then it's unlikely to be portable. >If i hardcode the sz to 1088 then it works on amd64 systems , how do i deal >with it. I am anticipating lot of coredumps like that, what is a generic >solution for such kinds of problems. There is no generic solution. FreeBSD includes shims to handle syscalls where the arguments differ in size between different emulations (i386, Linux, iBCS etc). If you want to pull assorted machine-dependent datastructures out of the kernel then you will need to write shims to handle the conversion. --=20 Peter Jeremy Please excuse any delays as the result of my ISP's inability to implement an MTA that is either RFC2821-compliant or matches their claimed behaviour. --Km1U/tdNT/EmXiR1 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.4 (FreeBSD) iD8DBQFHvS9u/opHv/APuIcRAjiyAJ9JME3xMauruYKyRVKVZpJoQULfbgCgkdhZ mnqAcjet9yaci41b9BaKEEk= =q/ps -----END PGP SIGNATURE----- --Km1U/tdNT/EmXiR1--