From nobody Sat May 4 18:01:56 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1624110236; cv=none; d=zohomail.com; s=zohoarc; b=H1EFJ8I1lz03qFZlZKcUHPxJHeASB4EtHBCjtCSH4YjEpVa/3rHD6r+tCafLIXa7FNJkajMMUHzi28SxM6WJF2sTueVD8LesKluRQUegISqv/70SUTxQNDXlzBbJSXHUAy+uCuQf+Ifsh+cO7tUPXvDFrKSIY7hTZOCXvncUVO4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1624110236; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=02OPjNpVB9ZnrobKmp1fswJeaS3qOsbtuOp66JMHRwU=; b=PPwI4ifTFqzSydubDsmmLhw0fkUchQUGzLtZATrPavMswVcOBduPC672NlkSHXhC54WtTXDQ3KjfvABUj9lS/rrde+IH96Ddo/CdMY6h0s8sGHWMenBMiHgfJRy/HamC+ccAlPiWcH4BDiFxk9JmlZ+ftZ40qzQ3lozRTyyfd3M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1624110236546608.3234820086985; Sat, 19 Jun 2021 06:43:56 -0700 (PDT) Received: from localhost ([::1]:49244 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lubGM-0006jE-I3 for importer2@patchew.org; Sat, 19 Jun 2021 09:43:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44080) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lubEt-0004ZM-CB for qemu-devel@nongnu.org; Sat, 19 Jun 2021 09:42:23 -0400 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]:39779) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lubEp-00081w-I2 for qemu-devel@nongnu.org; Sat, 19 Jun 2021 09:42:23 -0400 Received: by mail-pj1-x1035.google.com with SMTP id o88-20020a17090a0a61b029016eeb2adf66so9627262pjo.4 for ; Sat, 19 Jun 2021 06:42:19 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id y20sm12331511pfb.207.2021.06.19.06.42.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Jun 2021 06:42:17 -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=02OPjNpVB9ZnrobKmp1fswJeaS3qOsbtuOp66JMHRwU=; b=lZtY8cHHzqlFPyuPZshKiwhREEx+le/CrIWqE1s0FEJDrdPR/FdlIVBGMm7TOr1W1G jbjpsa9rKGBfGO/aaf1zp/CtZgBrnmvcKuLQVCbmuGQ16NnQLJ/XBBghQhgphTBYEljQ SdggCSNJQ/dQkdZayQrzbFRGBGIa5GkAgL3kzlt6N86bUEyxXAtBWi0tXyGgdny5Udkg 92tD2H2upiSy3u40H0cMZAcPAhYHNj53f12AP+VDdoEPRNj4nuTKyjJFcYGK0ile4Kne MDgS/vEMsObIfB3sCeMwytGo9+M5SNyo1xHIyXWisigt5CzRKik1JlLLJYajhtMahD+p WKQQ== 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=02OPjNpVB9ZnrobKmp1fswJeaS3qOsbtuOp66JMHRwU=; b=AZX8AB+RCFUqsy0pFXEtoEtgn63HzWZGUawd5+QtKJIkpzTL/OWjSPECY3WxXvxIbV HaE0Hd/G1+wWk/u+1qC/HsgNa08QvAlbpD1cR7cd7Rrpn+FYnQ32dfNsx7TUgWJbc3AK U0Ls2NRWNa8cY4z6cywOSK5pTg8DrSTlJMf0orVSNte7iHfO5V5WqRb+Fj0zKmwaljMk 092SXSgELIf0oc81uWX6TSHeMYNKjgSApaP2ChAVbZyR03UTteZ7yYNf4v+v2uZlWcNi DIgMXNj0vjswitTrHLlSRv006xeJzmKiAtqGDvixIYYEtNC+SW5giW4+yP2nvslzi4FR 4GbA== X-Gm-Message-State: AOAM531C5HyF8Nx113DmT7T98hjJ/5tJjSmTXYjH+wNOBPiA+57f7qCl 9Z1qXEerYda7IuiHQr6+U2Yw8Fgy8WFQFQ== X-Google-Smtp-Source: ABdhPJy0xQJQSzD8ph2L1r0s90YPGu6C1BMc6n4BbFem+OdEXteTcAuwUcxT486IljeeZJVkdJ0WMA== X-Received: by 2002:a17:90a:d106:: with SMTP id l6mr16472369pju.164.1624110138252; Sat, 19 Jun 2021 06:42:18 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 1/3] tcg/sparc: Fix temp_allocate_frame vs sparc stack bias Date: Sat, 19 Jun 2021 06:42:14 -0700 Message-Id: <20210619134216.590423-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210619134216.590423-1-richard.henderson@linaro.org> References: <20210619134216.590423-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1035; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1035.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: qemu-stable@nongnu.org Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" We should not be aligning the offset in temp_allocate_frame, because the odd offset produces an aligned address in the end. Instead, pass the logical offset into tcg_set_frame and add the stack bias last. Cc: qemu-stable@nongnu.org Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- tcg/tcg.c | 9 +++------ tcg/sparc/tcg-target.c.inc | 16 ++++++++++------ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/tcg/tcg.c b/tcg/tcg.c index dd584f3bba..52e858523c 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -3015,17 +3015,14 @@ static void check_regs(TCGContext *s) =20 static void temp_allocate_frame(TCGContext *s, TCGTemp *ts) { -#if !(defined(__sparc__) && TCG_TARGET_REG_BITS =3D=3D 64) - /* Sparc64 stack is accessed with offset of 2047 */ - s->current_frame_offset =3D (s->current_frame_offset + - (tcg_target_long)sizeof(tcg_target_long) - = 1) & - ~(sizeof(tcg_target_long) - 1); -#endif if (s->current_frame_offset + (tcg_target_long)sizeof(tcg_target_long)= > s->frame_end) { tcg_abort(); } ts->mem_offset =3D s->current_frame_offset; +#if defined(__sparc__) + ts->mem_offset +=3D TCG_TARGET_STACK_BIAS; +#endif ts->mem_base =3D s->frame_temp; ts->mem_allocated =3D 1; s->current_frame_offset +=3D sizeof(tcg_target_long); diff --git a/tcg/sparc/tcg-target.c.inc b/tcg/sparc/tcg-target.c.inc index ce39ac2d86..a6ec94a094 100644 --- a/tcg/sparc/tcg-target.c.inc +++ b/tcg/sparc/tcg-target.c.inc @@ -984,14 +984,18 @@ static void tcg_target_qemu_prologue(TCGContext *s) { int tmp_buf_size, frame_size; =20 - /* The TCG temp buffer is at the top of the frame, immediately - below the frame pointer. */ + /* + * The TCG temp buffer is at the top of the frame, immediately + * below the frame pointer. Use the logical (aligned) offset here; + * the stack bias is applied in temp_allocate_frame(). + */ tmp_buf_size =3D CPU_TEMP_BUF_NLONGS * (int)sizeof(long); - tcg_set_frame(s, TCG_REG_I6, TCG_TARGET_STACK_BIAS - tmp_buf_size, - tmp_buf_size); + tcg_set_frame(s, TCG_REG_I6, -tmp_buf_size, tmp_buf_size); =20 - /* TCG_TARGET_CALL_STACK_OFFSET includes the stack bias, but is - otherwise the minimal frame usable by callees. */ + /* + * TCG_TARGET_CALL_STACK_OFFSET includes the stack bias, but is + * otherwise the minimal frame usable by callees. + */ frame_size =3D TCG_TARGET_CALL_STACK_OFFSET - TCG_TARGET_STACK_BIAS; frame_size +=3D TCG_STATIC_CALL_ARGS_SIZE + tmp_buf_size; frame_size +=3D TCG_TARGET_STACK_ALIGN - 1; --=20 2.25.1 From nobody Sat May 4 18:01:56 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1624110296758249.80754497501573; Sat, 19 Jun 2021 06:44:56 -0700 (PDT) Received: from localhost ([::1]:53732 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lubHK-0001HL-LX for importer2@patchew.org; Sat, 19 Jun 2021 09:44:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44138) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lubEz-0004Zg-1h for qemu-devel@nongnu.org; Sat, 19 Jun 2021 09:42:30 -0400 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]:34705) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lubEq-00082Z-2B for qemu-devel@nongnu.org; Sat, 19 Jun 2021 09:42:28 -0400 Received: by mail-pl1-x632.google.com with SMTP id h1so6135166plt.1 for ; Sat, 19 Jun 2021 06:42:19 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id y20sm12331511pfb.207.2021.06.19.06.42.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Jun 2021 06:42:18 -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=LytYMtnsYuh2hV09DrZXb1O7PvYc+bH4l0VxPGg1/IbMaed414L492vkXSvcjeQLxL DUdKawiiFlI3e+7KX+fm73/ffvmBzdxOCs/vZK/Kz+W9zD+ZLauZEBjFlwBivy22yTsC eWNUalEkDw6v7ez6pQucnRorjiwF6qfS6qGwi2vjs/TdPUpBFgRJP1yqinaM+fZIVJdJ +gtBRQDXrCWBm6JoArtyN3Q6vVCgamUBxR7Ay9OpVic3tH1VdYNuHcOQjVJvKagYFpwF vWXqpcaHYZHLstf7sl7kGhSAmUZum9dvRyQyV+32LOAknFz7PZCyMKmP2EAcvkjGeCBw fICg== 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=tCVmvd6LSL3PX4QSWOD6ZCiTee89t1StcTt+ks7S+6F73PQpfJn26lVrJuoZa9+t+m Fl/LJbQFs2pP6pNyNUCwNWrUnqqwG0ieSNs5YA8PnsHtonk37/lZdCFyQU1w4BBCB1p8 kZ0bjfb4FsKpMP41cpGDGArxN3xuW6E99KMIPMKQG2P/hCNnzYHAxQ31GIrJp3tPw7LX gM3+NHV6T0YIBC9NgUbX5dHsxwotPKQ1FA1EekWEK4zGKzgK3DkViTgF5tgX3mNWaq6s ummbk2OCO6/MGJOmdUwAqhPytuYTetfVVAaTiYJ3sxRBv0rfPWMdzHHbSdWFCJ4RMjLm kP1Q== X-Gm-Message-State: AOAM530bdCYwdAEXWuUzlU0We6AkTSCRwTubE1GPr/VCOCHdu7JuVH+n bXT89+J/P+foNzvnfLBfQslZiBrJrCeBag== X-Google-Smtp-Source: ABdhPJydJckaiTQ7u++8fap5lJj17B6yNPOFOLN5X/Ge1Q1GvHrt9SA+kiiz3LBGIpoBY9DPy1cpXw== X-Received: by 2002:a17:902:7792:b029:fc:e490:ff9f with SMTP id o18-20020a1709027792b02900fce490ff9fmr9340055pll.27.1624110138792; Sat, 19 Jun 2021 06:42:18 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 2/3] tcg: Allocate sufficient storage in temp_allocate_frame Date: Sat, 19 Jun 2021 06:42:15 -0700 Message-Id: <20210619134216.590423-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210619134216.590423-1-richard.henderson@linaro.org> References: <20210619134216.590423-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::632; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x632.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: Stefan Weil , qemu-stable@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) 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=C3=A9 Signed-off-by: Richard Henderson --- tcg/tcg.c | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) 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) =20 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 =3D align =3D 4; + break; + case TCG_TYPE_I64: + case TCG_TYPE_V64: + size =3D align =3D 8; + break; + case TCG_TYPE_V128: + size =3D align =3D 16; + break; + case TCG_TYPE_V256: + /* Note that we do not require aligned storage for V256. */ + size =3D 32, align =3D 16; + break; + default: + g_assert_not_reached(); } - ts->mem_offset =3D s->current_frame_offset; + + assert(align <=3D TCG_TARGET_STACK_ALIGN); + off =3D ROUND_UP(s->current_frame_offset, align); + assert(off + size <=3D s->frame_end); + s->current_frame_offset =3D off + size; + + ts->mem_offset =3D off; #if defined(__sparc__) ts->mem_offset +=3D TCG_TARGET_STACK_BIAS; #endif ts->mem_base =3D s->frame_temp; ts->mem_allocated =3D 1; - s->current_frame_offset +=3D sizeof(tcg_target_long); } =20 static void temp_load(TCGContext *, TCGTemp *, TCGRegSet, TCGRegSet, TCGRe= gSet); --=20 2.25.1 From nobody Sat May 4 18:01:56 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1624110370; cv=none; d=zohomail.com; s=zohoarc; b=XMT7ORkAgWSGI06mcllSyYZC7EhINCo+wvUuyDAXMcClAuQJN7HBXm+jQ7B5Li1xFZhtPikicrnzZdrpeXToFd7VajUw93wTWRr2BG1q78GgenBTDxkWBbRbZ1nzLyTR7U6e+Z/exlyvfpyB8/vSdkg3k0wUJeSUmpmYq8gkBHA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1624110370; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=gDZ4fKHEj5x3/MSUxAskWLr9drbT4tzdH2sLCcgKL8A=; b=T/A27p862X7f2fJpPvF1z491m6RN6k7PcVWqkE0DGwvQVIFDu5sNMb9eyzGG1P/Zd6QY50r5Y71pSdg9lypIF6s3qC8vqhnPVPvz5qj5mxk5R6EO68ySe+xB7XI68DER5Mw91zOqdgTX6ZYqmenfyfk38x1JbjHOawFgNmZeaaU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1624110370333732.7050562263053; Sat, 19 Jun 2021 06:46:10 -0700 (PDT) Received: from localhost ([::1]:56472 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lubIX-0003CQ-4O for importer2@patchew.org; Sat, 19 Jun 2021 09:46:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44146) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lubF4-0004aO-Np for qemu-devel@nongnu.org; Sat, 19 Jun 2021 09:42:35 -0400 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]:41701) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lubEr-000838-AU for qemu-devel@nongnu.org; Sat, 19 Jun 2021 09:42:34 -0400 Received: by mail-pl1-x636.google.com with SMTP id y13so10092plc.8 for ; Sat, 19 Jun 2021 06:42:20 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id y20sm12331511pfb.207.2021.06.19.06.42.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Jun 2021 06:42:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=gDZ4fKHEj5x3/MSUxAskWLr9drbT4tzdH2sLCcgKL8A=; b=vZsDhT1sJo5laHSpLF0QflFbPdfoucJxc/XIX6exYmu8crybJiPmnTUtAuHGfPwwUC bwjmYpvdJStsRIOiJxPVqrwBq7CQhkRml0orR9vcSXL+bisU3TNYTZr8VYfqM9gJynLa sLTGkMe0E9ulF78Pn3ch32YdGT5euy08JjvfD7sMx7PjUBV71QG78xUh78XjH/V//ob4 e8wrebPwVeueJ7lxhAL5oqF2pemwIfH2e/4/X34duAuPVe0bWutPpPJEv94n6xn6Qop7 eNzv5nGqYCNYAnb+4O52jPr7Fsx0o2QlDs5eFVEBwlwsLhlzSTAeExwYH4nxlDl+7QB7 JhyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gDZ4fKHEj5x3/MSUxAskWLr9drbT4tzdH2sLCcgKL8A=; b=hEyQVQIjAavPysvmrltviIjTvZW5GaBO9cwoZ71Z9kg1WMFYMpQ7TQwQcKPPqC/qpN Xj6miJD95b5dJX/AelDROMrP2uARIQw1EjCmmAbew4jkkL47zZD40QB2XmPrQVf8mk8X EW+2O4ophyEwqxJwS55pcaZrJMihFFqxVjsJK03qxefu/E9hFHa8lxk6V22WQzhB5ZDq eVK3FM0sug4A4D8KzXDYyWzgVz4OOnT+R90N7IkGcEVBSuNIwwj/G1FfrDcMWRrxy2Th +hD8sl4HcNrbGk2TZ7MqSlJ9Y64z77AO3t3m8vEs69965vh5zxIQwldfE7FgZoTupdCD OY3Q== X-Gm-Message-State: AOAM532YqF+UTfBmQ1AjUjV2D7ouzrmC7i9SV3CfuBUNh+L2L4EGB6Iy 4p+Q7cuxx3BoaErP3Or/cb158EwGF7jNAA== X-Google-Smtp-Source: ABdhPJzB3bzzPdh3unRJe7WV3GgaWLr347uqWhPZ/xozk5wuUfjqtynJ3rrfIF08fLs806dnmnXynQ== X-Received: by 2002:a17:902:a5c9:b029:f7:9f7e:aa2f with SMTP id t9-20020a170902a5c9b02900f79f7eaa2fmr9389733plq.54.1624110139324; Sat, 19 Jun 2021 06:42:19 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 3/3] tcg: Restart when exhausting the stack frame Date: Sat, 19 Jun 2021 06:42:16 -0700 Message-Id: <20210619134216.590423-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210619134216.590423-1-richard.henderson@linaro.org> References: <20210619134216.590423-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::636; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x636.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: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" Assume that we'll have fewer temps allocated after restarting with a fewer number of instructions. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- tcg/tcg.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tcg/tcg.c b/tcg/tcg.c index 47cc66f159..fec922fa9e 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -3039,7 +3039,11 @@ static void temp_allocate_frame(TCGContext *s, TCGTe= mp *ts) =20 assert(align <=3D TCG_TARGET_STACK_ALIGN); off =3D ROUND_UP(s->current_frame_offset, align); - assert(off + size <=3D s->frame_end); + + /* If we've exhausted the stack frame, restart with a smaller TB. */ + if (off + size > s->frame_end) { + tcg_raise_tb_overflow(s); + } s->current_frame_offset =3D off + size; =20 ts->mem_offset =3D off; --=20 2.25.1