This is an automated email from Gerrit. "Tomas Vanek <van...@fbl.cz>" just uploaded a new patch set to Gerrit, which you can find at https://review.openocd.org/c/openocd/+/6754
-- gerrit commit 1a64e1c96c86026dca628433fd107741f71deb7c Author: Tomas Vanek <van...@fbl.cz> Date: Wed Nov 24 18:47:03 2021 +0100 target: move parent target stuct xxx_common to be the first member It looks better. target_to_xxx() function does not need to work with negative offset and eventual NULL target->arch_info pointer goes out unchanged. If you run OpenOCD under gdb, you may easy cast target->arch_info to any type. E.g. if the target is cortex_m you can inspect: (gdb) p *(struct cortex_m_common*)target->arch_info (gdb) p *(struct armv7m_common*)target->arch_info (gdb) p *(struct arm*)target->arch_info Change-Id: Ib08bab6660f80e747ce24687510c757786238afe Signed-off-by: Tomas Vanek <van...@fbl.cz> diff --git a/src/target/aarch64.h b/src/target/aarch64.h index b57361f88..12bce3db6 100644 --- a/src/target/aarch64.h +++ b/src/target/aarch64.h @@ -50,6 +50,8 @@ struct aarch64_brp { }; struct aarch64_common { + struct armv8_common armv8_common; + int common_magic; /* Context information */ @@ -67,8 +69,6 @@ struct aarch64_common { int wp_num_available; struct aarch64_brp *wp_list; - struct armv8_common armv8_common; - enum aarch64_isrmasking_mode isrmasking_mode; }; diff --git a/src/target/cortex_a.h b/src/target/cortex_a.h index 685621c6b..7c5cf649a 100644 --- a/src/target/cortex_a.h +++ b/src/target/cortex_a.h @@ -79,6 +79,8 @@ struct cortex_a_wrp { }; struct cortex_a_common { + struct armv7a_common armv7a_common; + int common_magic; /* Context information */ @@ -108,9 +110,6 @@ struct cortex_a_common { enum cortex_a_isrmasking_mode isrmasking_mode; enum cortex_a_dacrfixup_mode dacrfixup_mode; - - struct armv7a_common armv7a_common; - }; static inline struct cortex_a_common * diff --git a/src/target/cortex_m.h b/src/target/cortex_m.h index c2f836a35..0c7b13b9a 100644 --- a/src/target/cortex_m.h +++ b/src/target/cortex_m.h @@ -209,6 +209,8 @@ enum cortex_m_isrmasking_mode { }; struct cortex_m_common { + struct armv7m_common armv7m; + int common_magic; /* Context information */ @@ -236,7 +238,6 @@ struct cortex_m_common { enum cortex_m_isrmasking_mode isrmasking_mode; const struct cortex_m_part_info *core_info; - struct armv7m_common armv7m; bool slow_register_read; /* A register has not been ready, poll S_REGRDY */ diff --git a/src/target/mips_m4k.h b/src/target/mips_m4k.h index ea09ae527..232640088 100644 --- a/src/target/mips_m4k.h +++ b/src/target/mips_m4k.h @@ -29,9 +29,9 @@ struct target; #define MIPSM4K_COMMON_MAGIC 0xB321B321 struct mips_m4k_common { + struct mips32_common mips32; uint32_t common_magic; bool is_pic32mx; - struct mips32_common mips32; }; static inline struct mips_m4k_common * diff --git a/src/target/mips_mips64.h b/src/target/mips_mips64.h index 69fb2a6f9..b4c3cd078 100644 --- a/src/target/mips_mips64.h +++ b/src/target/mips_mips64.h @@ -17,8 +17,10 @@ #include "helper/types.h" struct mips_mips64_common { - int common_magic; struct mips64_common mips64_common; + int common_magic; + + /* REVISIT: Useless struct nesting without any added member? */ }; #endif /* OPENOCD_TARGET_MIPS_MIPS64_H */ --