[Pdbg] [PATCH] libpdbg: Add a hardware unit for the processor module

Alistair Popple alistair at popple.id.au
Fri Mar 20 16:03:36 AEDT 2020


The processor target is a purely logical target but it can be useful
for storing processor wide properties. This means an easy way of
iterating over the processor targets is required, so add a hardware
unit which assigns them to a specific class.

Signed-off-by: Alistair Popple <alistair at popple.id.au>
---
 libpdbg/chip.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/libpdbg/chip.c b/libpdbg/chip.c
index 908b20d..b45cffa 100644
--- a/libpdbg/chip.c
+++ b/libpdbg/chip.c
@@ -666,3 +666,18 @@ int thread_getregs(struct pdbg_target *thread, struct thread_regs *regs)
 
 	return 0;
 }
+
+static struct proc proc = {
+	.target = {
+		.name = "Processor Module",
+		.compatible = "ibm,processor",
+		.class = "proc",
+	},
+};
+DECLARE_HW_UNIT(proc);
+
+__attribute__((constructor))
+static void register_proc(void)
+{
+	pdbg_hwunit_register(&proc_hw_unit);
+}
-- 
2.20.1



More information about the Pdbg mailing list