From owner-freebsd-arm@FreeBSD.ORG Thu Jun 28 22:31:41 2012 Return-Path: Delivered-To: arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0F17E1065672 for ; Thu, 28 Jun 2012 22:31:41 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-ob0-f182.google.com (mail-ob0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id C10AA8FC12 for ; Thu, 28 Jun 2012 22:31:40 +0000 (UTC) Received: by obbun3 with SMTP id un3so4756693obb.13 for ; Thu, 28 Jun 2012 15:31:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to:x-mailer :x-gm-message-state; bh=kNDSbcA4WOoYv1phz+HTuwuvgtRrtN+fTVh4JXFaHIk=; b=D24Xg2c32cml4RAZ6l081QVDuMxoiXrpQf6DkuL4mzua9X6bLiLe5xycp91PLXrYoV AXwzN9Ja2yGQ0lDqy2p2DjPm34oWRmPlADctxilKpzC1ixKxklf58U8C0DGXkLTmRZJH EJrn06ZAww/GLP9/CS2sd1GxzFRQyBWBF7H/kneR5G88uiTxtLz0ghMJmbgNCBazrK2U wr2gIswD4HuaLKpuywwSbFY3MW+j13VldVhmiVQPubobD6J/TfXdTWI9G8z7TDabhRFY xOm+yPZknzJ7azXPoIGl2ErzT85AKCFxKAoi/FWTmvLwC9XRibnE9mPkw/UOwfXY1hmw 6GXw== Received: by 10.60.3.102 with SMTP id b6mr4537921oeb.35.1340922700145; Thu, 28 Jun 2012 15:31:40 -0700 (PDT) Received: from [10.30.101.53] ([209.117.142.2]) by mx.google.com with ESMTPS id a6sm485252oeg.7.2012.06.28.15.31.39 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 28 Jun 2012 15:31:39 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Warner Losh In-Reply-To: <1340921715.1110.100.camel@revolution.hippie.lan> Date: Thu, 28 Jun 2012 16:31:36 -0600 Content-Transfer-Encoding: quoted-printable Message-Id: <3AB368CC-BE8B-4058-A342-763B8C073800@bsdimp.com> References: <1340921715.1110.100.camel@revolution.hippie.lan> To: Ian Lepore X-Mailer: Apple Mail (2.1084) X-Gm-Message-State: ALoCoQn+ofaYcVZOL4hxvJ/31nb0xplY0DX+VR2PcQW085wrDR4AqEtGFR5AOyqlT02EQ8Tt8oiV Cc: arm@freebsd.org Subject: Re: Naming mess... X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the StrongARM Processor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jun 2012 22:31:41 -0000 On Jun 28, 2012, at 4:15 PM, Ian Lepore wrote: > On Tue, 2012-06-26 at 22:21 -0700, Tim Kientzle wrote: >> I've been building on Warner's ARMv6 cleanup patches and >> have them almost ready to commit to the armv6 tree (including >> the necessary configuration glue for GCC to actually default >> properly). >>=20 >> In the process, I've uncovered the following confusing bit of naming: >>=20 >> __ARM_ARCH_6__ >> _ARM_ARCH_6 >> ARM_ARCH_6 >>=20 >> The above are three symbols defined in different parts >> of the code with entirely different meanings. The >> pattern extends in the obvious way. >>=20 >> After some tracing, I figured out what they mean today: >>=20 >> __ARM_ARCH_6__ is defined by GCC if it is currently targeting a = processor that is exactly ARMv6. Two such symbols are never defined at = the same time. The patches I'm working on arrange for this to be = properly set in the armv6 builds.[0] >>=20 >> _ARM_ARCH_6 is defined in asm.h (and has been redefined elsewhere, = but I'm removing those) to indicate that the currently targeted = processor is _at_least_ ARMv6. Several such macros can be defined at = the same time. These are more useful in practice than the GCC symbols. = Unfortunately, besides the poor naming, defining these symbols in asm.h = means they cannot be used in C code. >>=20 >> ARM_ARCH_6 is used within the kernel source to indicate that support = routines should be included for this class of processor. Multiple such = symbols can be defined at the same time if you're building a kernel with = support for multiple CPUs. >>=20 >> Here's what I would like to do: >>=20 >> * The first is a given and we should leave it alone. The patches = I'm cleaning up make this useful in the armv6 tree. >>=20 >> * The second I would like to move out of asm.h so it can be used in = C code. I would like to rename it to _HAVE_ARMv6_INSTRUCTIONS, which I = think is clearer. I have renamed it in my patches but not yet moved it = to another header. Suggestions appreciated. >>=20 >> "NEED_ARM_ARCH_6_SUPPORT" * Someday, I would like to rename the third = one, though I don't have a concrete proposal yet. = ("NEED_ARM_ARCH_6_SUPPORT" is expressive but wordy; better suggestions = appreciated.) >>=20 >> Cheers, >>=20 >> Tim >>=20 >> [0] This page has a nice table: = https://wiki.edubuntu.org/ARM/Thumb2PortingHowto >>=20 >=20 > I'm not working with armv6 stuff yet, but I like all of what you > propose. I can't help but note that NEED_ARM_ARCH_6_SUPPORT is = actually > shorter than _HAVE_ARMv6_INSTRUCTIONS. If it's just too wordy, maybe > the "NEED_" part could be left off. =20 #define ARM_ARCH 6 #if ARM_ARCH >=3D 6 ... #endif Might not be the worst idea... Warner=