From nobody Thu May 9 11:03:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.221.46 as permitted sender) client-ip=209.85.221.46; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-f46.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.46 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1633543943; cv=none; d=zohomail.com; s=zohoarc; b=PM3kmFW07LvwA7CFNyxGZqVeZ6F/tZVrASFshy88mMe6Ymc3FtQVQgj5D/lNxW7uzZ8TJd5sRrm01buaKAx0YYP5wsR4+tBzdnCWvSu6Ed6P/ZzfYopaBy+aM/AkQiziC84sDjwxqIiIJpaiPL2OQgOqUVIV2TZlEp5wQUlaHhg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633543943; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:MIME-Version:Message-ID:Sender:Subject:To; bh=sZpfx2bUvI9CqllKUWhSqmnXDEtLWukZ0/HkURdc1jg=; b=cBbKg11TjLpiccBR4kH/vK4cKhToCEVqts3WpV0DM0cxMhthyMHw/NDaUJnglhiMQ+BAP1DsnzqHz01CojYL4VowgU300BAp4g0CKcYpMTqWK/Jevlogz9owvAmH6EwvyM1O5/32me/VX+ErleNnweJtwW1zs+CAU2p7TOe1Ago= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.46 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) by mx.zohomail.com with SMTPS id 1633543943557986.1024368874793; Wed, 6 Oct 2021 11:12:23 -0700 (PDT) Received: by mail-wr1-f46.google.com with SMTP id r18so11432431wrg.6 for ; Wed, 06 Oct 2021 11:12:22 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id t12sm18572537wrw.12.2021.10.06.11.12.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 11:12:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=sZpfx2bUvI9CqllKUWhSqmnXDEtLWukZ0/HkURdc1jg=; b=q5w5DiMWFPrKm03hgW80fA+kosanXWrZNfVDUoP5edv4a71DEOhm7XR1DGH2cNIJRq ZthavSq20O1xqtkJAqFYjT9iHl3ZqKoqPb9b6k6ggDBHrRb8qz8XjE7Q4CJFyk7ANQWx ZTIxsNPrcbXJnpzC0ELUuS1Q5eX2BLBFAdvWLsWRFm54D2qwZCTUl7qVlNyglJ3y/Yyf BhJv6eLXFcraR8CD1IeHDCORdcPG5meju+U1yn79e3c4WKK3urCqIBtY5XsEvJc19vXq YZ78h/SwAurTwrpaPiYdMvjHerPsD47D4cI/g8fqRNgu5v8mW9F5REQZsW9ka/+ORBwL MNwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=sZpfx2bUvI9CqllKUWhSqmnXDEtLWukZ0/HkURdc1jg=; b=8J16KQMFgdT2K3EDYIbJG2xVMXqabyksxAV4YBBgumG+gfI7XvUMtVU/NapEv/i45i NpQbO8TwXtyEpY7ieGlhb1o9+lrWVaCueo1Gb0zHrRNG3O4NAntHOJ1yQK39ygYiq9IV lKqzGpLkXNa6fZO4/KFlsEx0ALOoXr3rlsJhVvchnVykWMUJS6G624iXmBV2KsrPipOz oJlLgf7cZA8dmtfGp089tkWDBTzR50uiA9N+gsGbxAx/wPwfeusEPAHK+ASrI/WKd99K 2djKYx60WYM3kip3AOzFGD9Bx9ZmebZ+gIBRvsg7Co5njjP6rIBcIB8eo3XZzi0uMPAk 85Og== X-Gm-Message-State: AOAM5326nWzKsW0FclUXbW6CIZc1HkHMJ77khjlYsod8dMOMsgxZtxSz RqmCT9HNbOdxF6ziQGg8FuU= X-Google-Smtp-Source: ABdhPJyO0/4sZWc4WUmghR7yFs9Q6BOQPM9IvbfZYG+QvXxEwGoH5+jMpylE13Q4aZOtKZvokOWJRA== X-Received: by 2002:adf:9b97:: with SMTP id d23mr30053569wrc.53.1633543941720; Wed, 06 Oct 2021 11:12:21 -0700 (PDT) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Yoshinori Sato , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH] target/sh4: Split user/system helpers Date: Wed, 6 Oct 2021 20:12:20 +0200 Message-Id: <20211006181220.213866-1-f4bug@amsat.org> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1633543944646100001 cpu_sh4_is_cached() is the single user-emulation helper: move the function to its own file and simplify the #ifdef'ry. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- Based-on: <20211006172307.780893-1-richard.henderson@linaro.org> --- target/sh4/{helper.c =3D> helper_system.c} | 15 +------------ target/sh4/helper_user.c | 28 ++++++++++++++++++++++++ target/sh4/meson.build | 10 +++++++-- 3 files changed, 37 insertions(+), 16 deletions(-) rename target/sh4/{helper.c =3D> helper_system.c} (98%) create mode 100644 target/sh4/helper_user.c diff --git a/target/sh4/helper.c b/target/sh4/helper_system.c similarity index 98% rename from target/sh4/helper.c rename to target/sh4/helper_system.c index 6a620e36fc3..077b3dd8de5 100644 --- a/target/sh4/helper.c +++ b/target/sh4/helper_system.c @@ -1,5 +1,5 @@ /* - * SH4 emulation + * SH4 system emulation helpers * * Copyright (c) 2005 Samuel Tardieu * @@ -23,10 +23,8 @@ #include "exec/exec-all.h" #include "exec/log.h" =20 -#if !defined(CONFIG_USER_ONLY) #include "hw/sh4/sh_intc.h" #include "sysemu/runstate.h" -#endif =20 #define MMU_OK 0 #define MMU_ITLB_MISS (-1) @@ -43,16 +41,6 @@ #define MMU_DADDR_ERROR_READ (-12) #define MMU_DADDR_ERROR_WRITE (-13) =20 -#if defined(CONFIG_USER_ONLY) - -int cpu_sh4_is_cached(CPUSH4State *env, target_ulong addr) -{ - /* For user mode, only U0 area is cacheable. */ - return !(addr & 0x80000000); -} - -#else /* !CONFIG_USER_ONLY */ - void superh_cpu_do_interrupt(CPUState *cs) { SuperHCPU *cpu =3D SUPERH_CPU(cs); @@ -860,4 +848,3 @@ bool superh_cpu_tlb_fill(CPUState *cs, vaddr address, i= nt size, } cpu_loop_exit_restore(cs, retaddr); } -#endif /* !CONFIG_USER_ONLY */ diff --git a/target/sh4/helper_user.c b/target/sh4/helper_user.c new file mode 100644 index 00000000000..b6eba9d085c --- /dev/null +++ b/target/sh4/helper_user.c @@ -0,0 +1,28 @@ +/* + * SH4 user emulation helpers + * + * Copyright (c) 2005 Samuel Tardieu + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#include "qemu/osdep.h" + +#include "cpu.h" + +int cpu_sh4_is_cached(CPUSH4State *env, target_ulong addr) +{ + /* For user mode, only U0 area is cacheable. */ + return !(addr & 0x80000000); +} diff --git a/target/sh4/meson.build b/target/sh4/meson.build index 56a57576da7..bbf2bb8aa03 100644 --- a/target/sh4/meson.build +++ b/target/sh4/meson.build @@ -2,13 +2,19 @@ sh4_ss.add(files( 'cpu.c', 'gdbstub.c', - 'helper.c', 'op_helper.c', 'translate.c', )) =20 +sh4_user_ss =3D ss.source_set() +sh4_user_ss.add(files('helper_user.c')) + sh4_softmmu_ss =3D ss.source_set() -sh4_softmmu_ss.add(files('monitor.c')) +sh4_softmmu_ss.add(files( + 'monitor.c', + 'helper_system.c', +)) =20 target_arch +=3D {'sh4': sh4_ss} target_softmmu_arch +=3D {'sh4': sh4_softmmu_ss} +target_user_arch +=3D {'sh4': sh4_user_ss} --=20 2.31.1