[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 10/47] qom: Propagate alignment through type system
|
From: |
Richard Henderson |
|
Subject: |
[PULL 10/47] qom: Propagate alignment through type system |
|
Date: |
Tue, 3 Oct 2023 10:30:15 -0700 |
Propagate alignment just like size. This is required in order to
get the correct alignment on most cpu subclasses where the size and
alignment is only specified for the base cpu type.
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
qom/object.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/qom/object.c b/qom/object.c
index e25f1e96db..8557fe8e4e 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -220,6 +220,19 @@ static size_t type_object_get_size(TypeImpl *ti)
return 0;
}
+static size_t type_object_get_align(TypeImpl *ti)
+{
+ if (ti->instance_align) {
+ return ti->instance_align;
+ }
+
+ if (type_has_parent(ti)) {
+ return type_object_get_align(type_get_parent(ti));
+ }
+
+ return 0;
+}
+
size_t object_type_get_instance_size(const char *typename)
{
TypeImpl *type = type_get_by_name(typename);
@@ -293,6 +306,7 @@ static void type_initialize(TypeImpl *ti)
ti->class_size = type_class_get_size(ti);
ti->instance_size = type_object_get_size(ti);
+ ti->instance_align = type_object_get_align(ti);
/* Any type with zero instance_size is implicitly abstract.
* This means interface types are all abstract.
*/
--
2.34.1
- [PULL 00/47] tcg patch queue, Richard Henderson, 2023/10/03
- [PULL 01/47] accel: Rename accel_cpu_realizefn() -> accel_cpu_realize(), Richard Henderson, 2023/10/03
- [PULL 03/47] accel: Rename accel_cpu_realize() -> accel_cpu_common_realize(), Richard Henderson, 2023/10/03
- [PULL 02/47] accel: Rename AccelCPUClass::cpu_realizefn() -> cpu_target_realize(), Richard Henderson, 2023/10/03
- [PULL 04/47] accel: Introduce accel_cpu_common_unrealize() stub, Richard Henderson, 2023/10/03
- [PULL 10/47] qom: Propagate alignment through type system,
Richard Henderson <=
- [PULL 05/47] accel: Declare AccelClass::cpu_common_[un]realize() handlers, Richard Henderson, 2023/10/03
- [PULL 12/47] target/*: Add instance_align to all cpu base classes, Richard Henderson, 2023/10/03
- [PULL 06/47] accel/tcg: Have tcg_exec_realizefn() return a boolean, Richard Henderson, 2023/10/03
- [PULL 09/47] accel/tcg: Move CPUTLB definitions from cpu-defs.h, Richard Henderson, 2023/10/03
- [PULL 08/47] target/arm: Replace TARGET_PAGE_ENTRY_EXTRA, Richard Henderson, 2023/10/03
- [PULL 14/47] accel/tcg: Move CPUNegativeOffsetState into CPUState, Richard Henderson, 2023/10/03
- [PULL 20/47] accel/tcg: Remove cpu_set_cpustate_pointers, Richard Henderson, 2023/10/03
- [PULL 22/47] tcg: Remove TCGContext.tlb_fast_offset, Richard Henderson, 2023/10/03
- [PULL 26/47] accel/tcg: Modify atomic_mmu_lookup() to use CPUState, Richard Henderson, 2023/10/03
- [PULL 25/47] accel/tcg: Modify memory access functions to use CPUState, Richard Henderson, 2023/10/03