From nobody Fri May 10 06:16:12 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1654133829; cv=none; d=zohomail.com; s=zohoarc; b=PtbulS/E7JTu5kWL7giTf8/g+MI4uU7dgS6p9fyVkKJxLcz2S4a5NxYTxe4Qe6IzIXML/2M26AzZyNOcAtOXNhp7MQyCxzoWR554OeXqi8odnQ4uTRIyvqL0MqQSSbXaeDdLG+GPxl7mGqtBjXZMjTCO4/qO6n8ZmkdKA1KJ4SQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654133829; 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=v6GsMd9l2dAfQx+Uj+qJ1gCQp2pHPy4DQInBPdc5TCM=; b=YZ2qi1EM58wvXqau/ovdOuQSoEhEpeMO5I2+UKd0IyG6HP6cgcVPwDfZwkHwkaLxO5hoXq28ehEW+1GPT5yWBNsmbRR9AQ1k7rj42QBkDVJqH59ISBkbE36Fs7+XgM9RTtJX6x2i8tVydc4l/H3rhcZ8qbRZjmobKyQcAUG/ig0= 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+importer=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 1654133829110206.5499730508792; Wed, 1 Jun 2022 18:37:09 -0700 (PDT) Received: from localhost ([::1]:53122 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nwZlr-0005F7-Fu for importer@patchew.org; Wed, 01 Jun 2022 21:37:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43424) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwZix-0002KI-17 for qemu-devel@nongnu.org; Wed, 01 Jun 2022 21:34:07 -0400 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]:40670) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nwZiv-0005E2-BY for qemu-devel@nongnu.org; Wed, 01 Jun 2022 21:34:06 -0400 Received: by mail-pj1-x102a.google.com with SMTP id n13-20020a17090a394d00b001e30a60f82dso7944900pjf.5 for ; Wed, 01 Jun 2022 18:34:04 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:1eca:8ee3:9269:e00c]) by smtp.gmail.com with ESMTPSA id l191-20020a6391c8000000b003fc5b1db26fsm1962875pge.52.2022.06.01.18.34.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 18:34:03 -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=v6GsMd9l2dAfQx+Uj+qJ1gCQp2pHPy4DQInBPdc5TCM=; b=Qg8/PLu8Zu5+LZyYhCNcSfO3eQLy/+KrGp2UPo57WrKp2FNzJv6/R5JugOmcoBd8g8 Q6+48+Yth8+d7bNyLXzOKiHvU40oquMdEBZ7+Is4jewIOFdlrcs0Fzwv5umgZnJHWNl1 ipFYFg2KnroRZRt3u4VFI+t01EGLvMR86d82kHFQG4ElGyyJH/X1xTjjmPXVR8PobeST neBFoHW7+p0MTDqFDDc8mvHZiKol8iKBKGlufC1ng1sUUUBQDaypO4EWmyflTxJnFCBa IbCFVQbNTL2dR2xI5sZ+4GqSUDboG5v0uWI2n8iYg5NWkKfuQWDxIejOC8xA0rwdKxAl tfKA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=v6GsMd9l2dAfQx+Uj+qJ1gCQp2pHPy4DQInBPdc5TCM=; b=vYTHk3IGWj//PLAjkj6VOtGaL9wQE4P8Ia2XILUFZNhnznDK8x+iF9iGyAmn8g/X6S IYkVENqwIMtNo3HuBT5gpPF2I6w1qOLL0MdcUowir2Myd54FxGJIqE32xXFSrv0VvjbH tmdugfWGpwZfX2CnLdK1W07t4BzWKqDdgnMSXGGVt0V7a2BpLLW2/sp6GGFT+BnnFOoI eGvNAqK8+GqQl4kf68isFag4ozDuuW0oT0i711Qv5hdFvAdMFRusaaf3H/9BN0K0TrG6 uc+EO7j2Vl0MuAm/1N/3Ml199mCgmHevlgoLZT+vD+B5xwpPjsuXkQWq6Di4Yo+eGavd nvGA== X-Gm-Message-State: AOAM532GdbQdbC0xGdpYv/gfqU+LB78YmgAdP1qNxjNkTdLp4gnQbp1W Pel5cixpy66XAmfL2Kn4SNSslCI6eVniDw== X-Google-Smtp-Source: ABdhPJzg7elFncZg10kOPHp7phsyH9uC5DzWBNnb64ptOxce8i9VkPmjFxcfuiIxEQe4pBotaSGeeg== X-Received: by 2002:a17:902:a9ca:b0:161:54a6:af3f with SMTP id b10-20020a170902a9ca00b0016154a6af3fmr2358404plr.48.1654133644052; Wed, 01 Jun 2022 18:34:04 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu Subject: [PATCH v6 01/17] target/m68k: Raise the TRAPn exception with the correct pc Date: Wed, 1 Jun 2022 18:33:45 -0700 Message-Id: <20220602013401.303699-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220602013401.303699-1-richard.henderson@linaro.org> References: <20220602013401.303699-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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102a; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102a.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1654133830314100001 Content-Type: text/plain; charset="utf-8" Rather than adjust the PC in all of the consumers, raise the exception with the correct PC in the first place. Reviewed-by: Laurent Vivier Signed-off-by: Richard Henderson --- linux-user/m68k/cpu_loop.c | 1 - target/m68k/op_helper.c | 9 --------- target/m68k/translate.c | 2 +- 3 files changed, 1 insertion(+), 11 deletions(-) diff --git a/linux-user/m68k/cpu_loop.c b/linux-user/m68k/cpu_loop.c index d1bf8548b7..56417f7401 100644 --- a/linux-user/m68k/cpu_loop.c +++ b/linux-user/m68k/cpu_loop.c @@ -56,7 +56,6 @@ void cpu_loop(CPUM68KState *env) { abi_long ret; n =3D env->dregs[0]; - env->pc +=3D 2; ret =3D do_syscall(env, n, env->dregs[1], diff --git a/target/m68k/op_helper.c b/target/m68k/op_helper.c index 8decc61240..d30f988ae0 100644 --- a/target/m68k/op_helper.c +++ b/target/m68k/op_helper.c @@ -217,11 +217,6 @@ static void cf_interrupt_all(CPUM68KState *env, int is= _hw) cpu_loop_exit(cs); return; } - if (cs->exception_index >=3D EXCP_TRAP0 - && cs->exception_index <=3D EXCP_TRAP15) { - /* Move the PC after the trap instruction. */ - retaddr +=3D 2; - } } =20 vector =3D cs->exception_index << 2; @@ -304,10 +299,6 @@ static void m68k_interrupt_all(CPUM68KState *env, int = is_hw) /* Return from an exception. */ m68k_rte(env); return; - case EXCP_TRAP0 ... EXCP_TRAP15: - /* Move the PC after the trap instruction. */ - retaddr +=3D 2; - break; } } =20 diff --git a/target/m68k/translate.c b/target/m68k/translate.c index 4026572ed8..6d6d026e3c 100644 --- a/target/m68k/translate.c +++ b/target/m68k/translate.c @@ -4860,7 +4860,7 @@ DISAS_INSN(wdebug) =20 DISAS_INSN(trap) { - gen_exception(s, s->base.pc_next, EXCP_TRAP0 + (insn & 0xf)); + gen_exception(s, s->pc, EXCP_TRAP0 + (insn & 0xf)); } =20 static void gen_load_fcr(DisasContext *s, TCGv res, int reg) --=20 2.34.1 From nobody Fri May 10 06:16:12 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1654133925; cv=none; d=zohomail.com; s=zohoarc; b=S17hvCVksbblXLc0YLX28HU2GlFU7mfx4dX/5TN5JuZRQ1nRJdF5Rbc3EuKA2u0ctT90u6dKG1FTz+flnK/CO3AtY+qDtA+EmSVcH76u/lfEtSzYeY5FyDgHQEGh+PxrPy7JMDSx0iXTd18Cdhg0vx1PW9zABoTowl7QvHnnoew= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654133925; h=Content-Type: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=hV+IA21ry8VojR25e1IAEE42j7p287jopA93G1Fi9U8=; b=Uxy0jf55p333B9afHAFqbbtKi7UzWfvT3l58RxKr5Xt3zubkUyrABUZTJOSXtsIDkh5S53WNxKrEjfMaiEPBP4RSwxkLntcJbXoNYnZf8Ta+ZUtBp/6SOv4Ts3FtUmuAXIlTXADmSe0gF35rGdmSKtbYzMSrDd2B7RfqhMTDFkA= 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+importer=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 1654133925225583.0178590408179; Wed, 1 Jun 2022 18:38:45 -0700 (PDT) Received: from localhost ([::1]:55942 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nwZnQ-0007IA-6j for importer@patchew.org; Wed, 01 Jun 2022 21:38:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43468) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwZj1-0002Md-Q8 for qemu-devel@nongnu.org; Wed, 01 Jun 2022 21:34:12 -0400 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]:33374) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nwZiw-0005EC-V1 for qemu-devel@nongnu.org; Wed, 01 Jun 2022 21:34:09 -0400 Received: by mail-pj1-x1030.google.com with SMTP id hv24-20020a17090ae41800b001e33eebdb5dso4312244pjb.0 for ; Wed, 01 Jun 2022 18:34:06 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:1eca:8ee3:9269:e00c]) by smtp.gmail.com with ESMTPSA id l191-20020a6391c8000000b003fc5b1db26fsm1962875pge.52.2022.06.01.18.34.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 18:34:04 -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=hV+IA21ry8VojR25e1IAEE42j7p287jopA93G1Fi9U8=; b=ovgoZ/5Lrp0mnppAWS/xEp2q/zvJtCwmTkPtX4YwiLu6Ppv4zkVd4tV+ZMzGElwXEN 1mX8b/mrmHT/wujWhq+pyfBgAlOXC48N55fuDvj9zSFrh5bYH5VHraEQ8Vh1Ocl6GW2o QJsinlGnmUKGnd6q31sNM9WoroV4/S6gG+2kSNsEHleaWS5IXs2NQ3NOYl4pg17JzUJo As/7KZk1hH0kHmZhxHW1KHq/ZXcD3Hm1hl1DssOcwopg9aeuLexGn6Nhoh5dSTyIV8cs tsTVgWlsU9n/fKgmOSEDWxv7W1t2ynDAdMj/+IBDRURbr3aLZwGItja3bOdZroZ98kMc uH6A== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=hV+IA21ry8VojR25e1IAEE42j7p287jopA93G1Fi9U8=; b=wUzclgO7nNXyEcmcw/OG1da8t/l08fdlUQii5BDsW1T08/2ExGpAkvuKx1wKi1+hvM NFWg0P0mLDRFWunD1iDXjXG4hWx+dwA7i2Yp0jq9Gj9x9jkv42baH3jjAafIH6fT7afS HpcZQlsRc5VDvErXMFez/ZGtp949uQTwV6uZam0fGzY+Rv1IjDgNAkzkT9mhISfi66H+ l3W5JjIn6hHm0Vq5H2DqQ/JUYL5Zh1NCcgbtKFS8+620DxiPfjdEyV6JpS+2W1SX/wNH D/1T+JgZPyJ9L4yaeuwx3ahz05ME/Sl96PirhHrhT8lGbL05NTw+N+VsgtrQcr0XoQYg qbWw== X-Gm-Message-State: AOAM532E6aEVaCZKA1Co3rSUXv4y0DQ7SmCbLJmhE2mxvd8KsVR2jZaZ PI5Uat+7zNgP5ITZiVYlKXAYiSPeYt6/NA== X-Google-Smtp-Source: ABdhPJzs8Sv+mjbgQ3EZCuRGoC+bdXCiNoudf6clMQU8aZOUXi4nmerz/SRu+Mc/yc5MviQTevkUBQ== X-Received: by 2002:a17:902:ce8a:b0:161:af5e:a7b9 with SMTP id f10-20020a170902ce8a00b00161af5ea7b9mr2219577plg.167.1654133645361; Wed, 01 Jun 2022 18:34:05 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v6 02/17] target/m68k: Switch over exception type in m68k_interrupt_all Date: Wed, 1 Jun 2022 18:33:46 -0700 Message-Id: <20220602013401.303699-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220602013401.303699-1-richard.henderson@linaro.org> References: <20220602013401.303699-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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1030; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1030.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1654133926572100001 Replace an if ladder with a switch for clarity. Reviewed-by: Laurent Vivier Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- target/m68k/op_helper.c | 49 +++++++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 19 deletions(-) diff --git a/target/m68k/op_helper.c b/target/m68k/op_helper.c index d30f988ae0..2b94a6ec84 100644 --- a/target/m68k/op_helper.c +++ b/target/m68k/op_helper.c @@ -333,7 +333,8 @@ static void m68k_interrupt_all(CPUM68KState *env, int i= s_hw) sp &=3D ~1; } =20 - if (cs->exception_index =3D=3D EXCP_ACCESS) { + switch (cs->exception_index) { + case EXCP_ACCESS: if (env->mmu.fault) { cpu_abort(cs, "DOUBLE MMU FAULT\n"); } @@ -391,29 +392,39 @@ static void m68k_interrupt_all(CPUM68KState *env, int= is_hw) "ssw: %08x ea: %08x sfc: %d dfc: %d\n", env->mmu.ssw, env->mmu.ar, env->sfc, env->dfc); } - } else if (cs->exception_index =3D=3D EXCP_ADDRESS) { + break; + + case EXCP_ADDRESS: do_stack_frame(env, &sp, 2, oldsr, 0, retaddr); - } else if (cs->exception_index =3D=3D EXCP_ILLEGAL || - cs->exception_index =3D=3D EXCP_DIV0 || - cs->exception_index =3D=3D EXCP_CHK || - cs->exception_index =3D=3D EXCP_TRAPCC || - cs->exception_index =3D=3D EXCP_TRACE) { + break; + + case EXCP_ILLEGAL: + case EXCP_DIV0: + case EXCP_CHK: + case EXCP_TRAPCC: + case EXCP_TRACE: /* FIXME: addr is not only env->pc */ do_stack_frame(env, &sp, 2, oldsr, env->pc, retaddr); - } else if (is_hw && oldsr & SR_M && - cs->exception_index >=3D EXCP_SPURIOUS && - cs->exception_index <=3D EXCP_INT_LEVEL_7) { - do_stack_frame(env, &sp, 0, oldsr, 0, retaddr); - oldsr =3D sr; - env->aregs[7] =3D sp; - cpu_m68k_set_sr(env, sr &=3D ~SR_M); - sp =3D env->aregs[7]; - if (!m68k_feature(env, M68K_FEATURE_UNALIGNED_DATA)) { - sp &=3D ~1; + break; + + case EXCP_SPURIOUS ... EXCP_INT_LEVEL_7: + if (is_hw && oldsr & SR_M) { + do_stack_frame(env, &sp, 0, oldsr, 0, retaddr); + oldsr =3D sr; + env->aregs[7] =3D sp; + cpu_m68k_set_sr(env, sr &=3D ~SR_M); + sp =3D env->aregs[7]; + if (!m68k_feature(env, M68K_FEATURE_UNALIGNED_DATA)) { + sp &=3D ~1; + } + do_stack_frame(env, &sp, 1, oldsr, 0, retaddr); + break; } - do_stack_frame(env, &sp, 1, oldsr, 0, retaddr); - } else { + /* fall through */ + + default: do_stack_frame(env, &sp, 0, oldsr, 0, retaddr); + break; } =20 env->aregs[7] =3D sp; --=20 2.34.1 From nobody Fri May 10 06:16:12 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1654134090; cv=none; d=zohomail.com; s=zohoarc; b=BilljpRLusksN5gFaT+xZ693t5cfmdL+mIFNZpeFkzcBeA3A+jSXNmq1seHUORppHVTPYzZUc8gYmKnohN/Mha1FPmLgYlYQj6x1zJ6JEwq/IT2TZ2p9inmY9fvw1uvB9fXSsphMQkPQwygsd2oxtkRAe6WQiFtibRDOCMday8c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654134090; h=Content-Type: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=mCzaU+JrOI2uB5gjGXQ6lDaHwnlMpGfIPzqc07MdKqM=; b=dG7l6RsoXZVVfFOEQOQB5Ye5vNxEsKCifmp2fEJm1uQJeJQVMFlAFMkD4lsLitgzILL/QWYYUpQXHzKzIr4PCmMF67I/lblDxn4udfYYqju4mSwuYzHuyaTF6TWoTlFBZ3mHFM8IUEzzBUJN4KLm/JdY6ef4mszoQJl/Q6avZdY= 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+importer=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 1654134090207125.009577179031; Wed, 1 Jun 2022 18:41:30 -0700 (PDT) Received: from localhost ([::1]:33346 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nwZq5-0002mG-1L for importer@patchew.org; Wed, 01 Jun 2022 21:41:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43470) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwZj1-0002Me-Sa for qemu-devel@nongnu.org; Wed, 01 Jun 2022 21:34:12 -0400 Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]:36613) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nwZiy-0005ES-Ao for qemu-devel@nongnu.org; Wed, 01 Jun 2022 21:34:10 -0400 Received: by mail-pg1-x536.google.com with SMTP id y187so3463765pgd.3 for ; Wed, 01 Jun 2022 18:34:07 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:1eca:8ee3:9269:e00c]) by smtp.gmail.com with ESMTPSA id l191-20020a6391c8000000b003fc5b1db26fsm1962875pge.52.2022.06.01.18.34.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 18:34: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:in-reply-to:references :mime-version:content-transfer-encoding; bh=mCzaU+JrOI2uB5gjGXQ6lDaHwnlMpGfIPzqc07MdKqM=; b=eJrzavF78Dl8X1CBsr73mWkgbu4u9a93eLvEw8+IUzsqoTF31gPveXJtPx9cD2Dz71 KbvrUrQUAeoQMGM2ymi/hV/ObONEG+j4WeX9GwVxlN7gakUNtFCbSXUF/o3JgLMb1HZ7 hL9wSq7nKXAtbYxCnVrFXcAGOjq2C9Yy/Ahj6+Ccb48iAabOCx81l00rBohuQbc2fl/g 8/kwmY6SgJzNNKMEqShxtmtsZ2zRiGRlUPHDfR5pXcm9o5YJQOAbD2KG2pqexpdOoAYY yXNDOP3qYdwHf3Nl6LyFj1ZpebcWdgkQIJd+nx+mX9PAfK8cIKCPuusDaQ9WHc09cHjz vggg== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=mCzaU+JrOI2uB5gjGXQ6lDaHwnlMpGfIPzqc07MdKqM=; b=WjE7VUmJ7VA5HJh7Pgk38pZaoi6JmTbZMQ9Xozmz5r+FeOyAvxeWqqJJSB1iQYQlzX odvfubqgmnl5sVPMiY5K5bPJgUmSjmKOX/XvVjRprI4Q2r/jbg/E5qOEcpS4A99Xb0kT MPKoP0HmiQ5KYrBUjTk6313di9Nns8Ic+lPUGfGDkhw/W/vFzxxnQanhzxckv/MZbXgi ffEm0GBWp+qGGG1TnlXKpWkOmPEaIjnts3Y+uUv2NZbg/tmc3JfPnuXqxB8LqczvlQNv AUQ9aKIlVIMh5u/GE4heOVBo1KPfkMdflcqOwFEIth3iVF2+veDKwkabicg8/kWcm1vK KMdg== X-Gm-Message-State: AOAM531pbZK8aQ0ZKzYGZuznKf839GLLcA/5579JhQQwyNH/+SQU32k5 2y3xJf5MMyvffb4gMcJFJzz2qUIrsnaEsw== X-Google-Smtp-Source: ABdhPJyXcpi6RY3DahD5n4Ufcr/vM9TgrMNhTUeXGbk5+e+ClXh4IlgB6WkNuvOlSBxJO+mW3tq5MQ== X-Received: by 2002:a63:5f13:0:b0:3fc:68a8:b1c8 with SMTP id t19-20020a635f13000000b003fc68a8b1c8mr1919824pgb.607.1654133646741; Wed, 01 Jun 2022 18:34:06 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v6 03/17] target/m68k: Fix coding style in m68k_interrupt_all Date: Wed, 1 Jun 2022 18:33:47 -0700 Message-Id: <20220602013401.303699-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220602013401.303699-1-richard.henderson@linaro.org> References: <20220602013401.303699-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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::536; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x536.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1654134091511100001 Add parenthesis around & vs &&. Remove assignment to sr in function call argument -- note that sr is unused after the call, so the assignment was never needed, only the result of the & expression. Suggested-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Laurent Vivier Signed-off-by: Richard Henderson --- target/m68k/op_helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/m68k/op_helper.c b/target/m68k/op_helper.c index 2b94a6ec84..0f41c2dce3 100644 --- a/target/m68k/op_helper.c +++ b/target/m68k/op_helper.c @@ -408,11 +408,11 @@ static void m68k_interrupt_all(CPUM68KState *env, int= is_hw) break; =20 case EXCP_SPURIOUS ... EXCP_INT_LEVEL_7: - if (is_hw && oldsr & SR_M) { + if (is_hw && (oldsr & SR_M)) { do_stack_frame(env, &sp, 0, oldsr, 0, retaddr); oldsr =3D sr; env->aregs[7] =3D sp; - cpu_m68k_set_sr(env, sr &=3D ~SR_M); + cpu_m68k_set_sr(env, sr & ~SR_M); sp =3D env->aregs[7]; if (!m68k_feature(env, M68K_FEATURE_UNALIGNED_DATA)) { sp &=3D ~1; --=20 2.34.1 From nobody Fri May 10 06:16:12 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1654134194; cv=none; d=zohomail.com; s=zohoarc; b=hT1LgXPbHiWX+1SCvaYY2O0l34ifhXmny7As7xdqaxzDzNyjnYcbrzeSoXkrbVTkk029DRoluHeoeVdaw4Mrs6CCkO+cRB7Dx5kx/zrdReQJMZ0I3KCorAekWo7bGJbrYRmu/g5/ROhwIX7w8rHwMG5hAK+Unq9mLpQggyrpGWI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654134194; 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=P8QVHsssV/N9S00mQXjYBPgFpjBb96NXM+kaVdZ/lRE=; b=DsPo8fJqoCmqviWPhwYDZWUL6CAXBteQjZj3SymnP1us7XQcvHvOAEqWhGE9ExxcU0MV00V08AU2ZKiNLC4gdnQSsYoSbzXyByDaNGYnCGG/ipKQi1nELdsiXyNEZLRKWruIdpO2IYxyYoTNsvs+UGvLtA+p6xJAVkAvYUTWtGw= 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+importer=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 1654134194346850.21507360871; Wed, 1 Jun 2022 18:43:14 -0700 (PDT) Received: from localhost ([::1]:36238 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nwZrl-0004iZ-BK for importer@patchew.org; Wed, 01 Jun 2022 21:43:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43522) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwZj4-0002Ot-9f for qemu-devel@nongnu.org; Wed, 01 Jun 2022 21:34:14 -0400 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]:40529) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nwZiz-0005Ei-IC for qemu-devel@nongnu.org; Wed, 01 Jun 2022 21:34:12 -0400 Received: by mail-pl1-x629.google.com with SMTP id i1so3276876plg.7 for ; Wed, 01 Jun 2022 18:34:09 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:1eca:8ee3:9269:e00c]) by smtp.gmail.com with ESMTPSA id l191-20020a6391c8000000b003fc5b1db26fsm1962875pge.52.2022.06.01.18.34.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 18:34:07 -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=P8QVHsssV/N9S00mQXjYBPgFpjBb96NXM+kaVdZ/lRE=; b=Hlsxl02aExRZSOEMZ1YXVMIUwqpkQlJqLtVKC+eDhzgZlmpTslGd7yuZ5sxW7h+WCa 7sqbfycVWVJFKPKcf7HpNUYVrlBHZTZsVHZ6mrnj++XOGWmEWQm6pDFiXoq1Y+FbtWV4 M4P5IBEwJ7PrPCOSg1s65sq3oBXNX3NASZCMbA0fuBKf3OCFLxO4VKtcJloifoEuV0bx /ErqLhuoW5rdhJiY3LS3APfGXzKotGWUxoY+KaT4cxQmB1H8MEzDFOFOXYkjLtmq0hDB o/2lnOWckDmg/9Wuv3S1sN1JpyeBDfxUNidjm9+rJ9f7FnMhackoAooNJPqXJnOqYxnK Delw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=P8QVHsssV/N9S00mQXjYBPgFpjBb96NXM+kaVdZ/lRE=; b=2OwISZjZgDmQvaGlU9/KgrGLlP5pZy0omSQL+JG1qUWSkbxaeqiJJ0QsQcn/HgHQAD +kKCMEV6ZtUj70KSS+rSKkgzp1SHUdIuzxBYm4w5/TPRl9XQrHUKybl9oYGVgH/cPDJL 0XM/s80PPi8NfdTJAmWovrh5pTI/lxfmeoOvWsqpI46T/pEmnjZXtFq4pXRzPNDUlG1r 8cCmRtuQyg0a+7PmPdE/7Y0t7IGAclT6ertQBq++pVSGj5eA+4JmxkzM61zA7qV4OHme PftmJv3by/iS7LrOqMxHXmGx0uXlRc7On0dqb5vP44T4JTUf3fwGjxf8jfzSV3Frr7Ay mNMg== X-Gm-Message-State: AOAM533raPI5MhRwMNxO4HX/5XDc2lHYbpfDiINB6vkDUmqiWXvFi+fp imH4SYEsZwj95XivYpVE0EWJFpLtl2yO8A== X-Google-Smtp-Source: ABdhPJzwGPZvl63TpqAjgBI3dF59d80sAW9gIfvZzF6E/z5YRMrD1uMGButcaSCHVGrrrKaJu2AOzg== X-Received: by 2002:a17:90b:1d90:b0:1df:d0ae:1443 with SMTP id pf16-20020a17090b1d9000b001dfd0ae1443mr2418782pjb.122.1654133648114; Wed, 01 Jun 2022 18:34:08 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu Subject: [PATCH v6 04/17] linux-user/m68k: Handle EXCP_TRAP1 through EXCP_TRAP15 Date: Wed, 1 Jun 2022 18:33:48 -0700 Message-Id: <20220602013401.303699-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220602013401.303699-1-richard.henderson@linaro.org> References: <20220602013401.303699-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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::629; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x629.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1654134196523100001 Content-Type: text/plain; charset="utf-8" These are raised by guest instructions, and should not fall through into the default abort case. Signed-off-by: Richard Henderson --- linux-user/m68k/cpu_loop.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/linux-user/m68k/cpu_loop.c b/linux-user/m68k/cpu_loop.c index 56417f7401..12e5d9cd53 100644 --- a/linux-user/m68k/cpu_loop.c +++ b/linux-user/m68k/cpu_loop.c @@ -75,7 +75,11 @@ void cpu_loop(CPUM68KState *env) case EXCP_INTERRUPT: /* just indicate that signals should be handled asap */ break; + case EXCP_TRAP0 + 1 ... EXCP_TRAP0 + 14: + force_sig_fault(TARGET_SIGILL, TARGET_ILL_ILLTRP, env->pc); + break; case EXCP_DEBUG: + case EXCP_TRAP15: force_sig_fault(TARGET_SIGTRAP, TARGET_TRAP_BRKPT, env->pc); break; case EXCP_ATOMIC: --=20 2.34.1 From nobody Fri May 10 06:16:12 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1654134354; cv=none; d=zohomail.com; s=zohoarc; b=iZ4VpYMozaVZRvn/dVq09gncTb91C/zR5xLKcbibTb984HXxw9NVSyxhkLZFc657uUr1OIU8Ng1mRBtzO5xQEhc0OXn1Meg43M6ql+BV4F4t9eeEqOnkybGavx91grAk/J4OXNDKQGc0HxtKBAQblrvunZ97jvqJeWlXAsg9bmc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654134354; h=Content-Type: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=dBQmcYvQNWemNoz94qCXnnbynO5dcM+A32yDVQduyko=; b=GHK18JER3EYPsQq4Ci4cEHW0/5QcScS+Mnawtsr8YdfiT6kekt2+K09vnP+Xxwib40nI4/k2hGdmyLj0ACNSRgaxdWs8BBZONRMDYvehxRSzz6SQDF1Qyom7YCrvLyQwf2xU9zRAla5bBlZH7KpBuEl3u7Hi9XmflIpxcdU3sRc= 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+importer=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 1654134354252175.0504045516575; Wed, 1 Jun 2022 18:45:54 -0700 (PDT) Received: from localhost ([::1]:41004 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nwZuL-00088C-41 for importer@patchew.org; Wed, 01 Jun 2022 21:45:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43520) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwZj4-0002Os-9y for qemu-devel@nongnu.org; Wed, 01 Jun 2022 21:34:14 -0400 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]:35589) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nwZj1-0005F5-Qk for qemu-devel@nongnu.org; Wed, 01 Jun 2022 21:34:13 -0400 Received: by mail-pf1-x433.google.com with SMTP id u2so3480900pfc.2 for ; Wed, 01 Jun 2022 18:34:10 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:1eca:8ee3:9269:e00c]) by smtp.gmail.com with ESMTPSA id l191-20020a6391c8000000b003fc5b1db26fsm1962875pge.52.2022.06.01.18.34.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 18:34:08 -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=dBQmcYvQNWemNoz94qCXnnbynO5dcM+A32yDVQduyko=; b=Yk3723jLF3gTb9CncvWRZv7v4jv30ttiW0r1k86QlT/dwP1HSfirZzaTh890ccF6kP N+5FYcCDchwBpl94epRqAXDSKE2VteAPnkXQ8DwkVzCW8BYCy0WZeijSGTyMxmWD6XzT K1YY0zwpjD6cLorYgOwd5UZDcHB+LeY013IhSvEVdGQMMZX+1kl6pglvB81ElmEocwHX KmBXO+VUwUjOvD15OqH9zp8WnGhdP8cgMN1WwQteqUv9ZnASAgheFRBl0LO8UVodQDuO ijcevWreJXE8byjFeuAErSZ2XGcgKI7nnvqjdkYRD7J0CSUgnG2hUkbzWdJnunObA6KE 5Qyw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=dBQmcYvQNWemNoz94qCXnnbynO5dcM+A32yDVQduyko=; b=ld53qoesoVPgoSLuTqa3UIrvxRW7s4EpheVSHGK5oBVIW9ECWMF9K/TfM12lEMRJXe 3/MOR7DCmPzg0QXEWbl/REKDLWiNcd/ggwv8Tzen18ZoXfL85G/HkZhPtSWDVsiKtHNj ODWuDbhLq2uvHEvGKxlgBzv58QiZOLHWh4CnhtQprjEHGsLsDSPOtHqr0bl8/eFmwD2U gpZqUvPv78YPVxGrxJIELuvhVT5cJM3kvb4z7Lk1uBwYuKw4/dFmcZ+J9bCZ2Ecan32W SVzxVy+MTTO9zKMnwlMriiLDQ5azBqb/IiSexU2LkkfeVWB6EHiTJ1/zkpIwOeKURBx0 Pv4g== X-Gm-Message-State: AOAM531adC41pTgYc17a8qfiFj/QwzTsr/KoidrFV5G9h4xFOnHB0Yie c2TXmKwLFg5Rs2yfm5dmL0wEmxCnDAs0CQ== X-Google-Smtp-Source: ABdhPJwtX9WkB5u8mfvwhrafrfIC38BBQXOH4B/o0AJOZqfkQqFy/hWjv+Y6QoVILNe+5R378g2pmg== X-Received: by 2002:a05:6a00:1506:b0:518:bcdd:6a33 with SMTP id q6-20020a056a00150600b00518bcdd6a33mr2335457pfu.27.1654133649569; Wed, 01 Jun 2022 18:34:09 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v6 05/17] target/m68k: Remove retaddr in m68k_interrupt_all Date: Wed, 1 Jun 2022 18:33:49 -0700 Message-Id: <20220602013401.303699-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220602013401.303699-1-richard.henderson@linaro.org> References: <20220602013401.303699-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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::433; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x433.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1654134355142100001 The only value this variable holds is now env->pc. Reviewed-by: Laurent Vivier Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- target/m68k/op_helper.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/target/m68k/op_helper.c b/target/m68k/op_helper.c index 0f41c2dce3..777869790b 100644 --- a/target/m68k/op_helper.c +++ b/target/m68k/op_helper.c @@ -287,12 +287,9 @@ static void m68k_interrupt_all(CPUM68KState *env, int = is_hw) { CPUState *cs =3D env_cpu(env); uint32_t sp; - uint32_t retaddr; uint32_t vector; uint16_t sr, oldsr; =20 - retaddr =3D env->pc; - if (!is_hw) { switch (cs->exception_index) { case EXCP_RTE: @@ -385,7 +382,7 @@ static void m68k_interrupt_all(CPUM68KState *env, int i= s_hw) sp -=3D 4; cpu_stl_mmuidx_ra(env, sp, env->mmu.ar, MMU_KERNEL_IDX, 0); =20 - do_stack_frame(env, &sp, 7, oldsr, 0, retaddr); + do_stack_frame(env, &sp, 7, oldsr, 0, env->pc); env->mmu.fault =3D false; if (qemu_loglevel_mask(CPU_LOG_INT)) { qemu_log(" " @@ -395,7 +392,7 @@ static void m68k_interrupt_all(CPUM68KState *env, int i= s_hw) break; =20 case EXCP_ADDRESS: - do_stack_frame(env, &sp, 2, oldsr, 0, retaddr); + do_stack_frame(env, &sp, 2, oldsr, 0, env->pc); break; =20 case EXCP_ILLEGAL: @@ -404,12 +401,12 @@ static void m68k_interrupt_all(CPUM68KState *env, int= is_hw) case EXCP_TRAPCC: case EXCP_TRACE: /* FIXME: addr is not only env->pc */ - do_stack_frame(env, &sp, 2, oldsr, env->pc, retaddr); + do_stack_frame(env, &sp, 2, oldsr, env->pc, env->pc); break; =20 case EXCP_SPURIOUS ... EXCP_INT_LEVEL_7: if (is_hw && (oldsr & SR_M)) { - do_stack_frame(env, &sp, 0, oldsr, 0, retaddr); + do_stack_frame(env, &sp, 0, oldsr, 0, env->pc); oldsr =3D sr; env->aregs[7] =3D sp; cpu_m68k_set_sr(env, sr & ~SR_M); @@ -417,13 +414,13 @@ static void m68k_interrupt_all(CPUM68KState *env, int= is_hw) if (!m68k_feature(env, M68K_FEATURE_UNALIGNED_DATA)) { sp &=3D ~1; } - do_stack_frame(env, &sp, 1, oldsr, 0, retaddr); + do_stack_frame(env, &sp, 1, oldsr, 0, env->pc); break; } /* fall through */ =20 default: - do_stack_frame(env, &sp, 0, oldsr, 0, retaddr); + do_stack_frame(env, &sp, 0, oldsr, 0, env->pc); break; } =20 --=20 2.34.1 From nobody Fri May 10 06:16:12 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1654134638; cv=none; d=zohomail.com; s=zohoarc; b=R2aWjE/nk74KD4ohv5TbxHr47bzVGzOQ3bKBxEhWvbJYCNGUwQwf0NRDpriTuQtn2ziXYEBkH7No3ZWpj3CcJ24Kb966wUaG74T7bNgIlcrwSdZe7dwjG1Bq2H1dmLrO3cayi2fJNjG4It3c8sBeH9T0X5tMo6UyfXvOUMFAGKg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654134638; 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=lTUaM+lqbn8KxvXwj+n9JX47C53ZG33aTbTDGh5Ahv4=; b=KBAsNRuNLLUlbtZCP9xK2UHu2oiD7DfF+DoVdrE6qrU/lAys/sC6yHmhBqVpvOVZulxyPxpB+es76xvjT11HPcQaZdrYlUpMWdizaK+VU/SMLT8452tjd2o3AzuIkma+XCqI6tSEYXN4U0/Qjr9aHGco27GlvMirxW9v3QwmQJQ= 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+importer=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 1654134638455575.1978046143219; Wed, 1 Jun 2022 18:50:38 -0700 (PDT) Received: from localhost ([::1]:47266 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nwZyv-0004ND-AV for importer@patchew.org; Wed, 01 Jun 2022 21:50:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43628) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwZjJ-0002eY-31 for qemu-devel@nongnu.org; Wed, 01 Jun 2022 21:34:29 -0400 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]:37437) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nwZj2-0005FE-3D for qemu-devel@nongnu.org; Wed, 01 Jun 2022 21:34:21 -0400 Received: by mail-pj1-x1031.google.com with SMTP id 3-20020a17090a174300b001e426a02ac5so4797637pjm.2 for ; Wed, 01 Jun 2022 18:34:11 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:1eca:8ee3:9269:e00c]) by smtp.gmail.com with ESMTPSA id l191-20020a6391c8000000b003fc5b1db26fsm1962875pge.52.2022.06.01.18.34.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 18:34:10 -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=lTUaM+lqbn8KxvXwj+n9JX47C53ZG33aTbTDGh5Ahv4=; b=TMupXwDwJV7romQFcvkK3avSMh+Dd9KiHQ+ZncD116YInpq0N/Qji4//5NRAxu0kzD XoVqpBraci2MIwuKU6OM7XlV06EPN2e1gQMlHaYJqU7+Bn5Km/rCAgLd7/lDpv5O4paZ +XBzm6aR6pTz8U2rO3EdBmTuXWEHgxoj7kMfqk+NRBRtHrYmml5Scf//MniJWZ+741vB /n1cs6IPPDd1UiMb24jlrkpyiolKiFpJsF9yeORyQelDAf41w+4vZk4efT6hhFMMh22p 3Pyyub9Wzqn0rHA3O7+Ok2w/F1WFw9t6h4Z7EnIxzLiCLsUo1sLCJNmkOtAQZDJeNUm1 JTNA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=lTUaM+lqbn8KxvXwj+n9JX47C53ZG33aTbTDGh5Ahv4=; b=Xbd3ZC/UUsyOPzDHu+2+J1p2UuS1ESRVoPYFZ4SI0eWZVroFDm9hYIU/Li3rGxz48T HR+dIgCGRXflaH9VoS1gKzv8p4DHHuzSb5L0WUVcDaSJLkBQyfbm3ihNyyOt+F3uQjpF umOmAA040lghcItCSE5tf5ikW/O3zoxqc/uQR9OmwsaOgIepok55w5eszZAKIf2H9MXb hcyYpFlRg5pqBAoq3VX4gK9D/NkC01B2xMbLGDVvlRCrDHUM/7j5bXF4dtEdHrLmV15k SM/CdcBTPMEJ0uho5mERlithzxZ+rqHvBw/zyIMHiaxysc7enkRrutdk8LMkSbtDS5Vt VvJA== X-Gm-Message-State: AOAM533yW/qivTaiARx4THLnSKarLj44BNPDyegvhz5SCbtLVTiPz0eo hhF2zT8GT/o9LpVklDEMzcR2UUKF6+HwIw== X-Google-Smtp-Source: ABdhPJxUg9AE9ZYVG2WCkBfZQLAE2lJrxCx5ReV/Rt+2lX3kXI+OetVeUd57y8mSKuIVnK7POB9yBA== X-Received: by 2002:a17:90a:4896:b0:1de:fff2:6c48 with SMTP id b22-20020a17090a489600b001defff26c48mr2427993pjh.89.1654133650766; Wed, 01 Jun 2022 18:34:10 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu Subject: [PATCH v6 06/17] target/m68k: Fix address argument for EXCP_CHK Date: Wed, 1 Jun 2022 18:33:50 -0700 Message-Id: <20220602013401.303699-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220602013401.303699-1-richard.henderson@linaro.org> References: <20220602013401.303699-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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1031; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1031.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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1654134638685100001 Content-Type: text/plain; charset="utf-8" According to the M68040 Users Manual, section 8.4.3, Six word stack frame (format 2), CHK, CHK2 (and others) are supposed to record the next insn in PC and the address of the trapping instruction in ADDRESS. Create a raise_exception_format2 function to centralize recording of the trapping pc in mmu.ar, plus advancing to the next insn. Update m68k_interrupt_all to pass mmu.ar to do_stack_frame. Update cpu_loop to pass mmu.ar to siginfo.si_addr, as the kernel does in trap_c(). Reviewed-by: Laurent Vivier Signed-off-by: Richard Henderson --- target/m68k/cpu.h | 6 +++++ linux-user/m68k/cpu_loop.c | 2 +- target/m68k/op_helper.c | 54 ++++++++++++++++++++------------------ 3 files changed, 36 insertions(+), 26 deletions(-) diff --git a/target/m68k/cpu.h b/target/m68k/cpu.h index 9b3bf7a448..558c3c67d6 100644 --- a/target/m68k/cpu.h +++ b/target/m68k/cpu.h @@ -122,6 +122,12 @@ typedef struct CPUArchState { =20 /* MMU status. */ struct { + /* + * Holds the "address" value in between raising an exception + * and creation of the exception stack frame. + * Used for both Format 7 exceptions (Access, i.e. mmu) + * and Format 2 exceptions (chk, div0, trapcc, etc). + */ uint32_t ar; uint32_t ssw; /* 68040 */ diff --git a/linux-user/m68k/cpu_loop.c b/linux-user/m68k/cpu_loop.c index 12e5d9cd53..e24d17e180 100644 --- a/linux-user/m68k/cpu_loop.c +++ b/linux-user/m68k/cpu_loop.c @@ -47,7 +47,7 @@ void cpu_loop(CPUM68KState *env) force_sig_fault(TARGET_SIGILL, TARGET_ILL_ILLOPN, env->pc); break; case EXCP_CHK: - force_sig_fault(TARGET_SIGFPE, TARGET_FPE_INTOVF, env->pc); + force_sig_fault(TARGET_SIGFPE, TARGET_FPE_INTOVF, env->mmu.ar); break; case EXCP_DIV0: force_sig_fault(TARGET_SIGFPE, TARGET_FPE_INTDIV, env->pc); diff --git a/target/m68k/op_helper.c b/target/m68k/op_helper.c index 777869790b..750d65576f 100644 --- a/target/m68k/op_helper.c +++ b/target/m68k/op_helper.c @@ -397,13 +397,16 @@ static void m68k_interrupt_all(CPUM68KState *env, int= is_hw) =20 case EXCP_ILLEGAL: case EXCP_DIV0: - case EXCP_CHK: case EXCP_TRAPCC: case EXCP_TRACE: /* FIXME: addr is not only env->pc */ do_stack_frame(env, &sp, 2, oldsr, env->pc, env->pc); break; =20 + case EXCP_CHK: + do_stack_frame(env, &sp, 2, oldsr, env->mmu.ar, env->pc); + break; + case EXCP_SPURIOUS ... EXCP_INT_LEVEL_7: if (is_hw && (oldsr & SR_M)) { do_stack_frame(env, &sp, 0, oldsr, 0, env->pc); @@ -548,6 +551,29 @@ void HELPER(raise_exception)(CPUM68KState *env, uint32= _t tt) raise_exception(env, tt); } =20 +G_NORETURN static void +raise_exception_format2(CPUM68KState *env, int tt, int ilen, uintptr_t rad= dr) +{ + CPUState *cs =3D env_cpu(env); + + cs->exception_index =3D tt; + + /* Recover PC and CC_OP for the beginning of the insn. */ + cpu_restore_state(cs, raddr, true); + + /* Flags are current in env->cc_*, or are undefined. */ + env->cc_op =3D CC_OP_FLAGS; + + /* + * Remember original pc in mmu.ar, for the Format 2 stack frame. + * Adjust PC to end of the insn. + */ + env->mmu.ar =3D env->pc; + env->pc +=3D ilen; + + cpu_loop_exit(cs); +} + void HELPER(divuw)(CPUM68KState *env, int destr, uint32_t den) { uint32_t num =3D env->dregs[destr]; @@ -1065,18 +1091,7 @@ void HELPER(chk)(CPUM68KState *env, int32_t val, int= 32_t ub) env->cc_c =3D 0 <=3D ub ? val < 0 || val > ub : val > ub && val < 0; =20 if (val < 0 || val > ub) { - CPUState *cs =3D env_cpu(env); - - /* Recover PC and CC_OP for the beginning of the insn. */ - cpu_restore_state(cs, GETPC(), true); - - /* flags have been modified by gen_flush_flags() */ - env->cc_op =3D CC_OP_FLAGS; - /* Adjust PC to end of the insn. */ - env->pc +=3D 2; - - cs->exception_index =3D EXCP_CHK; - cpu_loop_exit(cs); + raise_exception_format2(env, EXCP_CHK, 2, GETPC()); } } =20 @@ -1097,17 +1112,6 @@ void HELPER(chk2)(CPUM68KState *env, int32_t val, in= t32_t lb, int32_t ub) env->cc_c =3D lb <=3D ub ? val < lb || val > ub : val > ub && val < lb; =20 if (env->cc_c) { - CPUState *cs =3D env_cpu(env); - - /* Recover PC and CC_OP for the beginning of the insn. */ - cpu_restore_state(cs, GETPC(), true); - - /* flags have been modified by gen_flush_flags() */ - env->cc_op =3D CC_OP_FLAGS; - /* Adjust PC to end of the insn. */ - env->pc +=3D 4; - - cs->exception_index =3D EXCP_CHK; - cpu_loop_exit(cs); + raise_exception_format2(env, EXCP_CHK, 4, GETPC()); } } --=20 2.34.1 From nobody Fri May 10 06:16:12 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1654134093; cv=none; d=zohomail.com; s=zohoarc; b=UWs/ejEm+bj2f+h/RH26q48zy5B8GaKWgIPZiR8DrzamHOlx4MR9AYp+N03eLt/AI2BV3th1a+ehmmRdrB9S7hcVTw33Z3a+1GQ+8f894yfmcn3Yb06MBjm/4Ny3R+r6rs5B/CS88u0+rh4NaxLgio0GvQkDcEwew0nHDw+v2qk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654134093; 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=9h8O/PKdXL0KvuNK2v2gIq3YV3vKmkNQsNhTF8q3vR8=; b=chIX8ApiRw1RETx4QEmabcXEKETf+YrGsWZdRCPo9Q9SJIaD5z0s+uH1BqLfwFgVZk/C9hEMrbqPZrdAABbG23kicVoGbUOZEuqhLlsRUMzulIBs2pbjt7vstl/zjUAwX8WlOzhZUeaj+sX9y71uedPFdd78q88umjWUqszVClw= 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+importer=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 165413409368598.01928489196939; Wed, 1 Jun 2022 18:41:33 -0700 (PDT) Received: from localhost ([::1]:33384 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nwZq8-0002nj-Il for importer@patchew.org; Wed, 01 Jun 2022 21:41:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43558) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwZj6-0002Tg-FE for qemu-devel@nongnu.org; Wed, 01 Jun 2022 21:34:16 -0400 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]:41732) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nwZj4-0005FX-16 for qemu-devel@nongnu.org; Wed, 01 Jun 2022 21:34:16 -0400 Received: by mail-pj1-x102e.google.com with SMTP id l20-20020a17090a409400b001dd2a9d555bso3615631pjg.0 for ; Wed, 01 Jun 2022 18:34:13 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:1eca:8ee3:9269:e00c]) by smtp.gmail.com with ESMTPSA id l191-20020a6391c8000000b003fc5b1db26fsm1962875pge.52.2022.06.01.18.34.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 18:34: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=9h8O/PKdXL0KvuNK2v2gIq3YV3vKmkNQsNhTF8q3vR8=; b=M27HBWjAQRRPuK1DpaBilH8Fkn0tTTOKOu2MvD1zY8+Vl+gtKZPaU40ick/1WEVh3e 9OkjSUABFgC3qT2B+VWHGwQru1Eiu00xNsNUlKVIsGvQMwJJibtXW5ThQ+BEhUCIfg3e KA0TQOeE+GSk4Jmisi89BHwxNVraVmvRlHR8tvlfTH7sCySf+mPMSLH015nhKU8L7bKN eIMTd4bETfrqrxnDVYqSDgM5+ChJILqFcCvz9LET92HTxOoh2HiegZU0/cZYSZOvAhVM aIbWC0v6MIZPdGWhORbyLjkXE6jGpqvZJ8ZW/YryGhUv17vXB7/xihSyGl2xZIJqa+xe HNDQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=9h8O/PKdXL0KvuNK2v2gIq3YV3vKmkNQsNhTF8q3vR8=; b=E+H5WC70y4Vkq16UbePaIFrtEucqVlenAEsqM/dhFHGpgR1Iaad+jIQ5gTYTRYvyCB ttVHXeJBXFdTfvgNqmJB9JnLFovrpK3wgluUO1wyul5ZoFoMEbmeK90QnQDBK0RjbUWP akPpcfkMNxnoQGWd/fsUUdJpa5AsYFVPxpNyf7yrfqdQPPOgtSjeM4zSt3MhVo/2XP85 YrUOkex+t/lF/mpTho6UprOGxne8F2e8OXHob0daYIAWS0jGo7gXsqdoHtdj7fCwybKj hok2A0+lu2tdZqNV9+IkjrQvUMMhSHeVRjAfVDEB9jCycp0pYVtX+jeFL/zdt8qnRv46 ZR9w== X-Gm-Message-State: AOAM532MGEJRmUvLB3xURMgSq34sta4m3nmLYghSQTvPtBwsSIiWVvbQ QLYy0lduHKAE/WXl0Prkl43T7UIehnqToQ== X-Google-Smtp-Source: ABdhPJwpAtWwErHnm2IG7vyV2g0gxPEMRAj/us4m5hzWIDr86w50vnbDseFULoIFICdwNw0YdDkZHw== X-Received: by 2002:a17:903:249:b0:163:6dc0:b8b3 with SMTP id j9-20020a170903024900b001636dc0b8b3mr2287235plh.24.1654133652133; Wed, 01 Jun 2022 18:34:12 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu Subject: [PATCH v6 07/17] target/m68k: Fix pc, c flag, and address argument for EXCP_DIV0 Date: Wed, 1 Jun 2022 18:33:51 -0700 Message-Id: <20220602013401.303699-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220602013401.303699-1-richard.henderson@linaro.org> References: <20220602013401.303699-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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1654134095622100001 Content-Type: text/plain; charset="utf-8" According to the M68040 Users Manual, section 8.4.3, Six word stack frame (format 2), Zero Div (and others) is supposed to record the next insn in PC and the address of the trapping instruction in ADDRESS. While the N, Z and V flags are documented to be undefine on DIV0, the C flag is documented as always cleared. Update helper_div* to take the instruction length as an argument and use raise_exception_format2. Hoist the reset of the C flag above the division by zero check. Update m68k_interrupt_all to pass mmu.ar to do_stack_frame. Update cpu_loop to pass mmu.ar to siginfo.si_addr, as the kernel does in trap_c(). Reviewed-by: Laurent Vivier Signed-off-by: Richard Henderson --- target/m68k/helper.h | 12 +++++----- linux-user/m68k/cpu_loop.c | 2 +- target/m68k/op_helper.c | 48 +++++++++++++++++++++++--------------- target/m68k/translate.c | 33 +++++++++++++------------- 4 files changed, 52 insertions(+), 43 deletions(-) diff --git a/target/m68k/helper.h b/target/m68k/helper.h index 0a6b4146f6..f016c4c1c2 100644 --- a/target/m68k/helper.h +++ b/target/m68k/helper.h @@ -1,12 +1,12 @@ DEF_HELPER_1(bitrev, i32, i32) DEF_HELPER_1(ff1, i32, i32) DEF_HELPER_FLAGS_2(sats, TCG_CALL_NO_RWG_SE, i32, i32, i32) -DEF_HELPER_3(divuw, void, env, int, i32) -DEF_HELPER_3(divsw, void, env, int, s32) -DEF_HELPER_4(divul, void, env, int, int, i32) -DEF_HELPER_4(divsl, void, env, int, int, s32) -DEF_HELPER_4(divull, void, env, int, int, i32) -DEF_HELPER_4(divsll, void, env, int, int, s32) +DEF_HELPER_4(divuw, void, env, int, i32, int) +DEF_HELPER_4(divsw, void, env, int, s32, int) +DEF_HELPER_5(divul, void, env, int, int, i32, int) +DEF_HELPER_5(divsl, void, env, int, int, s32, int) +DEF_HELPER_5(divull, void, env, int, int, i32, int) +DEF_HELPER_5(divsll, void, env, int, int, s32, int) DEF_HELPER_2(set_sr, void, env, i32) DEF_HELPER_3(cf_movec_to, void, env, i32, i32) DEF_HELPER_3(m68k_movec_to, void, env, i32, i32) diff --git a/linux-user/m68k/cpu_loop.c b/linux-user/m68k/cpu_loop.c index e24d17e180..6598bce3c4 100644 --- a/linux-user/m68k/cpu_loop.c +++ b/linux-user/m68k/cpu_loop.c @@ -50,7 +50,7 @@ void cpu_loop(CPUM68KState *env) force_sig_fault(TARGET_SIGFPE, TARGET_FPE_INTOVF, env->mmu.ar); break; case EXCP_DIV0: - force_sig_fault(TARGET_SIGFPE, TARGET_FPE_INTDIV, env->pc); + force_sig_fault(TARGET_SIGFPE, TARGET_FPE_INTDIV, env->mmu.ar); break; case EXCP_TRAP0: { diff --git a/target/m68k/op_helper.c b/target/m68k/op_helper.c index 750d65576f..729ee0e934 100644 --- a/target/m68k/op_helper.c +++ b/target/m68k/op_helper.c @@ -396,7 +396,6 @@ static void m68k_interrupt_all(CPUM68KState *env, int i= s_hw) break; =20 case EXCP_ILLEGAL: - case EXCP_DIV0: case EXCP_TRAPCC: case EXCP_TRACE: /* FIXME: addr is not only env->pc */ @@ -404,6 +403,7 @@ static void m68k_interrupt_all(CPUM68KState *env, int i= s_hw) break; =20 case EXCP_CHK: + case EXCP_DIV0: do_stack_frame(env, &sp, 2, oldsr, env->mmu.ar, env->pc); break; =20 @@ -574,18 +574,19 @@ raise_exception_format2(CPUM68KState *env, int tt, in= t ilen, uintptr_t raddr) cpu_loop_exit(cs); } =20 -void HELPER(divuw)(CPUM68KState *env, int destr, uint32_t den) +void HELPER(divuw)(CPUM68KState *env, int destr, uint32_t den, int ilen) { uint32_t num =3D env->dregs[destr]; uint32_t quot, rem; =20 + env->cc_c =3D 0; /* always cleared, even if div0 */ + if (den =3D=3D 0) { - raise_exception_ra(env, EXCP_DIV0, GETPC()); + raise_exception_format2(env, EXCP_DIV0, ilen, GETPC()); } quot =3D num / den; rem =3D num % den; =20 - env->cc_c =3D 0; /* always cleared, even if overflow */ if (quot > 0xffff) { env->cc_v =3D -1; /* @@ -601,18 +602,19 @@ void HELPER(divuw)(CPUM68KState *env, int destr, uint= 32_t den) env->cc_v =3D 0; } =20 -void HELPER(divsw)(CPUM68KState *env, int destr, int32_t den) +void HELPER(divsw)(CPUM68KState *env, int destr, int32_t den, int ilen) { int32_t num =3D env->dregs[destr]; uint32_t quot, rem; =20 + env->cc_c =3D 0; /* always cleared, even if overflow/div0 */ + if (den =3D=3D 0) { - raise_exception_ra(env, EXCP_DIV0, GETPC()); + raise_exception_format2(env, EXCP_DIV0, ilen, GETPC()); } quot =3D num / den; rem =3D num % den; =20 - env->cc_c =3D 0; /* always cleared, even if overflow */ if (quot !=3D (int16_t)quot) { env->cc_v =3D -1; /* nothing else is modified */ @@ -629,18 +631,20 @@ void HELPER(divsw)(CPUM68KState *env, int destr, int3= 2_t den) env->cc_v =3D 0; } =20 -void HELPER(divul)(CPUM68KState *env, int numr, int regr, uint32_t den) +void HELPER(divul)(CPUM68KState *env, int numr, int regr, + uint32_t den, int ilen) { uint32_t num =3D env->dregs[numr]; uint32_t quot, rem; =20 + env->cc_c =3D 0; /* always cleared, even if div0 */ + if (den =3D=3D 0) { - raise_exception_ra(env, EXCP_DIV0, GETPC()); + raise_exception_format2(env, EXCP_DIV0, ilen, GETPC()); } quot =3D num / den; rem =3D num % den; =20 - env->cc_c =3D 0; env->cc_z =3D quot; env->cc_n =3D quot; env->cc_v =3D 0; @@ -657,18 +661,20 @@ void HELPER(divul)(CPUM68KState *env, int numr, int r= egr, uint32_t den) } } =20 -void HELPER(divsl)(CPUM68KState *env, int numr, int regr, int32_t den) +void HELPER(divsl)(CPUM68KState *env, int numr, int regr, + int32_t den, int ilen) { int32_t num =3D env->dregs[numr]; int32_t quot, rem; =20 + env->cc_c =3D 0; /* always cleared, even if overflow/div0 */ + if (den =3D=3D 0) { - raise_exception_ra(env, EXCP_DIV0, GETPC()); + raise_exception_format2(env, EXCP_DIV0, ilen, GETPC()); } quot =3D num / den; rem =3D num % den; =20 - env->cc_c =3D 0; env->cc_z =3D quot; env->cc_n =3D quot; env->cc_v =3D 0; @@ -685,19 +691,21 @@ void HELPER(divsl)(CPUM68KState *env, int numr, int r= egr, int32_t den) } } =20 -void HELPER(divull)(CPUM68KState *env, int numr, int regr, uint32_t den) +void HELPER(divull)(CPUM68KState *env, int numr, int regr, + uint32_t den, int ilen) { uint64_t num =3D deposit64(env->dregs[numr], 32, 32, env->dregs[regr]); uint64_t quot; uint32_t rem; =20 + env->cc_c =3D 0; /* always cleared, even if overflow/div0 */ + if (den =3D=3D 0) { - raise_exception_ra(env, EXCP_DIV0, GETPC()); + raise_exception_format2(env, EXCP_DIV0, ilen, GETPC()); } quot =3D num / den; rem =3D num % den; =20 - env->cc_c =3D 0; /* always cleared, even if overflow */ if (quot > 0xffffffffULL) { env->cc_v =3D -1; /* @@ -720,19 +728,21 @@ void HELPER(divull)(CPUM68KState *env, int numr, int = regr, uint32_t den) env->dregs[numr] =3D quot; } =20 -void HELPER(divsll)(CPUM68KState *env, int numr, int regr, int32_t den) +void HELPER(divsll)(CPUM68KState *env, int numr, int regr, + int32_t den, int ilen) { int64_t num =3D deposit64(env->dregs[numr], 32, 32, env->dregs[regr]); int64_t quot; int32_t rem; =20 + env->cc_c =3D 0; /* always cleared, even if overflow/div0 */ + if (den =3D=3D 0) { - raise_exception_ra(env, EXCP_DIV0, GETPC()); + raise_exception_format2(env, EXCP_DIV0, ilen, GETPC()); } quot =3D num / den; rem =3D num % den; =20 - env->cc_c =3D 0; /* always cleared, even if overflow */ if (quot !=3D (int32_t)quot) { env->cc_v =3D -1; /* diff --git a/target/m68k/translate.c b/target/m68k/translate.c index 6d6d026e3c..d775345bfa 100644 --- a/target/m68k/translate.c +++ b/target/m68k/translate.c @@ -1601,6 +1601,7 @@ DISAS_INSN(divw) int sign; TCGv src; TCGv destr; + TCGv ilen; =20 /* divX.w ,Dn 32/16 -> 16r:16q */ =20 @@ -1609,20 +1610,20 @@ DISAS_INSN(divw) /* dest.l / src.w */ =20 SRC_EA(env, src, OS_WORD, sign, NULL); - destr =3D tcg_const_i32(REG(insn, 9)); + destr =3D tcg_constant_i32(REG(insn, 9)); + ilen =3D tcg_constant_i32(s->pc - s->base.pc_next); if (sign) { - gen_helper_divsw(cpu_env, destr, src); + gen_helper_divsw(cpu_env, destr, src, ilen); } else { - gen_helper_divuw(cpu_env, destr, src); + gen_helper_divuw(cpu_env, destr, src, ilen); } - tcg_temp_free(destr); =20 set_cc_op(s, CC_OP_FLAGS); } =20 DISAS_INSN(divl) { - TCGv num, reg, den; + TCGv num, reg, den, ilen; int sign; uint16_t ext; =20 @@ -1639,15 +1640,14 @@ DISAS_INSN(divl) /* divX.l , Dr:Dq 64/32 -> 32r:32q */ =20 SRC_EA(env, den, OS_LONG, 0, NULL); - num =3D tcg_const_i32(REG(ext, 12)); - reg =3D tcg_const_i32(REG(ext, 0)); + num =3D tcg_constant_i32(REG(ext, 12)); + reg =3D tcg_constant_i32(REG(ext, 0)); + ilen =3D tcg_constant_i32(s->pc - s->base.pc_next); if (sign) { - gen_helper_divsll(cpu_env, num, reg, den); + gen_helper_divsll(cpu_env, num, reg, den, ilen); } else { - gen_helper_divull(cpu_env, num, reg, den); + gen_helper_divull(cpu_env, num, reg, den, ilen); } - tcg_temp_free(reg); - tcg_temp_free(num); set_cc_op(s, CC_OP_FLAGS); return; } @@ -1656,15 +1656,14 @@ DISAS_INSN(divl) /* divXl.l , Dr:Dq 32/32 -> 32r:32q */ =20 SRC_EA(env, den, OS_LONG, 0, NULL); - num =3D tcg_const_i32(REG(ext, 12)); - reg =3D tcg_const_i32(REG(ext, 0)); + num =3D tcg_constant_i32(REG(ext, 12)); + reg =3D tcg_constant_i32(REG(ext, 0)); + ilen =3D tcg_constant_i32(s->pc - s->base.pc_next); if (sign) { - gen_helper_divsl(cpu_env, num, reg, den); + gen_helper_divsl(cpu_env, num, reg, den, ilen); } else { - gen_helper_divul(cpu_env, num, reg, den); + gen_helper_divul(cpu_env, num, reg, den, ilen); } - tcg_temp_free(reg); - tcg_temp_free(num); =20 set_cc_op(s, CC_OP_FLAGS); } --=20 2.34.1 From nobody Fri May 10 06:16:12 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1654134375; cv=none; d=zohomail.com; s=zohoarc; b=RKmOXFfYlwqq6HnOOhVqPcyATucJkarRnC99zDdNkFoMqW6trx5jAaRdnkMNBSx58lPzg+6i48a7ciw/jRaHRUvHJvx2bqVp6WebUi5KZ/8wyQ3b/9+cexikDstgE45JWuPNWYj3SU2IrUM9ZMYWpEMbUzIdIEXPp0viZBmeb48= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654134375; 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=ni15K8P7PnzwsRRTsJwiOks83s+NNkxpUTsfrcqynEQ=; b=eePL2F1zyHOLzYNlp1FswNs3BrMmQ0eNo5GvS46Rjl+eE1PVOwL1jxMy11ZclbqME6Stb6SVJJLgGDX5sZ/Awwg1BG/CiLHETQGd5ltmKsoGd7uRNB0o/f4B33+zU9cYInXoU6qgA9AF7J/yFNTybuNxoHC1B0QWy3AzKEd/hPQ= 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+importer=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 16541343759911015.4143829461423; Wed, 1 Jun 2022 18:46:15 -0700 (PDT) Received: from localhost ([::1]:41134 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nwZug-0008EK-Sb for importer@patchew.org; Wed, 01 Jun 2022 21:46:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43562) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwZj6-0002UQ-Pm for qemu-devel@nongnu.org; Wed, 01 Jun 2022 21:34:17 -0400 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]:40535) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nwZj4-0005Fh-NK for qemu-devel@nongnu.org; Wed, 01 Jun 2022 21:34:16 -0400 Received: by mail-pl1-x62f.google.com with SMTP id i1so3277006plg.7 for ; Wed, 01 Jun 2022 18:34:14 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:1eca:8ee3:9269:e00c]) by smtp.gmail.com with ESMTPSA id l191-20020a6391c8000000b003fc5b1db26fsm1962875pge.52.2022.06.01.18.34.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 18:34:12 -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=ni15K8P7PnzwsRRTsJwiOks83s+NNkxpUTsfrcqynEQ=; b=K+PpDcgXa4dWnYGJRfkVEMQyEofiEI6LkjjbDsD4RvJbZ8OqUcM3+mLPXHGwKceAmr sfAyb1OpetiUe1OPhIYemk/n/FI/NfL+18jv6Npt011tRSZiDO2mJrJ2JwFKsug3XDlO myJZlTZs76l/Avkxjug0oRwHt/dgo2bHi0U8qMjk4mslLrZjxsax273kNFMEn0AZcSsR xDrDBVIAHIW/DM94zerwZUSmrS/f8ptjY0wcAOhZsI57Fcobt+mz1ZvqTg/eAkAVz99y KBCj8k9Qo90Tbq1vJ0Jhyyaqznxp1pRMtzHfMoWO9RmCTwts7ei4h6krpuSpZ1QgBkXY qhOw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=ni15K8P7PnzwsRRTsJwiOks83s+NNkxpUTsfrcqynEQ=; b=CHTYvCEsxsCJ73hNxf+25Bqtw9RQTf+5NFQHlUfcSpxokfE9SHzAHBhSJFE56bmNLb pZltBNvtN8Nf7T0/2CunimaJuYvVFxUj9GSkFXnmpO5gvvqDyU5MvS1a+yL0Gb1Z8ZFl gQKGK9T6Pav8tI2GZY3YJ5pGeYlcN8HE+FvkXon1EpkpoIFweJfKXPu1PUWeYOHSwyjt ysxQAWfnDTuj9ipRH9VHOW7w53o8lMNFcRafH4bvm5wnAV8AS9+Es4KHM/bqwksA2vws ysGBbExk3BjO2o5n0tGMmrWc8nAMA7z/+sPHk5JwYmXkaMKFPDNW2ALWaPicPFesPygs MuJw== X-Gm-Message-State: AOAM533tZCMxvbFTCzAUkiYAPXPB5mr7Jlx9e+m5rtg2um419H73rshQ ghrVSJMJywlRWm4+IyeV2IDCdmlbqV1z1g== X-Google-Smtp-Source: ABdhPJyL6NSga0i09VMyxeHYO52gXVPWTSnLpcYejTLJvaMjgctAnPUrT8uzhHYuj4UGMbS0Gvdoig== X-Received: by 2002:a17:902:ec83:b0:161:ab37:7ad3 with SMTP id x3-20020a170902ec8300b00161ab377ad3mr2296347plg.114.1654133653372; Wed, 01 Jun 2022 18:34:13 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu Subject: [PATCH v6 08/17] target/m68k: Fix address argument for EXCP_TRACE Date: Wed, 1 Jun 2022 18:33:52 -0700 Message-Id: <20220602013401.303699-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220602013401.303699-1-richard.henderson@linaro.org> References: <20220602013401.303699-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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::62f; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62f.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1654134377222100001 Content-Type: text/plain; charset="utf-8" According to the M68040 Users Manual, section 8.4.3, Six word stack frame (format 2), Trace (and others) is supposed to record the next insn in PC and the address of the trapping instruction in ADDRESS. Create gen_raise_exception_format2 to record the trapping pc in env->mmu.ar. Update m68k_interrupt_all to pass the value to do_stack_frame. Update cpu_loop to handle EXCP_TRACE. Reviewed-by: Laurent Vivier Signed-off-by: Richard Henderson --- linux-user/m68k/cpu_loop.c | 3 +++ target/m68k/op_helper.c | 2 +- target/m68k/translate.c | 49 +++++++++++++++++++++++++------------- 3 files changed, 36 insertions(+), 18 deletions(-) diff --git a/linux-user/m68k/cpu_loop.c b/linux-user/m68k/cpu_loop.c index 6598bce3c4..fcf9220552 100644 --- a/linux-user/m68k/cpu_loop.c +++ b/linux-user/m68k/cpu_loop.c @@ -52,6 +52,9 @@ void cpu_loop(CPUM68KState *env) case EXCP_DIV0: force_sig_fault(TARGET_SIGFPE, TARGET_FPE_INTDIV, env->mmu.ar); break; + case EXCP_TRACE: + force_sig_fault(TARGET_SIGTRAP, TARGET_TRAP_TRACE, env->mmu.ar= ); + break; case EXCP_TRAP0: { abi_long ret; diff --git a/target/m68k/op_helper.c b/target/m68k/op_helper.c index 729ee0e934..3cb71c9140 100644 --- a/target/m68k/op_helper.c +++ b/target/m68k/op_helper.c @@ -397,13 +397,13 @@ static void m68k_interrupt_all(CPUM68KState *env, int= is_hw) =20 case EXCP_ILLEGAL: case EXCP_TRAPCC: - case EXCP_TRACE: /* FIXME: addr is not only env->pc */ do_stack_frame(env, &sp, 2, oldsr, env->pc, env->pc); break; =20 case EXCP_CHK: case EXCP_DIV0: + case EXCP_TRACE: do_stack_frame(env, &sp, 2, oldsr, env->mmu.ar, env->pc); break; =20 diff --git a/target/m68k/translate.c b/target/m68k/translate.c index d775345bfa..399d9232e4 100644 --- a/target/m68k/translate.c +++ b/target/m68k/translate.c @@ -114,6 +114,7 @@ typedef struct DisasContext { DisasContextBase base; CPUM68KState *env; target_ulong pc; + target_ulong pc_prev; CCOp cc_op; /* Current CC operation */ int cc_op_synced; TCGv_i64 mactmp; @@ -298,6 +299,21 @@ static void gen_raise_exception(int nr) tcg_temp_free_i32(tmp); } =20 +static void gen_raise_exception_format2(DisasContext *s, int nr, + target_ulong this_pc) +{ + /* + * Pass the address of the insn to the exception handler, + * for recording in the Format $2 (6-word) stack frame. + * Re-use mmu.ar for the purpose, since that's only valid + * after tlb_fill. + */ + tcg_gen_st_i32(tcg_constant_i32(this_pc), cpu_env, + offsetof(CPUM68KState, mmu.ar)); + gen_raise_exception(nr); + s->base.is_jmp =3D DISAS_NORETURN; +} + static void gen_exception(DisasContext *s, uint32_t dest, int nr) { update_cc_op(s); @@ -1494,12 +1510,13 @@ static void gen_exit_tb(DisasContext *s) } while (0) =20 /* Generate a jump to an immediate address. */ -static void gen_jmp_tb(DisasContext *s, int n, uint32_t dest) +static void gen_jmp_tb(DisasContext *s, int n, target_ulong dest, + target_ulong src) { if (unlikely(s->ss_active)) { update_cc_op(s); tcg_gen_movi_i32(QREG_PC, dest); - gen_raise_exception(EXCP_TRACE); + gen_raise_exception_format2(s, EXCP_TRACE, src); } else if (translator_use_goto_tb(&s->base, dest)) { tcg_gen_goto_tb(n); tcg_gen_movi_i32(QREG_PC, dest); @@ -1548,9 +1565,9 @@ DISAS_INSN(dbcc) tcg_gen_addi_i32(tmp, tmp, -1); gen_partset_reg(OS_WORD, reg, tmp); tcg_gen_brcondi_i32(TCG_COND_EQ, tmp, -1, l1); - gen_jmp_tb(s, 1, base + offset); + gen_jmp_tb(s, 1, base + offset, s->base.pc_next); gen_set_label(l1); - gen_jmp_tb(s, 0, s->pc); + gen_jmp_tb(s, 0, s->pc, s->base.pc_next); } =20 DISAS_INSN(undef_mac) @@ -3096,13 +3113,13 @@ DISAS_INSN(branch) /* Bcc */ TCGLabel *l1 =3D gen_new_label(); gen_jmpcc(s, ((insn >> 8) & 0xf) ^ 1, l1); - gen_jmp_tb(s, 1, base + offset); + gen_jmp_tb(s, 1, base + offset, s->base.pc_next); gen_set_label(l1); - gen_jmp_tb(s, 0, s->pc); + gen_jmp_tb(s, 0, s->pc, s->base.pc_next); } else { /* Unconditional branch. */ update_cc_op(s); - gen_jmp_tb(s, 0, base + offset); + gen_jmp_tb(s, 0, base + offset, s->base.pc_next); } } =20 @@ -5485,9 +5502,9 @@ DISAS_INSN(fbcc) l1 =3D gen_new_label(); update_cc_op(s); gen_fjmpcc(s, insn & 0x3f, l1); - gen_jmp_tb(s, 0, s->pc); + gen_jmp_tb(s, 0, s->pc, s->base.pc_next); gen_set_label(l1); - gen_jmp_tb(s, 1, base + offset); + gen_jmp_tb(s, 1, base + offset, s->base.pc_next); } =20 DISAS_INSN(fscc) @@ -6158,6 +6175,8 @@ static void m68k_tr_init_disas_context(DisasContextBa= se *dcbase, CPUState *cpu) =20 dc->env =3D env; dc->pc =3D dc->base.pc_first; + /* This value will always be filled in properly before m68k_tr_tb_stop= . */ + dc->pc_prev =3D 0xdeadbeef; dc->cc_op =3D CC_OP_DYNAMIC; dc->cc_op_synced =3D 1; dc->done_mac =3D 0; @@ -6191,6 +6210,7 @@ static void m68k_tr_translate_insn(DisasContextBase *= dcbase, CPUState *cpu) do_writebacks(dc); do_release(dc); =20 + dc->pc_prev =3D dc->base.pc_next; dc->base.pc_next =3D dc->pc; =20 if (dc->base.is_jmp =3D=3D DISAS_NEXT) { @@ -6225,17 +6245,12 @@ static void m68k_tr_tb_stop(DisasContextBase *dcbas= e, CPUState *cpu) break; case DISAS_TOO_MANY: update_cc_op(dc); - if (dc->ss_active) { - tcg_gen_movi_i32(QREG_PC, dc->pc); - gen_raise_exception(EXCP_TRACE); - } else { - gen_jmp_tb(dc, 0, dc->pc); - } + gen_jmp_tb(dc, 0, dc->pc, dc->pc_prev); break; case DISAS_JUMP: /* We updated CC_OP and PC in gen_jmp/gen_jmp_im. */ if (dc->ss_active) { - gen_raise_exception(EXCP_TRACE); + gen_raise_exception_format2(dc, EXCP_TRACE, dc->pc_prev); } else { tcg_gen_lookup_and_goto_ptr(); } @@ -6246,7 +6261,7 @@ static void m68k_tr_tb_stop(DisasContextBase *dcbase,= CPUState *cpu) * other state that may require returning to the main loop. */ if (dc->ss_active) { - gen_raise_exception(EXCP_TRACE); + gen_raise_exception_format2(dc, EXCP_TRACE, dc->pc_prev); } else { tcg_gen_exit_tb(NULL, 0); } --=20 2.34.1 From nobody Fri May 10 06:16:12 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1654134473; cv=none; d=zohomail.com; s=zohoarc; b=dAY81Otc80EOK0q9j/u5Yfq/igVl5ML18Irxw4UEpY38TZyEy2BsiT/nj85DB2SksiiGT4vB2a+aiOyw2y1l1h/2G3Zqir5FgM+dKtVii8uJnxvs5fthI6WakDg4JMc+B15VivPg23sC2M6XssMWxarTMr22CxEsfpiiYInUCRs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654134473; 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=CpiwNuN9uaF8J7CUE8swrx6xThfojHeB858pnr3+AiA=; b=O+uFkGWJHF4OoYKIyb1S0kWOYgscYSLCTEW8NmTbfSR8WXab5e6nmeKtSEAvTuSMA6o0veluSb48E15fYVeuHaFV26Iims0tR1U7SSqIg7b9/0zwUfFGUwHCXscn8tPWdC5KshDHBmrAopSQq/bii2YQDq9Q0Q4gbwZIutUICJg= 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+importer=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 1654134473619675.5778381603951; Wed, 1 Jun 2022 18:47:53 -0700 (PDT) Received: from localhost ([::1]:43326 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nwZwG-0001Te-1q for importer@patchew.org; Wed, 01 Jun 2022 21:47:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43582) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwZj7-0002Wt-NU for qemu-devel@nongnu.org; Wed, 01 Jun 2022 21:34:17 -0400 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]:43967) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nwZj6-0005G5-4X for qemu-devel@nongnu.org; Wed, 01 Jun 2022 21:34:17 -0400 Received: by mail-pf1-x434.google.com with SMTP id y189so3447526pfy.10 for ; Wed, 01 Jun 2022 18:34:15 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:1eca:8ee3:9269:e00c]) by smtp.gmail.com with ESMTPSA id l191-20020a6391c8000000b003fc5b1db26fsm1962875pge.52.2022.06.01.18.34.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 18:34:14 -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=CpiwNuN9uaF8J7CUE8swrx6xThfojHeB858pnr3+AiA=; b=sHsVAgCRwajM3ZFKTsSm/NiFM3eWVtD0Wq/y0eWUP2TDHz8likNPKekX7321z1muMM b6VtFxfcbJGxKHBOF2Bc3m1PuWpBTqUCqXrfyGRZmPEbr1qBebbCvST3OxM9fddgJum7 jOKGcRhSAh4UXtWVp6WYUsFphy9XzBmqHPWo2CN7wELZFe1Z5z+B4iWWi9N0t+LsHXnv 6pgMR43HMNy88fnVwQP+xHXr2WFJgwqLfPlpyvu5akMxDO9uvOpPvfunqkrbMO1K9c75 LW2OCAu4lonUbCQYEaFtzO2YDmIYVYnSIZDLP60e+uO8ikwT2LxwtSAsukeNO90RqdEl Fgkw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=CpiwNuN9uaF8J7CUE8swrx6xThfojHeB858pnr3+AiA=; b=hFjGvtz1gRXkMqIhcue/GN3/RAOmp6DVzIjCNSWVretS0icrPNULdYa3WTR7FgqaJr YGy2gbRHhMWRkI3Pob/01Gwgjiv2P19QedlJuHII2hylVJLw0V6//OAVQq5gECrmNh7D 2e+UoSOWEScQ7qjZpR4XZ2IoFKaFsQl2AsNHt2rN53fNyBgcIANPzYJX9xL49PSVcS5p wrTdupXiOicPW9A+MUcZolH6SbuMIel6b6Gl8M2LHp9Nh48+s9V/1AGKnk8pFlM+6NYQ 1ndBBLR3ff5ovSZnGY7cukLhf0LlvJKXeyNz+FaLljsG/s4Tg4OJh+uCYt2+tX4JlR0U Ueiw== X-Gm-Message-State: AOAM532PmPRFIffnD8QOMEldzFx9D5DiwrzmuqnAxjfyTYt22/pdSpjA IJ1DcvnLEvjlntJU48GJGdRvnBVXpQL3DA== X-Google-Smtp-Source: ABdhPJyqs9gLt/SVrqSHDYvaig3/RQrN6h9DSDbR58TWoG7db/LTwaYPNu/53oqi0fydG5GnW5fHTw== X-Received: by 2002:a65:63d9:0:b0:374:6b38:c6b3 with SMTP id n25-20020a6563d9000000b003746b38c6b3mr1951822pgv.195.1654133654775; Wed, 01 Jun 2022 18:34:14 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu Subject: [PATCH v6 09/17] target/m68k: Fix stack frame for EXCP_ILLEGAL Date: Wed, 1 Jun 2022 18:33:53 -0700 Message-Id: <20220602013401.303699-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220602013401.303699-1-richard.henderson@linaro.org> References: <20220602013401.303699-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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::434; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x434.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1654134475963100001 Content-Type: text/plain; charset="utf-8" According to the M68040 Users Manual, section 8.4.1, Four word stack frame (format 0), includes Illegal Instruction. Use the correct frame format, which does not use the ADDR argument. Reviewed-by: Laurent Vivier Signed-off-by: Richard Henderson --- target/m68k/op_helper.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/target/m68k/op_helper.c b/target/m68k/op_helper.c index 3cb71c9140..aa62158eb9 100644 --- a/target/m68k/op_helper.c +++ b/target/m68k/op_helper.c @@ -391,11 +391,14 @@ static void m68k_interrupt_all(CPUM68KState *env, int= is_hw) } break; =20 + case EXCP_ILLEGAL: + do_stack_frame(env, &sp, 0, oldsr, 0, env->pc); + break; + case EXCP_ADDRESS: do_stack_frame(env, &sp, 2, oldsr, 0, env->pc); break; =20 - case EXCP_ILLEGAL: case EXCP_TRAPCC: /* FIXME: addr is not only env->pc */ do_stack_frame(env, &sp, 2, oldsr, env->pc, env->pc); --=20 2.34.1 From nobody Fri May 10 06:16:12 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1654134641; cv=none; d=zohomail.com; s=zohoarc; b=M0qTmeE4LQ8Xt1KGwwhs0vO3dg+culuUMiMZ/75lyWSwLEYGflxTdyQPdhJ7fxlNMlkpIjm4q/Vlm6FQBKQpzSRoGtCHLa1k/bTBayZD+k+ZBuGIT85Zwwoov9GRJdo67iNPmGCB0BK52LZvpcI8JgpMZq27T2DdDs/aB6x9Jfg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654134641; 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=Ga6M5TFkkaYF0mj3zd4e3fWL1GckLYt0gBCWZ8vZfkU=; b=QkDs0r/TXBK7d03NpQSvK4S3ojJb9rwd59tk7oMlfu/MmG957oE+Mm5SwxJoqAvZnHFL3VKGK1G+85C5CFl6yUQ0EB0yheFFxj8HT3la/13TWvPApgwnxBKX1KrZm9/Im5la3mtUaUX+yEK9778TymKZgNakNNkFatAu5sql+l4= 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+importer=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 1654134641065480.9543261397132; Wed, 1 Jun 2022 18:50:41 -0700 (PDT) Received: from localhost ([::1]:47406 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nwZyx-0004TQ-Tt for importer@patchew.org; Wed, 01 Jun 2022 21:50:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43612) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwZj9-0002bA-IL for qemu-devel@nongnu.org; Wed, 01 Jun 2022 21:34:19 -0400 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]:44615) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nwZj7-0005GO-I4 for qemu-devel@nongnu.org; Wed, 01 Jun 2022 21:34:19 -0400 Received: by mail-pj1-x1029.google.com with SMTP id gc3-20020a17090b310300b001e33092c737so3577359pjb.3 for ; Wed, 01 Jun 2022 18:34:17 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:1eca:8ee3:9269:e00c]) by smtp.gmail.com with ESMTPSA id l191-20020a6391c8000000b003fc5b1db26fsm1962875pge.52.2022.06.01.18.34.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 18:34:15 -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=Ga6M5TFkkaYF0mj3zd4e3fWL1GckLYt0gBCWZ8vZfkU=; b=zYAViKlrko/kTMxjpr9FhJ53h1vFswuBA5nuDoaJD3/Q3rGz4JmjvsVRNVfLtY6ToK q3JEGoWH2OsVGo3PJsnIZRS3SeTOrGhmDuRwezEKSa8O0gMk67W8KLODGEvuu8HLicPH VY8/hrN4i8DUPLG5RPIhg82JiKpelKyU20n7OENKk8WUmWBJQXC64Te1FrMlzRza4i7B tuQSfaXTuSKnAhJ4e3rKSKKB1yRoK2oBY5buK5kSIKmK8vWFzBQA6R9gAZFG8a6OZiO9 4HL29t+FQwMw1m1REZG/TLzHEzEivJRo5Anjw2sLUcl3MI7N598ezFxNrgti3m49RpMa 7LTQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ga6M5TFkkaYF0mj3zd4e3fWL1GckLYt0gBCWZ8vZfkU=; b=sITlOrAH0b1+zue7NQxoiDu9XzArCytR2YnxO0mEuCePGhHgyghSbZNz5y2IM/dZC0 d1mwmYJZEhjDpZxiHCxklEmlBh2UW2KLT2lFlg3Sg6ZQbBOqNwylDQIwjueH4z6slSDw +IwEOssgeF+41bTjdHl3+5xlnnCyewHxWB1T1wQDvZ8GUvTtkHdtbSXxSAwrAhjl5SpQ c1ORBmqpwcHjH70pnZqQN3JL3+2AgeVTKYnnx9LRFK//FEmEg91DwsKFFvVw7zGz6upp W7nBOvkeX2ZoeUgUXW08A9XmDKnaX3xCHFI9KPyh8k+vXMaV+O/eCTA4k/+TTqem7KIK aiLA== X-Gm-Message-State: AOAM530bFL9IEflpJWsXKp6ACF4dQgni72hXHprJ5SvZz3yzlmKiHCML 1xcpjKrzmg3ONBBWkbu4Q/FhaKbqkmGyCA== X-Google-Smtp-Source: ABdhPJyPj4UwmRQoMqS/FCzNXVeLhTwexkGCPSTCUyu5epsul+O5VZInFDwFY2b2VvmWbD3ABS3uQg== X-Received: by 2002:a17:90b:4b82:b0:1e6:7835:2f05 with SMTP id lr2-20020a17090b4b8200b001e678352f05mr2363161pjb.121.1654133656233; Wed, 01 Jun 2022 18:34:16 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu Subject: [PATCH v6 10/17] target/m68k: Implement TRAPcc Date: Wed, 1 Jun 2022 18:33:54 -0700 Message-Id: <20220602013401.303699-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220602013401.303699-1-richard.henderson@linaro.org> References: <20220602013401.303699-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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1029; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1029.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1654134642703100001 Content-Type: text/plain; charset="utf-8" Resolves: https://gitlab.com/qemu-project/qemu/-/issues/754 Reviewed-by: Laurent Vivier Signed-off-by: Richard Henderson --- v6: Use more exact masks for trapcc, to fix overlap with scc. --- target/m68k/cpu.h | 2 ++ linux-user/m68k/cpu_loop.c | 1 + target/m68k/cpu.c | 1 + target/m68k/op_helper.c | 6 +---- target/m68k/translate.c | 49 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 54 insertions(+), 5 deletions(-) diff --git a/target/m68k/cpu.h b/target/m68k/cpu.h index 558c3c67d6..4d8f48e8c7 100644 --- a/target/m68k/cpu.h +++ b/target/m68k/cpu.h @@ -534,6 +534,8 @@ enum m68k_features { M68K_FEATURE_MOVEC, /* Unaligned data accesses (680[2346]0) */ M68K_FEATURE_UNALIGNED_DATA, + /* TRAPcc insn. (680[2346]0, and CPU32) */ + M68K_FEATURE_TRAPCC, }; =20 static inline int m68k_feature(CPUM68KState *env, int feature) diff --git a/linux-user/m68k/cpu_loop.c b/linux-user/m68k/cpu_loop.c index fcf9220552..3d3033155f 100644 --- a/linux-user/m68k/cpu_loop.c +++ b/linux-user/m68k/cpu_loop.c @@ -47,6 +47,7 @@ void cpu_loop(CPUM68KState *env) force_sig_fault(TARGET_SIGILL, TARGET_ILL_ILLOPN, env->pc); break; case EXCP_CHK: + case EXCP_TRAPCC: force_sig_fault(TARGET_SIGFPE, TARGET_FPE_INTOVF, env->mmu.ar); break; case EXCP_DIV0: diff --git a/target/m68k/cpu.c b/target/m68k/cpu.c index c7aeb7da9c..5f778773d1 100644 --- a/target/m68k/cpu.c +++ b/target/m68k/cpu.c @@ -162,6 +162,7 @@ static void m68020_cpu_initfn(Object *obj) m68k_set_feature(env, M68K_FEATURE_CHK2); m68k_set_feature(env, M68K_FEATURE_MSP); m68k_set_feature(env, M68K_FEATURE_UNALIGNED_DATA); + m68k_set_feature(env, M68K_FEATURE_TRAPCC); } =20 /* diff --git a/target/m68k/op_helper.c b/target/m68k/op_helper.c index aa62158eb9..61948d92bb 100644 --- a/target/m68k/op_helper.c +++ b/target/m68k/op_helper.c @@ -399,14 +399,10 @@ static void m68k_interrupt_all(CPUM68KState *env, int= is_hw) do_stack_frame(env, &sp, 2, oldsr, 0, env->pc); break; =20 - case EXCP_TRAPCC: - /* FIXME: addr is not only env->pc */ - do_stack_frame(env, &sp, 2, oldsr, env->pc, env->pc); - break; - case EXCP_CHK: case EXCP_DIV0: case EXCP_TRACE: + case EXCP_TRAPCC: do_stack_frame(env, &sp, 2, oldsr, env->mmu.ar, env->pc); break; =20 diff --git a/target/m68k/translate.c b/target/m68k/translate.c index 399d9232e4..61b624b3a1 100644 --- a/target/m68k/translate.c +++ b/target/m68k/translate.c @@ -4879,6 +4879,53 @@ DISAS_INSN(trap) gen_exception(s, s->pc, EXCP_TRAP0 + (insn & 0xf)); } =20 +static void do_trapcc(DisasContext *s, DisasCompare *c) +{ + if (c->tcond !=3D TCG_COND_NEVER) { + TCGLabel *over =3D NULL; + + update_cc_op(s); + + if (c->tcond !=3D TCG_COND_ALWAYS) { + /* Jump over if !c. */ + over =3D gen_new_label(); + tcg_gen_brcond_i32(tcg_invert_cond(c->tcond), c->v1, c->v2, ov= er); + } + + tcg_gen_movi_i32(QREG_PC, s->pc); + gen_raise_exception_format2(s, EXCP_TRAPCC, s->base.pc_next); + + if (over !=3D NULL) { + gen_set_label(over); + s->base.is_jmp =3D DISAS_NEXT; + } + } + free_cond(c); +} + +DISAS_INSN(trapcc) +{ + DisasCompare c; + + /* Consume and discard the immediate operand. */ + switch (extract32(insn, 0, 3)) { + case 2: /* trapcc.w */ + (void)read_im16(env, s); + break; + case 3: /* trapcc.l */ + (void)read_im32(env, s); + break; + case 4: /* trapcc (no operand) */ + break; + default: + /* trapcc registered with only valid opmodes */ + g_assert_not_reached(); + } + + gen_cc_cond(&c, s, extract32(insn, 8, 4)); + do_trapcc(s, &c); +} + static void gen_load_fcr(DisasContext *s, TCGv res, int reg) { switch (reg) { @@ -6050,6 +6097,8 @@ void register_m68k_insns (CPUM68KState *env) INSN(scc, 50c0, f0f8, CF_ISA_A); /* Scc.B Dx */ INSN(scc, 50c0, f0c0, M68000); /* Scc.B */ INSN(dbcc, 50c8, f0f8, M68000); + INSN(trapcc, 50fa, f0fe, TRAPCC); /* opmode 010, 011 */ + INSN(trapcc, 50fc, f0ff, TRAPCC); /* opmode 100 */ INSN(tpf, 51f8, fff8, CF_ISA_A); =20 /* Branch instructions. */ --=20 2.34.1 From nobody Fri May 10 06:16:12 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1654134726; cv=none; d=zohomail.com; s=zohoarc; b=EOHlvAilosozTXM/HtPZTQK6Pd3wKhxcSNEeZL0573S66FkHBWWp4lDanP0b1OCQQGDPrP9etrM9J7tD0oH7aaYu3DGeBGCHRJdDQCS0hVnR9Y9BOAHjozt94AJlp1qCRL75+xEspqHP/HECNOPgM/hnzzxnT8uvJimph8fdRLc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654134726; h=Content-Type: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=Qtzekvw6N/DL8al1dZWPmdZqmx+jbmtvWakWbkZg+40=; b=LpoDwmLwM+s9OfPuviLJMfbx7qxUnPUAH6asHyw1CcYwd2illTxwU7Dp8VuL+i1HdhezxVpjVo5zd1YZkENZxF0fP48MvkOclM1lG9CKOxygFFqDHpcKTrPdf0KdHiMVGRAGOaiFE642TYkm/7sL3mfW+b3DGh9BwoDBppRyMrA= 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+importer=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 1654134726035659.4200941809902; Wed, 1 Jun 2022 18:52:06 -0700 (PDT) Received: from localhost ([::1]:49566 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nwa0H-0006D8-HO for importer@patchew.org; Wed, 01 Jun 2022 21:52:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43624) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwZjJ-0002eX-1t for qemu-devel@nongnu.org; Wed, 01 Jun 2022 21:34:29 -0400 Received: from mail-pg1-x529.google.com ([2607:f8b0:4864:20::529]:33552) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nwZj8-0005HW-PW for qemu-devel@nongnu.org; Wed, 01 Jun 2022 21:34:20 -0400 Received: by mail-pg1-x529.google.com with SMTP id r71so3490896pgr.0 for ; Wed, 01 Jun 2022 18:34:18 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:1eca:8ee3:9269:e00c]) by smtp.gmail.com with ESMTPSA id l191-20020a6391c8000000b003fc5b1db26fsm1962875pge.52.2022.06.01.18.34.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 18:34:16 -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=Qtzekvw6N/DL8al1dZWPmdZqmx+jbmtvWakWbkZg+40=; b=TJuyvYC8lWa82QlATLgcUikJlHMvqfvKnjsdGAfeKO7qDUz8QeO52cmwXE4TzpP97W uu007n4NrTJ2ChT/SQzS68OpDTDY0hokA8bn1T0sO/7cCnwKz5OrD8gGlfUDMFbLq2Sv 8A/XAH55C3biXd2rpNxOIlIQqxRBveZks7QKJkM2b0h5OhiEskyKu4ruKqHm8n45uCzQ vTZacfiiorkfeAlpxodEiJqBWOLmKWvi+sDZn1K+JQ72gYD9IY9H0lKpnC56TghuZVCo WyOxxUvwAfCl2j3u+S4nbaRXk1Su8a1CGkhqRTyKNxqkGUZHZHl5gWuuqFb/Snn8hoxR 8hWQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=Qtzekvw6N/DL8al1dZWPmdZqmx+jbmtvWakWbkZg+40=; b=SLYkr/XdhSn65elqzWYZbZ/UlzQIDUH4uR32qmLIWUv4OOCBq7cEVvjMaA4Ly5XRHL cgg41AMtk4sdskb7DPX4viGNasZDM9NVRpj0i48yEmBj5JZ5rtv5hsKl9YO8PJ9nXRAd npp8Lsu3Rxq/gNMYusv4qv7x40t/0ZmjAQ6HI23TA5AoShp1pG/3/Bd9HvUYZ2SLoajE aVRVcofrDELiVy8BKe7YV55gsCC2q9k70mU/VbQ5S1SfRaiuTFI2aYFb9F/ZHhteqKlf Qwsl3H+wqFmRWpVY+xbTd0fzlWWfFqR+FG0TERN/t2pRmB3gcFfVZ6tSODeorLGxexbR i6nw== X-Gm-Message-State: AOAM532fdsrJvBs6VbTeMVIqfQ5HZUyX7EvNKdL8jDn6lOTy4IdCHdr4 Qsl5ZCGVeSu8uLYEpgRtYVdjV43Jfz27lQ== X-Google-Smtp-Source: ABdhPJx3JlfzujYU6Dm/qAHl/GyMP89VfJLrxlk5OtRLPA1bduYa/OkBBPqYhq1bWnxeu5nkDgp9Lw== X-Received: by 2002:a63:2209:0:b0:3ab:113b:9a2b with SMTP id i9-20020a632209000000b003ab113b9a2bmr2000144pgi.235.1654133657465; Wed, 01 Jun 2022 18:34:17 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v6 11/17] target/m68k: Implement TPF in terms of TRAPcc Date: Wed, 1 Jun 2022 18:33:55 -0700 Message-Id: <20220602013401.303699-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220602013401.303699-1-richard.henderson@linaro.org> References: <20220602013401.303699-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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::529; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x529.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1654134727194100001 TPF stands for "trap false", and is a long-form nop for ColdFire. Re-use the immediate consumption code from trapcc; the insn will already expand to a nop because of the TCG_COND_NEVER test within do_trapcc. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Laurent Vivier Signed-off-by: Richard Henderson --- target/m68k/translate.c | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/target/m68k/translate.c b/target/m68k/translate.c index 61b624b3a1..83c2f73063 100644 --- a/target/m68k/translate.c +++ b/target/m68k/translate.c @@ -3075,22 +3075,6 @@ DISAS_INSN(addsubq) tcg_temp_free(dest); } =20 -DISAS_INSN(tpf) -{ - switch (insn & 7) { - case 2: /* One extension word. */ - s->pc +=3D 2; - break; - case 3: /* Two extension words. */ - s->pc +=3D 4; - break; - case 4: /* No extension words. */ - break; - default: - disas_undef(env, s, insn); - } -} - DISAS_INSN(branch) { int32_t offset; @@ -6099,7 +6083,8 @@ void register_m68k_insns (CPUM68KState *env) INSN(dbcc, 50c8, f0f8, M68000); INSN(trapcc, 50fa, f0fe, TRAPCC); /* opmode 010, 011 */ INSN(trapcc, 50fc, f0ff, TRAPCC); /* opmode 100 */ - INSN(tpf, 51f8, fff8, CF_ISA_A); + INSN(trapcc, 51fa, fffe, CF_ISA_A); /* TPF (trapf) opmode 010, 011 = */ + INSN(trapcc, 51fc, ffff, CF_ISA_A); /* TPF (trapf) opmode 100 */ =20 /* Branch instructions. */ BASE(branch, 6000, f000); --=20 2.34.1 From nobody Fri May 10 06:16:12 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1654134882; cv=none; d=zohomail.com; s=zohoarc; b=h9s9dp3Pojme682UcA2ry1AftlBhoKsKzXgVK2qpvO69u3wqjg1cXzpJu8YV0D4jm9jcFxdmBwXjRFBkrZiEmLOgzF0l/r4Tfe1/HOJhXHBB/L4SuWAzAI+T87tJQSMdp9wnb4QkPJoVPpnbYwK24oEhq/vs4WtMoKKtC6u8MO0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654134882; 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=L/s5DB9oA5m3J3r5mnRcmLEGwctJwKQaqGAa+nl3EZs=; b=N6ZW+ruhEZMbNEVn7ZTaoJ8kN5OeVJMItSGBICbdApzMRU/EOVHIZF1xv5m3O1JhQdwB14AO1D8nLyzZhfoMWFPriedivSBDYnHCu77WBZY5X3Z3fHZdagqXdGWFOUHbwkQDm6ssQSRdcbHKVYLYSMUIfzRPW60/nzLi2Db713M= 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+importer=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 1654134882716962.6215406631258; Wed, 1 Jun 2022 18:54:42 -0700 (PDT) Received: from localhost ([::1]:53354 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nwa2r-0000k7-6x for importer@patchew.org; Wed, 01 Jun 2022 21:54:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43690) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwZjL-0002hL-Av for qemu-devel@nongnu.org; Wed, 01 Jun 2022 21:34:31 -0400 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]:35486) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nwZjI-0005Ht-Q7 for qemu-devel@nongnu.org; Wed, 01 Jun 2022 21:34:31 -0400 Received: by mail-pj1-x1034.google.com with SMTP id o6-20020a17090a0a0600b001e2c6566046so7988838pjo.0 for ; Wed, 01 Jun 2022 18:34:19 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:1eca:8ee3:9269:e00c]) by smtp.gmail.com with ESMTPSA id l191-20020a6391c8000000b003fc5b1db26fsm1962875pge.52.2022.06.01.18.34.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 18:34: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=L/s5DB9oA5m3J3r5mnRcmLEGwctJwKQaqGAa+nl3EZs=; b=xwtzXLAhoMju4N5qLw1tZp4zDEkGY2MnVNNFRnFL5fYtcu4T5Ci7yvpHqbd/UXctWB CM0n4SmJqdbGOIpb43GpyJhaxdUhUOvRJzR80VGtde0U5WYa7KHfZF7yiPd+STJD+m/k +kc3dxv0MgskyzudzhvK8fU2J8EA51ZbhgQ3lSqn5entGdqhi7SFjT3eopHvXk8Jmf7p Rnfdp09Yn2e3CAAqszaqxTYKKAROAQVc+apG3Rlwpk9qo2BqrCw6dIrqf/V1SmpfGPOW m0g6eityYLZWmFwM3AjFQa+Iw311sQoz1R+dKgs935u4oa135TVPKG9AIlD0fEQ6q9JG YwQQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=L/s5DB9oA5m3J3r5mnRcmLEGwctJwKQaqGAa+nl3EZs=; b=qQinrN6fbLNaMFzAh1qILcn4xSaN8JhfurzO3dAy8KnMwI7ht4mJBxeVSc62Ckl0yr PX+BC/RnjPZobOITByXmXqUdlTPgGCUi9ghXicMYv7eNhYtPEJdOcXbgTeClxMjJj5lZ 5QEL40V/Fim2i9vF/ez2x4q5LyHZqakmRvs0WXh3vDhiqp5iba0CS7I+fvsm3Xb2K+q4 3oSyMut1GbXbwj2oPcooKTKpds9iK9Wb9MEVdAhnAaAOPhKOC86Lm/hdpqyEBszt2e7q kEZLhqZ1c0ormyOxianrjFxTgPhKCZNDvEbJjMaz2CCbQhRLGVbcl07sPF2CP6WVBiE8 p+pA== X-Gm-Message-State: AOAM531wEzaWL0EzOhEeMh+iHKRY4LbtF6owO/LJSuJPHINK5g7v+jlY NH/j2OPaPYcq69hSmxD3MPrvyqWdkHizwA== X-Google-Smtp-Source: ABdhPJxsayAq0vUrHM3Icu6hBINZa4SrHqImxVegRJk199sEZEQ8Gc6pDJ4bKlTh9tDmHpjWrPV9lQ== X-Received: by 2002:a17:90a:fe0d:b0:1e2:e9bf:1139 with SMTP id ck13-20020a17090afe0d00b001e2e9bf1139mr2442184pjb.106.1654133658860; Wed, 01 Jun 2022 18:34:18 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu Subject: [PATCH v6 12/17] target/m68k: Implement TRAPV Date: Wed, 1 Jun 2022 18:33:56 -0700 Message-Id: <20220602013401.303699-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220602013401.303699-1-richard.henderson@linaro.org> References: <20220602013401.303699-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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1034; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1034.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1654134884318100001 Content-Type: text/plain; charset="utf-8" Reviewed-by: Laurent Vivier Signed-off-by: Richard Henderson --- target/m68k/translate.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/target/m68k/translate.c b/target/m68k/translate.c index 83c2f73063..fa704e0c25 100644 --- a/target/m68k/translate.c +++ b/target/m68k/translate.c @@ -4910,6 +4910,14 @@ DISAS_INSN(trapcc) do_trapcc(s, &c); } =20 +DISAS_INSN(trapv) +{ + DisasCompare c; + + gen_cc_cond(&c, s, 9); /* V set */ + do_trapcc(s, &c); +} + static void gen_load_fcr(DisasContext *s, TCGv res, int reg) { switch (reg) { @@ -6073,6 +6081,7 @@ void register_m68k_insns (CPUM68KState *env) BASE(nop, 4e71, ffff); INSN(rtd, 4e74, ffff, RTD); BASE(rts, 4e75, ffff); + INSN(trapv, 4e76, ffff, M68000); INSN(rtr, 4e77, ffff, M68000); BASE(jump, 4e80, ffc0); BASE(jump, 4ec0, ffc0); --=20 2.34.1 From nobody Fri May 10 06:16:12 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1654134878; cv=none; d=zohomail.com; s=zohoarc; b=Gq64ENvKaFRAIm3jjEFde8ptWojgDUy7EixHjOOJzkbM2l5JTMbhvyy6s2xzJaq3z4q5PbFCT2TARfaMq3g4PNeaertFplXV5OYRZSsJLulUZktgzgnqrQQYjd7nFaDqXnN+/7FzOcRwU1YjFGocUUCIrYR/1gPdDyJ4w/stYzU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654134878; 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=IhaQ71DRJcMZN5BIZLMGgAqxrNC/+qcBfUUjhN0p2Oc=; b=aIPrtSmP0BhSmVB+kNNmAGZPqXP6NCZUsOD600QNd5FWjD/iIF2iY0rmh/BDXYUuETClUkRUSTapwB+sORigpbDlylUMRKPPPgmTOrgTVLBALlqBCJUPMpAnoCBbQkarsvqCgwU7ScbzQbCtYmO58oxlOX/ZkxhF7Wivcx8/Xs8= 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+importer=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 1654134878719100.3238299483437; Wed, 1 Jun 2022 18:54:38 -0700 (PDT) Received: from localhost ([::1]:53220 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nwa2n-0000eP-5B for importer@patchew.org; Wed, 01 Jun 2022 21:54:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43692) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwZjL-0002hS-CD for qemu-devel@nongnu.org; Wed, 01 Jun 2022 21:34:31 -0400 Received: from mail-pg1-x533.google.com ([2607:f8b0:4864:20::533]:38401) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nwZjI-0005I5-QG for qemu-devel@nongnu.org; Wed, 01 Jun 2022 21:34:31 -0400 Received: by mail-pg1-x533.google.com with SMTP id 137so3447489pgb.5 for ; Wed, 01 Jun 2022 18:34:20 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:1eca:8ee3:9269:e00c]) by smtp.gmail.com with ESMTPSA id l191-20020a6391c8000000b003fc5b1db26fsm1962875pge.52.2022.06.01.18.34.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 18:34:19 -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=IhaQ71DRJcMZN5BIZLMGgAqxrNC/+qcBfUUjhN0p2Oc=; b=MLxIj7UCop7tmozUI/E/nJgf6qyEoDRj9zVIEVoiuIDG/yjFvn82q/TpDPq23giZN5 E0simAANAPuaIsymD3XbZZ/ym0n/8mN351qpe28LL9IpwNVNOGn1uCfCg/PJOcCLoKE/ C8kpX0lFOYRnb4gYroFwhpiCqyoUJHHjeMjqofygEQ24qqR0ZNt6wAdDIeiTDCf8Mstn ZIJJT238puHyzP7aZoZDwKl/imu7n9N8UtvjPDx2FEQq84AYCkd6P976BKrGQXsn62c/ m0i4PoUjgn3KYQcQ2PkPWsofb2/vdOe+smjWYIwRG/8SB7Wp8bUMDNxaf5QSQUGCNW+1 Huhg== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=IhaQ71DRJcMZN5BIZLMGgAqxrNC/+qcBfUUjhN0p2Oc=; b=k2UsEXPMba+NvdIusc7OAUXOBtQ6iItGW4eN3N9v7xib8XlHHg+czEOHi7N7Cbwm31 7TwXJ4FUoSiNdvzLSiqjMEOLnYJDdiRU99ZNIAe33BJPsfwQWcqk0jGdWspIuQUXTmre H3rUblnxF60fF/0G+o3rbL5mEDtPewKE5EtgpYXeAMjM7LL85IdAe8MnXd2cmFhu/KgN iX/HHQ+ppFgxaeKaBQVFcVIzs3J5HgF6nW4oq6t5lbdsuUgnvA17i4MKDExHDKAnbKBu upNP8Hoya7CU+tbSoTb/wGusoDBFOQkvNx8PML3rjoY7jBShYmelyZJDj6QJFhmhpXUK 382A== X-Gm-Message-State: AOAM531ZXzhk9uVVUUQ2xBIz6xxQ9XcQZ5lPjM2E/+FmsJ6o8LEv5ZrL VF16swhsBoBz7jEMlUNkvJiG/6iEzE+/GQ== X-Google-Smtp-Source: ABdhPJwUjGCb0GKVtMaAbHfVLFblJs+tUrV7M/s5eFjEBEzKrJd2l374RQ5gKDYbV2bi+zFJu3AzJg== X-Received: by 2002:a63:85c2:0:b0:3fc:94a8:d350 with SMTP id u185-20020a6385c2000000b003fc94a8d350mr1981427pgd.454.1654133659983; Wed, 01 Jun 2022 18:34:19 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu Subject: [PATCH v6 13/17] target/m68k: Implement FTRAPcc Date: Wed, 1 Jun 2022 18:33:57 -0700 Message-Id: <20220602013401.303699-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220602013401.303699-1-richard.henderson@linaro.org> References: <20220602013401.303699-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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::533; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x533.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1654134880385100001 Content-Type: text/plain; charset="utf-8" Reviewed-by: Laurent Vivier Signed-off-by: Richard Henderson --- target/m68k/translate.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/target/m68k/translate.c b/target/m68k/translate.c index fa704e0c25..cc3bd4dd2b 100644 --- a/target/m68k/translate.c +++ b/target/m68k/translate.c @@ -5566,6 +5566,34 @@ DISAS_INSN(fscc) tcg_temp_free(tmp); } =20 +DISAS_INSN(ftrapcc) +{ + DisasCompare c; + uint16_t ext; + int cond; + + ext =3D read_im16(env, s); + cond =3D ext & 0x3f; + + /* Consume and discard the immediate operand. */ + switch (extract32(insn, 0, 3)) { + case 2: /* ftrapcc.w */ + (void)read_im16(env, s); + break; + case 3: /* ftrapcc.l */ + (void)read_im32(env, s); + break; + case 4: /* ftrapcc (no operand) */ + break; + default: + /* ftrapcc registered with only valid opmodes */ + g_assert_not_reached(); + } + + gen_fcc_cond(&c, s, cond); + do_trapcc(s, &c); +} + #if defined(CONFIG_SOFTMMU) DISAS_INSN(frestore) { @@ -6191,6 +6219,8 @@ void register_m68k_insns (CPUM68KState *env) INSN(fbcc, f280, ffc0, CF_FPU); INSN(fpu, f200, ffc0, FPU); INSN(fscc, f240, ffc0, FPU); + INSN(ftrapcc, f27a, fffe, FPU); /* opmode 010, 011 */ + INSN(ftrapcc, f27c, ffff, FPU); /* opmode 100 */ INSN(fbcc, f280, ff80, FPU); #if defined(CONFIG_SOFTMMU) INSN(frestore, f340, ffc0, CF_FPU); --=20 2.34.1 From nobody Fri May 10 06:16:12 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1654134125; cv=none; d=zohomail.com; s=zohoarc; b=Hu/teHQwzqa7J7o13Hjm0cMKHQ9D+qCPF85xCWlfAmeqglthwOAQxM04emAPrq+eDbcdfSSRMQyiJBNxV/6E/2zeH0GlPw4DzAcc5bivoCg41LanprVfeh2rFSX6NiERZj/Z1EIG7Ukj+QguHGNkdmqxb7ZSfbG/GyKM7Icz6sE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654134125; 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=Ec0dbY3Lo89Y5jy2prv7uGoDI+hJWJ+BkmpUFqfWdho=; b=BqZzJNovS3yvD3ocSRLs3emqirEUp8VQwngkEeWV1DNsjjS/oBNOljbI804I28z/Es3jsSWrQcGUVKBLd9T/wHKQMKeiyU9Z0W92PhBxF5sOf4DfM2xaQ5lFvC2lDKuFH6EfWqbQsorQXAP2zvBsRvLAURfJV6U2YmuR7207Qow= 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+importer=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 1654134125224174.05614363437724; Wed, 1 Jun 2022 18:42:05 -0700 (PDT) Received: from localhost ([::1]:34480 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nwZqd-0003Xg-UF for importer@patchew.org; Wed, 01 Jun 2022 21:42:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43746) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwZjN-0002jz-1p for qemu-devel@nongnu.org; Wed, 01 Jun 2022 21:34:33 -0400 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]:36457) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nwZjJ-0005I9-RJ for qemu-devel@nongnu.org; Wed, 01 Jun 2022 21:34:32 -0400 Received: by mail-pj1-x1035.google.com with SMTP id u12-20020a17090a1d4c00b001df78c7c209so7975388pju.1 for ; Wed, 01 Jun 2022 18:34:22 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:1eca:8ee3:9269:e00c]) by smtp.gmail.com with ESMTPSA id l191-20020a6391c8000000b003fc5b1db26fsm1962875pge.52.2022.06.01.18.34.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 18:34:20 -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=Ec0dbY3Lo89Y5jy2prv7uGoDI+hJWJ+BkmpUFqfWdho=; b=y68fsTxszpmTWBuZ1q4Vt43XPX2n+F+Y5PVMLT9hdgrZIbdKBKTJTh3EOu+glZ4BvE SDVtKMf9eIO8N6KJaAW/vJN4UlbDiiD57yOhwC30v9UiT8seFdUEBeXik5rXX1GtkRtj XP0uQxlr9PJSQ/Emyni4jYTFk3QZlGW6lgAfRHw8mFiNuE7+9myrXpiFEJydxdnpcTC6 CK6Mt6nKKONw0q4Y79tVFKuocqG9Zh4GfF2THEBdBgFB+nSBSevO7zZA6FXhKORJvoyg gdA7uwWlI94U0uUZDVAEu/BtFdHjXEEsUeQzEZ3u5LW/9CF23d02gzWBRgSEkvkDU65E hNRw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ec0dbY3Lo89Y5jy2prv7uGoDI+hJWJ+BkmpUFqfWdho=; b=i0tzuwxs0hIJrXJTcvDtMMn/yr5o0ZbjXxvuikmP8vLhsx9WdT0kRvU/zKxfH/RjKK G2fHFkY/z/pk2YP3lLfGHiNWfjgs/KNeTZUlGkQsKTEW8l2yszbBm4fPKpkMJ32vaujW hhQmfJ03j4QgSw+vPIvuV629z4n1tmoyBsp9t95Q5WwYfqmTixUp+FLqW03tO4BBKEss mWaa8O6VdWIND1hQh5jfE+FHR41TEcBQb0zoWuPN+Ba/AsgQTrK8KDFxNs8qFcsvPnCX tOYkkhAjJZb4lCChRKB6RT+S+drbrPbAMvFpUf/YPjBi0mCk7SczvdA+ccsO1zRbm0Vw eR5g== X-Gm-Message-State: AOAM531C94HaVCV5fmSEb3pELXKkpIKd22cM53SC4ghiJECGFEA1wxrA zUmCN5evEBxuFXvmT7bhqgJFoB/kebreyQ== X-Google-Smtp-Source: ABdhPJzwLwcbj85qUZ86fFjx+vqusgvQGSffdgugfWiMHtw+rj1BglAOPoLteBAm1pL1pNyJSUWgzw== X-Received: by 2002:a17:90a:5c84:b0:1dc:9b42:f2cf with SMTP id r4-20020a17090a5c8400b001dc9b42f2cfmr37258335pji.123.1654133661361; Wed, 01 Jun 2022 18:34:21 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu Subject: [PATCH v6 14/17] tests/tcg/m68k: Add trap.c Date: Wed, 1 Jun 2022 18:33:58 -0700 Message-Id: <20220602013401.303699-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220602013401.303699-1-richard.henderson@linaro.org> References: <20220602013401.303699-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+importer=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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1654134125913100001 Content-Type: text/plain; charset="utf-8" Test various trap instructions: chk, div, trap, trapv, trapcc, ftrapcc, and the signals and addresses that we expect from them. Reviewed-by: Laurent Vivier Signed-off-by: Richard Henderson --- tests/tcg/m68k/trap.c | 129 +++++++++++++++++++++++++++++++++ tests/tcg/m68k/Makefile.target | 3 + 2 files changed, 132 insertions(+) create mode 100644 tests/tcg/m68k/trap.c diff --git a/tests/tcg/m68k/trap.c b/tests/tcg/m68k/trap.c new file mode 100644 index 0000000000..96cac18d4d --- /dev/null +++ b/tests/tcg/m68k/trap.c @@ -0,0 +1,129 @@ +/* + * Test m68k trap addresses. + */ + +#define _GNU_SOURCE 1 +#include +#include +#include + +static int expect_sig; +static int expect_si_code; +static void *expect_si_addr; +static greg_t expect_mc_pc; +static volatile int got_signal; + +static void sig_handler(int sig, siginfo_t *si, void *puc) +{ + ucontext_t *uc =3D puc; + mcontext_t *mc =3D &uc->uc_mcontext; + + assert(sig =3D=3D expect_sig); + assert(si->si_code =3D=3D expect_si_code); + assert(si->si_addr =3D=3D expect_si_addr); + assert(mc->gregs[R_PC] =3D=3D expect_mc_pc); + + got_signal =3D 1; +} + +#define FMT_INS [ad] "a"(&expect_si_addr), [pc] "a"(&expect_mc_pc) +#define FMT0_STR(S) \ + "move.l #1f, (%[ad])\n\tmove.l #1f, (%[pc])\n" S "\n1:\n" +#define FMT2_STR(S) \ + "move.l #0f, (%[ad])\n\tmove.l #1f, (%[pc])\n" S "\n1:\n" + +#define CHECK_SIG do { assert(got_signal); got_signal =3D 0; } while (0) + +int main(int argc, char **argv) +{ + struct sigaction act =3D { + .sa_sigaction =3D sig_handler, + .sa_flags =3D SA_SIGINFO + }; + int t0, t1; + + sigaction(SIGILL, &act, NULL); + sigaction(SIGTRAP, &act, NULL); + sigaction(SIGFPE, &act, NULL); + + expect_sig =3D SIGFPE; + expect_si_code =3D FPE_INTOVF; + asm volatile(FMT2_STR("0:\tchk %0, %1") : : "d"(0), "d"(-1), FMT_INS); + CHECK_SIG; + +#if 0 + /* FIXME: chk2 not correctly translated. */ + int bounds[2] =3D { 0, 1 }; + asm volatile(FMT2_STR("0:\tchk2.l %0, %1") + : : "m"(bounds), "d"(2), FMT_INS); + CHECK_SIG; +#endif + + asm volatile(FMT2_STR("cmp.l %0, %1\n0:\ttrapv") + : : "d"(INT_MIN), "d"(1), FMT_INS); + CHECK_SIG; + + asm volatile(FMT2_STR("cmp.l %0, %0\n0:\ttrapeq") + : : "d"(0), FMT_INS); + CHECK_SIG; + + asm volatile(FMT2_STR("cmp.l %0, %0\n0:\ttrapeq.w #0x1234") + : : "d"(0), FMT_INS); + CHECK_SIG; + + asm volatile(FMT2_STR("cmp.l %0, %0\n0:\ttrapeq.l #0x12345678") + : : "d"(0), FMT_INS); + CHECK_SIG; + + asm volatile(FMT2_STR("fcmp.x %0, %0\n0:\tftrapeq") + : : "f"(0.0L), FMT_INS); + CHECK_SIG; + + expect_si_code =3D FPE_INTDIV; + + asm volatile(FMT2_STR("0:\tdivs.w %1, %0") + : "=3Dd"(t0) : "d"(0), "0"(1), FMT_INS); + CHECK_SIG; + + asm volatile(FMT2_STR("0:\tdivsl.l %2, %1:%0") + : "=3Dd"(t0), "=3Dd"(t1) : "d"(0), "0"(1), FMT_INS); + CHECK_SIG; + + expect_sig =3D SIGILL; + expect_si_code =3D ILL_ILLTRP; + asm volatile(FMT0_STR("trap #1") : : FMT_INS); + CHECK_SIG; + asm volatile(FMT0_STR("trap #2") : : FMT_INS); + CHECK_SIG; + asm volatile(FMT0_STR("trap #3") : : FMT_INS); + CHECK_SIG; + asm volatile(FMT0_STR("trap #4") : : FMT_INS); + CHECK_SIG; + asm volatile(FMT0_STR("trap #5") : : FMT_INS); + CHECK_SIG; + asm volatile(FMT0_STR("trap #6") : : FMT_INS); + CHECK_SIG; + asm volatile(FMT0_STR("trap #7") : : FMT_INS); + CHECK_SIG; + asm volatile(FMT0_STR("trap #8") : : FMT_INS); + CHECK_SIG; + asm volatile(FMT0_STR("trap #9") : : FMT_INS); + CHECK_SIG; + asm volatile(FMT0_STR("trap #10") : : FMT_INS); + CHECK_SIG; + asm volatile(FMT0_STR("trap #11") : : FMT_INS); + CHECK_SIG; + asm volatile(FMT0_STR("trap #12") : : FMT_INS); + CHECK_SIG; + asm volatile(FMT0_STR("trap #13") : : FMT_INS); + CHECK_SIG; + asm volatile(FMT0_STR("trap #14") : : FMT_INS); + CHECK_SIG; + + expect_sig =3D SIGTRAP; + expect_si_code =3D TRAP_BRKPT; + asm volatile(FMT0_STR("trap #15") : : FMT_INS); + CHECK_SIG; + + return 0; +} diff --git a/tests/tcg/m68k/Makefile.target b/tests/tcg/m68k/Makefile.target index 62f109eef4..1163c7ef03 100644 --- a/tests/tcg/m68k/Makefile.target +++ b/tests/tcg/m68k/Makefile.target @@ -3,5 +3,8 @@ # m68k specific tweaks - specifically masking out broken tests # =20 +VPATH +=3D $(SRC_PATH)/tests/tcg/m68k +TESTS +=3D trap + # On m68k Linux supports 4k and 8k pages (but 8k is currently broken) EXTRA_RUNS+=3Drun-test-mmap-4096 # run-test-mmap-8192 --=20 2.34.1 From nobody Fri May 10 06:16:12 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1654135068; cv=none; d=zohomail.com; s=zohoarc; b=hL+BJAmCfXepAbKYOINui6N5aAoDNbwdq0isiZO4U7c190ekTVGGBumJphDoXO6TT0fF4b8J3ylpqXzhbseq0gUuCPlQY3rOu42Twdu4veeAhn7fcLNWSmrITAr/5zo0lQhOwPsNmmAAruUh4fX1MH3omVls/BdxcZwQnVqMGGQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654135068; h=Content-Type: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=37l0ckMoMVGJpBF2TcV75mrqlQxEuC7DjW9Iu6LSXsQ=; b=SI/h5/XEA+RNi4ttPtKEWaGNK/R9sBxSBmXoAvmPpeN1NQltNUMIu6SMaBXmPmoPS93GTXDuaNJRGs6VUToxCzyt8c3Ej5gdz2PagDj8ca2Vin+VWhUWaHi/wNbUZPLqwkXfpvaon8/y/cf9p2WTtF8TY2RJP1nkzVTQBZBRS0I= 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+importer=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 1654135068942524.7373260065599; Wed, 1 Jun 2022 18:57:48 -0700 (PDT) Received: from localhost ([::1]:57566 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nwa5r-0003oI-Gx for importer@patchew.org; Wed, 01 Jun 2022 21:57:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43728) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwZjM-0002j1-LU for qemu-devel@nongnu.org; Wed, 01 Jun 2022 21:34:32 -0400 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]:37439) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nwZjI-0005ID-QR for qemu-devel@nongnu.org; Wed, 01 Jun 2022 21:34:32 -0400 Received: by mail-pj1-x1032.google.com with SMTP id 3-20020a17090a174300b001e426a02ac5so4797994pjm.2 for ; Wed, 01 Jun 2022 18:34:23 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:1eca:8ee3:9269:e00c]) by smtp.gmail.com with ESMTPSA id l191-20020a6391c8000000b003fc5b1db26fsm1962875pge.52.2022.06.01.18.34.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 18:34:21 -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=37l0ckMoMVGJpBF2TcV75mrqlQxEuC7DjW9Iu6LSXsQ=; b=cv+sXEfF3W2Hx9oQlNLC7QdpICSYeu/+RbiT8O7yV6EaOAWQkJcdjJnpwDW99qmq3s Lt8By4O1T7vUOWUUBI7Uuc0E5ZuKJKaJtCypVQkHehJzoZhnn3oARM4d96m2hatQAzGA QVFV42xw4QwQaRDpsD0JhK8pA8GFTrNM3MLKuSoAnXQK7P5g0Exyy5HNz/0v9Gjlfj9m iZE/yEoMuFJUJmvL40mMZnViADDagMNncpqLWVAo7sIArJMQ49QRep6xl9CYZLBYEGGg ayDKL9MuMvngvuU/YMCHOPJRqdpNAGT41MaZ6JzbrKMnkcoUusEkeyov5XWJ8s+LRNJ6 2jcA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=37l0ckMoMVGJpBF2TcV75mrqlQxEuC7DjW9Iu6LSXsQ=; b=08+ExP3dD1sO2FpCkT9l0hCynAjijLq24keKxTMsuMFBi6SOH5Y0qhtFMTZcFwSYIj Hm9lBJDllrxd1AYWv5ZpRng0MNp1oTwDq1q5E/AOo9DEJczMn/UTjkYj/kr/PEPkKh6P kYeBxEN0UrsDlqUUKmVo/N2T+DFqFEkSrrxJkvYTDL6bUSxEjv7crGTFBSYVxmAmDgHh b40ifbgwNm3sH7G+M6G06Gx0xVNcA7k7aGJ5ZF39fHJhn/I1LCS8m5yvP9JW32IF/Umi aBCZAU1tMuMq0b+gbliLSzydBCcO2ihMQNmWdHIO2i8UJCtDJQn++hWP6kVUwAP9qZ5A 519g== X-Gm-Message-State: AOAM533mx/rd8ZHvhwLtEqABpsTIsymF6Y3n9WXL41SqE4CkVHAdC0QI NAldF7cg5C2e5br6gg1Q0BD9Vu5FhPTNAw== X-Google-Smtp-Source: ABdhPJwmn5QQy81wESeYON1pkqhyKPdYwfISDTBiTXEF6a1p5b8F9wpBHVA4IO9UYmPaDMVVE2r76A== X-Received: by 2002:a17:902:e5c9:b0:166:34ff:72a3 with SMTP id u9-20020a170902e5c900b0016634ff72a3mr2299539plf.80.1654133662318; Wed, 01 Jun 2022 18:34:22 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v6 15/17] linux-user/strace: Use is_error in print_syscall_err Date: Wed, 1 Jun 2022 18:33:59 -0700 Message-Id: <20220602013401.303699-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220602013401.303699-1-richard.henderson@linaro.org> References: <20220602013401.303699-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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1032; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1032.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1654135069355100001 Errors are not all negative numbers: use is_error. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- linux-user/strace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux-user/strace.c b/linux-user/strace.c index 9fa681dea9..7d882526da 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -689,7 +689,7 @@ print_syscall_err(abi_long ret) const char *errstr; =20 qemu_log(" =3D "); - if (ret < 0) { + if (is_error(ret)) { errstr =3D target_strerror(-ret); if (errstr) { qemu_log("-1 errno=3D%d (%s)", (int)-ret, errstr); --=20 2.34.1 From nobody Fri May 10 06:16:12 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1654135068; cv=none; d=zohomail.com; s=zohoarc; b=Ucu9Ph1M4VuZSZzHKRFRZXZFWh1wegittrIIsMSynSkr7O2dDjogZSTZacXuk4ZcYv2hD2TqqzJ80t39UuLEAxcIrntZq9ba+wgiw49rWdGQu7v38PQhOA7umjGocAOYHWl8MEJ9cQaoujvGvDcDDpDW2rMzCG4PbraQpdC1FYU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654135068; 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=frtjY4kXdf+btOwpubtlaBEs6SblJPqCp8QSyGl5a7Y=; b=dXbXNjZ4ikNzQES/JyuC41o0UTs0cdJfkjUhMlEgwUxHs1F+v5K+dAh9GQxLkUlMJ9wuMH3cPHkblQsxO3Y02vvjUloEApsIH4cE5VFeDhQB1T4oo4eNwmbqwq50zKaH+gPNRabIQrzu/ovZuAHy3nGB+ClINN5wwjndsLhCWvk= 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+importer=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 1654135067981675.3402625664075; Wed, 1 Jun 2022 18:57:47 -0700 (PDT) Received: from localhost ([::1]:57508 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nwa5q-0003m4-O8 for importer@patchew.org; Wed, 01 Jun 2022 21:57:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43736) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwZjM-0002jT-Sr for qemu-devel@nongnu.org; Wed, 01 Jun 2022 21:34:32 -0400 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]:36813) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nwZjJ-0005IK-SJ for qemu-devel@nongnu.org; Wed, 01 Jun 2022 21:34:32 -0400 Received: by mail-pl1-x633.google.com with SMTP id u18so3292631plb.3 for ; Wed, 01 Jun 2022 18:34:24 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:1eca:8ee3:9269:e00c]) by smtp.gmail.com with ESMTPSA id l191-20020a6391c8000000b003fc5b1db26fsm1962875pge.52.2022.06.01.18.34.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 18:34:22 -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=frtjY4kXdf+btOwpubtlaBEs6SblJPqCp8QSyGl5a7Y=; b=VTmk8IiNt9HkLNsIVTJc4F6AqqSh+hPO3FTrAKuPK6uUjBie/aqkuMVeFjPeC0xtO9 mX7emgRH8rYHzRquWS65XPN3r0ZUUDdS4fK68WqlsZW/KJKltIqYRzg82VWg0QSXuSIK czgZAeVBuiwSqoJexlHnKSpoU2J645y7ZQ5J2QNw/TMtcAXoLHMu81x6K3lpGPvdtoBI n9YiRTuczfb8lXTtUQjUejSo1ie2Uj5esc3v/tG1VMtweBykl7eCRZKdjTYGImCuWgTE Uv63XfjErdbCeE+KhYbxPp3C9Dzf0QVmT0GgjYx08io3nOkL8HnFzI2YtRE1/flZ3drh RHVw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=frtjY4kXdf+btOwpubtlaBEs6SblJPqCp8QSyGl5a7Y=; b=gERGSCPX2CezaSGtacKdZVyZXKlzt0eecalwpx7Lg2xmWH2qckWAemeGSXM1ZxwbO9 3pzjlpiZbCu0jgmL3nLF3KxnMabtcEqnRY4kFgoW4MdF5tnJ1NRm3n9ToiVN7B2HK9PK DuqaLwhu72QPg3RLhjsW9wb7/BG3QbCmf82jHvgBLHzid7RIg39d5fLPivsbvCtyORJM ZPJP+h3bIpR8Fx/SvhXEweDbhN6536DHe9gI3aYnJ8pnt5cI5nlUX2UpJXS1qeXejp4V F11znckiWkzWfQY9wnBndwYUdrOBAkC+2gviMReERzRl0Ze6jW+uJrkaXe360/6wUn39 o6kQ== X-Gm-Message-State: AOAM532mrRpnQ4ttFvXb4PoyChn7JUK+0YftZs2hYed3Xxm3CJq3Okbw AZnjqIElWa6VHUnea68Sw6FYZA3zk03KsA== X-Google-Smtp-Source: ABdhPJzNdbDNKx/hcu3hOtttrq433I38wcxMukQWewvClidfCj6GAuELzXvpWGI1UEPshlbbQj8U7Q== X-Received: by 2002:a17:902:f647:b0:161:67af:6bf0 with SMTP id m7-20020a170902f64700b0016167af6bf0mr2232147plg.100.1654133663260; Wed, 01 Jun 2022 18:34:23 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu Subject: [PATCH v6 16/17] linux-user/strace: Adjust get_thread_area for m68k Date: Wed, 1 Jun 2022 18:34:00 -0700 Message-Id: <20220602013401.303699-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220602013401.303699-1-richard.henderson@linaro.org> References: <20220602013401.303699-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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::633; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x633.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1654135069531100003 Content-Type: text/plain; charset="utf-8" Unlike i386, m68k get_thread_area has no arguments. Reviewed-by: Laurent Vivier Signed-off-by: Richard Henderson --- linux-user/strace.list | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/linux-user/strace.list b/linux-user/strace.list index 278596acd1..72e17b1acf 100644 --- a/linux-user/strace.list +++ b/linux-user/strace.list @@ -384,8 +384,13 @@ { TARGET_NR_getsockopt, "getsockopt" , NULL, NULL, NULL }, #endif #ifdef TARGET_NR_get_thread_area +#if defined(TARGET_I386) && defined(TARGET_ABI32) { TARGET_NR_get_thread_area, "get_thread_area", "%s(0x"TARGET_ABI_FMT_lx")= ", NULL, NULL }, +#elif defined(TARGET_M68K) +{ TARGET_NR_get_thread_area, "get_thread_area" , "%s()", + NULL, print_syscall_ret_addr }, +#endif #endif #ifdef TARGET_NR_gettid { TARGET_NR_gettid, "gettid" , "%s()", NULL, NULL }, --=20 2.34.1 From nobody Fri May 10 06:16:12 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1654133872; cv=none; d=zohomail.com; s=zohoarc; b=nMOAkiAvlq+UuaPbp1bFysv+DVBKymY2mxhq7CEmP51l0vHAXkDz3+rNm6CFO2EsbLual2xV49iuEm9T7pHuoxjzA+wnz3/CiTM2Q4avD6aoz9reMNkIljBxd5l40p70tbTkWbuEGhzp12sX6siTy0OX5F0rkw6gMk8pP/UTxyA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654133872; h=Content-Type: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=IPe9v04jpSOnM1YqKXysVjOVagzaKcyYJ8pPspoxKJ4=; b=Z6HXPeE7QwpxEPfdCnwqZcBt9FmCnkGzLymIYGYPe52aK+u1ox6/tzch9mL1qGK7YD4m7yeCGC0QPNqQG10rqdy0yaXiZ23h5xRcS0140+0U/DyAMsBdTBOLGm+Xsa9PDlzfMNxXfy8v1sKWouNEorzbeRpFuwAqFFfxpeAWDCc= 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+importer=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 16541338721301019.5944379185374; Wed, 1 Jun 2022 18:37:52 -0700 (PDT) Received: from localhost ([::1]:53782 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nwZmZ-0005hW-3S for importer@patchew.org; Wed, 01 Jun 2022 21:37:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43734) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwZjM-0002jM-Si for qemu-devel@nongnu.org; Wed, 01 Jun 2022 21:34:32 -0400 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]:36663) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nwZjJ-0005IU-S3 for qemu-devel@nongnu.org; Wed, 01 Jun 2022 21:34:32 -0400 Received: by mail-pf1-x434.google.com with SMTP id 15so3479152pfy.3 for ; Wed, 01 Jun 2022 18:34:25 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:1eca:8ee3:9269:e00c]) by smtp.gmail.com with ESMTPSA id l191-20020a6391c8000000b003fc5b1db26fsm1962875pge.52.2022.06.01.18.34.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 18:34:23 -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=IPe9v04jpSOnM1YqKXysVjOVagzaKcyYJ8pPspoxKJ4=; b=KLGBU8uibNZIo+WGaor6RMr1kjNUFZUCv7ItcJT01nBneqfG6A0yC/10tT1cMDwrDH pmA/KWgEdiapfuy5AGRdUub5XGGGj3Rcqp76d28SIAuB244ClQSTQR+mjSYlldqWCeVZ WeqcFmU6mG/atr4gF5rpvP1ahAj3LzcSX5pWulM1/4AQjP/WeUpnDbiXjkWNBPYSJ2/N Zp3akOan5ZckcY4MM8ep0Oyg4fGt7Iy/jax0i1tCse4g7tftLP2HmPoFOeq+K3vuqIea 2xAxdEJSy+1V1GxAlnp10lA6qk+OjmIcobLFqJ9pTgiomOgaJneGl1tqYqwLtaMf0GMx Sh7g== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=IPe9v04jpSOnM1YqKXysVjOVagzaKcyYJ8pPspoxKJ4=; b=rVin2d0N9ieSgr53WDMFYZk52eC7zU1p0Hx+rnj1uS2QSyVW+ywz/dXBLiNCbGAime wcsocazsrpskzAs6M0YkfhlaeMPIV+DU5RHwnzgIOCgHm3xG2jy7M5IOuK4kmnqRpVSQ ROoeyL39JULtFzO9wLdpwICFG/Bqyy2Ncxh42oxpSxfGqBCZvVAVVKCwBntdvv70V9fH R34kk51v3zEpnlq6hFzMkTj5H8B9NWH/caLEp8QAlW4XpuDrdN7X7DQzb08hhowqk9EU 0FJ4aSUiS+L64KdI3QmeT60TS2L7a7ndHhCcXpfbRGjqZepaUWqTyBn8KRE5dWbXicax 0yWQ== X-Gm-Message-State: AOAM532tcoArwnllVHMZiahBCSC37bpMOD1FdcBSQ+2/AvHPJ38MBWis OrGrGJY3d7840JY6s9IFhOPMJSodqDlqzw== X-Google-Smtp-Source: ABdhPJxqy/dGNz7bCMgNOMzTKmtl+ROsppe0aliSjCISHBqxyXDjth21bZ0R2KDeC69dGHh7m2RyJg== X-Received: by 2002:a63:8842:0:b0:3fc:64b0:cacd with SMTP id l63-20020a638842000000b003fc64b0cacdmr2009607pgd.490.1654133664380; Wed, 01 Jun 2022 18:34:24 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v6 17/17] target/m68k: Mark helper_raise_exception as noreturn Date: Wed, 1 Jun 2022 18:34:01 -0700 Message-Id: <20220602013401.303699-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220602013401.303699-1-richard.henderson@linaro.org> References: <20220602013401.303699-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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::434; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x434.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1654133874415100001 Also mark raise_exception_ra and raise_exception, lest we generate a warning about helper_raise_exception returning. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Laurent Vivier Signed-off-by: Richard Henderson --- target/m68k/helper.h | 2 +- target/m68k/op_helper.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/target/m68k/helper.h b/target/m68k/helper.h index f016c4c1c2..c9bed2b884 100644 --- a/target/m68k/helper.h +++ b/target/m68k/helper.h @@ -109,7 +109,7 @@ DEF_HELPER_3(set_mac_extu, void, env, i32, i32) DEF_HELPER_2(flush_flags, void, env, i32) DEF_HELPER_2(set_ccr, void, env, i32) DEF_HELPER_FLAGS_1(get_ccr, TCG_CALL_NO_WG_SE, i32, env) -DEF_HELPER_2(raise_exception, void, env, i32) +DEF_HELPER_2(raise_exception, noreturn, env, i32) =20 DEF_HELPER_FLAGS_3(bfffo_reg, TCG_CALL_NO_RWG_SE, i32, i32, i32, i32) =20 diff --git a/target/m68k/op_helper.c b/target/m68k/op_helper.c index 61948d92bb..d9937ca8dc 100644 --- a/target/m68k/op_helper.c +++ b/target/m68k/op_helper.c @@ -532,7 +532,8 @@ bool m68k_cpu_exec_interrupt(CPUState *cs, int interrup= t_request) =20 #endif /* !CONFIG_USER_ONLY */ =20 -static void raise_exception_ra(CPUM68KState *env, int tt, uintptr_t raddr) +G_NORETURN static void +raise_exception_ra(CPUM68KState *env, int tt, uintptr_t raddr) { CPUState *cs =3D env_cpu(env); =20 @@ -540,7 +541,7 @@ static void raise_exception_ra(CPUM68KState *env, int t= t, uintptr_t raddr) cpu_loop_exit_restore(cs, raddr); } =20 -static void raise_exception(CPUM68KState *env, int tt) +G_NORETURN static void raise_exception(CPUM68KState *env, int tt) { raise_exception_ra(env, tt, 0); } --=20 2.34.1