From patchwork Mon Dec 14 20:34:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 11973061 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6735DC4361B for ; Mon, 14 Dec 2020 20:46:26 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D7A29222BB for ; Mon, 14 Dec 2020 20:46:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D7A29222BB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:59582 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1koujh-0000k3-1P for qemu-devel@archiver.kernel.org; Mon, 14 Dec 2020 15:46:25 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:46932) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kouYD-0001hm-AV; Mon, 14 Dec 2020 15:34:33 -0500 Received: from esa3.hgst.iphmx.com ([216.71.153.141]:60614) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kouYB-0007vm-HI; Mon, 14 Dec 2020 15:34:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1607978071; x=1639514071; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Hsj4JIbnoPeXWo3xGpMTNzMelbtCFmgMYA0wdibbDmk=; b=cxjdgrp/PAFPsy3mzA3P5ztELu1IeCUVqrZcjJG0sScJbJ8IEqYDYits 0quLITWZyzE5ryC91cKqhvzaUh09pBmv0eNXCfGXV7uBkTwLW9OgAGGjD 2pf+jZKFtmaC4n67lT0W8KvgtqSifArzZwSJKRBFUE+oa6cc80WEi9Nrj 6mLp4Ux81syeXOYQERFq5RIwmZD0M/i5fIfxbJePxrx1GKkNNYMUl70+0 JOy3QBaoS5r3W3vdUEmLsHsUc6nd8Lg3lbt4KdxM3JWckhuS/se+kxGHk 9c4s1TCPceMRp+BP2oMi9dQ9SYlJNsTnbQjjlccX6VKaiKOzO27iprwEW w==; IronPort-SDR: Y6V7SgpR9+C7VYhOmjjem06NWRKL2LeM/mBAEDzxzYuX5vfsa5usrwpJk7h4l28C42ZFdqJv0j P6onT7DGTgT6XI6jvgCWRUiHliVN3DO4iZnBUrAelV5JD1OE5e/38sDKi/b+N7WSWAu4Odh47R 8YKPSaV2QhvVuaXAx5HTkqUpPlhdpYaP8inpXFhvw1y+SX/gkmWJNM/p/lM5dBuWQrF5U2aqqW aEzNryJz0371n1bs8p0BcWoKzRTnGxEEESfM56GQyQkq7ah5XmljHjW1kw8JOqxzoTUVFBTvY0 8WY= X-IronPort-AV: E=Sophos;i="5.78,420,1599494400"; d="scan'208";a="159586006" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 15 Dec 2020 04:34:29 +0800 IronPort-SDR: J+p7Ppq85p4iI3Dd6Y3GRpFuVr3TFtbSaYeTzf1bGcGdVfrCjO6+LHC2Fv+U/ccvaPTcyNNlt9 x3NHv7/sSxCXDTYGj9/NZSXwYUm0OaU1MZSUCGzYKJ40yPnFO9zu6C/P8QNl7CVYqb9RyYJ1yY om93JRgVcTm0ZpsCWCuP9c9seRmGV/7eQzC32EqiAvNVYPSGAujpMB2nmv+E2JzG6ch/MFxvhb qQX1Bt3QAe4LoTSomqyj0z15YJiVCKnJn+SQ5L/rqhOXtyQnSuyyOcH6w0N7rgYGbCnBCU3XXs NMjtzr1Id/u9JWA/jQoAG9Cu Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Dec 2020 12:18:13 -0800 IronPort-SDR: ISD3HW5l0fQwogWCx/BOX06ayM9yZdTRVKAf9lUytQv16qjkzNKcbEQLojOOrTbF06sEN3RAx4 kMG5fL++qSwWel5FMx0As0ZEUEhfo3k9qlkyk7Iun39ul3Ad/8zyADT2QbxJvTI9ILhwCgHZ9g S3fDl+9YBnfp6CzFDHf+IbvjKoSYjJZd+nMOtl23W1Th5p9TS0n2xWo6jn2ZaEvu1mz7YHyxF+ Kqn+P+EI63LDrqM8PZSwLPQJ2zsHJMSdAqwcXfEjOCnLexMFmR7Afr7G9kJr+KnAYLKihRIsGr a1A= WDCIronportException: Internal Received: from cnf006900.ad.shared (HELO risc6-mainframe.hgst.com) ([10.86.62.52]) by uls-op-cesaip02.wdc.com with ESMTP; 14 Dec 2020 12:34:29 -0800 From: Alistair Francis To: qemu-devel@nongnu.org, qemu-riscv@nongnu.org Subject: [PATCH v3 12/15] target/riscv: cpu: Remove compile time XLEN checks Date: Mon, 14 Dec 2020 12:34:29 -0800 Message-Id: X-Mailer: git-send-email 2.29.2 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=216.71.153.141; envelope-from=prvs=61015ee87=alistair.francis@wdc.com; helo=esa3.hgst.iphmx.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alistair.francis@wdc.com, bmeng.cn@gmail.com, palmer@dabbelt.com, alistair23@gmail.com Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Alistair Francis Reviewed-by: Bin Meng Reviewed-by: Richard Henderson --- target/riscv/cpu.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 7d6f032122..47b738c314 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -240,10 +240,10 @@ static void riscv_cpu_dump_state(CPUState *cs, FILE *f, int flags) #ifndef CONFIG_USER_ONLY qemu_fprintf(f, " %s " TARGET_FMT_lx "\n", "mhartid ", env->mhartid); qemu_fprintf(f, " %s " TARGET_FMT_lx "\n", "mstatus ", (target_ulong)env->mstatus); -#ifdef TARGET_RISCV32 - qemu_fprintf(f, " %s " TARGET_FMT_lx "\n", "mstatush ", - (target_ulong)(env->mstatus >> 32)); -#endif + if (riscv_cpu_is_32bit(env)) { + qemu_fprintf(f, " %s " TARGET_FMT_lx "\n", "mstatush ", + (target_ulong)(env->mstatus >> 32)); + } if (riscv_has_ext(env, RVH)) { qemu_fprintf(f, " %s " TARGET_FMT_lx "\n", "hstatus ", env->hstatus); qemu_fprintf(f, " %s " TARGET_FMT_lx "\n", "vsstatus ", @@ -356,11 +356,12 @@ static void riscv_cpu_reset(DeviceState *dev) static void riscv_cpu_disas_set_info(CPUState *s, disassemble_info *info) { -#if defined(TARGET_RISCV32) - info->print_insn = print_insn_riscv32; -#elif defined(TARGET_RISCV64) - info->print_insn = print_insn_riscv64; -#endif + RISCVCPU *cpu = RISCV_CPU(s); + if (riscv_cpu_is_32bit(&cpu->env)) { + info->print_insn = print_insn_riscv32; + } else { + info->print_insn = print_insn_riscv64; + } } static void riscv_cpu_realize(DeviceState *dev, Error **errp)