From patchwork Thu Jun 2 11:58:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 578093 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5806:0:0:0:0 with SMTP id j6csp468779max; Thu, 2 Jun 2022 05:00:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyI9Xix/fZT4tX7lHp22JrDn9f7/tnGTF1F2D2TmQd8mSR6hQLYuA3PGKHJogYfZ/htM5B4 X-Received: by 2002:a05:6214:2521:b0:464:4793:daf7 with SMTP id gg1-20020a056214252100b004644793daf7mr18678951qvb.115.1654171235995; Thu, 02 Jun 2022 05:00:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654171235; cv=none; d=google.com; s=arc-20160816; b=0fxAm7p9wDThjioXTY4MYk9tq8EGU6ncxc7sHzaXBOQ3+stVUkZCHLojufLmXs1wb1 sSmZxOdbWtzD5Geo0UAsQmomN57cO8NSlJz7P2UHDTHZePsWz4vPXHLAIRBcxFD5J+xn +yqLmhi66TwX1M5iNQoK+dr/aepiERLrqUgMa/8xt5y9l5XQCwtzayERhc9OH27dOeqZ gRBQ17PPH/u6LZKuzTQdviGKloEqfly5/i3klPaSGcnBaY6hGItZakNyui5uNLItuh39 kpFMn1k9HPHRPXP1a5wfu2nWQdiE15BBwew48YSq99GPUvBcgiHrEnNGXIL7Ervz6ycS kC5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=LJ0TWCCI8kOLR9ZSea9wH/f8OauH/bKRYood5ZMbMJs=; b=FFr9FObEeQeiMpF7ZOmX/PrFQ4NC/gQRSqQkkRhimyg1eNJnZyk49P96YYNic8hwsD +BS9GbAbCrNURoDuTHvWRp4mwuNRl+avnNq+wh1xfEebO1Pln7tFv1zIcWJgNX+G+jky 9Bqos7Bu6878A1mO5seuZo+Q5KwlLvx7AJ3RZnLSJ88iwxtekKh9cXhBTwAq6anikHOe 7/No78qcmB5hv2zNAoVvyBFAWyRk0qfS/qh4zsengZ1MmPFn5sAUdXx9e4UllaQad1Tl fIjCVzXc7GkkK9CR2KrBvZChYc2l55K5zP7omZmWZJXpj5y5TuRXtOVXkt8NofnKIxSC 3QNQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id t13-20020a05622a148d00b002f39f798a13si2145533qtx.721.2022.06.02.05.00.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Jun 2022 05:00:35 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:57618 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nwjVD-0000Uc-72 for patch@linaro.org; Thu, 02 Jun 2022 08:00:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46822) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwjTQ-0000RU-GJ for qemu-devel@nongnu.org; Thu, 02 Jun 2022 07:58:44 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:37629) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwjTO-0001D4-BF for qemu-devel@nongnu.org; Thu, 02 Jun 2022 07:58:43 -0400 Received: from quad ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.183]) with ESMTPSA (Nemesis) id 1M7JrG-1nrFpL3B8O-007ja8; Thu, 02 Jun 2022 13:58:39 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Laurent Vivier , Richard Henderson Subject: [PULL 01/19] target/m68k: Clear mach in m68k_cpu_disas_set_info Date: Thu, 2 Jun 2022 13:58:19 +0200 Message-Id: <20220602115837.2013918-2-laurent@vivier.eu> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220602115837.2013918-1-laurent@vivier.eu> References: <20220602115837.2013918-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:9YYpO0UbLK2qUfZGGPz8V4GgQwOo1/v8LOsqyH8cqeaa1MzHvS/ WZ1kIbBrmZJnqmdhluSQ5fF9H+RySHao9wAxqx9k0i/WegCUDVlANvVJLwCS3foRmVijiOT fgX1LZH30lrk1I7iYx16kzlEvE6f14j9pdcNmkyXmUUEu9gLA8PqGz8M9xbpQZAhrVVPDn3 ceBi3DmTRxXhyOh5k5Xyg== X-UI-Out-Filterresults: notjunk:1;V03:K0:mgufHukKBHQ=:H1SGxwLPYKSj2NwZgTRSYV ZCFsoIZdRMfk6DjgmQQ+YjXU0OF5PAfXZgyhStJeYnxR7Q6rbGrLQivgAY4tsVb86r0DZeFIJ AhTlxVm/gGPlSyBBBBEpLEUn6yW7dQRghtFbuOR5cDtRO3XLxyjEWcs2XwHQb8722+GulkcX9 cDFy91yGQ+N9GxsKozOaw6XYmh3twDJbsSaFWEUFbyPBxDZLUloKHgapqv6rQH1FNt754mCl0 /1rkzu5BnjgtVJgt1vuV8cXUy4gWu3V5cxmZSknAng5klq2ZT4QlFkoj6GUxeFHx/LMomzPzb /2VfO03inRr2jmf+9kspv8vnT8Uj1i28j7m4CE44Z/RsFXgnZhpRAcUn23NRL6wwQgy2kava3 kXPMjFvtPee8T+zNjSW6lPFfbwczX8nzXEWEBC/AmxYu3x4t+tx0GkvWlPAGJnYwYfPweymzO rNqRB4vB9jCTNp4ftgz0d6o0IiREv6NHuv739M7YxNzPLoEAodfnOlNjch36PXwXaYtOif4ru V6/LT5RrNd5VlxuSRxUY2yHBE5r9bu9uJOoKNYUDOb6jcdeiZfjAN5Y4g1KCMBe6IVzbDOgas b7m4xeEfBB/iWWVMwqNsWysDZoMyA5PIfmBiGA9++Cl9T01V13wRya84N8n40tgiFmYQc3Xfz N0ofX/esvZG773VFeVWFoPymo5OtjgidYdjSX0ySkwT76hS3Ofhzj9vdsJbCdm9cqqnwY3PvK 6u0IOMqTHZbg0B8iO87/0/kOZOw5rJex4cf65w== Received-SPF: none client-ip=212.227.17.13; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de 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_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Zero selects all cpu features in disas/m68k.c, which is really what we want -- not limited to 68040. Signed-off-by: Richard Henderson Reviewed-by: Laurent Vivier Message-Id: <20220430170225.326447-2-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- target/m68k/cpu.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/target/m68k/cpu.c b/target/m68k/cpu.c index c7aeb7da9c42..567106792377 100644 --- a/target/m68k/cpu.c +++ b/target/m68k/cpu.c @@ -75,12 +75,8 @@ static void m68k_cpu_reset(DeviceState *dev) static void m68k_cpu_disas_set_info(CPUState *s, disassemble_info *info) { - M68kCPU *cpu = M68K_CPU(s); - CPUM68KState *env = &cpu->env; info->print_insn = print_insn_m68k; - if (m68k_feature(env, M68K_FEATURE_M68000)) { - info->mach = bfd_mach_m68040; - } + info->mach = 0; } /* CPU models */ From patchwork Thu Jun 2 11:58:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 578095 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5806:0:0:0:0 with SMTP id j6csp474577max; Thu, 2 Jun 2022 05:06:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy1rZjjgNVBxbgpQbI8DtqXe1auIQ8jLkXQM1MbV1IvFmDB/soRRoXH9RW7pIy7MBAwrh2H X-Received: by 2002:a05:6214:1150:b0:464:4bd3:e931 with SMTP id b16-20020a056214115000b004644bd3e931mr3058567qvt.32.1654171611395; Thu, 02 Jun 2022 05:06:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654171611; cv=none; d=google.com; s=arc-20160816; b=m+qMuVTxI/pZi+M2cIWzmwxxnZ3H9tT0Zixj/H3BZfqQRQYJ+SGrODLG6vHmXJ5VKS kwuTVuOuDtXbQbzLjLSdSp8ZXoXt30uUEQcf4dGVYAT//5W1C0vtCT9KdOrAgpKFpreI pBmnwIh2lFsFToq0dUtwVUqf8Pcbhe4iDzq0Ny1M3zpeRc/v2876qexkFPbTI94EabJI +hrvb98J9QImD+P9H/16VsSy0/ALzYZiDwIzkNsU3HwHshi6WzYkNZ4YzkDosGpXI4rU SvXvw8EDso2bBQOkxmPLTCdO9twvpjSCCLaW6FNniAffDaqxyX33r8FNjtZfdBo1hWoY WcDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=CAyNZFzTrJ4f0TJLmwsJqyYZq/jf+gi1auPH/JRU4lA=; b=uigJvnFnjLQOCaiI5uE3G+4aXYkZCvP2JgBae3Y/HNohe++I5yHDxOCaXH/9d9Ux+l 2jP0ZkHvBUto4jEk/w8EAXdg2ucsXHpelnhToQu34Xc3qC3IsksiemetkJJUdmHZB0Ca NdFCMTfrcIxeeU6frlAmEXYYEZrHy+E4Xx1NMJUtcdBj2npAbGv8Jz7waLJoHnn7jIL5 Y8VahkD16OGN1nAvvhPJJ8tZcAxhbAavVyn0xvDbO2ErZm4+beaRgcRyI2r8ejHFXpKR h0M03GKhrEC3NbRSzRAgUzfusaBYvRhhMBb093K7r9lXs+Ed2hT5L2uzALz52QRXgYaV ucsg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id bm3-20020a05620a198300b006a328d98cfdsi2440249qkb.65.2022.06.02.05.06.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Jun 2022 05:06:51 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:33564 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nwjbG-0003Un-SI for patch@linaro.org; Thu, 02 Jun 2022 08:06:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46840) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwjTR-0000Sp-4z for qemu-devel@nongnu.org; Thu, 02 Jun 2022 07:58:45 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:40993) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwjTO-0001D6-Bj for qemu-devel@nongnu.org; Thu, 02 Jun 2022 07:58:44 -0400 Received: from quad ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MEV7U-1nzTYI0gVG-00FxJC; Thu, 02 Jun 2022 13:58:40 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Laurent Vivier , Richard Henderson Subject: [PULL 02/19] target/m68k: Enable halt insn for 68060 Date: Thu, 2 Jun 2022 13:58:20 +0200 Message-Id: <20220602115837.2013918-3-laurent@vivier.eu> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220602115837.2013918-1-laurent@vivier.eu> References: <20220602115837.2013918-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:WE+vm4POpxuT/AcqBQKdjScVPfqJyL364Er30eYxC4Qpp7IR1CA Rvy07CYmmu/y9AscIw+u4e+d/2LIqRIkQuS+6eiovgH6gp/C000/Ebu5WA8ZaUfBNNunoNl lxsA3JFpe0qfnNPFMGeX5zYBqGmRbWk5zUj5fRndH586b3q44jVRWtMm7QgjaZVR6gZb2Ph WBbYiDGs9fJwtDsfIOf0Q== X-UI-Out-Filterresults: notjunk:1;V03:K0:ZjoRdlo9Ows=:rWADOVKFsyfZL2DR+/zrVf FzS1DSOXwsnrPz7hMRmjiFt5kxMKDgKFL28zoii8fL9hlZ+MfMy3J0spY3MPm1fyLfy58aYjf V+Il55MqC4Y2kd5pNKVuwq9k1i+WJIgtrxFIChZAaAP61Hi+2fvwHx04pRJ2MVR44osPkvbgP ILq/QBwWoWG95RwvK86u5DFaUbwPpPqN0/f3nKad/4oxW1lIyV1zHcttTlQzpztz2j7Rqcqn2 sJWtZi+afK0bigvUSe54MjhgTNYwx3OuRstrbRAdbJ6TJgzsukEm1Ma+V0DF4LPmejWN2x3On H6z3vDcamPqn0ibJ8sUAh8Z5Af4Y+2et4ggPhvmeWcGb/xIid0bwDbXGFCJXpYhA5C/T/9D2H anwW5jenZ7ISWIU7ixODizruXdbDsj0dk7TFhAzygCt7qL6nAQdwUr3hZ0TF64AgRi97a5dVv r7V4Li5fAE88INBYQsNUPXwncbUUz00IVCXkloJGE43hbn7apPHUh7VUUhjAXeUtRds/BfbNY XFSaxRB7SUp0SczwTWMgHwd/sdPP1r91NXthz9u6QzuOWF34TLiPX6EfWeuyI0PjzjVQ+KnXm TYrWa9uG7BCo6tJsR8sXamGEXHz4VRi8TEuS1I553ct9R/KXdPpwGcMytZEGAqGe9+cL7P5gU bQ6gbgO0ih9C3oTduov/GTAu3gK/Xveo+ZleTWvI8XR4853MbV/mfJKzLDpNR+b3g+BSokUc/ p85sbqSfLn6kmkXLDgbUNJY9yM6LN7KwHKlCgQ== Received-SPF: none client-ip=212.227.17.10; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de 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_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Signed-off-by: Richard Henderson Reviewed-by: Laurent Vivier Message-Id: <20220430170225.326447-3-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- target/m68k/translate.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target/m68k/translate.c b/target/m68k/translate.c index 4026572ed83a..e4efd988d2db 100644 --- a/target/m68k/translate.c +++ b/target/m68k/translate.c @@ -6003,6 +6003,7 @@ void register_m68k_insns (CPUM68KState *env) INSN(tas, 4ac0, ffc0, M68000); #if defined(CONFIG_SOFTMMU) INSN(halt, 4ac8, ffff, CF_ISA_A); + INSN(halt, 4ac8, ffff, M68060); #endif INSN(pulse, 4acc, ffff, CF_ISA_A); BASE(illegal, 4afc, ffff); From patchwork Thu Jun 2 11:58:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 578098 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5806:0:0:0:0 with SMTP id j6csp478719max; Thu, 2 Jun 2022 05:11:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxM9mPs62R8/DMNVtTC64HbZEx6weTZD5xBSQbZu5C73UO3umkxe16AJkpdvRgxsvaKhDbE X-Received: by 2002:a05:620a:c1b:b0:6a3:4dbc:e707 with SMTP id l27-20020a05620a0c1b00b006a34dbce707mr2671341qki.393.1654171872690; Thu, 02 Jun 2022 05:11:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654171872; cv=none; d=google.com; s=arc-20160816; b=z4tYa8gv6w76zELAGQLCQBVrOc5W1ccCos2dp1koi18qngiHMdhuc2EHcu8F5B4Pj0 0vrxzichkTMeOt3/XixaA+GOGd+nsESwSSA6y5BP6MDQl5AzXZvQ/KZeX9FZR/p9ggNa KNmPCNaK0mu6cZ4V8O6/doibcUs5xk/lc9xlAhKfWmQbyKrgm+gm0165WoH9WS901nMs swOdGEO86s6qEU/zzYYgDE1V4N0TUPoiC/egEZFxsQ+prLr3P85WIQiV1LONNgrS0TC7 szrO41gS0fIVbsPx52aiCotwJlYn7cQTKATV3AtzmLfXkbvISQqoskyE0y6VV6qCA4cY YxYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=u0QF+2DucTLWKBOYS3gW/gddzD8bDVaHvPB90+XG+F0=; b=ul8cwynKQ14WUa3UvSgAJIiIop92hmyPiswZq1Qyn5E+08NhEFRxpCULA/YtNaN521 pInwI1f2B8KtsUODwHQloAYecZvD+T/oe6QDBC4LjoA4pGIhJXnccEfjcfZMi61Chi0k MBmmImhu2amvFsgiRZjNREJfUTAxmN9WeSYUlJWTWk+V2tztHu2ihA+pYbq27609Sirj Pi2iC0YnvwqFdjcvI9RVQwGWKX5b/a/hpvmCOOJqT5XSigD1mbfk2mT3xeJV8tHxk+qk I0HqltFvq0onB+z+R/qVZcJoPHSMxGjcpbnLl9BaDGikU7+jDKV0WoOphjJDsGVpFiPk qg7A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id h1-20020a05620a244100b006a67c66f084si545633qkn.653.2022.06.02.05.11.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Jun 2022 05:11:12 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:41832 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nwjfU-00019v-7L for patch@linaro.org; Thu, 02 Jun 2022 08:11:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46862) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwjTS-0000Uf-0W for qemu-devel@nongnu.org; Thu, 02 Jun 2022 07:58:46 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:52839) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwjTQ-0001DC-6z for qemu-devel@nongnu.org; Thu, 02 Jun 2022 07:58:45 -0400 Received: from quad ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MacWq-1nLl1u2Qwc-00c8yo; Thu, 02 Jun 2022 13:58:40 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Laurent Vivier , Richard Henderson Subject: [PULL 03/19] target/m68k: Raise the TRAPn exception with the correct pc Date: Thu, 2 Jun 2022 13:58:21 +0200 Message-Id: <20220602115837.2013918-4-laurent@vivier.eu> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220602115837.2013918-1-laurent@vivier.eu> References: <20220602115837.2013918-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:ltkQRhIAjDRTaKjTXT+IRcKvQIyZQsLXbUR9bDbhZ79QlzA6Q4m gB0AQaMf/3s0NKG/VvSD6eANX2L/uUX+nvGLfPSfMQCOL4veC0hFuDi1buNZtS/Yz3vpI17 u+YtGWIthZgFUkQzC1oorZRbXUkjj67P1B/0Pb2cpKd20IpwWRpgp+buOVk2j9snmb1OFhN 0k3Gt9dVFf1evam+NG8pg== X-UI-Out-Filterresults: notjunk:1;V03:K0:rajuMxlQMPg=:COhWzAfA/M6RrO2jQH0iqv 4jfxgAeixx48fK2tQ+hnyuLJQ34+AfafOT7LDYbk3Wlk2xKcgDVYckbHuJ/Xs3mmbNbfJ6HRK IHg+93U8VsVuD9MTCDXErkDseb+lnOIjMApBP96NOFRvIvxg2T8WqNhj34LofaYSUSIAqNqBM jt8IjCQmVY/+U19kieBAaou0IGJN5OB6fsEwnmDNXouiuQHcXBIFw6IuggwcYh63vA3J+SdHw HHMzxB9VfX3nLFYAFXjv31g5WrElk2Zc/jwMFxD0zxh1Jp84ABrR7rAwUVaGCuyasNYPasYMa vPLrOkVvrNtXkdi3WWT+4LNqfzkZi1CyzvYV5rf520n4p4cuWoaiphe9ic1Avly4mLSpiBtQH UQgpiQK11H+QxpB1uyiIfj3tmqG3BBwLF/Y6hdqFtigl4ckiFuLn+PGKpsnwYID4PotOAka8K aHr1qGqk8u1wQbLZoztl+i0HZkILDlGAobZGaDtuNYIaFZI3Gek2hJUrGbUG2U4HQWwHciH1P DFjm6OC+m2pgiJWhMtefTnGo/ucJBYvEHu8cFYR1V9TSZwdCd0q0vZ1N5CXg/aw5n1vztDF3s KdRJJTlEoOrWxggBvLPHA2emiciMqT8XYQG8UIRrl+Y0ODccTunCEYX/npWZToEGNon92sVeE 9+CbvqLkfEFuxIz2jVWqbDrscSvg5SN1daFr3mHQko+o9IfLJf5H2f3nqxWyRBA+CkEOthFxW EqzPVkyV7LAp4Q7W+2PpGjXQRv2/bh3O3ytfjQ== Received-SPF: none client-ip=217.72.192.75; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de 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, SPF_HELO_NONE=0.001, SPF_NONE=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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson 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 Message-Id: <20220602013401.303699-2-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- 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 d1bf8548b747..56417f7401dd 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 = env->dregs[0]; - env->pc += 2; ret = do_syscall(env, n, env->dregs[1], diff --git a/target/m68k/op_helper.c b/target/m68k/op_helper.c index 8decc612409c..d30f988ae089 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 >= EXCP_TRAP0 - && cs->exception_index <= EXCP_TRAP15) { - /* Move the PC after the trap instruction. */ - retaddr += 2; - } } vector = 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 += 2; - break; } } diff --git a/target/m68k/translate.c b/target/m68k/translate.c index e4efd988d2db..22e5379d3c64 100644 --- a/target/m68k/translate.c +++ b/target/m68k/translate.c @@ -4860,7 +4860,7 @@ DISAS_INSN(wdebug) DISAS_INSN(trap) { - gen_exception(s, s->base.pc_next, EXCP_TRAP0 + (insn & 0xf)); + gen_exception(s, s->pc, EXCP_TRAP0 + (insn & 0xf)); } static void gen_load_fcr(DisasContext *s, TCGv res, int reg) From patchwork Thu Jun 2 11:58:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 578096 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5806:0:0:0:0 with SMTP id j6csp476732max; Thu, 2 Jun 2022 05:09:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzX6dacqjsyYvseS3LoSnEM73nH72w7gYjoWp7i8aJTVGbdWL/5QbE0ro8Ake/ZHma2tuLO X-Received: by 2002:a05:622a:295:b0:304:b4fc:cae2 with SMTP id z21-20020a05622a029500b00304b4fccae2mr3232858qtw.217.1654171750221; Thu, 02 Jun 2022 05:09:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654171750; cv=none; d=google.com; s=arc-20160816; b=1CSNEfg5U540kTzyVaGrCWsuFITAGGQ/THD5TwJMKF6voISFcfj9Nm+6YsUULCz9Nm cP4GlaqCUL2jQqf9ygSRygqZia2YPJWOMr6vhVkARndEEIzLzwQRbclYGWzVcQ8uJ8Yr rRpvPpcyXYndpEVFFYuVGnmiOPMh2WauBBcmY00PbczTh20qDuSt1IUt/kkTYofCJ2vQ f4K+P6trkQoD2ClgmEImxrgrXhtJjmCMHiSwotm+LR4uq/RBinabEhms8R4EQP4LwwmG nCyT9kheH8OfVsfczHBXiiQjKp/Bt51AV90yO3qcDkkNv2cZo5hgiOtHBqqEipw6efun b7rA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=YJ0n6D789b5cacS4dNnJ4EKPaMm9LqP30YshHniopLo=; b=qzTllV5zGmPm4AmlTsekPMmXxP3Y+VHziDu1K7i4LWgzri7Gf/s8ej6V6leZp4hyw1 kflrZwxUQaXkeZNJl6X2iCd4cp+J9htQnAU3x4wABSVSLrgVGAMIl8c6NndI8FMj52ex vp6b3daiirsWtx+IssU9o4/1qYhimV0aXSRuhW6/FTEaJnfzvcBK3gRBy9PdO3+wiTp8 KSBNafYNl2RjPxySxXClc3qkvI+FeoZQyhgPTuq8Sx6XLOUWU7Xid5GLjivQ1fwcDV0j PW3SB2ToqIMD/mlsafR87XAdVJ5diGk/wc83vYjUJlmY/ef6l7w8ReKBu5RevX/Mn4wW sIIQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id k18-20020a05620a415200b0069eab0cc228si2242552qko.763.2022.06.02.05.09.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Jun 2022 05:09:10 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:37754 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nwjdV-0006mi-Qr for patch@linaro.org; Thu, 02 Jun 2022 08:09:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46916) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwjTT-0000Yf-EZ for qemu-devel@nongnu.org; Thu, 02 Jun 2022 07:58:47 -0400 Received: from mout.kundenserver.de ([217.72.192.73]:44991) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwjTR-0001Dy-OX for qemu-devel@nongnu.org; Thu, 02 Jun 2022 07:58:47 -0400 Received: from quad ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.183]) with ESMTPSA (Nemesis) id 1Mk0BK-1nTyDx0Jgm-00kMAq; Thu, 02 Jun 2022 13:58:41 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Laurent Vivier , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PULL 04/19] target/m68k: Switch over exception type in m68k_interrupt_all Date: Thu, 2 Jun 2022 13:58:22 +0200 Message-Id: <20220602115837.2013918-5-laurent@vivier.eu> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220602115837.2013918-1-laurent@vivier.eu> References: <20220602115837.2013918-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:3yy/6cRXLahJTt3MX413aSaYxSs4uxAnqC7280jofzISyv8LfxY JkJzon5lj5U7e21UtFV6Iv7NsQcJcQZBDOZcMCA0NRWaxZOeTyz4bpUOZw4zXPIn5KVmlXu vEmlj8TOa5HbGyEyOZZITK+zcJm8XqEK4o2JUBCJVb9Ek4NzjIOsr2lwS20anu14NNGWtKl vSzDfccZw+JPQGlhYtpcA== X-UI-Out-Filterresults: notjunk:1;V03:K0:tnIFgJhjMcw=:enrsHJTck8WR1NsvOqhQDV AL8QzDXCpPiWPZQhAYWLR70bjBXKfogyMRt6+KUqAYhI9JS+4lp45BLhe7ybLFU3FMOp057Xk pCr2xK1SHmYOQXvUYe0Uxkxf7j7a4rzF8iXACpPSrK0svtDiWOXVMW6Dt/Q99EQunGNurGCVz AqC8XyMT1KU6KzYRuRrv6lPCG/wbO/OrDLZtWZvL09p31OUTyN3ndUIOePvY7w9f13AMuNWqb /swPXCzndP+PrX3gwLUQp8lMfJbFI0d+GqzEgtka87Ga1WM3wfPzlyoKduCq+sMTk7VKVK1cR 2iJku8ETamL5L1K0t3SCJ8h/ZuXrgloemd93fKWCSJsOJAZV5ISTJUmWKOCoc9rE0BC7hDYBn drtyaTEPtGIUaTqK6mvIK0NkDWqwiN3zQkk5cVfybO1Sd96xNN1kh5qfVxHNPWCbheuGFd57U pPgqcG8UmNJNKqJOTtytHda2Aw7UC4qrv+zNtCNHn+Q+m1A0d76tJHFpH67sdjaVTX4SLAIPg w6ntxmIEez2bbDLY7aB5+CdFjPI1P492JD+c4lHKfmsP/zIahFUuCkO51eok8gN7prh6B35ST o47DI91Y4vygzRoRHxz58KPJx9/nra7xwSu55GaLMemI3rCqf1/LavsqQOrpYK1CnqVx/T8zh aqHW8HllYYAi4JP49hWYTtTqHqpju4JS1V4Gj7BvgwQJ4AjdBFBLYlSfXnO/D0/3gcMnvkMwE 9ZgFPojmwi8xYzmSFhldDlrnyNcpEgkp9XAypA== Received-SPF: none client-ip=217.72.192.73; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de 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, SPF_HELO_NONE=0.001, SPF_NONE=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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Replace an if ladder with a switch for clarity. Reviewed-by: Laurent Vivier Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson Message-Id: <20220602013401.303699-3-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- 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 d30f988ae089..2b94a6ec84de 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 is_hw) sp &= ~1; } - if (cs->exception_index == 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 == EXCP_ADDRESS) { + break; + + case EXCP_ADDRESS: do_stack_frame(env, &sp, 2, oldsr, 0, retaddr); - } else if (cs->exception_index == EXCP_ILLEGAL || - cs->exception_index == EXCP_DIV0 || - cs->exception_index == EXCP_CHK || - cs->exception_index == EXCP_TRAPCC || - cs->exception_index == 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 >= EXCP_SPURIOUS && - cs->exception_index <= EXCP_INT_LEVEL_7) { - do_stack_frame(env, &sp, 0, oldsr, 0, retaddr); - oldsr = sr; - env->aregs[7] = sp; - cpu_m68k_set_sr(env, sr &= ~SR_M); - sp = env->aregs[7]; - if (!m68k_feature(env, M68K_FEATURE_UNALIGNED_DATA)) { - sp &= ~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 = sr; + env->aregs[7] = sp; + cpu_m68k_set_sr(env, sr &= ~SR_M); + sp = env->aregs[7]; + if (!m68k_feature(env, M68K_FEATURE_UNALIGNED_DATA)) { + sp &= ~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; } env->aregs[7] = sp; From patchwork Thu Jun 2 11:58:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 578111 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5806:0:0:0:0 with SMTP id j6csp501038max; Thu, 2 Jun 2022 05:40:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwMiQ74xsTk7wq9vrClgi6nDflocVt2I0y9FPxUD0+emLInM84zcAXd3p2v0IMOrpF2FYXS X-Received: by 2002:a05:6214:301b:b0:462:5d73:3e6d with SMTP id ke27-20020a056214301b00b004625d733e6dmr38949090qvb.114.1654173615748; Thu, 02 Jun 2022 05:40:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654173615; cv=none; d=google.com; s=arc-20160816; b=WDXm03Cuq7hYOANcm0CbbrIC+z+Edoq2KoTZtnuzxUpIe90bhVQT4hYkMvRS1jNVq8 AAjLhxEgnQqz4bGZuGtF7d5dWnoNkhOgy1raNpOZltjbYI5DBEmKl7PoLorKkGtA42es kzn5uhxlJfE8mlwEE6tuKIG18cX89vC5pNb7WFRjjtvKW/jIeTcVn5uPGpQ1hBZdLHO1 zb0A3LbqWGl8iR1uu/7b8f3m4nBo3Vf3UY/sjD3HHf6u8BY8gNhPB2UuEaq4trwIMaN7 Z/pClra+dpWeD3tc5eV44js89MgwVLGSqnhdsiCdRvH1n8DJnaW9LIDC2/9Iztu2BV6S bbTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=YXGeSST9Ofa/LUdyDFbNMXWsoXNI/iBkynvqPZH9cCQ=; b=CE6/y/flq6k+eDhhEc+N6oLOANValLT6U53AbQrTUvhGaFDQ3PPn5qO3VI38/PV6q6 LqbGhNF5Tn8xzzQuxaiPlKLqEIe8r0a8wOM8BqaAgrMOzSSV5WVyidLq3C78S5kqXsYA kRnBOrIwL/FsL6fJCdyH4S6MQHhjtx/Zyc8kcAErXEqAj9OKYmJNs/8WPgK3gSV+Krih yp2bcmtVU6zGOWN7FJUerKXYYLocaxwE7bdmxz3jISso+HxglojnpgeqL19PxT5JlbGU Grs3+PX1xq8suCkwgU+lAWzAfcWSnPxQ2dyszzxLeuhZ4zfBHlZaTphUIe4n1Z9NDwkn zNpA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q18-20020a05622a04d200b00301b64dc7dasi2278467qtx.674.2022.06.02.05.40.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Jun 2022 05:40:15 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:56714 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nwk7b-0005fr-BV for patch@linaro.org; Thu, 02 Jun 2022 08:40:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47032) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwjTZ-0000or-61 for qemu-devel@nongnu.org; Thu, 02 Jun 2022 07:58:53 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:51931) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwjTX-0001GW-Ja for qemu-devel@nongnu.org; Thu, 02 Jun 2022 07:58:52 -0400 Received: from quad ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MC2wN-1o4fxE2OSL-00COGj; Thu, 02 Jun 2022 13:58:41 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Laurent Vivier , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PULL 05/19] target/m68k: Fix coding style in m68k_interrupt_all Date: Thu, 2 Jun 2022 13:58:23 +0200 Message-Id: <20220602115837.2013918-6-laurent@vivier.eu> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220602115837.2013918-1-laurent@vivier.eu> References: <20220602115837.2013918-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:S55jd4+FUU0Vu9TAGkeOUB3CV1u0XwpWiXYOfZy19ai6P5wpb/P MMJiq2Nj0Tl5E6JUMAmBo4CKNxZRLUqTXA23fJ5ZwWKtESsT5PJVxLhlvHWTEh8Lb5Vx50W vhszdFW+seo9bnYmTAejVGvOCkWyRWZOng6663MQQDqnDBmD6csGDpvHYDySVGaRxxsCbYa XM+92adDTGzr71F+0eSmA== X-UI-Out-Filterresults: notjunk:1;V03:K0:Gjdxg35eqg0=:bsLqbKjB79LAKo5EXwgCmH xeovS/c19ZxfIO9tcyz7SlSs4a5v4ldj8QnVcM8KKqTw8+7IVFR2P4u9wJQvErZudQtzbL4zo TupvDjCa2VfSKqHoExvwOWiKQDX68opFxbAiAnP148gcurOA8NZvhMUZZPfcqgrTUxe0PTXqq cbv/LJZal9b9S1NUndXfAsitJ0m1/YcL2PiOHYnhZtTu+n4Slr4vb7YaqnFCI1YDF9+/PmLpJ fu/PkrZOPYbAzlry8zillZXGC22RXEVsro5wCJE2Aeem9MP+JSikZRl6VwO4mXor/cp/KaBlT Drpw8w+I0NUWvbwfpSHs4dKmc0SGSjVKn3Ju0gt1qGOpDA1+nMm9hOAnc88yFjEEr2wg79vne xogyUbIHjCg1GfSfq4fdCKo3haJyEh9aqOKcQ47qU9kqfkBTocMEx7pTYUqE4Dcjg7k1JOoc5 twfBhUujH2lE+2TdeuHpiXTVgsZccmRZV93w9mj7GcAHJlyTqKqp4IHvNT7sMCwQyN4HtEkig LaW9poppH7jr1EbFUqLZvO9+9xAkY/Pgm41ZI85wjg40Xb3xdEKfvlz8hrTeNLcd67VAvuKne 7HatHPig6QZsdn0L/y9CmTkbnnrGB9oxffrJl9GjEh+dhEB4xgHfU8uK5PDNtyPunpC/3iq0x Rjn2xovpQ1sKS8VFy0eEgpSag8IZ4ONdGnk+NMrPiKJRtVN2HCQPR9TkHoGpw5pDSXv34mlsd SohIsdJi0AjNcd+hHPOKs8Wxab1u/ldJowYOqw== Received-SPF: none client-ip=212.227.17.10; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de 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_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson 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é Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Laurent Vivier Signed-off-by: Richard Henderson Message-Id: <20220602013401.303699-4-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- 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 2b94a6ec84de..0f41c2dce3cc 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; 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 = sr; env->aregs[7] = sp; - cpu_m68k_set_sr(env, sr &= ~SR_M); + cpu_m68k_set_sr(env, sr & ~SR_M); sp = env->aregs[7]; if (!m68k_feature(env, M68K_FEATURE_UNALIGNED_DATA)) { sp &= ~1; From patchwork Thu Jun 2 11:58:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 578094 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5806:0:0:0:0 with SMTP id j6csp468795max; Thu, 2 Jun 2022 05:00:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwHFw6YvyLbHn0eX1z9mzxHLY07+RmsJQAKic8OlnSDOnBcTZ/tLTJkKKlA8+ZIElCERTot X-Received: by 2002:a05:620a:2892:b0:6a6:3e04:bfdf with SMTP id j18-20020a05620a289200b006a63e04bfdfmr2647142qkp.653.1654171237308; Thu, 02 Jun 2022 05:00:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654171237; cv=none; d=google.com; s=arc-20160816; b=MYH08hLqAWOOiVyzD9xbkf8DNdDjzAqNbzw24901TAkMeqH/oZ/2DD3qyVwKm5fwu/ 0NdNYqM7iy1Ut4ZRE+ljnQfKlLsGCAnocDPkpqIlPsuvmwNfwX1xQ6xvqGkeftOtRYJl rDHIOwSMvUtl1bqrBzKkwwGSIzpujtNLlS0kkmRQJLwJwwS9guRu6AjeEyiGn9zgAVRO ovI+5iKtP4ixuVThGlPjzSGM+Yj9GMptNXdTa4agdqL/zPZ8Fyoj/foar0cbTptNplIR fRZCO4djzvU3J5Td23BsIkst1ImWX1OwX9imSUmYcUJpq51hQtEn69Cv08dqGak7JxsI HHVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=gGjyR7zBAuf4NiltiLv9mXNwBDATnGY9QS2WY/4maZw=; b=QL7RIVL7jBLxKtQAMZ7ZQTohFb6wzzwK7LbT56YAtYGU5/YFkwoJ+h7PPQI1RspaQy aRMYoXsSPadjqS2zad0qjISCIHwRPGGBUceGQIxYT8G3JgIiZu7Q4F3F+cxW6ko5GzQn ygZfnbG2q+7RINFhhAvL9p1RH3viB0xD/2+fpZgkfJUZ4OwRxv/BA+8AOlji9iQjIULZ SPXVIjjpHbvn7OnStcGsjxCqvNbEFMEqpEveqJe9JzqbltMVRm8SJYCjCluaptzaXxOk fFKtaWDjkJbbsDuWqDHtYq/h41ef7nHS+/8IOYQaraOyJdylQA/DJNLu7U5UyAzuzsQi +XYg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d8-20020a05620a140800b0069f92e72e59si1997970qkj.383.2022.06.02.05.00.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Jun 2022 05:00:37 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:57712 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nwjVE-0000Z7-Kx for patch@linaro.org; Thu, 02 Jun 2022 08:00:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46872) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwjTS-0000V6-71 for qemu-devel@nongnu.org; Thu, 02 Jun 2022 07:58:46 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:33543) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwjTQ-0001Da-HD for qemu-devel@nongnu.org; Thu, 02 Jun 2022 07:58:45 -0400 Received: from quad ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MiakT-1nKw4s4BV9-00fhkl; Thu, 02 Jun 2022 13:58:42 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Laurent Vivier , Richard Henderson Subject: [PULL 06/19] linux-user/m68k: Handle EXCP_TRAP1 through EXCP_TRAP15 Date: Thu, 2 Jun 2022 13:58:24 +0200 Message-Id: <20220602115837.2013918-7-laurent@vivier.eu> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220602115837.2013918-1-laurent@vivier.eu> References: <20220602115837.2013918-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:S+pnPJHyysi4eznHgu74eOFRdnIExZsdv+STBbocPE02m34jMHU zTk+xl0b9sqp/EPMBaVpndFrYEx3bYe+HwCHxiLnjn0nNOrczQR8qBlBQGP2sHvGf+y50K0 meJ17thJYbIrxfPWF1tTX6Sc3E0LzgLxu2SsdbKc0Ihfm3yPicThaRZg8oWVshystsSO7vx fe9m2o+uJQlwYKgcoeoPw== X-UI-Out-Filterresults: notjunk:1;V03:K0:8VFCskYE41Y=:qOpR1qQLc+WpT/246rTG9C SFpWBh+uk/m3ek13+XQK4AKpG48nEuU69mty1pwh5Y5UJAtzp9Ag/6sHN/Wn2ykmuijX7Z6Bx 4H8LrEQxNtNYRs/yeFQEsG9QCPCdtt4dGWovbDA5CbsPkCxPgkDYMVJIIuME8WTPQo6SwfNh4 jmJzx5XPjDrF1mDCcl47SZVMyEKDVPy9Cqqikdh+6pNpGx1mNrBwTdB2EIy2x3FCJz/x9tgM5 T/a+DwtQnYCQcnHlMaRHPbJkqXQ3gyXD+u3zcWfgYCVHg2jeZjBaGAqaQ0zu+wN3bsoPoqmnB RBEVFaZM4E+z1X8cjhKysAs6rxjOo17HHf3tBrl5Y14VaYCAHrxG0OrN/Rz9+3ac8kVVkE6/B ifFi+mNHiOEtvCtT5NIYJILfDdz5ZqvTorRMlULBS1hIrel+dF99c4y5WA3nm7RhIp5pWpejh IJ4pZNDSY51bVV4xwHE5iy57qGRCiYm82yM3OsN+y2VmqRy3E4Fp0K7KyeylNcsUUJt9SQfkg aWIVIOpWhU2iZNXwC9AvoFk4hSSfj37iULlNZqtwIJWBDOzzZMdVk+BO+yKe0IZwiz8pBMHNk AmBuvEnCPWQIyMxuqGzC9UWwuI+WkloB5HmDjspbLgjNukadvW1Y1zVhY3vpJVzoQsoCk7G/B aI3E229/cWN/Z4t+Xs0YxD8o++BwtUi6SBjkF+tI/Oi3DVnXTVusakl92MzAYlzoosxc0TQsL sbYIAixR+IwUXiiwUKazVmnUumWprjXeZQjJkA== Received-SPF: none client-ip=212.227.17.24; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de 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, SPF_HELO_NONE=0.001, SPF_NONE=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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson These are raised by guest instructions, and should not fall through into the default abort case. Signed-off-by: Richard Henderson Message-Id: <20220602013401.303699-5-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- 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 56417f7401dd..12e5d9cd5363 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: From patchwork Thu Jun 2 11:58:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 578103 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5806:0:0:0:0 with SMTP id j6csp486451max; Thu, 2 Jun 2022 05:20:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzMSNI8R9VIeUuURNF+9b5IElOMPBt9cfNg3Adk8nWLhm5BaF8Du2S21e5VHpLMzT4Of8QH X-Received: by 2002:ad4:4433:0:b0:464:4626:7a85 with SMTP id e19-20020ad44433000000b0046446267a85mr3161951qvt.52.1654172447921; Thu, 02 Jun 2022 05:20:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654172447; cv=none; d=google.com; s=arc-20160816; b=suDVsYeEmVwtqDSz6HrkYCKghzbOY+ADpxNgoX5wLqONBEYjR6Etpx6ceYBe53+ukG j5mJ5lFOeEBzr0ZzMEzbkGpw4QLm7yPaifUkVKwlyIJxvNSv5736RBpgWf3c1R5/V66k 6U6VMu4Z+ciNXfZso2tzqrFP48bSJfME0N6HKz7ikThOYtcMplyApcdrCrL+Rld8UQ5C euzGx/W8DvFxLowaRwBRTxRvM9Qc9zx3DLxKoza5BAPiYKfxt8V+0ZpqX7q23YvyUmGe lTUCpHfFOSE/eznzCxIM+6f5i0qK98qSVDymbMy7BPcoa4AaIKVxbVstLFrRR0pdo+Wj cCxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=wZ8BpI5uSvvctoNoaOogRvabeitk0qodUfcCQuMtwtU=; b=X0i/fMQ6DFBJDiRis8hKwfVGxR6hdMc3qOskdA7qlLkb7JL9tMoRGRm5XTEJXQSjcb 6lwfNDY+of08l7Xd3e3yGbSPe4AShI79zNqrbMYmZti0B/UKgVHIazlpKO2Wy+gJOFCB txaKlFiXgPdRDogLmTD2dpofJAN6l3fiNwfRc+NZ3yWpdHFkUkmf6F9MfpM+UoS/uhzp eYCPtj5LTGT1UYR4JsWmbMh6tc+XjD18PD4z9sl6kW9DJQz9CiPI5gFUizV2AqSQIelZ LY25zTppi3Qcyc9XaWBgSQ5HWYX/lBXmoma4X/jNrBLvCUZkv6lD0ZmNF2D5to63PV2X +nbQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id j10-20020a05621419ca00b004622c7893d1si1834342qvc.486.2022.06.02.05.20.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Jun 2022 05:20:47 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:50500 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nwjok-0007X1-BS for patch@linaro.org; Thu, 02 Jun 2022 08:20:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46954) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwjTU-0000bM-Bb for qemu-devel@nongnu.org; Thu, 02 Jun 2022 07:58:48 -0400 Received: from mout.kundenserver.de ([217.72.192.73]:56375) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwjTS-0001E8-6w for qemu-devel@nongnu.org; Thu, 02 Jun 2022 07:58:48 -0400 Received: from quad ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MKsf5-1oDZuB1zDx-00LIFh; Thu, 02 Jun 2022 13:58:42 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Laurent Vivier , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PULL 07/19] target/m68k: Remove retaddr in m68k_interrupt_all Date: Thu, 2 Jun 2022 13:58:25 +0200 Message-Id: <20220602115837.2013918-8-laurent@vivier.eu> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220602115837.2013918-1-laurent@vivier.eu> References: <20220602115837.2013918-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:q1sjSe+GkGOoLn5SpR62FDp5/1rKAfDn74SyKr5evD+4lhcX5Pd xZfGAhnr42NLWnRGHF5WU+h30xWpsv5gxUuuh4WdfxyfsI6TRvAo76OMwce1Je3hBRjOExO XeLmofY4vyhoiLhHjth7vDKj5pyFRn+5Jx8bILjhicPkNM4Ey2kmJFlk/cIWS7GLUtvyF5S NqZu65HZSlLN08pCOuuuQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:evpqtX4b1Nc=:lrr91Yw8qWAJhByZVrs175 O9n77bFe49d4Q0Ykbl69Hu7XW8tKQYMcTsBJUKZ5RhwJ+uY6kUvPQAy7hdxx1tmRthajZDSLN 8uOiIEVpzJHiawGJcBt5CzxswKIzJ1Azqsw+mMYlpQcDF2B4G0eB8jIaBfcZAQMNbX8F65cjl HwOC8XjN24jFY04SduJl6dRdGy3HDK97YytgQwhOA4xLu2C0LUGzzJPuOTkZBBJezR+NaVUy7 W8z+4cEMZI0IYhdtOlKYgW8nakGSmj7zm1hlrsPAvX12d2p9aZsea5vuN8myRfeCtD2udIi8n LLccoeFCtCq1hEuiGzXYJpGx0OPu3VnNz/lnLLGuPMJJb2QzEu6Q6Gz96GYkkOfqla4hojte6 xgfQmGZcKRYnyI4iLS837/p2yhdJD4I6KamNxj+r3fq25RHysvTmBGuZ0ZV5iTQkuHk4VHEiN +FeYui67uBuNYitO/+yi41CtSzASi2OOohh3aGTmxbcpo4wJV1NB9cTg1PZp95jqcPHzgbZxt /mCNdG2DskFIAQ/EtLRgH2dShv5aEjmWaHfuOjRN3m1JcqiWH22e7ph2p245lmsGH86R7Xr5e ZpKktggtvOOGV2QceZ9Tmwrz9YydSpCCNv5aHJInp6onGH1WZYSxjZkvglkDRnaHCoiCzPkB4 hqlYHjKEKj5uEbk1vlU52da68z2ISamK/wxIAH/w7ZLE1onE9HqCNpaOZIxSja06y55m/Ql7r Np2OdIOZRTqZaI3w7FZ1LFBW6wKxwmLOpgDgXg== Received-SPF: none client-ip=217.72.192.73; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de 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, SPF_HELO_NONE=0.001, SPF_NONE=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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson The only value this variable holds is now env->pc. Reviewed-by: Laurent Vivier Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson Message-Id: <20220602013401.303699-6-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- 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 0f41c2dce3cc..777869790b66 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 = env_cpu(env); uint32_t sp; - uint32_t retaddr; uint32_t vector; uint16_t sr, oldsr; - retaddr = env->pc; - if (!is_hw) { switch (cs->exception_index) { case EXCP_RTE: @@ -385,7 +382,7 @@ static void m68k_interrupt_all(CPUM68KState *env, int is_hw) sp -= 4; cpu_stl_mmuidx_ra(env, sp, env->mmu.ar, MMU_KERNEL_IDX, 0); - do_stack_frame(env, &sp, 7, oldsr, 0, retaddr); + do_stack_frame(env, &sp, 7, oldsr, 0, env->pc); env->mmu.fault = false; if (qemu_loglevel_mask(CPU_LOG_INT)) { qemu_log(" " @@ -395,7 +392,7 @@ static void m68k_interrupt_all(CPUM68KState *env, int is_hw) break; case EXCP_ADDRESS: - do_stack_frame(env, &sp, 2, oldsr, 0, retaddr); + do_stack_frame(env, &sp, 2, oldsr, 0, env->pc); break; 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; 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 = sr; env->aregs[7] = 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 &= ~1; } - do_stack_frame(env, &sp, 1, oldsr, 0, retaddr); + do_stack_frame(env, &sp, 1, oldsr, 0, env->pc); break; } /* fall through */ default: - do_stack_frame(env, &sp, 0, oldsr, 0, retaddr); + do_stack_frame(env, &sp, 0, oldsr, 0, env->pc); break; } From patchwork Thu Jun 2 11:58:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 578099 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5806:0:0:0:0 with SMTP id j6csp478954max; Thu, 2 Jun 2022 05:11:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzgK/4qXoqvJf9WCpaQUc5cXgaDb/VNwutqw6TfQ3RQWAf9Vkx0UBYRbTfmaQUNWqEP1z6n X-Received: by 2002:ac8:7f82:0:b0:304:cbe0:caa6 with SMTP id z2-20020ac87f82000000b00304cbe0caa6mr3248367qtj.143.1654171887631; Thu, 02 Jun 2022 05:11:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654171887; cv=none; d=google.com; s=arc-20160816; b=u5JU9hPKEuN1uqxiSXmL6VewZs7zUpT0N9cYPMUV+xKg8WKV/5s/dcXlRmc7BVR5mP l70Dmhf7fAjyK1x0caE2eNICUzyRXNKumm0Bkxk0om8efGCvUpBwOXG5k7llzmosQgD0 /COmyN1p0TB/fljxO7gV0BS6I9TksE7GsOD8Ya8AKwVa63/Tz1D7vs9pJGUB5EczGsw+ n0flEDujsRdVC4pGA+8KCe22xdkLp7KSj/morqcZR/qWkdWnV7ooiGWI3zFQLlYEhEWM rAGHhEMWu0EWJoBiWi5eYGQ9f3oD2HoK7qW/LDI3FkJm1npeKPPYWFPTJ6RSJsVJjQ2I rHDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=MgOWkm9lnwXwN/8QV4yYmwMrlRUvUHV28taLdb072Io=; b=ppVWdPAfv0MK79AxQ5D/7FnImOmFa2/HuQdFk0ujMQAxPO7rr31o+zCr8mHuAPO1cn IJCRMYJwyrCmfam6CKOZfRO9aeFYyAmjFWrOqsF2WKfBQLes9ORpLk2jOTA0B6Ug5VKV V24onFHvfsnhTmIRGZgKf6blXzqeJiN4qHvCrl1MxsUmiA8iTSAemddHwb0D2abwbzjf GUeSClgabbXhrauv+ePMLQkx+/JFlyMqcqz0+N/+zKTYESj33huiCp4s9r2Smwfbt8MR wLrldY/ssE28CRk9DSX9WN4/pn3VrPDQ4vLXIRdiS0o4oSmE4EJrFM6o9GUeK4JdWSA0 tDvg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id iy11-20020a0562140f6b00b004644b74cd94si1764886qvb.477.2022.06.02.05.11.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Jun 2022 05:11:27 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:41932 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nwjfj-0001Dp-5T for patch@linaro.org; Thu, 02 Jun 2022 08:11:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46900) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwjTT-0000Xl-2Z for qemu-devel@nongnu.org; Thu, 02 Jun 2022 07:58:47 -0400 Received: from mout.kundenserver.de ([217.72.192.73]:37981) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwjTR-0001Df-5Y for qemu-devel@nongnu.org; Thu, 02 Jun 2022 07:58:46 -0400 Received: from quad ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MeD1l-1nPJnZ3nip-00bK23; Thu, 02 Jun 2022 13:58:43 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Laurent Vivier , Richard Henderson Subject: [PULL 08/19] target/m68k: Fix address argument for EXCP_CHK Date: Thu, 2 Jun 2022 13:58:26 +0200 Message-Id: <20220602115837.2013918-9-laurent@vivier.eu> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220602115837.2013918-1-laurent@vivier.eu> References: <20220602115837.2013918-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:WnZLBWQ7LjeNtl2oz0PAPlylRE93UJuVhVrCe/LcWs5UC3SopHt jeZH6ADRHay4qmMoXcSHlvhLwGmp+pb9Jhyhslv01ciWT4ZDFKaY5aTeIf13q8tQGUs6Obf OZQS30bhcMiLBlXjc7eJoVyAOcovR1Xc3SWUHe1gN61y9pvjpR6kB6bFZsC2ZqNWIJeudIl Tq9sYnlNW8JYNeuZEXt/A== X-UI-Out-Filterresults: notjunk:1;V03:K0:BUwLszaAd1Y=:r4zbB+hGInrflnqv7MC727 rGQpmOLaiAvQGvULoAd/zlTgT6yots3+Bx2ApOHtz9dk4Fx/y8J89UQliMgNmCaGK4Ors0lUg m43tfzS0mYsGsqN6hwqt1r+NiCo59/VsNLHwq5d8s1eDgszLM3vLrqVYyV490d0frTmeo99YB hVkVD5DQqKeMZRUXKBV7kbOQ32rzux2UMRdN5Of3lF8eM8Wk+FNaykwSGDQzQTlOd1NbLZdyV QvydcL8VCVGkKWEHciZ55REUrOKKh2oReoIzUYC/buGmaeaxtiBRNX8N5rLAWI+9k2RC9/bn3 f9aJkN6voGRG2NMNfh0ehhvhedY2KdSbMv3u8RKBiXGIvKiyaQANi5yvRWDNEee78YCT38200 ekJo0WCZ4OyhZ1/cISOgCG/M3Ga1xfeubyeIHn7Kf2iAqRGJC+HNDHmRUvc4GPdvxO7FH76rS cNjXfS2fRHdacLByf2ITiABM1Ddm/mgjekDczXW5HFP1KNFFeikToqiwrn+s7wOUSZtlvR2fT yfUj4bsDreF1tGnFom3unDRPa9CcaXbYuVbkE1liET2X6Kn0paJepSlm025Yl1CnRx7CGUG9j 0TPeDTQkCtbeg+qq2ByoBZXihm0zYAyw1bdSfE69ou7B5YNHI40PR3VlPuIcgzAl/GucvsivW Q0tzAs49zNMIVnyMyT6r5ZFvFJu0ZKb+sJxRk8Mh1zDQqd5UXVu9olognwtppTn5U2Wi/sMJW pCfp0wKXBLzPTKJOYuKhR1IhDnInhvyN5PyvlQ== Received-SPF: none client-ip=217.72.192.73; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de 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, SPF_HELO_NONE=0.001, SPF_NONE=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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson 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 Message-Id: <20220602013401.303699-7-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- 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 9b3bf7a44819..558c3c67d607 100644 --- a/target/m68k/cpu.h +++ b/target/m68k/cpu.h @@ -122,6 +122,12 @@ typedef struct CPUArchState { /* 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 12e5d9cd5363..e24d17e180e3 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 777869790b66..750d65576fcf 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) 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; + 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); } +G_NORETURN static void +raise_exception_format2(CPUM68KState *env, int tt, int ilen, uintptr_t raddr) +{ + CPUState *cs = env_cpu(env); + + cs->exception_index = 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 = 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 = env->pc; + env->pc += ilen; + + cpu_loop_exit(cs); +} + void HELPER(divuw)(CPUM68KState *env, int destr, uint32_t den) { uint32_t num = env->dregs[destr]; @@ -1065,18 +1091,7 @@ void HELPER(chk)(CPUM68KState *env, int32_t val, int32_t ub) env->cc_c = 0 <= ub ? val < 0 || val > ub : val > ub && val < 0; if (val < 0 || val > ub) { - CPUState *cs = 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 = CC_OP_FLAGS; - /* Adjust PC to end of the insn. */ - env->pc += 2; - - cs->exception_index = EXCP_CHK; - cpu_loop_exit(cs); + raise_exception_format2(env, EXCP_CHK, 2, GETPC()); } } @@ -1097,17 +1112,6 @@ void HELPER(chk2)(CPUM68KState *env, int32_t val, int32_t lb, int32_t ub) env->cc_c = lb <= ub ? val < lb || val > ub : val > ub && val < lb; if (env->cc_c) { - CPUState *cs = 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 = CC_OP_FLAGS; - /* Adjust PC to end of the insn. */ - env->pc += 4; - - cs->exception_index = EXCP_CHK; - cpu_loop_exit(cs); + raise_exception_format2(env, EXCP_CHK, 4, GETPC()); } } From patchwork Thu Jun 2 11:58:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 578097 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5806:0:0:0:0 with SMTP id j6csp476776max; Thu, 2 Jun 2022 05:09:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwMB0Txx5mtRVV8pIlphKbfs4Oi+Ycr3w/Cqvd3maF2N60JFebBS7BysUVNxX63jyBZ5kub X-Received: by 2002:ac8:7d11:0:b0:304:b367:e2b8 with SMTP id g17-20020ac87d11000000b00304b367e2b8mr3262932qtb.382.1654171752526; Thu, 02 Jun 2022 05:09:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654171752; cv=none; d=google.com; s=arc-20160816; b=YtloGTRhmOtuAvruVatymuWQWQmVeyAN1nl3qHOS8yvXkqkuf7jcX8ix3SjLU17aFc 5muilmcrfUQikhG3KRZZzoAC2JaxZ9Q/Yre81eq2uDC7FLdu1gTbhoSNbnM4SaJlfqG6 m4lDIVqpKkMQltHVY+4VhWsS1OpPm/ZI05BJaCTizUu3JAExGU8JfcN7WvcvrcwfZuiD 4PAX5diEr+e7I1m9bRc70k4Vxzt2iuGttFni7K026zM4sAYCn3TZbL9pr/vQoCi/0Ou2 IPnoL+OmUM5XLfLqVd7lQmyM8/m5wQi2pSUPsjpYD590UdGcuLzf+VGIOw0jvsYoM3Jt Wh3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=RpsRbHI5O0F4XlHCEnmuwBey4ynOY9CVLs5BLTdSmb8=; b=zlRh5Infwzmfm6yEJF6dPRQvWEaXKaOnJ9tJKT/fpc3MAXvEvzwrY3BTnbvt0pExL/ xGH1aTvr3JNBivheQD4+nCVzMgY1f/Ll7lhC5z+TY36zJODKCckUlMQLru0ezC6A4BBR PZPnI8nDeRvuTv4MwbiXrVjshcH2WI7jEHRHEs0JzcKekWX9yy5FDXvOiOuacrBGAq6T hfOdEOijzjt0mvmepCIti9H6VsPBwZooLHF0TwtabNyju7xbe0mndvYxb6UhX8hyEbnV zrD84W4yjts1TLk7ItOLl9/8zkFSaTBkwIcFMySYGJdynTEtys0Q8tXzNUyTCty0cpU7 3eXA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id o19-20020a05620a131300b0069fba2135f2si1888950qkj.690.2022.06.02.05.09.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Jun 2022 05:09:12 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:37868 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nwjdY-0006rO-1P for patch@linaro.org; Thu, 02 Jun 2022 08:09:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46930) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwjTT-0000a0-Qq for qemu-devel@nongnu.org; Thu, 02 Jun 2022 07:58:47 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:45559) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwjTR-0001Du-KI for qemu-devel@nongnu.org; Thu, 02 Jun 2022 07:58:47 -0400 Received: from quad ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MYNS0-1oJKmf1PXO-00VQrC; Thu, 02 Jun 2022 13:58:43 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Laurent Vivier , Richard Henderson Subject: [PULL 09/19] target/m68k: Fix pc, c flag, and address argument for EXCP_DIV0 Date: Thu, 2 Jun 2022 13:58:27 +0200 Message-Id: <20220602115837.2013918-10-laurent@vivier.eu> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220602115837.2013918-1-laurent@vivier.eu> References: <20220602115837.2013918-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:pqc3r/HEB15/YeH/OaPtISXwt4qva2YCyTOCRbDbVawZj59XmzQ O3AlyN0GRnYutLWTZtWJd0zRMPSGk+Q2jzBANdBPUmP4IuPbz24ej81cgBp5GuaPKZfPI2W xlcgSZa1G9vwDaRuLkopr9g/4VNXij0CXcXzlOMFXS5CukHKNVigUOcCrOad2WCW5rV1/WJ xCq1aPTcq+nztONkUz2zQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:9Mm51OlHIT8=:nwUQ7CT/u7ms67LH1ooe3n Agiwga5I9dKBEuMhtxE0AJrZ/BYZYvaA7u1grzfb5WFBsrsRG7Gqf+Xe/AseiVanMLBX9Fzf/ SpIzryrXtfof0++b00YqF7ClF4vPGkiA6kPLnafhxUCHAPpGZ3e9PR/qTgOl0XGha6jjKLu7V X7KzXPxwvG+spIFocdcQw4SxXmvostcH+5WA3YvG9kt8+A0+r56rPn+npu5iO3hT1yRJPnlxH tA5HWKy/LkzSsWCpW7bPD6WMoCCJIASNj9Sz2vfWfb63zo3SwqFSEaP4btO0zt9ueN0x+VymG 3BFECwcB2ld40CXIu7yCg+QqoAF2RS7zRvRg3wgdp+AhDXosbvu6MeAHvx1ZXq9qPO493ACgT HlJF/05R7C0giDPHdz7hMftgTsA3hhwXFuNbLXautJPnEAGujhjHt2OQBwHUnAeWO3wNkB7EF ahvyZ8aiRZxvLTF7gYZWQy++YpOV1BjRTpKdyLVRXLsqo3SQ5C5RkRg78be+xK60nTXaYji9K PjAdKYgieDnauKzwLE8Q92YTl8LfIKOG4nr0bezLN8RJEo18Ga9Gpr263HvUu+XKJMcswtyRL ImlE+3L9oV7/FqJnMx+q+2zn8IGJvdzNSHq3KiXi2CQ2qnD05sxTcN5Pzwy+PbKhNcmcKBHYs QasxSDvCLmES2RDhKuVDidVJ64eq9iTer36qyA8uEI6Ceb3MbJGVpZEdjR98A7drUmfNHHEjD AGUAGzHmxAIumQ+Dv89oOoirPFzxRyY3M9pCpw== Received-SPF: none client-ip=217.72.192.75; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de 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, SPF_HELO_NONE=0.001, SPF_NONE=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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson 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 Message-Id: <20220602013401.303699-8-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- 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 0a6b4146f635..f016c4c1c226 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 e24d17e180e3..6598bce3c4e7 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 750d65576fcf..729ee0e93482 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 is_hw) break; 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 is_hw) break; case EXCP_CHK: + case EXCP_DIV0: do_stack_frame(env, &sp, 2, oldsr, env->mmu.ar, env->pc); break; @@ -574,18 +574,19 @@ raise_exception_format2(CPUM68KState *env, int tt, int ilen, uintptr_t raddr) cpu_loop_exit(cs); } -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 = env->dregs[destr]; uint32_t quot, rem; + env->cc_c = 0; /* always cleared, even if div0 */ + if (den == 0) { - raise_exception_ra(env, EXCP_DIV0, GETPC()); + raise_exception_format2(env, EXCP_DIV0, ilen, GETPC()); } quot = num / den; rem = num % den; - env->cc_c = 0; /* always cleared, even if overflow */ if (quot > 0xffff) { env->cc_v = -1; /* @@ -601,18 +602,19 @@ void HELPER(divuw)(CPUM68KState *env, int destr, uint32_t den) env->cc_v = 0; } -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 = env->dregs[destr]; uint32_t quot, rem; + env->cc_c = 0; /* always cleared, even if overflow/div0 */ + if (den == 0) { - raise_exception_ra(env, EXCP_DIV0, GETPC()); + raise_exception_format2(env, EXCP_DIV0, ilen, GETPC()); } quot = num / den; rem = num % den; - env->cc_c = 0; /* always cleared, even if overflow */ if (quot != (int16_t)quot) { env->cc_v = -1; /* nothing else is modified */ @@ -629,18 +631,20 @@ void HELPER(divsw)(CPUM68KState *env, int destr, int32_t den) env->cc_v = 0; } -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 = env->dregs[numr]; uint32_t quot, rem; + env->cc_c = 0; /* always cleared, even if div0 */ + if (den == 0) { - raise_exception_ra(env, EXCP_DIV0, GETPC()); + raise_exception_format2(env, EXCP_DIV0, ilen, GETPC()); } quot = num / den; rem = num % den; - env->cc_c = 0; env->cc_z = quot; env->cc_n = quot; env->cc_v = 0; @@ -657,18 +661,20 @@ void HELPER(divul)(CPUM68KState *env, int numr, int regr, uint32_t den) } } -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 = env->dregs[numr]; int32_t quot, rem; + env->cc_c = 0; /* always cleared, even if overflow/div0 */ + if (den == 0) { - raise_exception_ra(env, EXCP_DIV0, GETPC()); + raise_exception_format2(env, EXCP_DIV0, ilen, GETPC()); } quot = num / den; rem = num % den; - env->cc_c = 0; env->cc_z = quot; env->cc_n = quot; env->cc_v = 0; @@ -685,19 +691,21 @@ void HELPER(divsl)(CPUM68KState *env, int numr, int regr, int32_t den) } } -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 = deposit64(env->dregs[numr], 32, 32, env->dregs[regr]); uint64_t quot; uint32_t rem; + env->cc_c = 0; /* always cleared, even if overflow/div0 */ + if (den == 0) { - raise_exception_ra(env, EXCP_DIV0, GETPC()); + raise_exception_format2(env, EXCP_DIV0, ilen, GETPC()); } quot = num / den; rem = num % den; - env->cc_c = 0; /* always cleared, even if overflow */ if (quot > 0xffffffffULL) { env->cc_v = -1; /* @@ -720,19 +728,21 @@ void HELPER(divull)(CPUM68KState *env, int numr, int regr, uint32_t den) env->dregs[numr] = quot; } -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 = deposit64(env->dregs[numr], 32, 32, env->dregs[regr]); int64_t quot; int32_t rem; + env->cc_c = 0; /* always cleared, even if overflow/div0 */ + if (den == 0) { - raise_exception_ra(env, EXCP_DIV0, GETPC()); + raise_exception_format2(env, EXCP_DIV0, ilen, GETPC()); } quot = num / den; rem = num % den; - env->cc_c = 0; /* always cleared, even if overflow */ if (quot != (int32_t)quot) { env->cc_v = -1; /* diff --git a/target/m68k/translate.c b/target/m68k/translate.c index 22e5379d3c64..6075f4993031 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; /* divX.w ,Dn 32/16 -> 16r:16q */ @@ -1609,20 +1610,20 @@ DISAS_INSN(divw) /* dest.l / src.w */ SRC_EA(env, src, OS_WORD, sign, NULL); - destr = tcg_const_i32(REG(insn, 9)); + destr = tcg_constant_i32(REG(insn, 9)); + ilen = 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); set_cc_op(s, CC_OP_FLAGS); } DISAS_INSN(divl) { - TCGv num, reg, den; + TCGv num, reg, den, ilen; int sign; uint16_t ext; @@ -1639,15 +1640,14 @@ DISAS_INSN(divl) /* divX.l , Dr:Dq 64/32 -> 32r:32q */ SRC_EA(env, den, OS_LONG, 0, NULL); - num = tcg_const_i32(REG(ext, 12)); - reg = tcg_const_i32(REG(ext, 0)); + num = tcg_constant_i32(REG(ext, 12)); + reg = tcg_constant_i32(REG(ext, 0)); + ilen = 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 */ SRC_EA(env, den, OS_LONG, 0, NULL); - num = tcg_const_i32(REG(ext, 12)); - reg = tcg_const_i32(REG(ext, 0)); + num = tcg_constant_i32(REG(ext, 12)); + reg = tcg_constant_i32(REG(ext, 0)); + ilen = 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); set_cc_op(s, CC_OP_FLAGS); } From patchwork Thu Jun 2 11:58:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 578107 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5806:0:0:0:0 with SMTP id j6csp488277max; Thu, 2 Jun 2022 05:23:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxZ5cDc8dbwtbzo0UBRYreH6+3VHgcpdSACP0SHA63PKLcqSuO9o0VQ3Xm/zXRPYxhkEPCp X-Received: by 2002:ad4:5be3:0:b0:464:491f:f6ba with SMTP id k3-20020ad45be3000000b00464491ff6bamr18094253qvc.35.1654172597767; Thu, 02 Jun 2022 05:23:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654172597; cv=none; d=google.com; s=arc-20160816; b=etWoIfM+estHC+ZsiuV/elLJNQFpq3F1uBHjEIgvyVrrU9viKnFKrnSzpJXi7S5SkC LjhMjt5+VwWiCT8V9S9Cke8vkZOdZvH3OK88Iu/LgZPD0WtG7CN6ZsQeolQ6AYD2DDYe IwqmgKACndj8wEWIKRKiR2OpC0YtkpSRL6v2xHxeWme3DA7dTYfZiQvbp2NqROBgaOnO T/4yEGC3NQLaEqOPZIXdHMB1VAXGnjJ19Tk3wIaatMMihsTxtP8vNRGDqCnRUgmVxDND H0IXBUBnnX1pg/zMR/EOguY37ezU6LbxHiACs8uyfjqjctr7/BzaYCOvAS9qedeTiO89 imGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=0ZrRG/ZJaKKKy3N26ovuVzCKj4nTL1ZFWH4fTT8WmXI=; b=g9gboL8K6aDtQsKVzSUeuLvB8vUz4DQNBsnZnKKv8zAhvrb7g/M9fyuaFADuy2fCAV l6D0itRZmrONTkG3Zg+xKQDY4ZpmKkN2SakRCZK4h0L/44jVqEWcyPg9Tc4hkEPtarNy fdo7/8prwmpFEu+ApJyRB6IeE12xpnbaa0gREUdDiQylSwQNvPSr0lqNMGdyOOXc3YfQ V2ofYErO/SS4y0fw3BJxI63iWDMFY8fREgC5/qyiDbatH/9mBmRyj2TcQiaerv+/H+wp qRlE642Fkv7qzElclnpaWyMeYPJnPvzFDbh5WmSKaPurPS3UF6MLyMi5f0IByRfiv+kM ZiKQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id v8-20020a05622a188800b002f91038e682si2139443qtc.5.2022.06.02.05.23.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Jun 2022 05:23:17 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:59164 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nwjrB-0005Fn-9x for patch@linaro.org; Thu, 02 Jun 2022 08:23:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46962) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwjTU-0000bb-H6 for qemu-devel@nongnu.org; Thu, 02 Jun 2022 07:58:48 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:40887) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwjTS-0001E6-2B for qemu-devel@nongnu.org; Thu, 02 Jun 2022 07:58:48 -0400 Received: from quad ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.183]) with ESMTPSA (Nemesis) id 1N5mSj-1ni55k3kp1-017EWB; Thu, 02 Jun 2022 13:58:44 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Laurent Vivier , Richard Henderson Subject: [PULL 10/19] target/m68k: Fix address argument for EXCP_TRACE Date: Thu, 2 Jun 2022 13:58:28 +0200 Message-Id: <20220602115837.2013918-11-laurent@vivier.eu> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220602115837.2013918-1-laurent@vivier.eu> References: <20220602115837.2013918-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:yHtcuEI5oWPEj21RnBWwmQG1PB2U1nccNA1xUHgD1dZ0tjk06zG kyLPVXqVegdeSi09d4cflMs8mMNm7muJpIkazz5j61oTDVyCcLJPclU+SUNwai7ch+kHxS/ oP3Xza0M24OuFj1MZ3ta8SjiQm35wmZJI8yJFWtocx72AA8vN4CxQ9boTlqOzUiAgbhetw9 1FfUgTDOFC10rteOGDHXg== X-UI-Out-Filterresults: notjunk:1;V03:K0:gbRDYPoZyrY=:PElDNouuAcoceyxKfdegqT dmHgZWsd5UWhhC7oHj4F32DmLowL2uV7nOq2/S6T1uWGcCGjZg/2qiaZEu/J4uRq4AXutK5rX xhiFIbDqQTli33XyZvE5KiILBQP3QxZ5HxVeXh+OAchkrG19xlTGWSobounvezhBAtpqozSJz A3zAcxn/Tcgyc1/Cmrr5KhTIxop7usSEq5a0H41g2TP+PFypmLNs2hEg8W20bQvJDNrKX+KcH bxVBwIs4fHX9enRxKDoboUDzw09Ovjgqua3htmhl5Jdr63t/AbHJaYuCzC1noHQCl+jMkFt+Y RfeJkV7GnyDshQ6k1oGA+VT6zlL6xQzK5x7OJbMmEltgZkVtOmM1R1Ra4bb9zRZT4xCLXTVeU cwq8oesNDGd0OWrlcIcQ3xkfTgaIDnzcGaatCYmAPqSkg76Zm2IGezZ3a2mofrrsKX4lBmr2P HhhL6guqm+1N8rXhvG+WjYVTfO0T3AKHP1WwfwmnKv+HdKtSMSPgBIXJaslaYx4Rz+XWE3DcP jjRAC+JiBNhhFO0S6qvL05LLMq/HCeXAY5SRzv0RJJkPuqss+Amb4Kr8fVdOwjk/VEoT0tQFq iPXeaRfT0CJAgiGboOqCwT/8buZdf24Tjmbp4388BhjhviZP9NKGdj/dJbQpfF+1lUkzZhPmh lS8ypChlyDVG+T8xFPYvCEU2gDQNdhZVzzVk2CF+QZ0Z7sr8Y6dUXJRpT5R0CtfB4dOloFHPF yjSFU3U+VDBgOvUUvkmmgW0H/3XnIhgC6fOG9Q== Received-SPF: none client-ip=212.227.17.10; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de 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_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson 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 Message-Id: <20220602013401.303699-9-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- 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 6598bce3c4e7..fcf92205529e 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 729ee0e93482..3cb71c914003 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) 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; case EXCP_CHK: case EXCP_DIV0: + case EXCP_TRACE: do_stack_frame(env, &sp, 2, oldsr, env->mmu.ar, env->pc); break; diff --git a/target/m68k/translate.c b/target/m68k/translate.c index 6075f4993031..38b72d282aa6 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); } +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 = 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) /* 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); } DISAS_INSN(undef_mac) @@ -3096,13 +3113,13 @@ DISAS_INSN(branch) /* Bcc */ TCGLabel *l1 = 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); } } @@ -5485,9 +5502,9 @@ DISAS_INSN(fbcc) l1 = 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); } DISAS_INSN(fscc) @@ -6159,6 +6176,8 @@ static void m68k_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cpu) dc->env = env; dc->pc = dc->base.pc_first; + /* This value will always be filled in properly before m68k_tr_tb_stop. */ + dc->pc_prev = 0xdeadbeef; dc->cc_op = CC_OP_DYNAMIC; dc->cc_op_synced = 1; dc->done_mac = 0; @@ -6192,6 +6211,7 @@ static void m68k_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) do_writebacks(dc); do_release(dc); + dc->pc_prev = dc->base.pc_next; dc->base.pc_next = dc->pc; if (dc->base.is_jmp == DISAS_NEXT) { @@ -6226,17 +6246,12 @@ static void m68k_tr_tb_stop(DisasContextBase *dcbase, 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(); } @@ -6247,7 +6262,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); } From patchwork Thu Jun 2 11:58:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 578101 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5806:0:0:0:0 with SMTP id j6csp483582max; Thu, 2 Jun 2022 05:17:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyNTFQQZFIn24mAyPuWHdTA6s3iWizwwa6AkNS/xxgAkPHUZ1h+ML1X8zwP3b0FlamGLDnL X-Received: by 2002:a05:620a:491a:b0:6a6:73ce:ee72 with SMTP id ed26-20020a05620a491a00b006a673ceee72mr2537675qkb.343.1654172227703; Thu, 02 Jun 2022 05:17:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654172227; cv=none; d=google.com; s=arc-20160816; b=w2P/EV1Gs5ziUlsoYEecXQvZfUVi3dg6oqyuFptmlj92NjbcA66++C/KhOz0/Nm6qe XC1Ixa7EIbbsaWUQH01maYvJwma/Gfbs1+5le6b12U0nHX4YSrntdAov8dnQYzpG1Zvo AIUEuhXQFAWvOV+a3zDxxPx0n/FXjBX3dZz9dCQAShx3PFQnRXaFRCJQ2GeNzgFoTij0 QE19W6ENOnjx+GdWy5PBNMeiVocvHmkZNpJ+rQZyTf61xAct/J7wgGI3MXgNVjUoxwnn BvjN8HJEWJz4QceseSopDfJZ80h/X8TkiL6HW3lsgdMEAmoK3L/fVz0uQjuFEn8Cv7Ob xOcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=KbtKI5iIBBfrPVdvCr670TWSeS+XTGWUxE7ys7Nz+E4=; b=u0RaZ2ylbowL5R4zHTou9jnAF9806cp9ZDRaoRkOSBsXJY3V8YKCIyV2Ir9t7pdMRM 3RINt3OWYYQ8BAnccL1GgiucPdoB2+JOEboesHHRRu4cUlJk6Mtg7V9Waq98+6xq+TX7 xyl8NiKWTb1axuBsT2phI3nJ2E7/oTaZ1V5rIQeSpKlzkPFBrUGQNsiOQ32Bg9x+h2tY aetPDi+Z0giemRQxw6ok/xdu21VVAKoZmdjl/W8bMNsBGK9zwwBWOa5Iz7N4Wae8SUHU 8jKO1No9ZjMd7pGvKGTU6zniWn70zzulXAublBFau34BszTLViW79u2cmAZhwuJsx4ga SGHw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id o8-20020ac872c8000000b00304b6c5dc45si1824358qtp.623.2022.06.02.05.17.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Jun 2022 05:17:07 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:46594 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nwjlC-0004UL-TR for patch@linaro.org; Thu, 02 Jun 2022 08:17:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46970) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwjTU-0000ca-PM for qemu-devel@nongnu.org; Thu, 02 Jun 2022 07:58:48 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:59465) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwjTT-0001ET-47 for qemu-devel@nongnu.org; Thu, 02 Jun 2022 07:58:48 -0400 Received: from quad ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MvsR7-1ngzAp1dg7-00szRP; Thu, 02 Jun 2022 13:58:44 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Laurent Vivier , Richard Henderson Subject: [PULL 11/19] target/m68k: Fix stack frame for EXCP_ILLEGAL Date: Thu, 2 Jun 2022 13:58:29 +0200 Message-Id: <20220602115837.2013918-12-laurent@vivier.eu> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220602115837.2013918-1-laurent@vivier.eu> References: <20220602115837.2013918-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:u4GDy3CSL4HtG1XGhMv0X9GfHFZt16h8rO3u/h4KWxlTJnU42np bZDIGs0kybqGk9IerBf4YU2SVUrULVWr8UYX5Cf8W1hqkwivGNYbEIInuL4S5kHAXeMYmuI rnSEAzX4v91hHLSXIARehFjnH5xYyi5Ls36A4S+K7U2MK06gmhKklEz7OW8np3OAjhQo3O7 Vv/Z/9S4kBAYcv9E1dK1A== X-UI-Out-Filterresults: notjunk:1;V03:K0:j2MNrR6jPFw=:m8/3baLnwBX76LkVb4A+2/ wSYzO3SHUrEQMVx3jAkxxoZY0UyVo8bpteOAyKJycVToL6hc8n17UBPtKlCsicPgWsfkT9aje Aq1eGw2bpDVUvForNfK34uCrJ7cpZqapeKOT1VQWItTykf79w6aUmwHXDw4mZpjBEkBFToMoC 0mm16M5bCCAwN+0FHO8eK/3DklwYcQLzVOLiQsuDorpYC0BpsnWSzx7aL+l7OYT6tM4uRVIIr Bo7eADi4rkv8+eEgjrFvb+0rC9RDAvbQk5h3jIOCkNKk8XvIfIu020fx79xFGhhukIfISkksf 44Qs4ac+sf1yqpDFQfGgMLd4+sUywIaQdnvES+3vVgpmAdEKvzJ4f4+fgZYPeXpjCZWKiwNBL YdHc0y3H7Vv0SHsGZAjLqNCUInUc/e6IC9PtauvX9JbCDaiysy8o64fG3aIIZssHkoabCbg3w swxZ2xaoAe/73CL1bRTXrZ1/dq9PHeG3QxBBJ8gBa4jdVTUzoUPj0ZwtU1JE1VWJE4ffr0IcT iy8DwzAKznaVwQpRLAdDw4y0uiik4T2ZBqdi7YFcH5Y4zfTfZDQQSJq6HDJD7nMcQEqFQdxAr q/heqQw40jakwA7EizJ3p8eiVjgZy1TL0EdwccrIy4BLjuuogHyMAiySHGfuxX2Ogk567wESc +C0LOz2oEPMWWMOSiekWmMJi2o9yk8ha4FRyUkR5gu//IXZ9nzevzKFluXdYIB6eoKM92xTUP 0FRSSbXWYwe7d/WWRHJsQwhbXkY7+eA1lhAD5w== Received-SPF: none client-ip=212.227.17.24; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de 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, SPF_HELO_NONE=0.001, SPF_NONE=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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson 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 Message-Id: <20220602013401.303699-10-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- 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 3cb71c914003..aa62158eb97b 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; + 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; - case EXCP_ILLEGAL: case EXCP_TRAPCC: /* FIXME: addr is not only env->pc */ do_stack_frame(env, &sp, 2, oldsr, env->pc, env->pc); From patchwork Thu Jun 2 11:58:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 578109 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5806:0:0:0:0 with SMTP id j6csp492916max; Thu, 2 Jun 2022 05:29:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyh29H84T92wxogPo7UdvcL2dNYpgvxI8Ef2w/drFO5wPhn+h2CHzCCLTLjJQ8DK3BwT2Re X-Received: by 2002:a05:620a:448b:b0:6a0:3266:f6ef with SMTP id x11-20020a05620a448b00b006a03266f6efmr2869701qkp.427.1654172997574; Thu, 02 Jun 2022 05:29:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654172997; cv=none; d=google.com; s=arc-20160816; b=LawCOUjEqjLC6P/ZzmxrFH865fR3Cl5dIoBKO7ZxKGbE6h532TRr1d26OA8HmpeRmv AXwHalS8iv4Oys0SlliANPtZAbeFD+ySdy0H250apBI84uaLYYmHK8XzphPV69jV4RbV lJEGcODBwRShrujAfeO9KrK/Rh+/yp7NN197DbBp9B8BFmQ4muQROxoteMYf0hJDqAAj pPXGOWrxgXRNpwMekWJMxh0XGrI3F6QdtZune3rxqYZzK/xtv5xYNGRJwROVSsEYvi4P ODS059oLVF8NuWOI6B4RIRDA1EnPdizmZ/+EyRfKY/iUiQZLKTX4a4LIWNyGhdPR9Y40 dMQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=J4105yVmDNwGkEBmQNJCh2W/r2Filc+FhKNkWyZwT3s=; b=h+35RUjz9WFkSCKgjWM1bN6MQknezGHduRZYykHm3CHFpSp4SApaoluYqON0MS+NES k6nTJlgxi9MaRUbg0uxgSesY660411LTFwtxBjsqpBoaAh3GZYf3uzT5Zl9enfQfdwjg HoHm0hpEOt6cmS2PQ/azEB5QwPRxgH2LuXMN0hZTG7zyBEKjQZ1UPV2brSKgPdiIr3eJ U6QvUKaqWpHsDDQ5HDdRok1b1TRws+2FHCRs/hpPysacya/AOXFadFBePRKEl3UCHhX3 CAIMqVaJg98b67aSgAZDqCEIldtjbnlg5Fk8ryBcQUyvJC62bUJrorEIynK4DsleG95m 9u3g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id y12-20020a05620a09cc00b006a5cb5623c6si2012969qky.558.2022.06.02.05.29.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Jun 2022 05:29:57 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:39428 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nwjxd-0002dN-4a for patch@linaro.org; Thu, 02 Jun 2022 08:29:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46986) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwjTV-0000dl-5o for qemu-devel@nongnu.org; Thu, 02 Jun 2022 07:58:49 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:41035) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwjTT-0001EP-4R for qemu-devel@nongnu.org; Thu, 02 Jun 2022 07:58:48 -0400 Received: from quad ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.183]) with ESMTPSA (Nemesis) id 1M4b5s-1nyNdK3TF8-001iEQ; Thu, 02 Jun 2022 13:58:45 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Laurent Vivier , Richard Henderson Subject: [PULL 12/19] target/m68k: Implement TRAPcc Date: Thu, 2 Jun 2022 13:58:30 +0200 Message-Id: <20220602115837.2013918-13-laurent@vivier.eu> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220602115837.2013918-1-laurent@vivier.eu> References: <20220602115837.2013918-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:aM8JKn8e9Sb4Fg8HWR6thAno0SAYgKnGGVoT/kJddwsXSrQD0FO S5pWkU3e2I/cHVaMZa2TblJGVGxdEHc+DMHJlnVaVZ5ku+aZIc6KadOU/wqaL7+OiiIq5mC 5LEqft6DHVDiUwdM9NrfUkJo5NRzXDqYmyT1EnIQ70kKSJevHdW++SpYfZfajq1TA7Vjf4l 3dhtrW7X8Q6zpYmPCEESA== X-UI-Out-Filterresults: notjunk:1;V03:K0:wvsiIdWel9U=:aMrvljOazC5+tlcL1NHUvl wnzsr50VM8xhkuCWGbwPKb2AY5l4XV3LxNq1cHGFU23wbfcaQsHfyAZU20z9PwRC62eXqui+V bM2D6+0+jdDvEb9G1+mjg+uBSwZ4YjmeQnygm8opjNVWgYwiG9RMB0QJqc446IHz5VyqTqsCJ I2gToJLgv7mv7FjVoPkLQPca534FXwXqzvNISwEdV55579puDmvIFJ83x0sBDW+z8Gycm6nSt N5MGdd65iHdxnmNokkFsm0mIidO3vzNdL/bYy/T3VQ3cJjMmATXGWi2a4hJVmu87ktyd067Rd 35rCzmioZaPqoTfmpbxVL0nJSDRSonHAZkkLW5u7N5vI67qZevrBZvnO1pSlmXB6KZ/OdVqcl l2ulbVDBdqFuHwQzZy3CuVOQZFTpqNFWZwQo/KkRsErhns9ULczxRI5AQof2N2Dki+qgOMm73 ynI2cPhOJdmFNEPdMd5mEnGY8dHoSVPkmh3nFL3RX36wsQEWpCPKD9AEL1EnKQ6+0CDdhqssI 3ScEKjia9sO94PzH7GVCSb8JLWdlYL8ET3hbtOFjZSvA3EfmnZsCUGaI0TeqPVPOYB1BhlgLf 8odSb9hGAWk38w+s2CJDeTqoPJ1W21c+yAkfufRo9Iz3gPMBUbDcl6Y0bRCwsKRpg/qG+pDae KBx/PUum8mbRwL8nuqDpb2+xTTLIUDIwMFi64prF41caWfaZrn1URTD6uTzONj3tGaH5Znt8w tHlyh2K3/PMpf7gzS0NreEapuOCyfiqAp7739g== Received-SPF: none client-ip=217.72.192.74; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de 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, SPF_HELO_NONE=0.001, SPF_NONE=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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Resolves: https://gitlab.com/qemu-project/qemu/-/issues/754 Reviewed-by: Laurent Vivier Signed-off-by: Richard Henderson Message-Id: <20220602013401.303699-11-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- 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 558c3c67d607..4d8f48e8c747 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, }; 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 fcf92205529e..3d3033155f69 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 567106792377..5bbefda5752d 100644 --- a/target/m68k/cpu.c +++ b/target/m68k/cpu.c @@ -158,6 +158,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); } /* diff --git a/target/m68k/op_helper.c b/target/m68k/op_helper.c index aa62158eb97b..61948d92bb25 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; - 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; diff --git a/target/m68k/translate.c b/target/m68k/translate.c index 38b72d282aa6..e9aa96d7684b 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)); } +static void do_trapcc(DisasContext *s, DisasCompare *c) +{ + if (c->tcond != TCG_COND_NEVER) { + TCGLabel *over = NULL; + + update_cc_op(s); + + if (c->tcond != TCG_COND_ALWAYS) { + /* Jump over if !c. */ + over = gen_new_label(); + tcg_gen_brcond_i32(tcg_invert_cond(c->tcond), c->v1, c->v2, over); + } + + tcg_gen_movi_i32(QREG_PC, s->pc); + gen_raise_exception_format2(s, EXCP_TRAPCC, s->base.pc_next); + + if (over != NULL) { + gen_set_label(over); + s->base.is_jmp = 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) { @@ -6051,6 +6098,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); /* Branch instructions. */ From patchwork Thu Jun 2 11:58:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 578108 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5806:0:0:0:0 with SMTP id j6csp489867max; Thu, 2 Jun 2022 05:25:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw8cxLBhSshWnvaMIQhgrvuKwSUJiRBnx4HEfAupN1J6OcFdg4dKInu1z7upQUMf9ySD3up X-Received: by 2002:a05:620a:29d2:b0:6a5:8dca:51bc with SMTP id s18-20020a05620a29d200b006a58dca51bcmr2865209qkp.625.1654172723126; Thu, 02 Jun 2022 05:25:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654172723; cv=none; d=google.com; s=arc-20160816; b=Ar2/2XIiVgegat73eZev6nGniX8/TtBmQ4gKYtXs87SSDs8fLyRrH5i++fSW41BPkG fvTBMO9fq7cqCAbLYUCUiBHLxLl0Mmm6tvdo6hiD0zPd/je43sOyrHduhRIPu9QA5Brb CmlJ/0pD63GOoQn/WelHevUMSVP4WBxCQ5f5iiTIepxFajGBRv7EeARALKS7JAttrUaW D8vm/ypZ5cf1ArrfXlCx5CbS3SeHKErbmz0BzmkabitEbGjLotiYc/dBQRurCrKlWc+2 jmww4JYP2wPC2qaJ7DGdiPZ7f7kHcbazYXupzfrSno339HHwrWGJfxMrOMHuiPdWr1RR +rnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=YodallK5D4X1fA7pJDtnNydM7jP/mt7jqZ/rXK+ew7A=; b=T54AbeTRis3ye65Y5NiYdFSKnbjm1A8pnde8bJjwS5Rq5XCR7KCUHaMhNaBqwqa9xZ r1MqHYo6pQ5nB/VsjVNyegOE3ZHJBntPcTT06922DMx87E+mLJJOd9EGTsG2FeWYrF0T 0b3hur66wA7cITcsiemtUof78XeFtYFxQ/BU9zPusLOBDDAHQIfns7b73FOl1mZtVMov 34Av5Of0BNUtjx82WqNh2q6uTLsyuCGHADe6QSDwl2GpMV+o3sElrcEmKjYPWZ4Rqdls tkeNxJJ2lJhNJIEqL2i8hfuNy8b5YqfxCwoP403rrYQb0Qjk9XZgM6bK9uo9GVY4tuo/ i+/Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id s9-20020ac85289000000b002f3db794905si1790835qtn.587.2022.06.02.05.25.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Jun 2022 05:25:23 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:35402 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nwjtC-0008GI-Nk for patch@linaro.org; Thu, 02 Jun 2022 08:25:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47068) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwjTd-0000zR-F3 for qemu-devel@nongnu.org; Thu, 02 Jun 2022 07:58:57 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:49485) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwjTb-0001Gw-OQ for qemu-devel@nongnu.org; Thu, 02 Jun 2022 07:58:57 -0400 Received: from quad ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.183]) with ESMTPSA (Nemesis) id 1Mlf8e-1nWiJT1Jp4-00iiXq; Thu, 02 Jun 2022 13:58:45 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Laurent Vivier , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PULL 13/19] target/m68k: Implement TPF in terms of TRAPcc Date: Thu, 2 Jun 2022 13:58:31 +0200 Message-Id: <20220602115837.2013918-14-laurent@vivier.eu> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220602115837.2013918-1-laurent@vivier.eu> References: <20220602115837.2013918-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:n9uj/wcEOptFifWOopaitigEcrv3wKxG0k5e3c8PoRgIJhpSjKx TzO30MOpWbjXPC8O/F+h5frH/s92hgOaDP3YNc27nEZaR33DcET6AIMDWtmXqSj9j0ZF7MZ iG2jjojczvYvhN5okE2u/PNy0ji7cfpspT9RHl5cJQeSESgxOnAIPzm7WpOsSZdjZR67Dpb VFhnQvgllBm77UoZ1GcGA== X-UI-Out-Filterresults: notjunk:1;V03:K0:3QQB8RgD9bY=:vbDiedLU2LZaHr5HUfjxzx aOHizySFZE/zHVM93dyQ4igU0imauPH4MT5M0FbiNhbZMQV81m6z36rIdmQgtIUVrXblLYaFT KHcwVGAnRU57a5x5Jan0EXo0v4uWng6wlqb6+xoTJiDnK3zgmsXWGNXNw2rOWxpV7MUFF2hZD mBT1yYqdMv9TnEwcpjp1ydwb86gLmdZiwBniKoa6fcyX21KRB6bZRVPOfgzJEPaCRSD/3c9T4 sRerqegodwRaYa48o9pqvcqFl2qLf73ezCbdAfs4g0bZINKrcp1w1SLub976ywG57pdod3BSB vnnQtJsW0Pki+74/rJVAw67jHfh9sKhOxpDofDA0uRmBvkGlBAJH8PUyl4/eUYkORQoYgw7Ih OtXQ/d+XA32QIMgWkg9W+0A426F5WkU5YTL7gNnbfCgcfpucGuXuITOlAABHyp3ssid/dRYmX WVD1d71eFWS+UpyTERENVUoeCVnW/Ix7VeVEX2KmKuNYxDNnhHBJVh0IdAavuhZrKKTDrBCEH EWV1+0eji3dyJVjdpgBD66ouUUmvaak5vP24MMJ/NS/jfr5b/kvtybhcHjwdCiLNDGIWzpLHW 1RZrtmkxzHjdHWNL/k8RbsdrpBm1LOLhB8c2uSyI62f/CJ6K5Auv17jSwufm3xLLP9FLYS+ul 3flOzmF48kBOqE8bcdcQT1Tn4fsv9/k6sJ1VZ5GV6qphP1dD5CpdZ/evnR3qDKLgjHbnt9gTD MWJG6y9EWtngHmapCqWr65ZOHMUZRgKrnIjQSg== Received-SPF: none client-ip=212.227.17.24; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de 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, SPF_HELO_NONE=0.001, SPF_NONE=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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson 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é Reviewed-by: Laurent Vivier Signed-off-by: Richard Henderson Message-Id: <20220602013401.303699-12-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- 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 e9aa96d7684b..8b2157c31f54 100644 --- a/target/m68k/translate.c +++ b/target/m68k/translate.c @@ -3075,22 +3075,6 @@ DISAS_INSN(addsubq) tcg_temp_free(dest); } -DISAS_INSN(tpf) -{ - switch (insn & 7) { - case 2: /* One extension word. */ - s->pc += 2; - break; - case 3: /* Two extension words. */ - s->pc += 4; - break; - case 4: /* No extension words. */ - break; - default: - disas_undef(env, s, insn); - } -} - DISAS_INSN(branch) { int32_t offset; @@ -6100,7 +6084,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 */ /* Branch instructions. */ BASE(branch, 6000, f000); From patchwork Thu Jun 2 11:58:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 578100 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5806:0:0:0:0 with SMTP id j6csp483094max; Thu, 2 Jun 2022 05:16:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxVjvOGEMAQnwyzvD+X8naBHDZwGr8BFHMn7orHnfayr0strUSqOlGiL8XWgDwkquDP4NiE X-Received: by 2002:a37:a74f:0:b0:6a6:7f41:f11a with SMTP id q76-20020a37a74f000000b006a67f41f11amr1005962qke.721.1654172193828; Thu, 02 Jun 2022 05:16:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654172193; cv=none; d=google.com; s=arc-20160816; b=H9Y4BG5TtA6uy44P9HZoqqgYTkEj3D2TvCuebM9MDF7oo9HrvCvTn/Z0Xmh+rjyq/1 /R3m7fGrrvJ7kNN9aaiLiokDDhN4UjAZRwUzP5AEeYpAPgAfwo3/ekNwXASygQ4wCeDY lkCskopjcrwyauOGQshPpnEC1LiLxXUoP0xEOPhRK9IzTI7TYe+NedIfOJDhxdahCY8e RKeDFVJ1iq0x9gn7cz5X5WHEKKBEnufu6TRhSG7Kd26M4BL6d4dhqiv9GYBmVM0RZv+L xw9cgdPQUbym5TAsA0ejODzetOvvuwLp0veuIKVq7eD2jkjQ5OFwDCSZgogWzNUYq5yB K7dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=7j/ebFfbC2Oi7ikZhO51Q+9g7S+MERQSLsinJVzrXgg=; b=TciiK2TLa8PSBXPpHm3qvtrKirWQ161Ord7W9QzVa5gedWCmNThuKm28E52lig346b sKJmUuXYQDydKCDlriP/3AIus1pQcKvU3waT+hCoIKxL0+0C+TypvxoukRj/xxAU5Zpe BD++dY1H3HB1CTmddTWEhWbPJZKoIEDDed4/b7fZHBaVtrTEvCiyRi8RDTmLCqefn3Dk rvAWuoBKB3C5CIVRnMS6Ohx3VYV0ZxqVTLKffAcb9YYdp0kv7ZiFlxifDlCdKtpzB4s+ y1p5I7artJUJH0P1FuSn8Uhmb/ldQHcDBKauhWI+V1F+JoigaVQNwVFpA65ejNg2+Evw R6KQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id s6-20020a05620a29c600b006a06ffefacasi2463897qkp.522.2022.06.02.05.16.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Jun 2022 05:16:33 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:46284 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nwjkd-0004Hr-MM for patch@linaro.org; Thu, 02 Jun 2022 08:16:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46992) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwjTV-0000en-FU for qemu-devel@nongnu.org; Thu, 02 Jun 2022 07:58:49 -0400 Received: from mout.kundenserver.de ([217.72.192.73]:42613) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwjTT-0001Ep-QI for qemu-devel@nongnu.org; Thu, 02 Jun 2022 07:58:49 -0400 Received: from quad ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MO9vD-1o86Fo35UP-00Oa2j; Thu, 02 Jun 2022 13:58:45 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Laurent Vivier , Richard Henderson Subject: [PULL 14/19] target/m68k: Implement TRAPV Date: Thu, 2 Jun 2022 13:58:32 +0200 Message-Id: <20220602115837.2013918-15-laurent@vivier.eu> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220602115837.2013918-1-laurent@vivier.eu> References: <20220602115837.2013918-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:1OPeGsv3Q5yuq+In3e8gfptCQoLv/GmfjNIQCmz4hie6xw4gZDY EXACP5F9AujWU7Ef63iPaQ2n5auMQTaOHbeFk6CwyMj+W/zVG8vSV11APLv3IiPa9bV/qWC /ttCEIXXPeyE/KVigcGmOi4R2l5Nk88+ecw9/gUHNny1zBwP/0E1Qcdb5NM8OaVl0+p/NsP /ruNFD83OmQuRJf3tAh+w== X-UI-Out-Filterresults: notjunk:1;V03:K0:AurgsR2fp/8=:7Liw5zF12r9MeX8q0RI3JY 8uNIQ8z3D1iZ0OOx+XRWn0coPGhcnncwLINpBMqHVUj5hY/34CcYi5jzrys+rbj4G8KNAp2ev cduA69YRg47T6PMm1jc5flomfAL5o71KrU4mqcaDm9sn5USqWf3sN1Nr87YH+nP5YiOfW5kus +3wtaPsORpgiMJkWTg2Il3eYk9Dh7rNxt2mM/ZFOmlo/OnPZrDhJ5AXplpjuNo5CHJE6ZK8l9 HpRdsiwNLOn3YAilsC4vGPyAlOxsptowenLCqSzZS6iydwvQ3Y3geshkVBAAoDoFoDpsOa81i 9Sw5XAetiIvUx0519QNge8fwUSF6i7RPonCdL4IR0+6cMSIuQapQ+DkISFRp7IMZ2yZ5JSaox tOaPmCklpcbnPmMMnM+T2+nZfE/VQqHk1H/GjAe161YRIideqJOIy4cxV4S5vvNqWIjAs2foF AhBR4KzJf+vLh4xMMjueNI61tFHoXt3onqX47GXGMlQ3w4qgxnIRfk4uL+U2MQVrsOkehHIzl tU6h7jHE0BIGkRj4K2yAmJj8cPAKS/roSzln04vV0PoOWJx8XlijPQuurhcekd7uTy7tPzNXs BfB41BqeWB3msRbjGqFNHAsw27nmwhZmyOxpov1NoTFMeQQaR6ayEcKuGhIbTVxD7xa5QrXeP TXcGGsrmA3P+Z1vkac/VOHtNvyxzeWxEpTU3deoG3li5hoGjPLqWFSktrVHc3gxuQ417/7tdj tqkaTNkQ/kAWHWOeNUf0D2FXN/99l9HCJqLmbQ== Received-SPF: none client-ip=217.72.192.73; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de 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, SPF_HELO_NONE=0.001, SPF_NONE=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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Reviewed-by: Laurent Vivier Signed-off-by: Richard Henderson Message-Id: <20220602013401.303699-13-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- target/m68k/translate.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/target/m68k/translate.c b/target/m68k/translate.c index 8b2157c31f54..0dfddaa05628 100644 --- a/target/m68k/translate.c +++ b/target/m68k/translate.c @@ -4910,6 +4910,14 @@ DISAS_INSN(trapcc) do_trapcc(s, &c); } +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) { @@ -6074,6 +6082,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); From patchwork Thu Jun 2 11:58:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 578102 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5806:0:0:0:0 with SMTP id j6csp486429max; Thu, 2 Jun 2022 05:20:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy78x8ijHEnKtz9wdclcM4srCqahf4fvDgg9ech2WmSHnevDHwiviI0UgeMEbuwffHi2GrT X-Received: by 2002:a05:6214:2aab:b0:461:bb29:6f2 with SMTP id js11-20020a0562142aab00b00461bb2906f2mr58257855qvb.38.1654172446500; Thu, 02 Jun 2022 05:20:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654172446; cv=none; d=google.com; s=arc-20160816; b=oSYDhEWfPRN0b3hRPXkFtmGkWkbUvrOHygtDaRghmRQevXOI03rpQU9+sqhiiu1YXb H7oQuyMMzK4kcZvoSRlXHzbbgZwpamh7CBqAuZFi7+ARiHFy71I+6nUdu4kmTCKygh94 xBWPck/EdS2ItoKk9k7diXTXJDccloV8qsXNlMEB1X7wN74oFSfpWPRAMLNu0kgyeaQi 9bNTtD/QdbyuYmwcpBqRAvvNC38lj5qw+wMmZGmTIY+yomX9kjsfl5tW49DJ6JSTjASA pfLwMtXct2oRKeyhmi6JlxPf9T0zn3XKW/q1VbjFbC7kV5Ur17wiuFqYTj6doQtVzUqd D55A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=oh2/01Tig4gjEvGWpiyEINXAVP6Ly+okDBxXjhsaLdQ=; b=CyTDZFmTwykxov6KdYyzpD5MYgjCYUConMiVtmrmZOKc0gCppJrcShPDntD4ETbVDm OLe/8H1a/nXyNaH6VGNQVmdUo1uW7R5MftwkMCh3OGw/UpX2d738P5laj5bGpBqoG/G/ a2Ulbu2nv8XhJASLDVnz7LVdhveVUtqcwfPijVwmf0V79toX20rrVLvXvzLI7oVphWFL wqsvTD7UyK9HmIPJNdEhifbefgBx7k7w5vrQslyD1haf8N7LAscS/VEUjo95jhkv9WRB 4H0hImGS/GKWsmN+r8rKAgNpaCnOieWUioB2/tES8+MKdE98RNegTzQAGchoruIbKtAw ML9Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id i82-20020a379f55000000b006a36014c46asi1838477qke.737.2022.06.02.05.20.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Jun 2022 05:20:46 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:50390 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nwjok-0007S9-2e for patch@linaro.org; Thu, 02 Jun 2022 08:20:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47004) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwjTV-0000gD-UE for qemu-devel@nongnu.org; Thu, 02 Jun 2022 07:58:49 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:36841) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwjTU-0001F5-8R for qemu-devel@nongnu.org; Thu, 02 Jun 2022 07:58:49 -0400 Received: from quad ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.183]) with ESMTPSA (Nemesis) id 1M1Hi8-1nv5qe0jxC-002oA6; Thu, 02 Jun 2022 13:58:46 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Laurent Vivier , Richard Henderson Subject: [PULL 15/19] target/m68k: Implement FTRAPcc Date: Thu, 2 Jun 2022 13:58:33 +0200 Message-Id: <20220602115837.2013918-16-laurent@vivier.eu> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220602115837.2013918-1-laurent@vivier.eu> References: <20220602115837.2013918-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:BsQvszhiMunhfUGS9kl7E5WtpL9uCiUN+7E2JTwK7APFKVOqxqs uXITMBrg8VOWM232q7CMZdo2L8hEUM9AEu8TsYBDGFGYjiqQ3NfWuNw3gJp1TPvw20Jo0GD Z94tVjk+0ZpnInJTa0F/ol50Obpz2AaYTazhDDIHJ8t2vKXPmXi5r0XethonHOTPRKKeM3+ 9+7K4fhh8qxPNtXhSEYug== X-UI-Out-Filterresults: notjunk:1;V03:K0:mOYMHOGQ4B4=:TQZWJWYOVJ+uglpJZ3XQWl 9tiahQdcB3cIf9xPRcA7ABUgTReaWzD60Pit+F/JcQIo6ZqW7m6VGZLqRFlcjtF2nx06cZOnL Mx+UYB53ytgS+cT/XPpqZUGUKJK9sper2CPxQQDkfCUojtslWvYfuciupvULCLu/Ohv/xRSaJ beFczOhZQA/CR8k4YXaU6IfzEEy1vqsGmgOP8XtwqJkOmGWIYnh4s6Q/sgPmtbVoJHJL2oQu9 k9scptl5YMIABbSrK86A27MVT701KFPCXHntWrPWXk1h+cSkkVEX6k/Htno85KGjaX60fPRe4 KHHdJw3fl5pyENNx8AHaIT3lCO2KNBF4f/aTG3sjaYIL8C1LHCk5IwWfSqu59AR+DEb9iJRur glxRFUt3WYU4OvAv183SCzL+ZhNbgFkOGMAPgao7NRAhAqR0y13vMWIBHTYYK8fY8iCPGFZF7 /xTf0NibLoy0n4Xvqq2iorksYWs2tt15BfboDHVWyZwY2bdnLL3ycqnYdIPWHTRb8fBFJY8D1 u+kwOCYKwD+aobgnR1txuXLuIhsDDvnBkG49I+zMSD4rhCKgp1s/Y//mCZr6xJaCDdh2idCny 2ELHHUpw7f59QXWliUPMgzgW1/olNHyM/9orikTZdQk1hb29ejzKfqv8GWDfPOKtU61fxoH/N a4ovGoGLUvLrxK3PLca+R4NoLk3dypsoKhyZHB2fFhf+psfsk9LYA+TJ8IZfjEmANhDzHHYhr q2nOQ1oxfUy1eEDqpDp4KADess/TEAHxmcUiUw== Received-SPF: none client-ip=212.227.17.13; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de 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_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Reviewed-by: Laurent Vivier Signed-off-by: Richard Henderson Message-Id: <20220602013401.303699-14-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- target/m68k/translate.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/target/m68k/translate.c b/target/m68k/translate.c index 0dfddaa05628..8f3c298ad04f 100644 --- a/target/m68k/translate.c +++ b/target/m68k/translate.c @@ -5566,6 +5566,34 @@ DISAS_INSN(fscc) tcg_temp_free(tmp); } +DISAS_INSN(ftrapcc) +{ + DisasCompare c; + uint16_t ext; + int cond; + + ext = read_im16(env, s); + cond = 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) { @@ -6192,6 +6220,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); From patchwork Thu Jun 2 11:58:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 578105 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5806:0:0:0:0 with SMTP id j6csp487441max; Thu, 2 Jun 2022 05:22:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyu0nbJ/YnAIGpmQ05GzNLKWBlH0hpsqparcOJphS+DHyufrjBQv9rlP/94VOV5HkyBQR7r X-Received: by 2002:a05:6214:4117:b0:467:cc51:3f4d with SMTP id kc23-20020a056214411700b00467cc513f4dmr1760985qvb.40.1654172527423; Thu, 02 Jun 2022 05:22:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654172527; cv=none; d=google.com; s=arc-20160816; b=ZJ7r+Y2LrcqCyw1QFC388p4VD1iwvd6cxz38lWJ9p2OANeGoKAeAQjE7miNa04Bnaa CMoldXXXaiLP7bZ1bp5TRnnOz/9u2RJrAK1p6WR6wDbikeAVzLOcfWxzMCVnX4oaVmy8 XynlsIwnzk4HHHbrssfskTfqxwsRGWjE1dFn4lojGXQ/WkUggMWUmPmz9ftf6fbx2y0a fYkz2a/m9jLT+VLJnZC/Q6k8vlO6LQD/pm3J0NWHAbC2YGZIfOzfOAT5VIeElLIP1wdt lxI+8m5hUXJ7q83UcbJn3LGdI7RIuJ0zfsh//xsw9xStYKV+j2rHXRarNRLu90WW+cJO oO8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=UTHb29DQIWXY+PTbrdNeht4A7q6kIv+klk1KT/y97PU=; b=DMFwQ72PahRZwdOvZTzcRlvx9OPVrX357G5NHVxcQMlYR1uFtSrnGUGTvHRhZMvFp5 sIVSKbSWSdEzXftE5ecYyBNX75mu0h4L+xElqZp+JuHsuAF45caIYHTdF2eoGuYHLBcY TzgTIIUiw4ypkPmztpr/nP6/JoJM9IPEImi7SO5tz7NVCyn9evikV5ScCdaxboEs+l0q K5ShkeNpLQVsqDeZmTZhD9kXFRf/7zurPU/1DWxNxsUVqkJgKgcLC7zdaZr8/e4PdWVr tGB4aFVYTwoi6ESGgISXFIZvBQiLrDNLr+OQOKzclK+KBVxJ3SNJOX4fFnckU2k8+Dw9 2+Rg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id gf15-20020a056214250f00b00467cf803b47si549791qvb.396.2022.06.02.05.22.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Jun 2022 05:22:07 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:55104 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nwjq2-0002N6-W1 for patch@linaro.org; Thu, 02 Jun 2022 08:22:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47016) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwjTW-0000i5-IB for qemu-devel@nongnu.org; Thu, 02 Jun 2022 07:58:50 -0400 Received: from mout.kundenserver.de ([217.72.192.73]:48373) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwjTU-0001FD-Kf for qemu-devel@nongnu.org; Thu, 02 Jun 2022 07:58:50 -0400 Received: from quad ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MvJwN-1nfL0x2Tp3-00rLHN; Thu, 02 Jun 2022 13:58:46 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Laurent Vivier , Richard Henderson Subject: [PULL 16/19] tests/tcg/m68k: Add trap.c Date: Thu, 2 Jun 2022 13:58:34 +0200 Message-Id: <20220602115837.2013918-17-laurent@vivier.eu> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220602115837.2013918-1-laurent@vivier.eu> References: <20220602115837.2013918-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:JQGQGKNSJpDygUX0DhsidVlCLXwU9dfSRO4lGFdhve62gsmWVgI Xw4aEH+tDG7KsFEru7MB7osN9JqM+/1+cLQaUaH3Xrk8ThFISRLTaohnHJllF4EfvC655Ig XPqPpFelIcthCfRwHTfqWwPZAevEw/qmEV/s9D5VL0wDF/Ru0Tr2xeIC/4a1rbnM1Jo8/P2 oKJH0kzyCnD5x8Ock8k4g== X-UI-Out-Filterresults: notjunk:1;V03:K0:NjKuHP496LU=:ugkM1EBLlHazMscCgvy+6j 5wYtdNtdPqYowHS24B/1C5yapdNY1EZdiMSSzhoGkcgV6nzzSDWtKppPNjBWu4nc9z7aYE/Ay 0Qaj29IN0Wt98gFsrJo5/ojPWRT3NmJs3wSiKwnq4olmSyRQbcGHzxc87iVJ4Xlx8oLVBz4L+ gJsfKcsrkl1dJHAJitrrIH75jAKp+D8JMU3iwLzWAlqGwVD1hLpn7cMRM6Eo/dkMr69KD4e5I Led17IeIhf/Dr4XNAsNfgjm0wC4QGA+zjz/cyrZtHjs7m9WfAzfMpu5ojspYfJm1VYv5/BmHh uoSfLxdF+XPLYYVUROOGEHt1iJqBuJSess44ZbzjW2LyPvOQsfoFm037qEOj9cC33/zfDQb8F 91+UK2piZTNV0iEq2lW/5jBqom6X33ANSD0aGEFZVlav2cdnPOu17Qv+0wEyHUR+Bmd8RmDK5 dPXdcQYaNocsAb0od+Kbi+NVWTU4QbDiWUBzqPcQ/tt6utd13NMI5WK9mtCZZRHlw8xjr/wYO ZcJnu/lJCXlnBtsrtqGRGhjCljCgNMM7nliYZeMjEEdnskhWG3FEGPhgcCupkzhScnoMBbecZ QT4PMGvd7Co+Y3UiUbhkHPRjhde80IACYfoPPSsVALtuqAIgyll0wb/a2t90WeN/NbD/G48uO 5hZVTBPwm1rxnu4eRkpyDVDZD9B7Nt41/hSse/cwjBjK2o1ZQJyufMomesr2MjAWBFpcWjv91 1hN7EdytKBx124BcdF8RvNwHm2W51wvY+fpkSA== Received-SPF: none client-ip=217.72.192.73; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de 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, SPF_HELO_NONE=0.001, SPF_NONE=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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson 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 Message-Id: <20220602013401.303699-15-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- 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 000000000000..96cac18d4d5a --- /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 = puc; + mcontext_t *mc = &uc->uc_mcontext; + + assert(sig == expect_sig); + assert(si->si_code == expect_si_code); + assert(si->si_addr == expect_si_addr); + assert(mc->gregs[R_PC] == expect_mc_pc); + + got_signal = 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 = 0; } while (0) + +int main(int argc, char **argv) +{ + struct sigaction act = { + .sa_sigaction = sig_handler, + .sa_flags = SA_SIGINFO + }; + int t0, t1; + + sigaction(SIGILL, &act, NULL); + sigaction(SIGTRAP, &act, NULL); + sigaction(SIGFPE, &act, NULL); + + expect_sig = SIGFPE; + expect_si_code = 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] = { 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 = FPE_INTDIV; + + asm volatile(FMT2_STR("0:\tdivs.w %1, %0") + : "=d"(t0) : "d"(0), "0"(1), FMT_INS); + CHECK_SIG; + + asm volatile(FMT2_STR("0:\tdivsl.l %2, %1:%0") + : "=d"(t0), "=d"(t1) : "d"(0), "0"(1), FMT_INS); + CHECK_SIG; + + expect_sig = SIGILL; + expect_si_code = 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 = SIGTRAP; + expect_si_code = 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 62f109eef46b..1163c7ef034d 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 # +VPATH += $(SRC_PATH)/tests/tcg/m68k +TESTS += trap + # On m68k Linux supports 4k and 8k pages (but 8k is currently broken) EXTRA_RUNS+=run-test-mmap-4096 # run-test-mmap-8192 From patchwork Thu Jun 2 11:58:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 578104 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5806:0:0:0:0 with SMTP id j6csp487160max; Thu, 2 Jun 2022 05:21:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwR22bRJctKFLax9tv1JhRJ6+YzAuwLRki4M7bI+gbtPNN2qXZyk8Wsg+NeszuBY7gtKp2a X-Received: by 2002:ac8:7d4b:0:b0:2f3:e185:efd4 with SMTP id h11-20020ac87d4b000000b002f3e185efd4mr3342354qtb.392.1654172506360; Thu, 02 Jun 2022 05:21:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654172506; cv=none; d=google.com; s=arc-20160816; b=fA7UEZ2V40pmFgEs7t5t1ulbxrL6K6oxEGMUqtRbfOyl0h9mp9VaomtQHHfYAsfaID VqEK3QMoeUK37ysNUR5nB0DCs+Y01rFRe/xSRRQofLCEGMiqPLE7bXEBeFdPSOvOxdno JVvzsbyAkjdxU5rxna2iHcq1opGWL4FemolY/zSMUCQ8QBT3mwmUSsqFhycZP25dQUul QbXpysMG0KEFTe8jpDrFV/ZiaM1XrgV1is6iY3Jk/fi/q7+qIcks89YBc8o8VldDdWXI QyaMO0wFnmaXoLWNwETs/X+7J62D8j5raIIlzO5GXZ2hyyy6yn/W+Y4o3bK2xaR6Csji C6Iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=bcBu54h7+tbDtklrFWfENIqWH47Ct57YyirVnw34q7U=; b=T8peFWkkgBxLnGRrsRwbI+VjYKKjgecD5tc2mSBHhuHNFqvpaBOYxVNbV4E1KnkXlw CQZVogf3JV8i4Lh+zbS5xDVOmF56hY9DKWwAvOYvu4g7ILRb6RNadxaCt0hxCo1h1mTd GDCLrjeC7nRhR++0m1s+AKVEoEZb7I8XusHGiUFCCAj+58E+4LNRhb5YeXA3o2D52WME lo386H+O6S1HN8O5i6/01jmmtvaV848/Ws57K7cy0bYxGMgW8VAM4pxOM8cMCnBLyThr 1HCbgdnP+bi2A4TGd3J/9+SllUFe1kZv21+Yh47M5ajP/CDKRnZO3X+sFQmqrLsh3Aen 1+RQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id s13-20020a05620a0bcd00b006a57a0a0143si2255118qki.303.2022.06.02.05.21.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Jun 2022 05:21:46 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:54930 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nwjph-0002Fs-Uc for patch@linaro.org; Thu, 02 Jun 2022 08:21:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47084) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwjTe-00012y-Jb for qemu-devel@nongnu.org; Thu, 02 Jun 2022 07:58:58 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:39111) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwjTd-0001HA-2E for qemu-devel@nongnu.org; Thu, 02 Jun 2022 07:58:58 -0400 Received: from quad ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MDykM-1o6apP0V6q-009vQS; Thu, 02 Jun 2022 13:58:47 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Laurent Vivier , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PULL 17/19] linux-user/strace: Use is_error in print_syscall_err Date: Thu, 2 Jun 2022 13:58:35 +0200 Message-Id: <20220602115837.2013918-18-laurent@vivier.eu> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220602115837.2013918-1-laurent@vivier.eu> References: <20220602115837.2013918-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:XWErTcrZ6W5JxPdOk3q0B2fTn1s115yHePcBVlGBw46nDI3KZJw JQIQy/SIJwh3UqaapA8CPrCDw9Yrp9XcUsWIoePE6cjqwZ6T6uzA6FCjpCu8aJYp7AykLbJ VlXfd4NgmXg6OCRpaFfPklD77p8u2DEIbaIk9qrCpo1j5/n8AWufHGVJvjYarDunAk+nsyE TGIAE8hhatX8npu+GgCIw== X-UI-Out-Filterresults: notjunk:1;V03:K0:EM9Dr8HJ7BY=:/TYFpVVxoDDSBa3VMK7+HH gTASeUxFvDLe+YvyXJKWdqjFzUjJBOyiAEf1nS4RQ+/ahem/PYYZuX+APOnjf3fQC9O4U3Qmq 9j9SHmRwFzICUmuLbdmevg7UMF6RTkdASUzvGCfKS98LQO/inOPl4zQSLJ/1VmyblLIspvdNI nxahldfng0CNVgYkX81C0w7bpul71PNhgMwBLzGSvl1UZ0M2AIzthX92l9GIDhA2/0NKL/oXe P3VDfYfQpvV7qQsmc71Z3fy486yo2NxSccVN5zVgBeaRM1S1Z+wOsVXTNuzBekb+nMnXDNJT7 IV6tPBq2Z61xJH8AX6zIkGs+ZRo8tI3LdeCmc2HAZNgUvVrdvRHrdtyszSKPW4+WBQKAsEvjk 2ESVoYZcR2VviA72HiIngGHOUnyo/meOZM+ezySvuwhfWbNG39NaT6VtZ1nuvMIbVuOZvDBxb dwRjBaaju0/Kmz+YW5OZwXdcUZUGr4qdRtAOk4HY+dgJXsQlPgtUfbCnfi4OZ8xr1g6gX/ieC s5VnkljkFrVeealawdUcN0aQKXk8dYR6VyCvD/V+xMln7MezKsfrQzegnKE67k/Osx4qFbF/5 RSPkI8sTlf4kd3TkuGd2NiC5lUaWoG0Iy/EPgeARF9fFi6Q79ErYgcKP5xHxlWOFxbBaDlb0g Ph4ovwF4XZnOE3miC6iOvqj3VYvqYFfV75S0FYZ4D2/pfLfkJdI+Asy/BZV2Yfn8HEUuaIh0H MHPcczzkHgEvVWMOsGrC08XRhMWpzOhqeTdaiw== Received-SPF: none client-ip=212.227.17.24; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de 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, SPF_HELO_NONE=0.001, SPF_NONE=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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Errors are not all negative numbers: use is_error. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson Message-Id: <20220602013401.303699-16-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- 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 9fa681dea9bb..7d882526da03 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -689,7 +689,7 @@ print_syscall_err(abi_long ret) const char *errstr; qemu_log(" = "); - if (ret < 0) { + if (is_error(ret)) { errstr = target_strerror(-ret); if (errstr) { qemu_log("-1 errno=%d (%s)", (int)-ret, errstr); From patchwork Thu Jun 2 11:58:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 578110 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5806:0:0:0:0 with SMTP id j6csp497534max; Thu, 2 Jun 2022 05:35:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx+f6zOwtdKxUJtoU3fX+82Pq2g2csrZFxs5p0ASnYJN3R/dDQpOTgtoEcXyS28XWvybS6W X-Received: by 2002:ac8:7c4c:0:b0:304:c36a:c1da with SMTP id o12-20020ac87c4c000000b00304c36ac1damr3342217qtv.211.1654173332662; Thu, 02 Jun 2022 05:35:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654173332; cv=none; d=google.com; s=arc-20160816; b=rQumvzNTwGii71a0TBoEGxmcz+0qGewP+CBvj90d4m138fOLltw0WCK2zM6ImXffEt rq7VhbkrB90wfrCMtbmZxTvP/eroMow2ZYHj85GfKl93JotjK4VVwtrmvcjSi5cU3gmR a7QgEGrUQXiF8I8z9Y7s1x89aqt1PtyC47ugbai6YyOnbbAQWOe9rbYtP3wfs3lbxcba HNLLe3E+ZNWy2TRSLMlyTSHH5+wnPEBT+xQ5nPlqkWMS+CrOlfvMhWuptpxeE8YPkc5z l1nerQ/lmPCHkvyVJvBJs3DVH7ppwed0isoFSaUPdK5yySch/7wz7G2B0dI7CH6lTkdE GwKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=fCIBx/V++SPSbz13cPAYmoqi6Yjf5xB9Xdl4krGAXi8=; b=nE1JqgYs430/rGWOyPMlmWQsSY0ylfsLSHEDt/Os01pLQne3ZdRo+gPg58K7N38ZY7 rIVUgN6Rc8f0w+zupJLrGuZSpqJ/BgDhI6veZpC61nsAaQ/1uu5w59P2j8L0ZBuJENGi JpH+483hnxR+3KJn1BkuVxcry21YEPW2s7izFXhHhm2pTbE1SNnmJNqxvqogcrsDVb9Z r01RvtgqnOdMvviN45OOrDNraEi9Ry7hQAtdn0a6idWCHBA7EOOJkt1fbK+9rOyhz9bO MlzOPm9/QnXsheSQvu7uirAKbNGe3vthmn+0NInQnPNiqNWRSQCqOvnjjxoPxsUVkm7r 3aJQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 10-20020a05621420aa00b00464581335e3si1669380qvd.281.2022.06.02.05.35.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Jun 2022 05:35:32 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:48322 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nwk2x-0000Dr-7Z for patch@linaro.org; Thu, 02 Jun 2022 08:35:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47018) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwjTX-0000jT-5G for qemu-devel@nongnu.org; Thu, 02 Jun 2022 07:58:51 -0400 Received: from mout.kundenserver.de ([217.72.192.73]:48357) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwjTV-0001Fi-Hi for qemu-devel@nongnu.org; Thu, 02 Jun 2022 07:58:50 -0400 Received: from quad ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MmUDf-1nWR422KMD-00iRIP; Thu, 02 Jun 2022 13:58:47 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Laurent Vivier , Richard Henderson Subject: [PULL 18/19] linux-user/strace: Adjust get_thread_area for m68k Date: Thu, 2 Jun 2022 13:58:36 +0200 Message-Id: <20220602115837.2013918-19-laurent@vivier.eu> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220602115837.2013918-1-laurent@vivier.eu> References: <20220602115837.2013918-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:1i7W3jUYi+QzdhOVXBzBgAwSkthVMLDcViHEt268kF6hzJUTHls 42N81pfhCQLkI7K2avYmtSkLilpBe/7bjAVID3I5xcqjFXj4s7gDZuYSQDXBXhiQ5upzdnC J6+qO9aiY7Tt4JKo6SwgkPpHIO0NfKGkz128Umiqe1JBaiIS9utYQOe+88T/txf/xzH43ca zpMbLl+Z10TU3e0OGys9g== X-UI-Out-Filterresults: notjunk:1;V03:K0:ZWWXOEpeBKY=:Xd0oqVL5il1pHXarfkD11C Y7XS5H8Q3RaTAGARl90Fr50HPXyvzbVvv74sdv6X9uld6teKpA2Fx/JZH5nKMkv3s5ZF3OIWO nHNzrmpQzcObprc11fayI8EXghoK02rZdNq0E8si24NLsD30fVD/x+7z4xkE0ruHXY82WUyX/ 2sKu2/hslThDqlFnGmSxn6Ncm2/57Uct8mvywZ5LxMpSEtIWAwa7qYKhQ31D05IEBsYwf3iyN wsv+j1fMuSL7X58mnYCCsRgGMJVZc1dbez9qUFNffqeEB0WBuYDlOOE//nLPrtBiEQMGqTXo5 8tFpALWvL4wXok/a74RRo1rgq8FmlTgfe4phZDCrrZpfLwVbJakLT5D9pMp8KybrESLrbR3gb uIANw3I8s3QqosHL+9r64hWyzcwO8I6ZFgwmx8OEiOAVAnaXalQgUjwU1onacIdSTBxX+2ZgU ISUOhTOM35d/QsllQhZTOrMBx99f9x/OayhwuIu25Qh8nrEtCqZ6DfTQydNxTUJzVYm3PFaB8 BreZ/+tN/vFzYvhq4lz/ex6PsPMDYv7Da7JZNLHpvm0RcEnA5I2HR36l8FBWCtoOZr3sKZVyP ZYoZLi16qC2ChUnbs89n7ThYhA5tV393fhqs+FamLQN28qecAZQz6XdUoh7NUysAFaqq37dCM o3S6SIKiU+cdDeQOYgyJDsDMWVTveTXZcYhAGm8xlSp5pMJ4Y50u1kmJ9kQIA6LqDvDEbOTXv TRgg9viJw7rxMtn8DxsTfkmdDMljAhAOcbNmZg== Received-SPF: none client-ip=217.72.192.73; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de 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, SPF_HELO_NONE=0.001, SPF_NONE=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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Unlike i386, m68k get_thread_area has no arguments. Reviewed-by: Laurent Vivier Signed-off-by: Richard Henderson Message-Id: <20220602013401.303699-17-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/strace.list | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/linux-user/strace.list b/linux-user/strace.list index 278596acd131..72e17b1acf00 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 }, From patchwork Thu Jun 2 11:58:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 578106 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5806:0:0:0:0 with SMTP id j6csp488163max; Thu, 2 Jun 2022 05:23:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy8Vr5KBULJaFUiLrxxA1xF4abgYJIb//DGnMvwavpFApkZkhE6ZB+K59CRD/FfHi2FTbIS X-Received: by 2002:a05:622a:28d:b0:2fb:7c1b:6cfc with SMTP id z13-20020a05622a028d00b002fb7c1b6cfcmr3285178qtw.648.1654172589194; Thu, 02 Jun 2022 05:23:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654172589; cv=none; d=google.com; s=arc-20160816; b=QpCdnxkHy4lfXY2DTJ+77vMCBpP7Q8EFBAKfQLsStUFTHedYjuece6DE0i+MmjNVgZ Ru8cYtl8FLYSOCPF2aqpitBNTngdu1O4CSnp48pcRAtyR5+4NAkH3HpznQBsRYHtf0ja Xmx30jOG+bO+dkIgfFqgXVzTCjm0uPwF3YsrCF/d//ZI6wbpDrUOoUoKjPYGSE4yE5xw T/TDdZPKuKwhpx1U4eSc4cpBvEiz23VADOnjaLCsuGDiJJxI87Zo+HYvnJs0GqfmNynw t9QsYDQnEXkuM20sBipCfnPrYqTMWMQC8M0TZD+d/ZOEpaLjHC3v3wV39hoThYFK8feA tjHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=LQE0Eba1fxyu4DaswrC0hGTe68uEawjm3JY0FupsAR4=; b=blCUGmsQJF2GTZkU+1gscP+Baasgpnq2IPFL6x2Vpl3y9Zb2nXtZtlaWNYUFCiU7OV 5qlhYSm9hmMxRXlOO1YNB9dfIjfhNRWPD88c8BR78NeehAf10DaSYWRRY6cqKFLVAyvM OLsbE4j4Er8CsMhYKQr1P2raBGNSlmos4xENJUA7/bSUSYfTmIj5D5eIk0hrsuHznTau FPCN7oA/Gvc4/IhTi5xIJIzbkXWK2ievbGFx4OFd9IszwSZ1YDvCPxGvBsB+4/KfRD6P oFjrroo8lfbYDkmbgdDsMo/fUg98QQkVpCwH/SePaoFyMbVlMHReU7y7U/C01NYGun2a iPbQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 10-20020a0562140d4a00b00464565fc84csi2119897qvr.43.2022.06.02.05.23.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Jun 2022 05:23:09 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:59016 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nwjr2-0005A6-PP for patch@linaro.org; Thu, 02 Jun 2022 08:23:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47102) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwjTh-0001Bh-Jv for qemu-devel@nongnu.org; Thu, 02 Jun 2022 07:59:01 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:55455) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwjTf-0001Ho-SD for qemu-devel@nongnu.org; Thu, 02 Jun 2022 07:59:01 -0400 Received: from quad ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue009 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MsYzD-1ndhNy1SMF-00typ9; Thu, 02 Jun 2022 13:58:49 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Laurent Vivier , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PULL 19/19] target/m68k: Mark helper_raise_exception as noreturn Date: Thu, 2 Jun 2022 13:58:37 +0200 Message-Id: <20220602115837.2013918-20-laurent@vivier.eu> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220602115837.2013918-1-laurent@vivier.eu> References: <20220602115837.2013918-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:r8vNTj3IrYU1gL5zTDko+2/VbcHj2MLpeigxtozZJCcK6LnL7q+ 8sfb0xuzFJPNIbh/3fLluUp3J8UyT6jZgf0+FBQmLopayYtjGp2UKLuq+TpOeIwsbhpgu1C iX8jII82E788YIR/mXh3t+6eTEPX//QffdbkAbIz7bB2pALR75ALtU50tOnqpm/k4JLuAaG rwzqi7PpnDW7T70Om7UVQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:s9/8px6N+I8=:MqSSY3y7ibhDqoEi5mX7Vy +kmQy+0vqER70rO8nKBv7bas0iDzGYW6l2sJfV6igqofpgIMzqw4eeDb9UBEQMA8i3jkx++4t w9EPqwn4kHDTbaFaeGdgi7l5CvP97iBb/wtlxXWACr0At2g9I7TLTEh7adAEjMfoIQM1GzlO0 /M1+uwjE0cLBd7KGUTcQ0f/5EoAEmjiyLTtyR/8g3zl82qj8CkfMenCoazqibAfTAsHy8i3Nl 8hNriLTQncwPTKhthnafDqiCXQXXtuNQezY1W85B1EgITnHCIaGsizQpQGI8kYzteKLHrcRF6 0wOPpO7/9AfPCGFqbWBboiJnp22waJhiF0qq/S+U6ip081eexmcvhEOzBWhV/KphupZwwT+2X 33sFs0MuRGHeJTvAFhUR/ymSEgWRpAUgD/89b7eSMK96K1PAvJcFmGYPjU9uRSHDJ9whV3bmj x1PRBd/mjfwIIr5O3vMSgrHh8uMau4pwsxTZJIrH0r+SQykiXZy1UDfwbZvEllBZFazmXYDl2 bxwDydgUAqnLfel8VSlDo0lYm9Uak9KzvVzKI5tKkKNXgnlsVjGKe3cgSkg6y1UEc6BdQJTOX I52ZD2PFYgNAFmishZ1nYkUT7a9qnW1FF7xHGfShnbPUrTK6TvuQsTlYqcKuepLBpPw3BmqlL IRs/b/QbFElVsApEdftrRkxzodnEP3vLKHCt2sGUo5PuY1mQCxWOcYaOHn5RxckOqOblBcSL/ v+jmzuVstpukt/CJsR+gX+XvgEvNL/Llo/r6Pg== Received-SPF: none client-ip=212.227.126.131; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de 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, SPF_HELO_NONE=0.001, SPF_NONE=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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Also mark raise_exception_ra and raise_exception, lest we generate a warning about helper_raise_exception returning. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Laurent Vivier Signed-off-by: Richard Henderson Message-Id: <20220602013401.303699-18-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- 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 f016c4c1c226..c9bed2b88456 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) DEF_HELPER_FLAGS_3(bfffo_reg, TCG_CALL_NO_RWG_SE, i32, i32, i32, i32) diff --git a/target/m68k/op_helper.c b/target/m68k/op_helper.c index 61948d92bb25..d9937ca8dc5a 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 interrupt_request) #endif /* !CONFIG_USER_ONLY */ -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 = env_cpu(env); @@ -540,7 +541,7 @@ static void raise_exception_ra(CPUM68KState *env, int tt, uintptr_t raddr) cpu_loop_exit_restore(cs, raddr); } -static void raise_exception(CPUM68KState *env, int tt) +G_NORETURN static void raise_exception(CPUM68KState *env, int tt) { raise_exception_ra(env, tt, 0); }