From nobody Wed Nov 27 02:19:09 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1701364839; cv=none; d=zohomail.com; s=zohoarc; b=ZKpP/BE9de8HRK4mFAF5uYdvpKDBcCiosWnqeGcXrmaEiCqEn1KidD4vbdE2W7uzErYUrtBMZL++sLFnTXiEBxkSWQwnz32DS29IcUtfpAOuTgzHm7FmwfFEidncInOl4j2j3fJLyOnxvPari0XZ/0m4hXYfwk+D4Sr7qgJJkec= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1701364839; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=2AVZp+ShOFPnRVGbrxy+gEaCEjJII13GdahT5QjjZRQ=; b=kiLwY7chUSnh7Cpf6YU37k5gYVFLxrRXpjuRD3DwdaiJXVo2RWEtnQuzy8TD8h6iY7zG+f4X+5W9QP4y8gzTuXZfax858KRd58EtXt4OiUhxU3rPC8oj6JFsLUEMa2FoxA49Cxa1YnkVTCS5QLWqAUjsjVRP3o9T0+a8gWosOjY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1701364839087222.5225434546221; Thu, 30 Nov 2023 09:20:39 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r8khN-00055M-Ll; Thu, 30 Nov 2023 12:19:37 -0500 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 1r8khM-00054p-DO for qemu-devel@nongnu.org; Thu, 30 Nov 2023 12:19:36 -0500 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r8khK-0006dW-NN for qemu-devel@nongnu.org; Thu, 30 Nov 2023 12:19:36 -0500 Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-1cfd78f8a12so11478805ad.2 for ; Thu, 30 Nov 2023 09:19:34 -0800 (PST) Received: from octofox.hsd1.ca.comcast.net ([2601:646:a201:19d0:7eb0:c76b:d82c:8f94]) by smtp.gmail.com with ESMTPSA id bc3-20020a170902930300b001cc29ffcd96sm1645926plb.192.2023.11.30.09.19.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 09:19:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701364773; x=1701969573; darn=nongnu.org; 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=2AVZp+ShOFPnRVGbrxy+gEaCEjJII13GdahT5QjjZRQ=; b=lrKtjcp4iD44ddDt+38ff1sTh07kyzWCrBbjo0FBI10Tyru+fkEY+9xuHlTKJMXxlp Iq71JtjFpH3ymd6Xlcfs4/hQrCDAAD8+GyNGE86f6yzBOBsZZ2FFG8326NHpBVok0pcL AgVNGQ4mh9RsdByEAdkNb03ylsn8XtW5twjXFS57jwZY1GtyiKVaqmOCFJH/DUFMhvw6 zQmLI1UsJOmbsyRVTXAAXFxlKaXQx0YUT8qC01xOnHZDHhtC8enu3/FQhfXnYUF8khDE K37kItPnr2cO33rBVnbUKECYzUPYYmrtPwnevgUMkzHLDiVR4Db/s2mgLACgcGuSVe3S QwQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701364773; x=1701969573; 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=2AVZp+ShOFPnRVGbrxy+gEaCEjJII13GdahT5QjjZRQ=; b=pV7RV/pfk2swJScDLRDhDFSJ9uSAuSHxPPRwUrk4ONMRzZjNhAVz+weJrULwDnJp0l ykXJx/5BoVSK+har0mJBiR5KpRvGolNwJmlikfTjYS1zHt4+TxcUpkTungPRNEpsQvO9 cAozzVJtu6IjOVko1J6s1uiOmJaWMPpcPgW6EDNncEYYQ4x1hqDVJBlk5YapIgPiPS8Z +yhgJOwxDX0XpQnKqysFt3pRQoTmaEIoYbiWfFpmQrl+k3opIpbKENyohuVswj4ZyrQH vTejWCgs/lM98z8IKP4qtActaPX6AxObn6B29sun9qGlBz9fay4P27Q05kXhDZEM4XHe qFKg== X-Gm-Message-State: AOJu0YzCbdeA2NN1QunxJbuOGM3Z2epYJUSaIdssPn4bNnWA9MTk370Z 3G29vIVQ3jk095qcQd1i9oRQdswCYWw= X-Google-Smtp-Source: AGHT+IEBAQmDacIdXBc8zqhpCfcbC5Je57QOeZuOLb8eBjjZitoFaDdn5wwPaaCStjwNP9cTVBeVHw== X-Received: by 2002:a17:903:1248:b0:1cc:68a5:f388 with SMTP id u8-20020a170903124800b001cc68a5f388mr28097488plh.33.1701364773036; Thu, 30 Nov 2023 09:19:33 -0800 (PST) From: Max Filippov To: qemu-devel@nongnu.org Cc: Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Max Filippov Subject: [PATCH 1/2] target/xtensa: use generic instruction breakpoint infrastructure Date: Thu, 30 Nov 2023 09:19:19 -0800 Message-Id: <20231130171920.3798954-2-jcmvbkbc@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231130171920.3798954-1-jcmvbkbc@gmail.com> References: <20231130171920.3798954-1-jcmvbkbc@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::633; envelope-from=jcmvbkbc@gmail.com; helo=mail-pl1-x633.google.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.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, FREEMAIL_FROM=0.001, FROM_LOCAL_NOVOWEL=0.5, HK_RANDOM_ENVFROM=0.999, HK_RANDOM_FROM=0.999, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1701364840576000002 Content-Type: text/plain; charset="utf-8" Don't embed ibreak exception generation into TB and don't invalidate TB on ibreak address change. Add CPUBreakpoint pointers to xtensa CPUArchState, use cpu_breakpoint_insert/cpu_breakpoint_remove_by_ref to manage ibreak breakpoints and provide TCGCPUOps::debug_check_breakpoint callback that recognizes valid instruction breakpoints. Signed-off-by: Max Filippov Reviewed-by: Richard Henderson --- target/xtensa/cpu.c | 1 + target/xtensa/cpu.h | 4 ++++ target/xtensa/dbg_helper.c | 46 +++++++++++++++++++++++++------------- target/xtensa/helper.c | 12 ++++++++++ target/xtensa/translate.c | 17 -------------- 5 files changed, 47 insertions(+), 33 deletions(-) diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c index e20fe87bf255..b74ee8917065 100644 --- a/target/xtensa/cpu.c +++ b/target/xtensa/cpu.c @@ -235,6 +235,7 @@ static const struct TCGCPUOps xtensa_tcg_ops =3D { .do_interrupt =3D xtensa_cpu_do_interrupt, .do_transaction_failed =3D xtensa_cpu_do_transaction_failed, .do_unaligned_access =3D xtensa_cpu_do_unaligned_access, + .debug_check_breakpoint =3D xtensa_debug_check_breakpoint, #endif /* !CONFIG_USER_ONLY */ }; =20 diff --git a/target/xtensa/cpu.h b/target/xtensa/cpu.h index dd8172930653..8a423706d8c0 100644 --- a/target/xtensa/cpu.h +++ b/target/xtensa/cpu.h @@ -229,6 +229,7 @@ enum { #define MAX_NCCOMPARE 3 #define MAX_TLB_WAY_SIZE 8 #define MAX_NDBREAK 2 +#define MAX_NIBREAK 2 #define MAX_NMEMORY 4 #define MAX_MPU_FOREGROUND_SEGMENTS 32 =20 @@ -547,6 +548,8 @@ struct CPUArchState { =20 /* Watchpoints for DBREAK registers */ struct CPUWatchpoint *cpu_watchpoint[MAX_NDBREAK]; + /* Breakpoints for IBREAK registers */ + struct CPUBreakpoint *cpu_breakpoint[MAX_NIBREAK]; }; =20 /** @@ -590,6 +593,7 @@ void xtensa_cpu_do_transaction_failed(CPUState *cs, hwa= ddr physaddr, vaddr addr, int mmu_idx, MemTxAttrs attrs, MemTxResult response, uintptr_t reta= ddr); hwaddr xtensa_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); +bool xtensa_debug_check_breakpoint(CPUState *cs); #endif void xtensa_cpu_dump_state(CPUState *cpu, FILE *f, int flags); void xtensa_count_regs(const XtensaConfig *config, diff --git a/target/xtensa/dbg_helper.c b/target/xtensa/dbg_helper.c index 3e0c9e8e8be0..497dafca719c 100644 --- a/target/xtensa/dbg_helper.c +++ b/target/xtensa/dbg_helper.c @@ -33,27 +33,21 @@ #include "exec/exec-all.h" #include "exec/address-spaces.h" =20 -static void tb_invalidate_virtual_addr(CPUXtensaState *env, uint32_t vaddr) -{ - uint32_t paddr; - uint32_t page_size; - unsigned access; - int ret =3D xtensa_get_physical_addr(env, false, vaddr, 2, 0, - &paddr, &page_size, &access); - if (ret =3D=3D 0) { - tb_invalidate_phys_addr(&address_space_memory, paddr, - MEMTXATTRS_UNSPECIFIED); - } -} - void HELPER(wsr_ibreakenable)(CPUXtensaState *env, uint32_t v) { + CPUState *cs =3D env_cpu(env); uint32_t change =3D v ^ env->sregs[IBREAKENABLE]; unsigned i; =20 for (i =3D 0; i < env->config->nibreak; ++i) { if (change & (1 << i)) { - tb_invalidate_virtual_addr(env, env->sregs[IBREAKA + i]); + if (v & (1 << i)) { + cpu_breakpoint_insert(cs, env->sregs[IBREAKA + i], + BP_CPU, &env->cpu_breakpoint[i]); + } else { + cpu_breakpoint_remove_by_ref(cs, env->cpu_breakpoint[i]); + env->cpu_breakpoint[i] =3D NULL; + } } } env->sregs[IBREAKENABLE] =3D v & ((1 << env->config->nibreak) - 1); @@ -62,12 +56,32 @@ void HELPER(wsr_ibreakenable)(CPUXtensaState *env, uint= 32_t v) void HELPER(wsr_ibreaka)(CPUXtensaState *env, uint32_t i, uint32_t v) { if (env->sregs[IBREAKENABLE] & (1 << i) && env->sregs[IBREAKA + i] != =3D v) { - tb_invalidate_virtual_addr(env, env->sregs[IBREAKA + i]); - tb_invalidate_virtual_addr(env, v); + CPUState *cs =3D env_cpu(env); + + cpu_breakpoint_remove_by_ref(cs, env->cpu_breakpoint[i]); + cpu_breakpoint_insert(cs, v, BP_CPU, &env->cpu_breakpoint[i]); } env->sregs[IBREAKA + i] =3D v; } =20 +bool xtensa_debug_check_breakpoint(CPUState *cs) +{ + XtensaCPU *cpu =3D XTENSA_CPU(cs); + CPUXtensaState *env =3D &cpu->env; + unsigned int i; + + if (xtensa_get_cintlevel(env) >=3D env->config->debug_level) { + return false; + } + for (i =3D 0; i < env->config->nibreak; ++i) { + if (env->sregs[IBREAKENABLE] & (1 << i) && + env->sregs[IBREAKA + i] =3D=3D env->pc) { + return true; + } + } + return false; +} + static void set_dbreak(CPUXtensaState *env, unsigned i, uint32_t dbreaka, uint32_t dbreakc) { diff --git a/target/xtensa/helper.c b/target/xtensa/helper.c index dbeb97a953cc..151da75a41c5 100644 --- a/target/xtensa/helper.c +++ b/target/xtensa/helper.c @@ -231,6 +231,18 @@ void xtensa_breakpoint_handler(CPUState *cs) } cpu_loop_exit_noexc(cs); } + } else { + if (cpu_breakpoint_test(cs, env->pc, BP_GDB) + || !cpu_breakpoint_test(cs, env->pc, BP_CPU)) { + return; + } + if (env->sregs[ICOUNT] =3D=3D 0xffffffff && + xtensa_get_cintlevel(env) < env->sregs[ICOUNTLEVEL]) { + debug_exception_env(env, DEBUGCAUSE_IC); + } else { + debug_exception_env(env, DEBUGCAUSE_IB); + } + cpu_loop_exit_noexc(cs); } } =20 diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c index de899405994e..87947236ca3a 100644 --- a/target/xtensa/translate.c +++ b/target/xtensa/translate.c @@ -1123,19 +1123,6 @@ static inline unsigned xtensa_insn_len(CPUXtensaStat= e *env, DisasContext *dc) return xtensa_op0_insn_len(dc, b0); } =20 -static void gen_ibreak_check(CPUXtensaState *env, DisasContext *dc) -{ - unsigned i; - - for (i =3D 0; i < dc->config->nibreak; ++i) { - if ((env->sregs[IBREAKENABLE] & (1 << i)) && - env->sregs[IBREAKA + i] =3D=3D dc->pc) { - gen_debug_exception(dc, DEBUGCAUSE_IB); - break; - } - } -} - static void xtensa_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cpu) { @@ -1205,10 +1192,6 @@ static void xtensa_tr_translate_insn(DisasContextBas= e *dcbase, CPUState *cpu) gen_set_label(label); } =20 - if (dc->debug) { - gen_ibreak_check(env, dc); - } - disas_xtensa_insn(env, dc); =20 if (dc->icount) { --=20 2.39.2 From nobody Wed Nov 27 02:19:09 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1701364839; cv=none; d=zohomail.com; s=zohoarc; b=aRl8nxkT56aygG7Gb8C1NYth1+3yCMk52gS4/6/8LlKJcxoI3XFhqEWz/AURjSG97F0WSPDkpebqKItAPbhjuFbuSvSrHhsj2kOpSLS0eUt3e5onOXMKsx30Ry6ThFqapJKljm1w+fWviLM14o9VQeVNw3KvXs4uJljwKZOKOZM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1701364839; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=NGaFxDd9DEgIY946KKxNCCYQHrryKrWh5AcjMejeCmY=; b=eMKpqZNeRLZ2zR6EjnpWJdO+iixH97Omqv7eLqgP07JqSRkyS5+/xWfjAsDTCe+Q+XrLDVAgNO9HY+OuLvgURe8AwWd/SN31pVe9LsSUeNPM5MCphUVB6ffv9rbaEUc65mRXwoByK1IRUVLkfDukYb3KsbzVWGCtA8JyF+8AV34= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1701364839165686.8292288560219; Thu, 30 Nov 2023 09:20:39 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r8khP-00055y-HA; Thu, 30 Nov 2023 12:19:39 -0500 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 1r8khN-00055E-Ba for qemu-devel@nongnu.org; Thu, 30 Nov 2023 12:19:37 -0500 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r8khL-0006db-TN for qemu-devel@nongnu.org; Thu, 30 Nov 2023 12:19:37 -0500 Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-1cfa5840db3so11252015ad.2 for ; Thu, 30 Nov 2023 09:19:35 -0800 (PST) Received: from octofox.hsd1.ca.comcast.net ([2601:646:a201:19d0:7eb0:c76b:d82c:8f94]) by smtp.gmail.com with ESMTPSA id bc3-20020a170902930300b001cc29ffcd96sm1645926plb.192.2023.11.30.09.19.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 09:19:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701364774; x=1701969574; darn=nongnu.org; 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=NGaFxDd9DEgIY946KKxNCCYQHrryKrWh5AcjMejeCmY=; b=GWv+dUDnBRa8ngDezM0lLSRt7ieJHmjJzmYp+ujFbqGm5dOxynPizD+JBfD/QWTmw2 jW8MVq8W2OjxWfKz2nCE+OUD9jZ7FCLQsN02JK++70zpleHTvxhAdiLRA39Qg1tHOxoa NhIlnz98jjsTtNyPUpR2jXq1sdAnC1J88cdO4wuCpKXD2klXqIGxsJd0O3hNtqfp6FpR jd5z+inS/SuTtgpfwj3R3F2yjetddazQ9hwbUgJiDsy2Y6GZfnVa+wr6yZIiVQdqQIT+ d+AIS7Q8KPU3bmXsbHfGvNJSsjVZ4LissIdYXs3+1NweP6jrUnlrFZ/b3fAlvkugua7F a//g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701364774; x=1701969574; 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=NGaFxDd9DEgIY946KKxNCCYQHrryKrWh5AcjMejeCmY=; b=OMfFxrbQP1WjkzQtGZvtcXTG3Gi+PelW/uHnuGwAz9XHTXTviEvXtY92rZgDunqcTF +LgciCVdSg0vcAUgfsgSwc4LRBDfw0v6TyiAo0GH2WrZBJAFHxhBFEU4JjFfh9JETBMG Gg5fnS/sztgv7BGUrsRw7SvpfNlZjjPijd+TS/8qXuglrladLg0geD8FufFG6990NJ8u ZMuQz1H6Y3UbTYYZe3q/QPNSPhYwgMQ8RVowa7d2/YGZPMjVrM8XYwO6BwmaZc30EJeQ v5KcNZojU1XGmd3HwRgKuyxsUDFfMSBwoTKd4I2wETGZvVTPsiPhamTar3+TiM88+UDJ uAEQ== X-Gm-Message-State: AOJu0Yx2F0PRyPQ/qX0vHUUQIkXb0p+dakSEtkHjfWnwdDjrr8oiw+MW AiYzJSATnCA0la5g2CjazeKxx+TCvr8= X-Google-Smtp-Source: AGHT+IFUVoe11eoZ2T5TJ0ADewQphfA2qPSEp0EHce/eCPspGNjqMobYxN5Lpo2USuY4H6VRwRTwKQ== X-Received: by 2002:a17:902:724a:b0:1cf:d2c3:2865 with SMTP id c10-20020a170902724a00b001cfd2c32865mr13135930pll.40.1701364774296; Thu, 30 Nov 2023 09:19:34 -0800 (PST) From: Max Filippov To: qemu-devel@nongnu.org Cc: Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Max Filippov Subject: [PATCH 2/2] tests/tcg/xtensa: add icount/ibreak priority test Date: Thu, 30 Nov 2023 09:19:20 -0800 Message-Id: <20231130171920.3798954-3-jcmvbkbc@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231130171920.3798954-1-jcmvbkbc@gmail.com> References: <20231130171920.3798954-1-jcmvbkbc@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::62c; envelope-from=jcmvbkbc@gmail.com; helo=mail-pl1-x62c.google.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.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, FREEMAIL_FROM=0.001, FROM_LOCAL_NOVOWEL=0.5, HK_RANDOM_ENVFROM=0.999, HK_RANDOM_FROM=0.999, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1701364840558000001 Content-Type: text/plain; charset="utf-8" When icount and ibreak exceptions are due to happen on the same address icount has higher precedence. Signed-off-by: Max Filippov Acked-by: Richard Henderson --- tests/tcg/xtensa/test_break.S | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/tests/tcg/xtensa/test_break.S b/tests/tcg/xtensa/test_break.S index 3aa18b5cec3f..4c618feb5b10 100644 --- a/tests/tcg/xtensa/test_break.S +++ b/tests/tcg/xtensa/test_break.S @@ -129,7 +129,7 @@ test ibreak_remove 4: test_end =20 -test ibreak_priority +test ibreak_break_priority set_vector debug_vector, 2f rsil a2, debug_level - 1 movi a2, 1f @@ -145,6 +145,29 @@ test ibreak_priority movi a3, 0x2 assert eq, a2, a3 test_end + +test ibreak_icount_priority + set_vector debug_vector, 2f + rsil a2, debug_level - 1 + movi a2, 1f + wsr a2, ibreaka0 + movi a2, 1 + wsr a2, ibreakenable + movi a2, -2 + wsr a2, icount + movi a2, 1 + wsr a2, icountlevel + isync + rsil a2, 0 + nop +1: + break 0, 0 + test_fail +2: + rsr a2, debugcause + movi a3, 0x1 + assert eq, a2, a3 +test_end #endif =20 test icount --=20 2.39.2