From patchwork Sat Jun 19 18:14:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 463905 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:102:0:0:0:0 with SMTP id x2csp1051028jao; Sat, 19 Jun 2021 11:26:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz6hkbEQbm5AVACvLmRYFaf/Y8q9FtbMOn2HGmo/Gpt38UZcJzr/9a15ZHV3ug/VUTNkCMZ X-Received: by 2002:a02:6382:: with SMTP id j124mr9461161jac.72.1624127165210; Sat, 19 Jun 2021 11:26:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624127165; cv=none; d=google.com; s=arc-20160816; b=Hgrd3pHjLQjgRsenq6TxNI2i9MdZFS/FTAm0g9IB3S4G9ubDITBWzx4D0+K7/JdQ47 bmZ+te0j03gLGdMdiz2YhUk7xhq5NaNeHYYychSOTYUXHppnDT7xhO5ubo4qK7XEKUZp W/AGPcIsMd/EpYh9GEnzeDm7mbsQ2tolcutN6lXdlOZ89fXsle+HGE0ml2jXw95j1+El RSzcf8N5VRLup6yl8TOqe2b02opfELsUnlpcy49Qzds2BE48mL7u2/vOLwG42W9oyyza U2SQkM2X59s/TDiR0qdVJbtcGxdPlEJUpuNNDBHtgcB9wSZpGSe8reDaDzw0AB31XT06 ++9w== 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:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=dmNnvecqX0hYql4TUxzQSGInY+sbhElg47l+/R1+N+A=; b=EmwgRB74KChAH6SUSTyeK6tpFrYmERkBbunxfDRF4CVXgAZMbbgfRBPHCRIkbxnELc 2ecsN+4oY9q6wZpnUO+LSb5Cf6ewYkVliu39EVlprqN/VktaVNj1kIaoNgoVEYpeKdmA RXUROwUglmlSjqR0hgR3632vjWEUZ8Fj+Jf6S0OfqHhVKN828bH6KhFWU7V+UzJV9mb4 BoI8qOXAjVifUGkuaz5IwcrIaSRzSRJnTiQ8glAzkZnlyR9M3JGT1/ZgQmb4tBFBE8qz eIIB01zk0wBcUFn8tzvtBYiGvDXCJ+zFY+LlrjkUMk8aUmlGgV/foo0pHGnNuxLU6YK+ wC2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=a29f3HfM; 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 y11si5826214jai.99.2021.06.19.11.26.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 19 Jun 2021 11:26:05 -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=a29f3HfM; 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]:35434 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1luffO-0007DY-Tf for patch@linaro.org; Sat, 19 Jun 2021 14:26:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36140) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lufV3-0000ya-PC for qemu-devel@nongnu.org; Sat, 19 Jun 2021 14:15:22 -0400 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]:39850) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lufUt-0002OD-KC for qemu-devel@nongnu.org; Sat, 19 Jun 2021 14:15:21 -0400 Received: by mail-pj1-x102e.google.com with SMTP id o88-20020a17090a0a61b029016eeb2adf66so9861589pjo.4 for ; Sat, 19 Jun 2021 11:15:11 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=dmNnvecqX0hYql4TUxzQSGInY+sbhElg47l+/R1+N+A=; b=a29f3HfMkuDoIwPpWQ3r0hOMGXeRaovLEy29yOwwYhmRKDC4RSRdv4GbRzVLxkWDfc SiZRBrxmGH6PyHzIeWQ9Nozd/u+dHw5bX+p2nJryDXQOPH+qyyjsRfqbsi6sV2EDWu0R CTJqqAShw6mVf5lPVMzA1TvLqOb+CyH62uZh/pXVUxiCXkaKtBW57Y00qfLI/BAb+VcO EHR8EzAaRcxTcWu/9Ucm76Az/HiV6PtHHSoRFnj+uDkaarOQskrAo+PenJF77lxS63/N cVbwCjn1TXlstvhIQyLbp3uJ6p/uux5l86C5MF3nH6YTgpxhgQvi6HvzepGGTxkTmjgX fnNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dmNnvecqX0hYql4TUxzQSGInY+sbhElg47l+/R1+N+A=; b=LnlKAGF5QE49i8ckGrW5He6Ihyy2A0jQEyZ2qCq5NZxg0D3g8mBDtrQn7k2/gE8LCF dCLwZEyRfhB18nofOx4vY2jFfqKknbWtz7OI/ywV8yA3Z9UfmFJ3vi8QFFFxbUambWJS fODKpz/kuzz+WVeJEV+aNLvfezcB70nnha5SbUFS7FUL166DQN/SKzlLF6kqUL8EPIBZ dBlvd+Yx0TBFXiXnVIeLvNVOl2+pRQGCq02G2wCf6mQRJDfGwX/ZujZCo3QI2oRnkYKs W8TalxQc/+F95mtrHfDR/xcUhcUZb/LHrSzKvrzyE+gBv+zmfrJ3H3V7ztyz3oBiA7Ba gWpw== X-Gm-Message-State: AOAM530gNVMk5L1cypMBUdp8vcev7T4JEjbnCkh3J4b+vy5PP0s+7Uy2 CWlCnD7fjU5VwC8s/EXXbn84I3WJ+/mxYg== X-Received: by 2002:a17:90b:1893:: with SMTP id mn19mr2866548pjb.51.1624126510409; Sat, 19 Jun 2021 11:15:10 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id k35sm12059113pgi.21.2021.06.19.11.15.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Jun 2021 11:15:10 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 30/33] tcg: Allocate sufficient storage in temp_allocate_frame Date: Sat, 19 Jun 2021 11:14:49 -0700 Message-Id: <20210619181452.877683-31-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210619181452.877683-1-richard.henderson@linaro.org> References: <20210619181452.877683-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102e; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102e.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=unavailable 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: peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-stable@nongnu.org, Stefan Weil Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This function should have been updated for vector types when they were introduced. Fixes: d2fd745fe8b Resolves: https://gitlab.com/qemu-project/qemu/-/issues/367 Cc: qemu-stable@nongnu.org Tested-by: Stefan Weil Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- tcg/tcg.c | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) -- 2.25.1 diff --git a/tcg/tcg.c b/tcg/tcg.c index 52e858523c..47cc66f159 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -3015,17 +3015,39 @@ static void check_regs(TCGContext *s) static void temp_allocate_frame(TCGContext *s, TCGTemp *ts) { - if (s->current_frame_offset + (tcg_target_long)sizeof(tcg_target_long) > - s->frame_end) { - tcg_abort(); + size_t size, align; + intptr_t off; + + switch (ts->type) { + case TCG_TYPE_I32: + size = align = 4; + break; + case TCG_TYPE_I64: + case TCG_TYPE_V64: + size = align = 8; + break; + case TCG_TYPE_V128: + size = align = 16; + break; + case TCG_TYPE_V256: + /* Note that we do not require aligned storage for V256. */ + size = 32, align = 16; + break; + default: + g_assert_not_reached(); } - ts->mem_offset = s->current_frame_offset; + + assert(align <= TCG_TARGET_STACK_ALIGN); + off = ROUND_UP(s->current_frame_offset, align); + assert(off + size <= s->frame_end); + s->current_frame_offset = off + size; + + ts->mem_offset = off; #if defined(__sparc__) ts->mem_offset += TCG_TARGET_STACK_BIAS; #endif ts->mem_base = s->frame_temp; ts->mem_allocated = 1; - s->current_frame_offset += sizeof(tcg_target_long); } static void temp_load(TCGContext *, TCGTemp *, TCGRegSet, TCGRegSet, TCGRegSet);