[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 42/53] hw/core: introduce a 'format_tlb' callback
From: |
Daniel P . Berrangé |
Subject: |
[PATCH v2 42/53] hw/core: introduce a 'format_tlb' callback |
Date: |
Tue, 14 Sep 2021 15:20:31 +0100 |
This will allow us to reduce duplication between the different targets
implementing the 'info tlb' command.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
hw/core/cpu-common.c | 9 +++++++++
include/hw/core/cpu.h | 11 +++++++++++
2 files changed, 20 insertions(+)
diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c
index ffd9b9e07e..9b11ec3c8d 100644
--- a/hw/core/cpu-common.c
+++ b/hw/core/cpu-common.c
@@ -123,6 +123,15 @@ void cpu_format_state(CPUState *cpu, GString *buf, int
flags)
}
}
+void cpu_format_tlb(CPUState *cpu, GString *buf)
+{
+ CPUClass *cc = CPU_GET_CLASS(cpu);
+
+ if (cc->format_tlb) {
+ cc->format_tlb(cpu, buf);
+ }
+}
+
void cpu_reset(CPUState *cpu)
{
device_cold_reset(DEVICE(cpu));
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
index 4c47e1df18..64fc57c8d9 100644
--- a/include/hw/core/cpu.h
+++ b/include/hw/core/cpu.h
@@ -92,6 +92,7 @@ struct SysemuCPUOps;
* @has_work: Callback for checking if there is work to do.
* @memory_rw_debug: Callback for GDB memory access.
* @format_state: Callback for formatting state.
+ * @format_tlb: Callback for formatting memory mappings
* @get_arch_id: Callback for getting architecture-dependent CPU ID.
* @set_pc: Callback for setting the Program Counter register. This
* should have the semantics used by the target architecture when
@@ -136,6 +137,7 @@ struct CPUClass {
int (*memory_rw_debug)(CPUState *cpu, vaddr addr,
uint8_t *buf, int len, bool is_write);
void (*format_state)(CPUState *cpu, GString *buf, int flags);
+ void (*format_tlb)(CPUState *cpu, GString *buf);
int64_t (*get_arch_id)(CPUState *cpu);
void (*set_pc)(CPUState *cpu, vaddr value);
int (*gdb_read_register)(CPUState *cpu, GByteArray *buf, int reg);
@@ -546,6 +548,15 @@ void cpu_dump_state(CPUState *cpu, FILE *f, int flags);
*/
void cpu_format_state(CPUState *cpu, GString *buf, int flags);
+/**
+ * cpu_format_tlb:
+ * @cpu: The CPU whose memory mappings are to be formatted.
+ * @buf: buffer to format state into
+ *
+ * Formats the memory mappings
+ */
+void cpu_format_tlb(CPUState *cpu, GString *buf);
+
#ifndef CONFIG_USER_ONLY
/**
* cpu_get_phys_page_attrs_debug:
--
2.31.1
- [PATCH v2 35/53] qapi: introduce x-query-ramblock QMP command, (continued)
- [PATCH v2 35/53] qapi: introduce x-query-ramblock QMP command, Daniel P . Berrangé, 2021/09/14
- [PATCH v2 34/53] qapi: introduce x-query-rdma QMP command, Daniel P . Berrangé, 2021/09/14
- [PATCH v2 36/53] qapi: introduce x-query-skeys QMP command, Daniel P . Berrangé, 2021/09/14
- [PATCH v2 37/53] qapi: introduce x-query-cmma QMP command, Daniel P . Berrangé, 2021/09/14
- [PATCH v2 38/53] qapi: introduce x-query-lapic QMP command, Daniel P . Berrangé, 2021/09/14
- [PATCH v2 39/53] qapi: introduce x-query-irq QMP command, Daniel P . Berrangé, 2021/09/14
- [PATCH v2 40/53] hw/core: drop "dump_state" callback from CPU targets, Daniel P . Berrangé, 2021/09/14
- [PATCH v2 41/53] hw/core: drop support for NULL pointer for FILE * in cpu_dump_state, Daniel P . Berrangé, 2021/09/14
- [PATCH v2 42/53] hw/core: introduce a 'format_tlb' callback,
Daniel P . Berrangé <=
[PATCH v2 43/53] target/i386: convert to use format_tlb callback, Daniel P . Berrangé, 2021/09/14
[PATCH v2 44/53] target/m68k: convert to use format_tlb callback, Daniel P . Berrangé, 2021/09/14
[PATCH v2 45/53] target/nios2: convert to use format_tlb callback, Daniel P . Berrangé, 2021/09/14
[PATCH v2 46/53] target/ppc: convert to use format_tlb callback, Daniel P . Berrangé, 2021/09/14