cpu: Introduce CPUNegativeOffsetState

Nothing in there so far, but all of the plumbing done
within the target ArchCPU state.

Backports commit 5b146dc716cfd247f99556c04e6e46fbd67565a0 from qemu
This commit is contained in:
Richard Henderson 2019-06-13 15:05:34 -04:00 committed by Lioncash
parent a672b89e3b
commit 8f53f09a05
No known key found for this signature in database
GPG Key ID: 4E3C3CC1031BA9C7
8 changed files with 39 additions and 0 deletions

View File

@ -408,4 +408,28 @@ static inline CPUState *env_cpu(CPUArchState *env)
return &env_archcpu(env)->parent_obj;
}
/**
* env_neg(env)
* @env: The architecture environment
*
* Return the CPUNegativeOffsetState associated with the environment.
*/
static inline CPUNegativeOffsetState *env_neg(CPUArchState *env)
{
ArchCPU *arch_cpu = container_of(env, ArchCPU, env);
return &arch_cpu->neg;
}
/**
* cpu_neg(cpu)
* @cpu: The generic CPUState
*
* Return the CPUNegativeOffsetState associated with the cpu.
*/
static inline CPUNegativeOffsetState *cpu_neg(CPUState *cpu)
{
ArchCPU *arch_cpu = container_of(cpu, ArchCPU, parent_obj);
return &arch_cpu->neg;
}
#endif /* CPU_ALL_H */

View File

@ -214,4 +214,13 @@ typedef struct CPUTLBDesc {
CPU_COMMON_TLB \
uint64_t invalid_addr; \
int invalid_error;
/*
* This structure must be placed in ArchCPU immedately
* before CPUArchState, as a field named "neg".
*/
typedef struct CPUNegativeOffsetState {
/* Empty */
} CPUNegativeOffsetState;
#endif

View File

@ -724,6 +724,7 @@ struct ARMCPU {
CPUState parent_obj;
/*< public >*/
CPUNegativeOffsetState neg;
CPUARMState env;
/* Coprocessor information */

View File

@ -1311,6 +1311,7 @@ struct X86CPU {
CPUState parent_obj;
/*< public >*/
CPUNegativeOffsetState neg;
CPUX86State env;
bool hyperv_vapic;

View File

@ -164,6 +164,7 @@ struct M68kCPU {
CPUState parent_obj;
/*< public >*/
CPUNegativeOffsetState neg;
CPUM68KState env;
};

View File

@ -1066,6 +1066,7 @@ struct MIPSCPU {
CPUState parent_obj;
/*< public >*/
CPUNegativeOffsetState neg;
CPUMIPSState env;
};

View File

@ -215,6 +215,7 @@ typedef struct RISCVCPU {
/*< private >*/
CPUState parent_obj;
/*< public >*/
CPUNegativeOffsetState neg;
CPURISCVState env;
} RISCVCPU;

View File

@ -525,6 +525,7 @@ struct SPARCCPU {
CPUState parent_obj;
/*< public >*/
CPUNegativeOffsetState neg;
CPUSPARCState env;
};