From patchwork Tue Jun 13 13:33:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 691987 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d91:0:0:0:0:0 with SMTP id b17csp424376wru; Tue, 13 Jun 2023 06:36:51 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4bRc3pnFuRJF1Zfes8VrHqUF+zFgQtPvHnWsPLr/wYzxDOx/TdZSFsrfASkRFnVhRMYhrL X-Received: by 2002:a05:620a:1a1c:b0:75b:23a1:8314 with SMTP id bk28-20020a05620a1a1c00b0075b23a18314mr14002168qkb.15.1686663410867; Tue, 13 Jun 2023 06:36:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686663410; cv=none; d=google.com; s=arc-20160816; b=EsTV84j1K6wCvzOt97XukfuZZ8lgZ73B/xEAa/GwneGM5RfiN0qeOFOclWxi8AMCbO +i0yxoMmwsQQeQDgaOtKp52Voic7csTffFTWRRW3xup2rBMg6/KWAk2pVUuJtz+UTHGW g/5sIbJzW1D7mBzCrpuQjIkWIW0YHm55Ui8of3G5asHdZZsj/Oe95sQLY4X+B6vb93Yp U+zYZ6rxewK+FO+RfSOkBI1weB7CrNeWSHLJZhsUI4kcZUynMLkCnZQgB6rxcU8nsHtY Z5evJTRj5E4wkrB3fftEa4U84Kci4fSr0/2/Sg6e6XobsaRHXo1t/qXuJeb3HRGSf97u zBjw== 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:dkim-signature; bh=W5VKZg4F+9MZrxoe7cg5j1eqlVZezbWvVtc1kXE6jLI=; b=nka4e0hC7xeyuVphN5oT5WODqVEv31ydWS9VEjjCzQ23rWrMKOeXugBLh8tGyT3XRk ozoMGlRbKT38u1LCFSiX+wtg9GXo81lG10VAnRy3g+TAuIoJOmK9Mc6Y8FOqH9uDtn/X pE0j0aW42duUIkgsguPga63mAW2ZKRe1EOlsE0vTqezSPIVcqA9MzYOzhsvqKf4gV9A1 V4ropd67106Y88A1vIbt/1/5Cjw5x9MwdjZD1BRcjcUFnKSLFV0ZkaJU3oZrEKUgjUZw TdhBFov+H7A0zMidLgn8PFy9/AJsxe6tW5S8Ahgw56hJRmiEdS96t3wGtISLTfvs5cnG SCKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=J35vi3VH; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id pa29-20020a05620a831d00b0075ec5399093si7474455qkn.738.2023.06.13.06.36.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Jun 2023 06:36:50 -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; dkim=pass header.i=@linaro.org header.s=google header.b=J35vi3VH; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q94BZ-0008Us-Ik; Tue, 13 Jun 2023 09:35:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q94BX-0008QE-DJ for qemu-devel@nongnu.org; Tue, 13 Jun 2023 09:35:47 -0400 Received: from mail-ed1-x52c.google.com ([2a00:1450:4864:20::52c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q94BT-0002VH-Uw for qemu-devel@nongnu.org; Tue, 13 Jun 2023 09:35:47 -0400 Received: by mail-ed1-x52c.google.com with SMTP id 4fb4d7f45d1cf-5184abe9e86so2334928a12.0 for ; Tue, 13 Jun 2023 06:35:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1686663342; x=1689255342; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=W5VKZg4F+9MZrxoe7cg5j1eqlVZezbWvVtc1kXE6jLI=; b=J35vi3VH77ic5CB7eWaFNePExdyljKcZQj01xauILe+x4JUst3Ccvn+1XArbonvZLE fyvVfY2fWF4PHdmGDimG/00rBSRngemsdkiopZonH8Z69XHmLdnQTVHHIw52SIYSW1n/ i/ZH3hF88cTczOQ7UOPG2M62kO9T2ItuW2Fvk7sgFzkNJPo7mMWkEE7fOi1YD3QmSMhs A5hcVhzG5NvC4CV9qCQEeY2Q0hVXlIHythAcvOYSnSuDeWvxjX0rrkSajPMVXbmv7DTZ rOazquvI7cd80eLY81UoFhaSsH084eqs3rbjHYABRiraAt1Mb9sW3xgEZToCW/wYmxnD jFFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686663342; x=1689255342; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=W5VKZg4F+9MZrxoe7cg5j1eqlVZezbWvVtc1kXE6jLI=; b=GCRudDZsuU3D1HnVxvEEmU+4vjTeMwGHz7EbnIPZqhbUAixkPZJYmqvreNgcdkv7Mg 1cpBYTPf2B/MxsSBhvtqShFmJkN5Ykull41UiCaYW8i3XXdlosIiFBPB9YhgjBNyoCfq RSp8q550wcYhm8qBi9JjGaEOehPp6SDE29eFG8jvogM3U5KWnvUN2d/SxQJnWOtBAxtE wWNQrOBd656TiHuAaAblaWoNTNJt+YNYmowtEmmxEdYGWifBQg9e1iUS9BI7l+bhqdkO CedmIAlN9YQ5ZRMdkp+tZOcYAssVvgz5+yPOB5NVPEot88wDNwEqyAKmkrlyFi3lkz00 gTwA== X-Gm-Message-State: AC+VfDwRZaQTsV7v0gCgFQ7KFyzI0QdeVBdDnBieb+gXukYOBaZa9L96 9zdaqGUNuK/JVwJA3nWKT+onWK61hCPZywWPW/k= X-Received: by 2002:a17:907:944f:b0:982:1936:ad20 with SMTP id dl15-20020a170907944f00b009821936ad20mr4363066ejc.2.1686663342192; Tue, 13 Jun 2023 06:35:42 -0700 (PDT) Received: from localhost.localdomain ([213.235.133.109]) by smtp.gmail.com with ESMTPSA id kg6-20020a17090776e600b009661484e84esm6639050ejc.191.2023.06.13.06.35.36 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 13 Jun 2023 06:35:41 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Thomas Huth , qemu-s390x@nongnu.org, qemu-riscv@nongnu.org, qemu-arm@nongnu.org, Richard Henderson , qemu-ppc@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v3 3/9] target/m68k: Check for USER_ONLY definition instead of SOFTMMU one Date: Tue, 13 Jun 2023 15:33:41 +0200 Message-Id: <20230613133347.82210-4-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230613133347.82210-1-philmd@linaro.org> References: <20230613133347.82210-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::52c; envelope-from=philmd@linaro.org; helo=mail-ed1-x52c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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-bounces+patch=linaro.org@nongnu.org Since we *might* have user emulation with softmmu, replace the system emulation check by !user emulation one. Invert some if() ladders for clarity. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- target/m68k/helper.h | 2 +- target/m68k/cpu.c | 14 ++++++-------- target/m68k/helper.c | 4 ++-- target/m68k/translate.c | 28 ++++++++++++++-------------- 4 files changed, 23 insertions(+), 25 deletions(-) diff --git a/target/m68k/helper.h b/target/m68k/helper.h index c9bed2b884..2bbe0dc032 100644 --- a/target/m68k/helper.h +++ b/target/m68k/helper.h @@ -124,7 +124,7 @@ DEF_HELPER_FLAGS_4(bfffo_mem, TCG_CALL_NO_WG, i64, env, i32, s32, i32) DEF_HELPER_3(chk, void, env, s32, s32) DEF_HELPER_4(chk2, void, env, s32, s32, s32) -#if defined(CONFIG_SOFTMMU) +#if !defined(CONFIG_USER_ONLY) DEF_HELPER_3(ptest, void, env, i32, i32) DEF_HELPER_3(pflush, void, env, i32, i32) DEF_HELPER_FLAGS_1(reset, TCG_CALL_NO_RWG, void, env) diff --git a/target/m68k/cpu.c b/target/m68k/cpu.c index 99af1ab541..70d58471dc 100644 --- a/target/m68k/cpu.c +++ b/target/m68k/cpu.c @@ -80,10 +80,10 @@ static void m68k_cpu_reset_hold(Object *obj) } memset(env, 0, offsetof(CPUM68KState, end_reset_fields)); -#ifdef CONFIG_SOFTMMU - cpu_m68k_set_sr(env, SR_S | SR_I); -#else +#ifdef CONFIG_USER_ONLY cpu_m68k_set_sr(env, 0); +#else + cpu_m68k_set_sr(env, SR_S | SR_I); #endif for (i = 0; i < 8; i++) { env->fregs[i].d = nan; @@ -334,7 +334,7 @@ static void m68k_cpu_initfn(Object *obj) cpu_set_cpustate_pointers(cpu); } -#if defined(CONFIG_SOFTMMU) +#if !defined(CONFIG_USER_ONLY) static bool fpu_needed(void *opaque) { M68kCPU *s = opaque; @@ -525,15 +525,13 @@ static const VMStateDescription vmstate_m68k_cpu = { NULL }, }; -#endif -#ifndef CONFIG_USER_ONLY #include "hw/core/sysemu-cpu-ops.h" static const struct SysemuCPUOps m68k_sysemu_ops = { .get_phys_page_debug = m68k_cpu_get_phys_page_debug, }; -#endif +#endif /* !CONFIG_USER_ONLY */ #include "hw/core/tcg-cpu-ops.h" @@ -568,7 +566,7 @@ static void m68k_cpu_class_init(ObjectClass *c, void *data) cc->get_pc = m68k_cpu_get_pc; cc->gdb_read_register = m68k_cpu_gdb_read_register; cc->gdb_write_register = m68k_cpu_gdb_write_register; -#if defined(CONFIG_SOFTMMU) +#if !defined(CONFIG_USER_ONLY) dc->vmsd = &vmstate_m68k_cpu; cc->sysemu_ops = &m68k_sysemu_ops; #endif diff --git a/target/m68k/helper.c b/target/m68k/helper.c index 3b3a6ea8bd..01c18a7c59 100644 --- a/target/m68k/helper.c +++ b/target/m68k/helper.c @@ -1480,7 +1480,7 @@ void HELPER(set_mac_extu)(CPUM68KState *env, uint32_t val, uint32_t acc) env->macc[acc + 1] = res; } -#if defined(CONFIG_SOFTMMU) +#if !defined(CONFIG_USER_ONLY) void HELPER(ptest)(CPUM68KState *env, uint32_t addr, uint32_t is_read) { hwaddr physical; @@ -1534,4 +1534,4 @@ void HELPER(reset)(CPUM68KState *env) { /* FIXME: reset all except CPU */ } -#endif +#endif /* !CONFIG_USER_ONLY */ diff --git a/target/m68k/translate.c b/target/m68k/translate.c index 551ef9e52a..e07161d76f 100644 --- a/target/m68k/translate.c +++ b/target/m68k/translate.c @@ -2637,10 +2637,10 @@ DISAS_INSN(swap) DISAS_INSN(bkpt) { -#if defined(CONFIG_SOFTMMU) - gen_exception(s, s->base.pc_next, EXCP_ILLEGAL); -#else +#if defined(CONFIG_USER_ONLY) gen_exception(s, s->base.pc_next, EXCP_DEBUG); +#else + gen_exception(s, s->base.pc_next, EXCP_ILLEGAL); #endif } @@ -2838,7 +2838,7 @@ DISAS_INSN(unlk) tcg_gen_addi_i32(QREG_SP, src, 4); } -#if defined(CONFIG_SOFTMMU) +#if !defined(CONFIG_USER_ONLY) DISAS_INSN(reset) { if (IS_USER(s)) { @@ -4398,7 +4398,7 @@ DISAS_INSN(move_from_sr) DEST_EA(env, insn, OS_WORD, sr, NULL); } -#if defined(CONFIG_SOFTMMU) +#if !defined(CONFIG_USER_ONLY) DISAS_INSN(moves) { int opsize; @@ -4605,7 +4605,7 @@ DISAS_INSN(cinv) /* Invalidate cache line. Implement as no-op. */ } -#if defined(CONFIG_SOFTMMU) +#if !defined(CONFIG_USER_ONLY) DISAS_INSN(pflush) { TCGv opmode; @@ -5352,7 +5352,7 @@ DISAS_INSN(ftrapcc) do_trapcc(s, &c); } -#if defined(CONFIG_SOFTMMU) +#if !defined(CONFIG_USER_ONLY) DISAS_INSN(frestore) { TCGv addr; @@ -5795,7 +5795,7 @@ void register_m68k_insns (CPUM68KState *env) BASE(bitop_im, 08c0, ffc0); INSN(arith_im, 0a80, fff8, CF_ISA_A); INSN(arith_im, 0a00, ff00, M68K); -#if defined(CONFIG_SOFTMMU) +#if !defined(CONFIG_USER_ONLY) INSN(moves, 0e00, ff00, M68K); #endif INSN(cas, 0ac0, ffc0, CAS); @@ -5824,7 +5824,7 @@ void register_m68k_insns (CPUM68KState *env) BASE(move_to_ccr, 44c0, ffc0); INSN(not, 4680, fff8, CF_ISA_A); INSN(not, 4600, ff00, M68K); -#if defined(CONFIG_SOFTMMU) +#if !defined(CONFIG_USER_ONLY) BASE(move_to_sr, 46c0, ffc0); #endif INSN(nbcd, 4800, ffc0, M68K); @@ -5841,7 +5841,7 @@ void register_m68k_insns (CPUM68KState *env) BASE(tst, 4a00, ff00); INSN(tas, 4ac0, ffc0, CF_ISA_B); INSN(tas, 4ac0, ffc0, M68K); -#if defined(CONFIG_SOFTMMU) +#if !defined(CONFIG_USER_ONLY) INSN(halt, 4ac8, ffff, CF_ISA_A); INSN(halt, 4ac8, ffff, M68K); #endif @@ -5855,7 +5855,7 @@ void register_m68k_insns (CPUM68KState *env) BASE(trap, 4e40, fff0); BASE(link, 4e50, fff8); BASE(unlk, 4e58, fff8); -#if defined(CONFIG_SOFTMMU) +#if !defined(CONFIG_USER_ONLY) INSN(move_to_usp, 4e60, fff8, USP); INSN(move_from_usp, 4e68, fff8, USP); INSN(reset, 4e70, ffff, M68K); @@ -5980,7 +5980,7 @@ void register_m68k_insns (CPUM68KState *env) INSN(ftrapcc, f27a, fffe, FPU); /* opmode 010, 011 */ INSN(ftrapcc, f27c, ffff, FPU); /* opmode 100 */ INSN(fbcc, f280, ff80, FPU); -#if defined(CONFIG_SOFTMMU) +#if !defined(CONFIG_USER_ONLY) INSN(frestore, f340, ffc0, CF_FPU); INSN(fsave, f300, ffc0, CF_FPU); INSN(frestore, f340, ffc0, FPU); @@ -6190,7 +6190,7 @@ void m68k_cpu_dump_state(CPUState *cs, FILE *f, int flags) break; } qemu_fprintf(f, "\n"); -#ifdef CONFIG_SOFTMMU +#ifndef CONFIG_USER_ONLY qemu_fprintf(f, "%sA7(MSP) = %08x %sA7(USP) = %08x %sA7(ISP) = %08x\n", env->current_sp == M68K_SSP ? "->" : " ", env->sp[M68K_SSP], env->current_sp == M68K_USP ? "->" : " ", env->sp[M68K_USP], @@ -6204,5 +6204,5 @@ void m68k_cpu_dump_state(CPUState *cs, FILE *f, int flags) env->mmu.ttr[M68K_ITTR0], env->mmu.ttr[M68K_ITTR1]); qemu_fprintf(f, "MMUSR %08x, fault at %08x\n", env->mmu.mmusr, env->mmu.ar); -#endif +#endif /* !CONFIG_USER_ONLY */ }