[Pdbg] [PATCH v2] libpdbg: Add a hardware unit for the processor module
Amitay Isaacs
amitay at ozlabs.org
Mon Mar 23 15:45:08 AEDT 2020
From: Alistair Popple <alistair at popple.id.au>
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>
Signed-off-by: Amitay Isaacs <amitay at ozlabs.org>
---
libpdbg/chip.c | 15 +++++++++++++++
libpdbg/hwunit.h | 4 ++++
2 files changed, 19 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);
+}
diff --git a/libpdbg/hwunit.h b/libpdbg/hwunit.h
index ae8a15a..343de4b 100644
--- a/libpdbg/hwunit.h
+++ b/libpdbg/hwunit.h
@@ -46,6 +46,10 @@ const struct hw_unit_info *pdbg_hwunit_find_compatible(const char *compat);
const struct hw_unit_info __used name ##_hw_unit = \
{ .hw_unit = &name, .size = sizeof(name) };
+struct proc {
+ struct pdbg_target target;
+};
+
struct htm {
struct pdbg_target target;
int (*start)(struct htm *);
--
2.25.1
More information about the Pdbg
mailing list