target: Use ArchCPU as interface to target CPU

ArchCPU is our interface with target-specific code. Use it as
a forward-declared opaque pointer (abstract type), having its
structure defined by each target.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20220214183144.27402-15-f4bug@amsat.org>
This commit is contained in:
Philippe Mathieu-Daudé 2022-02-14 17:15:16 +01:00
parent 9295b1aa92
commit b36e239e08
22 changed files with 23 additions and 22 deletions

View File

@ -70,8 +70,8 @@ DECLARE_CLASS_CHECKERS(CPUClass, CPU,
* The object struct and class struct need to be declared manually.
*/
#define OBJECT_DECLARE_CPU_TYPE(CpuInstanceType, CpuClassType, CPU_MODULE_OBJ_NAME) \
OBJECT_DECLARE_TYPE(CpuInstanceType, CpuClassType, CPU_MODULE_OBJ_NAME); \
typedef CpuInstanceType ArchCPU;
typedef struct ArchCPU CpuInstanceType; \
OBJECT_DECLARE_TYPE(ArchCPU, CpuClassType, CPU_MODULE_OBJ_NAME);
typedef enum MMUAccessType {
MMU_DATA_LOAD = 0,

View File

@ -26,6 +26,7 @@ typedef struct AddressSpace AddressSpace;
typedef struct AioContext AioContext;
typedef struct Aml Aml;
typedef struct AnnounceTimer AnnounceTimer;
typedef struct ArchCPU ArchCPU;
typedef struct BdrvDirtyBitmap BdrvDirtyBitmap;
typedef struct BdrvDirtyBitmapIter BdrvDirtyBitmapIter;
typedef struct BlockBackend BlockBackend;

View File

@ -257,7 +257,7 @@ typedef struct CPUArchState {
*
* An Alpha CPU.
*/
struct AlphaCPU {
struct ArchCPU {
/*< private >*/
CPUState parent_obj;
/*< public >*/

View File

@ -774,7 +774,7 @@ typedef struct ARMISARegisters ARMISARegisters;
*
* An ARM CPU core.
*/
struct ARMCPU {
struct ArchCPU {
/*< private >*/
CPUState parent_obj;
/*< public >*/

View File

@ -143,7 +143,7 @@ typedef struct CPUArchState {
*
* A AVR CPU.
*/
struct AVRCPU {
struct ArchCPU {
/*< private >*/
CPUState parent_obj;
/*< public >*/

View File

@ -173,7 +173,7 @@ typedef struct CPUArchState {
*
* A CRIS CPU.
*/
struct CRISCPU {
struct ArchCPU {
/*< private >*/
CPUState parent_obj;
/*< public >*/

View File

@ -140,7 +140,7 @@ typedef struct HexagonCPUClass {
DeviceReset parent_reset;
} HexagonCPUClass;
struct HexagonCPU {
struct ArchCPU {
/*< private >*/
CPUState parent_obj;
/*< public >*/

View File

@ -213,7 +213,7 @@ typedef struct CPUArchState {
*
* An HPPA CPU.
*/
struct HPPACPU {
struct ArchCPU {
/*< private >*/
CPUState parent_obj;
/*< public >*/

View File

@ -1707,7 +1707,7 @@ struct kvm_msrs;
*
* An x86 CPU.
*/
struct X86CPU {
struct ArchCPU {
/*< private >*/
CPUState parent_obj;
/*< public >*/

View File

@ -156,7 +156,7 @@ typedef struct CPUArchState {
*
* A Motorola 68k CPU.
*/
struct M68kCPU {
struct ArchCPU {
/*< private >*/
CPUState parent_obj;
/*< public >*/

View File

@ -339,7 +339,7 @@ typedef struct {
*
* A MicroBlaze CPU.
*/
struct MicroBlazeCPU {
struct ArchCPU {
/*< private >*/
CPUState parent_obj;

View File

@ -1171,7 +1171,7 @@ typedef struct CPUArchState {
*
* A MIPS CPU.
*/
struct MIPSCPU {
struct ArchCPU {
/*< private >*/
CPUState parent_obj;
/*< public >*/

View File

@ -169,7 +169,7 @@ struct CPUArchState {
*
* A Nios2 CPU.
*/
struct Nios2CPU {
struct ArchCPU {
/*< private >*/
CPUState parent_obj;
/*< public >*/

View File

@ -297,7 +297,7 @@ typedef struct CPUArchState {
*
* A OpenRISC CPU.
*/
struct OpenRISCCPU {
struct ArchCPU {
/*< private >*/
CPUState parent_obj;
/*< public >*/

View File

@ -1275,7 +1275,7 @@ typedef struct PPCVirtualHypervisorClass PPCVirtualHypervisorClass;
*
* A PowerPC CPU.
*/
struct PowerPCCPU {
struct ArchCPU {
/*< private >*/
CPUState parent_obj;
/*< public >*/

View File

@ -394,7 +394,7 @@ typedef struct RISCVCPUConfig RISCVCPUConfig;
*
* A RISCV CPU.
*/
struct RISCVCPU {
struct ArchCPU {
/*< private >*/
CPUState parent_obj;
/*< public >*/

View File

@ -105,7 +105,7 @@ typedef struct CPUArchState {
*
* A RX CPU
*/
struct RXCPU {
struct ArchCPU {
/*< private >*/
CPUState parent_obj;
/*< public >*/

View File

@ -163,7 +163,7 @@ static inline uint64_t *get_freg(CPUS390XState *cs, int nr)
*
* An S/390 CPU.
*/
struct S390CPU {
struct ArchCPU {
/*< private >*/
CPUState parent_obj;
/*< public >*/

View File

@ -195,7 +195,7 @@ typedef struct CPUArchState {
*
* A SuperH CPU.
*/
struct SuperHCPU {
struct ArchCPU {
/*< private >*/
CPUState parent_obj;
/*< public >*/

View File

@ -556,7 +556,7 @@ struct CPUArchState {
*
* A SPARC CPU.
*/
struct SPARCCPU {
struct ArchCPU {
/*< private >*/
CPUState parent_obj;
/*< public >*/

View File

@ -196,7 +196,7 @@ typedef struct CPUArchState {
*
* A TriCore CPU.
*/
struct TriCoreCPU {
struct ArchCPU {
/*< private >*/
CPUState parent_obj;
/*< public >*/

View File

@ -553,7 +553,7 @@ struct CPUArchState {
*
* An Xtensa CPU.
*/
struct XtensaCPU {
struct ArchCPU {
/*< private >*/
CPUState parent_obj;
/*< public >*/