From nobody Wed Nov 5 18:30:56 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1536112010075124.25177698997027; Tue, 4 Sep 2018 18:46:50 -0700 (PDT) Received: from localhost ([::1]:53384 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fxMu7-00079m-Cn for importer@patchew.org; Tue, 04 Sep 2018 21:46:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57789) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fxMrx-0005uI-PF for qemu-devel@nongnu.org; Tue, 04 Sep 2018 21:44:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fxMrv-0006jv-T4 for qemu-devel@nongnu.org; Tue, 04 Sep 2018 21:44:33 -0400 Received: from mail-lf1-x12e.google.com ([2a00:1450:4864:20::12e]:40294) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fxMru-0006gE-Q1 for qemu-devel@nongnu.org; Tue, 04 Sep 2018 21:44:31 -0400 Received: by mail-lf1-x12e.google.com with SMTP id x26-v6so4575915lfi.7 for ; Tue, 04 Sep 2018 18:44:29 -0700 (PDT) Received: from octofox.cadence.com (jcmvbkbc-1-pt.tunnel.tserv24.sto1.ipv6.he.net. [2001:470:27:1fa::2]) by smtp.gmail.com with ESMTPSA id g10-v6sm59337lfl.11.2018.09.04.18.44.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Sep 2018 18:44:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=WbuiwURD1XdRYx69ckMkOGwbTDhBwY/RgI9CjIJlI+o=; b=GE398+xnq8yTM2yyQ2OpK2CqQsYspdMMsKFQwrVWLl7JMcmtbADTPzi8+M4AiCq/84 YuNYqNhlAATuw26zpUmG+MHLuxUQ92zgoq6lJ/YAM5W9l6zNyS1qcRHT/VZ2EcVcA3BZ xUW29J7hT+5PhLP/pGQrBU6JMEPu28w68hfJSxwuXbr1CcgpEOLTYCflbrQZPnZtLZt/ IzR2ejiaodFa0XipZ7mjE7BibPMQ/74oKhXegm/PkJofyEnltI5mLURuzM5sisHB4CPA 8kVyR1Z/T+ZKV15wYuViOdUj66gSc8rDoD16ptLhJhWAqhk49UGfO1hO3EjvQ+4mKebY ylEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=WbuiwURD1XdRYx69ckMkOGwbTDhBwY/RgI9CjIJlI+o=; b=nusAHv/T5pVh8zLK2br81X7SCB5mNgzlaHT+XHZz4VzQTxIuSieuXXpczhI+5vmS8A agZZUk/IdiGe3q1zdiGT6R0lsTAvGFT50NhXHcPHLqoOxFPWe9SyJ8631f69OBklST10 LDiLrQfqVRtEO/zUXrlmkDT4LJrQI840fwzWEckPmGT7K7drOFhU2ASpRfa0tVT2IL1i qxDrp3Yn4sHnJDMaVNfTEgpbcnrOCxhm8SlvFZG8lt/MtyAoalcNnSalgdAiCtrhO29E x2c4LYR09xS0CpYAF3Ufm0+xI1fsp4d9nUk9XclJ/GzY3+TcqImsOvnotZSrA6B5j0em Qefg== X-Gm-Message-State: APzg51DCtSy2wXpPSxqeILfw1qrZiuSlMKynfwadienYTmYOFX5B23hD 5niNLjfd+hJOMlJEDfjvIUvQeDJUzxI= X-Google-Smtp-Source: ANB0VdbDuU7VheSc/+lZOEf53+WPXApWF2GDQTXn+ITYSeCLG0MQAjls7qYzUySuag87p2LEI5LfHA== X-Received: by 2002:a19:8c8:: with SMTP id 191-v6mr4420864lfi.152.1536111867728; Tue, 04 Sep 2018 18:44:27 -0700 (PDT) From: Max Filippov To: qemu-devel@nongnu.org Date: Tue, 4 Sep 2018 18:43:41 -0700 Message-Id: <20180905014352.970-5-jcmvbkbc@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180905014352.970-1-jcmvbkbc@gmail.com> References: <20180905014352.970-1-jcmvbkbc@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::12e Subject: [Qemu-devel] [PATCH 04/15] target/xtensa: extract test for debug exception X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Max Filippov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDMRC_1 RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" - mark break and break.n instructions; - collect debug cause bits from parameter 0 of instructions marked for debug exception; - put debug exception check right after syscall check; Signed-off-by: Max Filippov --- target/xtensa/translate.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c index 450e30d316a8..5222c952a1b7 100644 --- a/target/xtensa/translate.c +++ b/target/xtensa/translate.c @@ -959,6 +959,7 @@ static void disas_xtensa_insn(CPUXtensaState *env, Disa= sContext *dc) uint32_t arg[MAX_OPCODE_ARGS]; uint32_t raw_arg[MAX_OPCODE_ARGS]; } slot_prop[MAX_INSN_SLOTS]; + uint32_t debug_cause =3D 0; =20 if (len =3D=3D XTENSA_UNDEFINED) { qemu_log_mask(LOG_GUEST_ERROR, @@ -1040,6 +1041,9 @@ static void disas_xtensa_insn(CPUXtensaState *env, Di= sasContext *dc) gen_exception_cause(dc, ILLEGAL_INSTRUCTION_CAUSE); return; } + if (ops->op_flags & XTENSA_OP_DEBUG_BREAK) { + debug_cause |=3D ops->par[0]; + } } =20 if ((op_flags & XTENSA_OP_PRIVILEGED) && @@ -1052,6 +1056,11 @@ static void disas_xtensa_insn(CPUXtensaState *env, D= isasContext *dc) return; } =20 + if ((op_flags & XTENSA_OP_DEBUG_BREAK) && dc->debug) { + gen_debug_exception(dc, debug_cause); + return; + } + for (slot =3D 0; slot < slots; ++slot) { XtensaOpcodeOps *ops =3D slot_prop[slot].ops; =20 @@ -1515,14 +1524,6 @@ static void translate_bp(DisasContext *dc, const uin= t32_t arg[], tcg_temp_free(tmp); } =20 -static void translate_break(DisasContext *dc, const uint32_t arg[], - const uint32_t par[]) -{ - if (dc->debug) { - gen_debug_exception(dc, par[0]); - } -} - static void translate_call0(DisasContext *dc, const uint32_t arg[], const uint32_t par[]) { @@ -2827,12 +2828,14 @@ static const XtensaOpcodeOps core_ops[] =3D { .par =3D (const uint32_t[]){TCG_COND_EQ}, }, { .name =3D "break", - .translate =3D translate_break, + .translate =3D translate_nop, .par =3D (const uint32_t[]){DEBUGCAUSE_BI}, + .op_flags =3D XTENSA_OP_DEBUG_BREAK, }, { .name =3D "break.n", - .translate =3D translate_break, + .translate =3D translate_nop, .par =3D (const uint32_t[]){DEBUGCAUSE_BN}, + .op_flags =3D XTENSA_OP_DEBUG_BREAK, }, { .name =3D "bt", .translate =3D translate_bp, --=20 2.11.0