From patchwork Fri May 2 17:32:38 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 29571 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f70.google.com (mail-oa0-f70.google.com [209.85.219.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3860A203F3 for ; Fri, 2 May 2014 17:32:42 +0000 (UTC) Received: by mail-oa0-f70.google.com with SMTP id i4sf22575700oah.9 for ; Fri, 02 May 2014 10:32:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=1gAiC+7z+J6E9qWfAV2JegfjudR5qsMYZL/6CquGw3U=; b=WdCbNuJqit0ZcTpOJaNIjH/HZbwkkklLetdEXAfkWm/RaARgWdHv5K6cmTM3UK3sOm CMXBa20eQnj7nmAEC7hFDTxsA0712dXDRjnHxvthugT72zWXWHiTXj+uag+hdQidFIr3 lpPdy3StOopay2Qf4vc/AmPAPLK1S+1mSgo6qpsGvmhWeYXtuX2t85Ah56utgVliozs9 bCv5wm1bDrkwyMy0qRRT/emLE+t/PwHz/NaX1HzWxigwfyyPszNCl7X64vRifkUp3tzt FQ7OVWrLE5a1TYGugWo11Gf8h09cYMh/1b1zqhLD0WKTMI9rmFof8vd6WUsDXpHJ1t0g Dzww== X-Gm-Message-State: ALoCoQl+C0JBP27IR8/c7i0aA9jZBWg7PbOaapH7RqSqPsf9Vg3Clm4+Dg0MtgEDLHAKq3KeAlV4 X-Received: by 10.182.16.199 with SMTP id i7mr9581220obd.42.1399051961498; Fri, 02 May 2014 10:32:41 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.47.203 with SMTP id m69ls1718361qga.84.gmail; Fri, 02 May 2014 10:32:41 -0700 (PDT) X-Received: by 10.52.6.162 with SMTP id c2mr11794566vda.6.1399051961404; Fri, 02 May 2014 10:32:41 -0700 (PDT) Received: from mail-vc0-f170.google.com (mail-vc0-f170.google.com [209.85.220.170]) by mx.google.com with ESMTPS id sw4si6845169vdc.30.2014.05.02.10.32.41 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 02 May 2014 10:32:41 -0700 (PDT) Received-SPF: none (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) client-ip=209.85.220.170; Received: by mail-vc0-f170.google.com with SMTP id hr9so5843008vcb.1 for ; Fri, 02 May 2014 10:32:41 -0700 (PDT) X-Received: by 10.220.105.130 with SMTP id t2mr14146165vco.18.1399051961311; Fri, 02 May 2014 10:32:41 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp119858vcb; Fri, 2 May 2014 10:32:40 -0700 (PDT) X-Received: by 10.194.203.42 with SMTP id kn10mr3205258wjc.54.1399051960507; Fri, 02 May 2014 10:32:40 -0700 (PDT) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id uu8si854248wjc.211.2014.05.02.10.32.39 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 02 May 2014 10:32:40 -0700 (PDT) Received-SPF: none (google.com: pm215@archaic.org.uk does not designate permitted sender hosts) client-ip=2001:8b0:1d0::1; Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1WgHKA-0002T2-NG; Fri, 02 May 2014 18:32:38 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Richard Henderson Subject: [PATCH] bswap.h: Rename ldl_p, stl_p, etc to ldl_he_p, stl_he_p, etc Date: Fri, 2 May 2014 18:32:38 +0100 Message-Id: <1399051958-9459-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , We have an unfortunate naming clash between the functions ldl_p, stl_p, etc defined in bswap.h (which have semantics "load/store in host endianness") and the #defines of the same name in cpu-all.h (which have the semantics "load/store in target endianness"). Fortunately it turns out that the only users of the bswap.h functions are all within bswap.h itself, so we can simply rename them to include a _he_ infix for "host endianness". Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- Frankly I'm surprised that the only users of these functions are the ones within bswap.h itself, but it's a lucky escape from having to audit an enormous pile of code... We had talked about changing the "target-endian" accessors to be ldl_te_p &c, but given the uses aren't tangled together as I feared they would be, I'm not sure we can justify the global function rename. include/qemu/bswap.h | 45 +++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/include/qemu/bswap.h b/include/qemu/bswap.h index 0f9c6cf..78c1ced 100644 --- a/include/qemu/bswap.h +++ b/include/qemu/bswap.h @@ -215,9 +215,10 @@ typedef union { * q: 64 bits * * endian is: - * (empty): host endian + * he : host endian * be : big endian * le : little endian + * (except for byte accesses, which have no endian infix). */ static inline int ldub_p(const void *ptr) @@ -239,82 +240,82 @@ static inline void stb_p(void *ptr, uint8_t v) operations. Thus we don't need to play games with packed attributes, or inline byte-by-byte stores. */ -static inline int lduw_p(const void *ptr) +static inline int lduw_he_p(const void *ptr) { uint16_t r; memcpy(&r, ptr, sizeof(r)); return r; } -static inline int ldsw_p(const void *ptr) +static inline int ldsw_he_p(const void *ptr) { int16_t r; memcpy(&r, ptr, sizeof(r)); return r; } -static inline void stw_p(void *ptr, uint16_t v) +static inline void stw_he_p(void *ptr, uint16_t v) { memcpy(ptr, &v, sizeof(v)); } -static inline int ldl_p(const void *ptr) +static inline int ldl_he_p(const void *ptr) { int32_t r; memcpy(&r, ptr, sizeof(r)); return r; } -static inline void stl_p(void *ptr, uint32_t v) +static inline void stl_he_p(void *ptr, uint32_t v) { memcpy(ptr, &v, sizeof(v)); } -static inline uint64_t ldq_p(const void *ptr) +static inline uint64_t ldq_he_p(const void *ptr) { uint64_t r; memcpy(&r, ptr, sizeof(r)); return r; } -static inline void stq_p(void *ptr, uint64_t v) +static inline void stq_he_p(void *ptr, uint64_t v) { memcpy(ptr, &v, sizeof(v)); } static inline int lduw_le_p(const void *ptr) { - return (uint16_t)le_bswap(lduw_p(ptr), 16); + return (uint16_t)le_bswap(lduw_he_p(ptr), 16); } static inline int ldsw_le_p(const void *ptr) { - return (int16_t)le_bswap(lduw_p(ptr), 16); + return (int16_t)le_bswap(lduw_he_p(ptr), 16); } static inline int ldl_le_p(const void *ptr) { - return le_bswap(ldl_p(ptr), 32); + return le_bswap(ldl_he_p(ptr), 32); } static inline uint64_t ldq_le_p(const void *ptr) { - return le_bswap(ldq_p(ptr), 64); + return le_bswap(ldq_he_p(ptr), 64); } static inline void stw_le_p(void *ptr, uint16_t v) { - stw_p(ptr, le_bswap(v, 16)); + stw_he_p(ptr, le_bswap(v, 16)); } static inline void stl_le_p(void *ptr, uint32_t v) { - stl_p(ptr, le_bswap(v, 32)); + stl_he_p(ptr, le_bswap(v, 32)); } static inline void stq_le_p(void *ptr, uint64_t v) { - stq_p(ptr, le_bswap(v, 64)); + stq_he_p(ptr, le_bswap(v, 64)); } /* float access */ @@ -349,37 +350,37 @@ static inline void stfq_le_p(void *ptr, float64 v) static inline int lduw_be_p(const void *ptr) { - return (uint16_t)be_bswap(lduw_p(ptr), 16); + return (uint16_t)be_bswap(lduw_he_p(ptr), 16); } static inline int ldsw_be_p(const void *ptr) { - return (int16_t)be_bswap(lduw_p(ptr), 16); + return (int16_t)be_bswap(lduw_he_p(ptr), 16); } static inline int ldl_be_p(const void *ptr) { - return be_bswap(ldl_p(ptr), 32); + return be_bswap(ldl_he_p(ptr), 32); } static inline uint64_t ldq_be_p(const void *ptr) { - return be_bswap(ldq_p(ptr), 64); + return be_bswap(ldq_he_p(ptr), 64); } static inline void stw_be_p(void *ptr, uint16_t v) { - stw_p(ptr, be_bswap(v, 16)); + stw_he_p(ptr, be_bswap(v, 16)); } static inline void stl_be_p(void *ptr, uint32_t v) { - stl_p(ptr, be_bswap(v, 32)); + stl_he_p(ptr, be_bswap(v, 32)); } static inline void stq_be_p(void *ptr, uint64_t v) { - stq_p(ptr, be_bswap(v, 64)); + stq_he_p(ptr, be_bswap(v, 64)); } /* float access */