From patchwork Sun Oct 10 17:43:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 515594 Delivered-To: patch@linaro.org Received: by 2002:ac0:b5cc:0:0:0:0:0 with SMTP id x12csp3815818ime; Sun, 10 Oct 2021 10:46:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzOPPbX/VDAuUvPIkFrbGEIO+pk3f23fyFi/tmQF0k5Se6/jPxaD8uImfpm08H9x+BqoBe8 X-Received: by 2002:a05:620a:137a:: with SMTP id d26mr11832019qkl.525.1633887999047; Sun, 10 Oct 2021 10:46:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633887999; cv=none; d=google.com; s=arc-20160816; b=f1keVuNcTi+aKv48ktcSN2VGm0SqFAb7bLh59BL9K542pQ+Yu+3CUh5tTQCFm+v7YM wfwl5E/wcmSE7mpwHRzt3tZG7jt9Qs+JuSQXc5itXXsOtbRsflYDb3xEnUdkiLSKT5eQ n6TPEgBzet9lVlhrS5ubH890ER9iBeBlNEXP0VoYTFp9TRpgSyzLQsOcU5qroy/g+Ddj +nCTVL/WkR7BPwEcleqGcNznhVio8Krq5nhd1QV0ku9s3UR2EzNN+zlg/mibbdGMyHEP soykhUUuvAy1VceYouCRWOH7k9+vvADRSO22qDi87Po/DK+scjsFANofpPpQeyWDwHt+ w74g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:to:from:dkim-signature; bh=issvR+5Tb5pYCgV3cOo6EeKof5gpcpR/vqySCKb4w1c=; b=vdvz5V53AXPKY9AbeQDbLfXChZVr4X7UAWjuRfGgEB3SwaI1t//NqHBYWqt04yQWpF X9OqxRpUjvTWRfWZMerVRm+ooMCVmjuoP3yQeO1hPeHm2MWp8UBLFnzqp9O2LEmbvLGW ghJhwkqbJFmo6hpOESvrd/cco0T+j9t6xifeX6JOt7clMK3RzF/wmf8TMsu56QyfJ+KT OWXqD5jZ6oKutQ61UXoJ1uqpGzNGqFhPcwPcJ35CbBYR2NfaGmemZo7TuT06buqZvYl8 94jOuyZT3NrppAY84FlcRxFwUWreHiRSlOZ6fRhZmUBg/tQ1R371L75l43e8FtE0P8Mu ZxWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=q+raBKjO; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id f1si3292119qti.324.2021.10.10.10.46.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 10 Oct 2021 10:46:39 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=q+raBKjO; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:55766 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mZcuE-0000Ta-IX for patch@linaro.org; Sun, 10 Oct 2021 13:46:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50780) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mZcro-0000Sh-Pv for qemu-devel@nongnu.org; Sun, 10 Oct 2021 13:44:10 -0400 Received: from mail-pg1-x52e.google.com ([2607:f8b0:4864:20::52e]:44972) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mZcrn-0005mq-5R for qemu-devel@nongnu.org; Sun, 10 Oct 2021 13:44:08 -0400 Received: by mail-pg1-x52e.google.com with SMTP id s11so8603328pgr.11 for ; Sun, 10 Oct 2021 10:44:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=issvR+5Tb5pYCgV3cOo6EeKof5gpcpR/vqySCKb4w1c=; b=q+raBKjOuOzk/BE1lmXMdCSlTX4qjaMESQBx2QRNu37eY+/zDcNC1BA7RJLI9sluQV INnWJWkC+z8OPaw3sTyp7nQQWhdu3ln/PQky3ihVCIWi6ibun51Fr8mDx91NKsIRjBOb KyUO8z5FFoco7h4uf84uThqei4rXRWp/mZtJ8U0o8EKELElZJL4AH0ZBsjSnr3u29oDf 8ccacVmLxSJkU8OUxpiavC1eLAXvsjPx6fnfs3ZbexNyEY1U0hnKAbUwEY0QrP0zqCB3 JCeJnHnIn7IcKyTK+IP5xdVtHFNLh6X1goEDwevz8bXlnBu4rlEAgPNqTHOn7Kiu3cMC mLiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=issvR+5Tb5pYCgV3cOo6EeKof5gpcpR/vqySCKb4w1c=; b=LnxQJSU3nfLhjQJuYCswNdSd6IXvIj20ByM3d+e/mi5OheUVzLwPmMmE1xxCywDE7W rclf6HvvWy67HlfKJmvUNbFuZ2+okhhb67GVzC3+oEAtU2ONlAuEHvvmnwByEOp+gU4B Egw1ILmeaHKY/E46ctQ+qV8zEA/09ImJpj7Da3EnPz1DnjBddBoRfvoAUS9NmcWYBFlp ePigaGqOHUTzvXzrHDGpwhPsdFDo8pvKWgNje/D5y3l/GpcTFwZkPIgoq6pBURmdMnyk 3j+CW35fLg7Bns1HrEN8pRecNVvkDZz4ItAHH0EjTdcIIgs05uiAEHkvPLocl+Dae9Q7 HP+w== X-Gm-Message-State: AOAM532kiGAqbh8fRAZrsoS3PCXU//1hz2srrcr4SvI8wsPvbPGb3mx+ KtYtOPRdjSl6SYSeO5He0uA9PTxA5v/wo1YZ X-Received: by 2002:a05:6a00:b96:b0:44c:65df:2760 with SMTP id g22-20020a056a000b9600b0044c65df2760mr21292569pfj.3.1633887845070; Sun, 10 Oct 2021 10:44:05 -0700 (PDT) Received: from localhost.localdomain (068-185-026-038.biz.spectrum.com. [68.185.26.38]) by smtp.gmail.com with ESMTPSA id 18sm5095391pfh.115.2021.10.10.10.44.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Oct 2021 10:44:04 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 0/8] tcg: support 32-bit guest addresses as signed Date: Sun, 10 Oct 2021 10:43:53 -0700 Message-Id: <20211010174401.141339-1-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52e; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: git@xen0n.name, Alistair.Francis@wdc.com, f4bug@amsat.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We have 2, and nearly 3, hosts that naturally produce sign-extended values, and have to work extra hard (with 1 or 2 insns) to produce the zero-extended address that we expect today. However, it's a simple matter of arithmetic for the middle-end to require sign-extended addresses instead. For user-only, we do have to be careful not to allow a guest object to wrap around the signed boundary, but that's fairly easily done. Tested with aarch64, as that's the best hw currently available. r~ Richard Henderson (8): tcg: Add TCG_TARGET_SIGNED_ADDR32 accel/tcg: Split out g2h_tlbe accel/tcg: Support TCG_TARGET_SIGNED_ADDR32 for softmmu accel/tcg: Add guest_base_signed_addr32 for user-only linux-user: Support TCG_TARGET_SIGNED_ADDR32 tcg/aarch64: Support TCG_TARGET_SIGNED_ADDR32 target/mips: Support TCG_TARGET_SIGNED_ADDR32 target/riscv: Support TCG_TARGET_SIGNED_ADDR32 include/exec/cpu-all.h | 20 ++++++++--- include/exec/cpu_ldst.h | 3 +- tcg/aarch64/tcg-target-sa32.h | 7 ++++ tcg/arm/tcg-target-sa32.h | 1 + tcg/i386/tcg-target-sa32.h | 1 + tcg/mips/tcg-target-sa32.h | 9 +++++ tcg/ppc/tcg-target-sa32.h | 1 + tcg/riscv/tcg-target-sa32.h | 5 +++ tcg/s390x/tcg-target-sa32.h | 1 + tcg/sparc/tcg-target-sa32.h | 1 + tcg/tci/tcg-target-sa32.h | 1 + accel/tcg/cputlb.c | 36 +++++++++++++------ bsd-user/main.c | 4 +++ linux-user/elfload.c | 62 +++++++++++++++++++++++++------- linux-user/main.c | 3 ++ tcg/aarch64/tcg-target.c.inc | 68 ++++++++++++++++++++++------------- tcg/mips/tcg-target.c.inc | 13 ++----- tcg/riscv/tcg-target.c.inc | 8 ++--- 18 files changed, 176 insertions(+), 68 deletions(-) create mode 100644 tcg/aarch64/tcg-target-sa32.h create mode 100644 tcg/arm/tcg-target-sa32.h create mode 100644 tcg/i386/tcg-target-sa32.h create mode 100644 tcg/mips/tcg-target-sa32.h create mode 100644 tcg/ppc/tcg-target-sa32.h create mode 100644 tcg/riscv/tcg-target-sa32.h create mode 100644 tcg/s390x/tcg-target-sa32.h create mode 100644 tcg/sparc/tcg-target-sa32.h create mode 100644 tcg/tci/tcg-target-sa32.h -- 2.25.1