Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp2320440pxm; Sun, 27 Feb 2022 18:08:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJz/xQl8ijHd8aP30Gh8P8USctrZlvIpKol06zQZFlJ5wX1B7tUqsfDyjisgb5K4SPYNAod/ X-Received: by 2002:a17:90a:fd01:b0:1bc:3481:c20 with SMTP id cv1-20020a17090afd0100b001bc34810c20mr14381181pjb.110.1646014085541; Sun, 27 Feb 2022 18:08:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646014085; cv=none; d=google.com; s=arc-20160816; b=ugxZf6LZfHqhUbZlMg9W6Z0vxLB85gexVmc3O0cpVa4B97DbMsps/dJY3PCBUqZcTw lwy5SGJgrWltwy7kWIP1zlob+ZLPwU4uq8jPcearHx/OFdqlg0hqQwhiW8d/yec3DhN+ 9u95v705cIO4AHUgfuOWVaM7F1ktSx39rPgBC0LifTkhk4cUCOb93NA4as+OW34br7l/ pbYLRl5Zndqs1D9gbuB5/5tQZYj5gYkgPhaTlHBuTVKgGBHrXffeH2UA/Vqp2Qn6jzmN x2W4J5tfJcAdwnDJCatZzild7ewdjEYQrb95VTsHvEFhzxUZMCQIe4AZFD7AZx2vmQTW PwSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:cancel-lock:user-agent:mime-version :references:message-id:date:subject:from:to; bh=TCWzbcb4zD/ItOYJ8Yl4or6XPsPicfTDmWNHiZfZNsk=; b=cV/XU5fZWyA5HS+/TPfEqJ12X63g2UxbqKT0H2RYndYQ0Q1Z60C3rqgU7YiiEAW2OL 0OC8hvi9hMhiiBm01+lp+CBYr5SvdRAEhPr9fsPW6kXQn5/gbWCBh/HvSGmPdsUB5mpL SG3zAEKz1J0RKXVJYtXpy7oUcIIPTUyU2yslK46ODx1GuxHEomrQx0jbgVSlcjeyamt5 0AiXf09cvrMZRLdGY5sTd3gDFfYi+wIilsDiTihTknLe3h37jKFQSFb5tr0jZGSw5fOx Ia8yzfo2J5kMjdcly8YuzJQ4voxMRDWUzJ0MnOu8UIF+TZc0W4svieQspURBUY08AlQa fTGQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bf1-20020a170902b90100b0014a3073eacasi8041314plb.405.2022.02.27.18.07.50; Sun, 27 Feb 2022 18:08:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231318AbiB1Azs (ORCPT + 99 others); Sun, 27 Feb 2022 19:55:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231203AbiB1Azq (ORCPT ); Sun, 27 Feb 2022 19:55:46 -0500 X-Greylist: delayed 302 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Sun, 27 Feb 2022 16:55:07 PST Received: from ciao.gmane.io (ciao.gmane.io [116.202.254.214]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D83FC47063 for ; Sun, 27 Feb 2022 16:55:06 -0800 (PST) Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1nOUEj-0003yc-QB for linux-kernel@vger.kernel.org; Mon, 28 Feb 2022 01:50:01 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: linux-kernel@vger.kernel.org From: Samuel Bronson Subject: Re: [PATCH v3 1/8] riscv: Avoid unaligned access when relocating modules Date: Fri, 25 Feb 2022 23:48:41 -0500 Message-ID: <87zgme6xna.fsf@DESKTOP-5JD7O8D.localdomain> References: <20220224152456.493365-1-kernel@esmil.dk> <20220224152456.493365-2-kernel@esmil.dk> Mime-Version: 1.0 Content-Type: text/plain User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) Cancel-Lock: sha1:mColZ0E90tcqhrcGvi1sG17CQfs= Cc: linux-riscv@lists.infradead.org X-Spam-Status: No, score=1.8 required=5.0 tests=BAYES_00,DATE_IN_PAST_24_48, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,NML_ADSP_CUSTOM_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Emil Renner Berthing writes: > With the C-extension regular 32bit instructions are not > necessarily aligned on 4-byte boundaries. RISC-V instructions > are in fact an ordered list of 16bit native-endian > "parcels", so access the instruction as such. Hold on a minute, this is what it says in my copy of the Unprivileged ISA: ,---- | RISC-V base ISAs have either little-endian or big-endian memory systems, | with the privileged architecture further defining bi-endian operation. | Instructions are stored in memory as a sequence of 16-bit *little-endian* | parcels, regardless of memory system endianness. Parcels forming one | instruction are stored at increasing halfword addresses, with the | *lowest-addressed parcel holding the lowest-numbered bits* in the | instruction specification. `---- [Emphasis mine.] In other words, the parcels are little endian, and they're arranged in little-endian order. System endianness doesn't matter, it collapses to plain old little-endian. (I'm really not sure why they describe the ordering in such a round-about way; I assume that's the source of the confusion here?)