From nobody Thu May 16 23:52:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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 ARC-Seal: i=1; a=rsa-sha256; t=1591111365; cv=none; d=zohomail.com; s=zohoarc; b=mgvR7WXOAzWtGehP7TEyndapmy8g+DMvC1gt5DaOHfStzfDFBcCNsLoqZep+3FJirTGd8zlBxV6l4R6Q07Mc6ItGTB6VJ1isSIZ0BxmK2E+OM2hZ5Bhq7V7wiw6wIMC+QWBHYP4Q/LRtGFT49wkjkqMCv0ZZNWLLAvA84bazt0I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591111365; 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=g00HAmTGtjDIAqNGiEfdtITFASyRjktGEx8rKpDCDu8=; b=nywvxTNNbBRxMXzJfvK7yMa/qPaaBGgFVXTdlrBoDR82g4v9fczEHNJvke/9jxpuovgG/zp/yO+eUiLEkaj3IyFeeEZ7bXSCn2q4RHriDpB9KxPQyg+1BOM7fgcvNTJCdjJx/SHHGz/TeD0XSJvHVEbl16toAxByV3OnhPIinA4= ARC-Authentication-Results: i=1; mx.zohomail.com; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1591111365388460.99441608811514; Tue, 2 Jun 2020 08:22:45 -0700 (PDT) Received: from localhost ([::1]:55478 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jg8kW-0005TZ-6f for importer@patchew.org; Tue, 02 Jun 2020 11:22:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50270) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jg8jc-0004Zv-NK for qemu-devel@nongnu.org; Tue, 02 Jun 2020 11:21:48 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:43297) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jg8jb-0008GO-CK for qemu-devel@nongnu.org; Tue, 02 Jun 2020 11:21:48 -0400 Received: from localhost.localdomain ([82.252.135.106]) by mrelayeu.kundenserver.de (mreue009 [212.227.15.167]) with ESMTPSA (Nemesis) id 1M7sQ6-1jbCmy1xD8-0055C1; Tue, 02 Jun 2020 17:21:43 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 1/2] target/m68k: implement fmove.l #,FPCR Date: Tue, 2 Jun 2020 17:21:34 +0200 Message-Id: <20200602152135.774894-2-laurent@vivier.eu> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200602152135.774894-1-laurent@vivier.eu> References: <20200602152135.774894-1-laurent@vivier.eu> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:pAPw0P2B//1hezBQa5BTXuiYZuVb5kHPicsCoBThRB3vpHQJjF9 /rIgfM9kvsU67xZD8tgrnn75DfleTGiS/mmhdbPkulAlfkxSFlvrL8pqQPJ3ov238kozKgL SMxU/qv0QuYqG83Tfstd04gDoLbEjxv+Q6IjY6sZrmcAnM0o6j6hLyUzpiVSf9Kf02MzL32 67tS927w+gR49MVe/FNpQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:sZh7GBAq6WY=:mrw7Qo8tZIZfDBEwmFWJ/v TZQo7ofSW3baQP/lq+/Ufzynnp3cLpQCtM7r+RZ/GiRvwwLwWaWbkEElYu5VGY4wezWi4Q8Te rkQmZiU48neeO+EzzveMRYTlJP6g9ZQkarextchyGXIQDm0Ysfi9ccLLLuWeRifqPfUc3yOEb LeOqKMmRY8nl2sbzgcwpGI3bRTNAhrVAYx8WtUyuRTNAN8o6FCZEWVtEGW2U5KN9I5wblXsjL Rze83aYhidQ8gKQLOtNs/K/v6Vsolq5HcyFiKjBBl7hdubeY4AVxoQqqJrjkaK01Vb1Y+SJzZ p/6yNhEQsFQXBLqYBuIkTmVPRgUkbQSNJlJwYbSYST/oQ8uxnUzzr2H+7J/srJV7dnYMLq09z a+u2qQ+RALoB/N7Y+JfzwWfWJ+pO4j8HOf9kz2pvC4ZiskbYRcd/Ib8iVZaBWhCTmT6n9EEBF W+3VxQI89LpDmYn+V8HVfv7yXZSH+VDAKG9fXHNuZg9NBgR5UVLrV7TxZoMs9sRA9x5V+ENp7 ZtrR+dRdUGWWWs85UOQZr9SLmZaXR+rSrwr2K0SGviqJ0AAgXzrTp58mAw2dosK9gwvTKEoCS 6Qsqc5y7goRufEnxuGxAbPzDgW78YbNBx98MGE86W1cO0nw8kOd5NLJAZTAeiKrnBM6SZoEpW xnFvHDZ6Ao6mcVyUGlzORSKFLvUjI3ExVQhagUWz+cUHOzMCHUiG1QcV1hrHhDKRLTiZa8+iF Jmhh/LoimDcKzIFkBFnJ/MsTiODVk+Lj12kbJaLD+/bS+Hp2gLBPkKycacg3XkeyZ14nr9Ek5 8SI/f55GXoPdmjGSSfCD+HfB+GmtsNnHa9App5V9noGEnsSH/0pDaB7SnPNL74NOSFHZ4me 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: none client-ip=212.227.126.134; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/02 11:21:45 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson , Laurent Vivier , John Paul Adrian Glaubitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" The immediate value mode was ignored and instruction execution ends to an invalid access mode. This was found running 'R' that set FPSR to 0 at startup with a 'fmove.l #0,FPSR' in qemu-system-m68k emulation and triggers a kernel crash: [ 56.640000] *** ADDRESS ERROR *** FORMAT=3D2 [ 56.640000] Current process id is 728 [ 56.640000] BAD KERNEL TRAP: 00000000 [ 56.640000] Modules linked in: sg evdev mac_hid ip_tables x_tables sha1_= generic hmac ipv6 nf_defrag_ipv6 autofs4 ext4 crc16 mbcache jbd2 crc32c_gen= eric sd_mod t10_pi crc_t10dif crct10dif_generic crct10dif_common sr_mod cdr= om mac_esp macsonic esp_scsi [ 56.640000] PC: [<00016a2c>] X_UNSUPP+0x2c/0x3c [ 56.640000] SR: 2004 SP: 3eb5e68c a2: c02e239a [ 56.640000] d0: 00000040 d1: 00000002 d2: 8002adec d3: 8002ad50 [ 56.640000] d4: 8002c768 d5: 0000000d a0: ffffffc2 a1: ffffffc1 [ 56.640000] Process R (pid: 728, task=3Da3dfda5d) [ 56.640000] Frame format=3D2 instr addr=3D00000000 [ 56.650000] Stack from 3a4d9f30: [ 56.650000] 41000000 00000002 00000002 ffffffc2 ffffffc1 1fff000= 0 80000000 00000000 [ 56.650000] 3fbf0000 80000000 00000000 00000000 20000000 0000000= 0 7fff0000 ffffffff [ 56.650000] ffffffff 00000000 00050008 00000000 8000067c c02c200= 0 efffee20 000002d8 [ 56.650000] 00002a28 3a4d9f98 00000002 00000014 fffffffe 8002c76= 8 00000002 00000041 [ 56.650000] 00000002 c041fc58 c0743758 ffffffff 00000000 0008c07= 5 00002b24 00000012 [ 56.650000] 000007d0 00000024 00000002 c05bef04 c05bef04 0000005= e 00000077 c28aca70 [ 56.650000] Call Trace: [<00050008>] copy_overflow+0x10/0x28 [ 56.650000] [<00002a28>] buserr+0x20/0x28 [ 56.650000] [<0008c075>] bpf_check+0x57f/0x1cfa [ 56.650000] [<00002b24>] syscall+0x8/0xc [ 56.650000] [<0000c019>] dn_sched_init+0x75/0x88 [ 56.650000] Code: 1017 0200 00f0 0c00 0040 66ff 0000 05ac 8800 00= 00 0000 f23c 9000 0000 0000 222e ff84 082e 0005 ff1c 6600 000a 0281 [ 56.650000] Disabling lock debugging due to kernel taint ... Reported-by: John Paul Adrian Glaubitz Signed-off-by: Laurent Vivier Tested-by: John Paul Adrian Glaubitz Reviewed-by: Richard Henderson Message-Id: <20200531110231.620711-1-laurent@vivier.eu> Signed-off-by: Laurent Vivier --- target/m68k/translate.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/target/m68k/translate.c b/target/m68k/translate.c index 0f80888203d3..c093f6c683e8 100644 --- a/target/m68k/translate.c +++ b/target/m68k/translate.c @@ -4936,6 +4936,20 @@ static void gen_op_fmove_fcr(CPUM68KState *env, Disa= sContext *s, gen_store_fcr(s, AREG(insn, 0), mask); } return; + case 7: /* Immediate */ + if (REG(insn, 0) =3D=3D 4) { + if (is_write || + (mask !=3D M68K_FPIAR && mask !=3D M68K_FPSR && + mask !=3D M68K_FPCR)) { + gen_exception(s, s->base.pc_next, EXCP_ILLEGAL); + return; + } + tmp =3D tcg_const_i32(read_im32(env, s)); + gen_store_fcr(s, tmp, mask); + tcg_temp_free(tmp); + return; + } + break; default: break; } --=20 2.26.2 From nobody Thu May 16 23:52:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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 ARC-Seal: i=1; a=rsa-sha256; t=1591111442; cv=none; d=zohomail.com; s=zohoarc; b=BXuT9XJoKtCwc+NKL2aDPy+qhyXP2uoT00n+P+sVnheRF+WVH6a8oKyG35dTn6pTRSxgu5i4IvrvxP8bKWY5b/Q1JcfrBv87juagmngIjpEYxHEyTXe4mcMm3EESUNIE9RCm19HfEIu8yC5ZtODNM2s+9XrbWkZQOAKpaH/Oj/8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591111442; 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=nHTS1w2BRYJnHGHnOvRcUJJmAxtluutCA9Znamn25ZM=; b=QsWq9c2JTHDTNJqDNVVRfG6uznFK6mo3ZjfYARaz06vjuhSstaUVcvB2AVB+eV5nS4s4d9qBsmFxDo/7tF76fzvNvZEuTTV2H8lSofTCOsqfRsLyzc/h3JznjDYaqiGw4kgKF7Pp/Sy6hr090KLKSxPWjUn7AR3IEissSo5GDrQ= ARC-Authentication-Results: i=1; mx.zohomail.com; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1591111442074833.9432469241732; Tue, 2 Jun 2020 08:24:02 -0700 (PDT) Received: from localhost ([::1]:58724 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jg8lk-0006yS-Ut for importer@patchew.org; Tue, 02 Jun 2020 11:24:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50268) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jg8jc-0004Zi-FJ for qemu-devel@nongnu.org; Tue, 02 Jun 2020 11:21:48 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:56699) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jg8jb-0008GP-Ax for qemu-devel@nongnu.org; Tue, 02 Jun 2020 11:21:48 -0400 Received: from localhost.localdomain ([82.252.135.106]) by mrelayeu.kundenserver.de (mreue009 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MVvCn-1jWPS62lyn-00RmiI; Tue, 02 Jun 2020 17:21:45 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 2/2] target/m68k: implement opcode fetoxm1 Date: Tue, 2 Jun 2020 17:21:35 +0200 Message-Id: <20200602152135.774894-3-laurent@vivier.eu> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200602152135.774894-1-laurent@vivier.eu> References: <20200602152135.774894-1-laurent@vivier.eu> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:wGgm4wo+FhCfaDRFvdtWI7upNhydgEkGR4/fcVgLHGP5xlH/CL+ 4QEB0My3usX0blwNpL3lAJQaIlt0MOILFhPteiN6mf8rcSAfFpyMS6bfh+GQU9nVX+RZp+o xhW9ZqsIoD8sQAG8T97kOAHdCaRulTaXo0uYgSm302BhMRk+RLmU7tueg6YYetUVnENXyT5 lQzpLSeSJyMgBuLAeOenw== X-UI-Out-Filterresults: notjunk:1;V03:K0:mJEJ9SBE/F4=:b5dsjvjH6A/WzKH3d5WCma eHUI1Cwdrn7oS7zJbevFbwO0ViLW5AK210yZHgtYqilM32m8toulVlMbAy/wyBRtO/1sJETGf pQ1VYehragzIFE2rcj2P9oRCXKmJNbeRiLnM5v6nk2sIkD9+INyJORQTdjdIHlwFbzDPPqihc anvm7YIcgZjwFeTxFTW7KHjlcAdAIQdzASlcWwCO6zTL2re8WcrcNLXAu/htufwqe4dTbOeeB XD4S3Ab5glgCE8oDKn0pcCbWxniPJfrUV+aG3ju9KKbHHN00u9FaYlFhKHhg3q0I2lhN04wby /lJ2n8pUdFftEJ7XknHOGHbFIdhgOL+lSN6wz2rb1Pot19z9oN422LSpemuaRuco1qLWgkd0+ IQBwWI4Pg6yYc8lcQmNrvBHP395/zcHGYPCGyiuC7Fc0EtDNBtfpl2nE5vIbSBFvc+r++I1NS tHMj4Yvw7OHkS+ZlZZ7UNyUWFs3kYOuNlZ7hbYdEa/21FDtWEOiGjKOnWZ1N/Fx8MCtzspmkz 3ieJ7VSXaidfniqhnGplo8f+jzNOjYFv3QDKh8Pq4w7M/wpiUoTDUsY0ccuCJkeLL0ctFxbJj X6HTbRsMLkdxy/Ol4FFFKsTrvX1rXdXdxeipAapnfrT20ZjGKq77T0zG9hkZHf2zhVEtElTv3 erLXpMHj15UQQMvHGu+Y6y9bTAhjsE0vZ1gV5rxepJwsuFYvnUIyo3bswnNp1UlakdxnDOV4D ZOiqm11jADpUo8d580oqXG7JWNBoPp5DGmL/uy/4c/9zvi9m8xGdNUhUZgsRYu91plFGIHlFg QqQVnqZDRIdiReI/UVJ29rZVR5s+AFq3UM8VAwqvbvWGUIh4NIn3DZs81ll+tmqwe56nIA+ 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: none client-ip=212.227.126.134; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/02 11:21:45 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson , Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Example provided in the launchpad bug fails with: qemu: uncaught target signal 4 (Illegal instruction) - core dumped Illegal instruction (core dumped) It appears fetoxm1 is not implemented: IN: expm1f 0x800005cc: fetoxm1x %fp2,%fp0 Disassembler disagrees with translator over instruction decoding Please report this to qemu-devel@nongnu.org (gdb) x/2hx 0x800005cc 0x800005cc: 0xf200 0x0808 This patch adds the instruction. Bug: https://bugs.launchpad.net/qemu/+bug/1881450 Signed-off-by: Laurent Vivier Reviewed-by: Richard Henderson Message-Id: <20200531131951.631902-1-laurent@vivier.eu> Signed-off-by: Laurent Vivier --- target/m68k/helper.h | 1 + target/m68k/fpu_helper.c | 5 +++++ target/m68k/translate.c | 3 +++ 3 files changed, 9 insertions(+) diff --git a/target/m68k/helper.h b/target/m68k/helper.h index feee7be62655..77808497a95c 100644 --- a/target/m68k/helper.h +++ b/target/m68k/helper.h @@ -83,6 +83,7 @@ DEF_HELPER_3(fatan, void, env, fp, fp) DEF_HELPER_3(fasin, void, env, fp, fp) DEF_HELPER_3(facos, void, env, fp, fp) DEF_HELPER_3(fatanh, void, env, fp, fp) +DEF_HELPER_3(fetoxm1, void, env, fp, fp) DEF_HELPER_3(ftanh, void, env, fp, fp) DEF_HELPER_3(fsinh, void, env, fp, fp) DEF_HELPER_3(fcosh, void, env, fp, fp) diff --git a/target/m68k/fpu_helper.c b/target/m68k/fpu_helper.c index 36e6c704d1d0..9acf60dfd443 100644 --- a/target/m68k/fpu_helper.c +++ b/target/m68k/fpu_helper.c @@ -641,6 +641,11 @@ void HELPER(fatanh)(CPUM68KState *env, FPReg *res, FPR= eg *val) res->d =3D floatx80_atanh(val->d, &env->fp_status); } =20 +void HELPER(fetoxm1)(CPUM68KState *env, FPReg *res, FPReg *val) +{ + res->d =3D floatx80_etoxm1(val->d, &env->fp_status); +} + void HELPER(ftanh)(CPUM68KState *env, FPReg *res, FPReg *val) { res->d =3D floatx80_tanh(val->d, &env->fp_status); diff --git a/target/m68k/translate.c b/target/m68k/translate.c index c093f6c683e8..3fc67aa45261 100644 --- a/target/m68k/translate.c +++ b/target/m68k/translate.c @@ -5160,6 +5160,9 @@ DISAS_INSN(fpu) case 0x06: /* flognp1 */ gen_helper_flognp1(cpu_env, cpu_dest, cpu_src); break; + case 0x08: /* fetoxm1 */ + gen_helper_fetoxm1(cpu_env, cpu_dest, cpu_src); + break; case 0x09: /* ftanh */ gen_helper_ftanh(cpu_env, cpu_dest, cpu_src); break; --=20 2.26.2