From owner-freebsd-questions@FreeBSD.ORG Tue Oct 5 03:41:55 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 78CB8106564A for ; Tue, 5 Oct 2010 03:41:55 +0000 (UTC) (envelope-from dan@dan.emsphone.com) Received: from email1.allantgroup.com (email1.emsphone.com [199.67.51.115]) by mx1.freebsd.org (Postfix) with ESMTP id 3601B8FC14 for ; Tue, 5 Oct 2010 03:41:54 +0000 (UTC) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by email1.allantgroup.com (8.14.0/8.14.0) with ESMTP id o953fpLb071767 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 4 Oct 2010 22:41:51 -0500 (CDT) (envelope-from dan@dan.emsphone.com) Received: from dan.emsphone.com (smmsp@localhost [127.0.0.1]) by dan.emsphone.com (8.14.4/8.14.4) with ESMTP id o953fpxQ023703 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 4 Oct 2010 22:41:51 -0500 (CDT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.14.4/8.14.4/Submit) id o953foGt023702; Mon, 4 Oct 2010 22:41:50 -0500 (CDT) (envelope-from dan) Date: Mon, 4 Oct 2010 22:41:50 -0500 From: Dan Nelson To: spellberg_robert Message-ID: <20101005034150.GL40148@dan.emsphone.com> References: <4CAA3030.3090001@emailrob.com> <4CAA3CFE.1060609@emailrob.com> <20101004225757.GK40148@dan.emsphone.com> <4CAA654B.7040409@emailrob.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4CAA654B.7040409@emailrob.com> X-OS: FreeBSD 8.1-STABLE User-Agent: Mutt/1.5.21 (2010-09-15) X-Virus-Scanned: clamav-milter 0.96 at email1.allantgroup.com X-Virus-Status: Clean X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0.2 (email1.allantgroup.com [199.67.51.78]); Mon, 04 Oct 2010 22:41:51 -0500 (CDT) X-Scanned-By: MIMEDefang 2.45 Cc: fbsd_questions Subject: Re: [fbsd_questions] i386 vs amd64, on intel_64 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Oct 2010 03:41:55 -0000 In the last episode (Oct 05), spellberg_robert said: > well, i looked at questions back to the beginning of august. > > on aug_09 i found a thread that suggests the following questions. You might want to just use "i386" and "amd64" instead of making up your own terminology ("i_386", "intel_64", "amd_64", etc). Note that Intel has chips that support two competing 64-bit instruction sets: ia64, which is used by their Itanium line, and amd64, which originated on AMD chips but Intel adopted for their 64-bit-capable x86 chips (Xeon, Core etc). I'll assume that any time you say "intel_64" or "amd_64" you really mean amd64, since nobody uses Itaniums :) > for a given release of freebsd, > > q: is it that the version labeled "i386" contains only 32_bit > headers and source, which creates the 32_bit version of > freebsd, as well as 32_bit versions of what i write, which will > run as 32_bit code on either i_386, intel_64 or amd_64 ? Yes, assuming you have COMPAT_FREEBSD32 in your kernel config (which GENERIC has, so most people have it). > q: is it that the version labeled "amd64" contains only 64_bit headers and source, > which creates the 64_bit version of freebsd, as well as 64_bit > versions of what i write, which will run as 64_bit code on the > intel_64 and the amd_64, but, not the i_386 ? Yes. > q: if a "i386" version is installed on an intel_64 platform, then > the pointers are 32_bits_wide, no matter what ? Yes. FreeBSD's models are ILP32 (int, long, pointer are all 32-bit) or LP64 (int is 32-bit, long and pointer are 64-bit). > q: if i want to produce both 32_bit and 64_bit versions of my > "killer_app", then i need two machines, > one a 32_bit or a 64_bit running "i386", > the other --only-- a 64_bit running "amd64" ? Or an amd64 machine with a 32-bit world installed in a subdirectory that you can chroot to to do your 32-bit compiles, or a virtual machine running a 32-bit world. > q: given that i have intel_64 hardware, > do i need to start acquiring the "amd64" versions of the > releases, rather_than / in_addition_to the "i386" versions ? If you have more than 4GB of ram, it would be a good idea. If you have 4GB or less, then 64-bit mode doesn't buy you much, and may cost you performance since all your pointers take up twice the space, filling up your L1/L2 caches twice as fast. > q: given that --i-- am committed to 64_bit hardware, perhaps, i > should give up on the "i386" versions of the releases and > require my users to spend us$_300 on 64_bit hardware [ it would > save a large number of conditional_compilation directives; > nudge_nudge, wink_wink, say no more > ] ? Or provide source and let the users compile what they need on their own machines. Assuming you code using the appropriate types (size_t, intptr_t, etc, or int32_t and int64_t for when you know you need a particular word size) instead of assuming that a pointer will fit in an int, your code should compile on either 32- or 64-bit machines with no conditional code. http://www.opengroup.org/onlinepubs/9699919799/basedefs/stdint.h.html -- Dan Nelson dnelson@allantgroup.com