qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 0/4] Support native debug icount trigger
@ 2022-10-13  6:29 LIU Zhiwei
  2022-10-13  6:29 ` [PATCH v1 1/4] target/riscv: Add itrigger support when icount is not enabled LIU Zhiwei
                   ` (4 more replies)
  0 siblings, 5 replies; 17+ messages in thread
From: LIU Zhiwei @ 2022-10-13  6:29 UTC (permalink / raw)
  To: qemu-devel, qemu-riscv
  Cc: Alistair.Francis, palmer, bin.meng, sergey.matyukevich,
	vladimir.isaev, anatoly.parshintsev, philipp.tomsich, zhiwei_liu,
	LIU Zhiwei

icount trigger set an instruction count. After one instruction retired,
the count will be decreased by 1. If the count decreased to 0, the icount
trigger will fire.

icount trigger is needed by single step ptrace system call and the native
GDB.

In this patch set, change the translation when icount trigger enabled in the
way that instruction executes one by one. After executing one instruction,
call a helper function to decrease the count for itrigger.


It also provides an accelebrated way. If QEMU executes with -icount parameter,
itrigger is simulated by a timer with the count in itrigger as the deadline.

Note the count in itrigger will only decrease when the priviledge matches, which
is also processed in this patch set.


After merging this patch set, QEMU will support type2/type6 trigger(needed by
breakpoint and watchpoint) and icount trigger(needed by single step),
which is enough for a PoC of native debug. 

LIU Zhiwei (4):
  target/riscv: Add itrigger support when icount is not enabled
  target/riscv: Add itrigger support when icount is enabled
  target/riscv: Enable native debug itrigger
  target/riscv: Add itrigger_enabled field to CPURISCVState

 target/riscv/cpu.h                            |   5 +
 target/riscv/cpu_helper.c                     |   8 +
 target/riscv/debug.c                          | 205 ++++++++++++++++++
 target/riscv/debug.h                          |  13 ++
 target/riscv/helper.h                         |   2 +
 .../riscv/insn_trans/trans_privileged.c.inc   |   4 +-
 target/riscv/insn_trans/trans_rvi.c.inc       |   8 +-
 target/riscv/insn_trans/trans_rvv.c.inc       |   4 +-
 target/riscv/machine.c                        |  15 ++
 target/riscv/translate.c                      |  33 ++-
 10 files changed, 286 insertions(+), 11 deletions(-)

-- 
2.17.1



^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2022-11-11  5:33 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-13  6:29 [PATCH v1 0/4] Support native debug icount trigger LIU Zhiwei
2022-10-13  6:29 ` [PATCH v1 1/4] target/riscv: Add itrigger support when icount is not enabled LIU Zhiwei
2022-11-07  1:37   ` Alistair Francis
2022-11-07  2:01     ` LIU Zhiwei
2022-11-07 15:58       ` Alex Bennée
2022-11-08  1:54         ` LIU Zhiwei
2022-11-09 22:33       ` Alistair Francis
2022-10-13  6:29 ` [PATCH v1 2/4] target/riscv: Add itrigger support when icount is enabled LIU Zhiwei
2022-11-09 22:50   ` Alistair Francis
2022-10-13  6:29 ` [PATCH v1 3/4] target/riscv: Enable native debug itrigger LIU Zhiwei
2022-11-09 22:54   ` Alistair Francis
2022-10-13  6:29 ` [PATCH v1 4/4] target/riscv: Add itrigger_enabled field to CPURISCVState LIU Zhiwei
2022-11-09 22:55   ` Alistair Francis
2022-11-10  2:15     ` LIU Zhiwei
2022-11-10  5:35       ` Richard Henderson
2022-11-11  0:54         ` Alistair Francis
2022-11-11  5:31 ` [PATCH v1 0/4] Support native debug icount trigger Alistair Francis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).