Re: [Qemu-devel] [PATCH v3 33/39] cpu: Introduce CPUNegativeOffsetState
On Tue, May 7, 2019 at 5:26 PM Richard Henderson wrote: > > Nothing in there so far, but all of the plumbing done > within the target ArchCPU state. > > Reviewed-by: Peter Maydell > Signed-off-by: Richard Henderson Reviewed-by: Alistair Francis Alistair > --- > include/exec/cpu-all.h | 24 > include/exec/cpu-defs.h | 8 > target/alpha/cpu.h | 1 + > target/arm/cpu.h| 1 + > target/cris/cpu.h | 1 + > target/hppa/cpu.h | 1 + > target/i386/cpu.h | 1 + > target/lm32/cpu.h | 1 + > target/m68k/cpu.h | 1 + > target/microblaze/cpu.h | 5 +++-- > target/mips/cpu.h | 1 + > target/moxie/cpu.h | 1 + > target/nios2/cpu.h | 2 ++ > target/openrisc/cpu.h | 2 +- > target/ppc/cpu.h| 2 ++ > target/riscv/cpu.h | 1 + > target/s390x/cpu.h | 1 + > target/sh4/cpu.h| 1 + > target/sparc/cpu.h | 1 + > target/tilegx/cpu.h | 1 + > target/tricore/cpu.h| 1 + > target/unicore32/cpu.h | 1 + > target/xtensa/cpu.h | 1 + > 23 files changed, 57 insertions(+), 3 deletions(-) > > diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h > index 71154070a7..5ae83405c8 100644 > --- a/include/exec/cpu-all.h > +++ b/include/exec/cpu-all.h > @@ -404,4 +404,28 @@ static inline CPUState *env_cpu(CPUArchState *env) > return _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 _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 _cpu->neg; > +} > + > #endif /* CPU_ALL_H */ > diff --git a/include/exec/cpu-defs.h b/include/exec/cpu-defs.h > index fbe8945606..ad97991faf 100644 > --- a/include/exec/cpu-defs.h > +++ b/include/exec/cpu-defs.h > @@ -227,4 +227,12 @@ typedef struct CPUTLB { > > #endif /* !CONFIG_USER_ONLY && CONFIG_TCG */ > > +/* > + * This structure must be placed in ArchCPU immedately > + * before CPUArchState, as a field named "neg". > + */ > +typedef struct CPUNegativeOffsetState { > +/* Empty */ > +} CPUNegativeOffsetState; > + > #endif > diff --git a/target/alpha/cpu.h b/target/alpha/cpu.h > index 66782cf5d4..f4bb67c101 100644 > --- a/target/alpha/cpu.h > +++ b/target/alpha/cpu.h > @@ -267,6 +267,7 @@ struct AlphaCPU { > CPUState parent_obj; > /*< public >*/ > > +CPUNegativeOffsetState neg; > CPUAlphaState env; > > /* This alarm doesn't exist in real hardware; we wish it did. */ > diff --git a/target/arm/cpu.h b/target/arm/cpu.h > index 23beb1de9a..909cb4604d 100644 > --- a/target/arm/cpu.h > +++ b/target/arm/cpu.h > @@ -719,6 +719,7 @@ struct ARMCPU { > CPUState parent_obj; > /*< public >*/ > > +CPUNegativeOffsetState neg; > CPUARMState env; > > /* Coprocessor information */ > diff --git a/target/cris/cpu.h b/target/cris/cpu.h > index c19fdcec1e..eeab483dba 100644 > --- a/target/cris/cpu.h > +++ b/target/cris/cpu.h > @@ -180,6 +180,7 @@ struct CRISCPU { > CPUState parent_obj; > /*< public >*/ > > +CPUNegativeOffsetState neg; > CPUCRISState env; > }; > > diff --git a/target/hppa/cpu.h b/target/hppa/cpu.h > index 58b2bf2933..0661ff60c1 100644 > --- a/target/hppa/cpu.h > +++ b/target/hppa/cpu.h > @@ -218,6 +218,7 @@ struct HPPACPU { > CPUState parent_obj; > /*< public >*/ > > +CPUNegativeOffsetState neg; > CPUHPPAState env; > QEMUTimer *alarm_timer; > }; > diff --git a/target/i386/cpu.h b/target/i386/cpu.h > index a9cfb42b22..43bb6ab841 100644 > --- a/target/i386/cpu.h > +++ b/target/i386/cpu.h > @@ -1368,6 +1368,7 @@ struct X86CPU { > CPUState parent_obj; > /*< public >*/ > > +CPUNegativeOffsetState neg; > CPUX86State env; > > bool hyperv_vapic; > diff --git a/target/lm32/cpu.h b/target/lm32/cpu.h > index 4234a439a3..0ec898eb1d 100644 > --- a/target/lm32/cpu.h > +++ b/target/lm32/cpu.h > @@ -186,6 +186,7 @@ struct LM32CPU { > CPUState parent_obj; > /*< public >*/ > > +CPUNegativeOffsetState neg; > CPULM32State env; > > uint32_t revision; > diff --git a/target/m68k/cpu.h b/target/m68k/cpu.h > index 02fbff3625..096d1eb588 100644 > --- a/target/m68k/cpu.h > +++ b/target/m68k/cpu.h > @@ -160,6 +160,7 @@ struct M68kCPU { > CPUState parent_obj; > /*< public >*/ > > +CPUNegativeOffsetState neg; > CPUM68KState env; > }; > > diff --git a/target/microblaze/cpu.h b/target/microblaze/cpu.h > index 1becb9270b..732653caed 100644 > --- a/target/microblaze/cpu.h > +++
[Qemu-devel] [PATCH v3 33/39] cpu: Introduce CPUNegativeOffsetState
Nothing in there so far, but all of the plumbing done within the target ArchCPU state. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- include/exec/cpu-all.h | 24 include/exec/cpu-defs.h | 8 target/alpha/cpu.h | 1 + target/arm/cpu.h| 1 + target/cris/cpu.h | 1 + target/hppa/cpu.h | 1 + target/i386/cpu.h | 1 + target/lm32/cpu.h | 1 + target/m68k/cpu.h | 1 + target/microblaze/cpu.h | 5 +++-- target/mips/cpu.h | 1 + target/moxie/cpu.h | 1 + target/nios2/cpu.h | 2 ++ target/openrisc/cpu.h | 2 +- target/ppc/cpu.h| 2 ++ target/riscv/cpu.h | 1 + target/s390x/cpu.h | 1 + target/sh4/cpu.h| 1 + target/sparc/cpu.h | 1 + target/tilegx/cpu.h | 1 + target/tricore/cpu.h| 1 + target/unicore32/cpu.h | 1 + target/xtensa/cpu.h | 1 + 23 files changed, 57 insertions(+), 3 deletions(-) diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h index 71154070a7..5ae83405c8 100644 --- a/include/exec/cpu-all.h +++ b/include/exec/cpu-all.h @@ -404,4 +404,28 @@ static inline CPUState *env_cpu(CPUArchState *env) return _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 _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 _cpu->neg; +} + #endif /* CPU_ALL_H */ diff --git a/include/exec/cpu-defs.h b/include/exec/cpu-defs.h index fbe8945606..ad97991faf 100644 --- a/include/exec/cpu-defs.h +++ b/include/exec/cpu-defs.h @@ -227,4 +227,12 @@ typedef struct CPUTLB { #endif /* !CONFIG_USER_ONLY && CONFIG_TCG */ +/* + * This structure must be placed in ArchCPU immedately + * before CPUArchState, as a field named "neg". + */ +typedef struct CPUNegativeOffsetState { +/* Empty */ +} CPUNegativeOffsetState; + #endif diff --git a/target/alpha/cpu.h b/target/alpha/cpu.h index 66782cf5d4..f4bb67c101 100644 --- a/target/alpha/cpu.h +++ b/target/alpha/cpu.h @@ -267,6 +267,7 @@ struct AlphaCPU { CPUState parent_obj; /*< public >*/ +CPUNegativeOffsetState neg; CPUAlphaState env; /* This alarm doesn't exist in real hardware; we wish it did. */ diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 23beb1de9a..909cb4604d 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -719,6 +719,7 @@ struct ARMCPU { CPUState parent_obj; /*< public >*/ +CPUNegativeOffsetState neg; CPUARMState env; /* Coprocessor information */ diff --git a/target/cris/cpu.h b/target/cris/cpu.h index c19fdcec1e..eeab483dba 100644 --- a/target/cris/cpu.h +++ b/target/cris/cpu.h @@ -180,6 +180,7 @@ struct CRISCPU { CPUState parent_obj; /*< public >*/ +CPUNegativeOffsetState neg; CPUCRISState env; }; diff --git a/target/hppa/cpu.h b/target/hppa/cpu.h index 58b2bf2933..0661ff60c1 100644 --- a/target/hppa/cpu.h +++ b/target/hppa/cpu.h @@ -218,6 +218,7 @@ struct HPPACPU { CPUState parent_obj; /*< public >*/ +CPUNegativeOffsetState neg; CPUHPPAState env; QEMUTimer *alarm_timer; }; diff --git a/target/i386/cpu.h b/target/i386/cpu.h index a9cfb42b22..43bb6ab841 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -1368,6 +1368,7 @@ struct X86CPU { CPUState parent_obj; /*< public >*/ +CPUNegativeOffsetState neg; CPUX86State env; bool hyperv_vapic; diff --git a/target/lm32/cpu.h b/target/lm32/cpu.h index 4234a439a3..0ec898eb1d 100644 --- a/target/lm32/cpu.h +++ b/target/lm32/cpu.h @@ -186,6 +186,7 @@ struct LM32CPU { CPUState parent_obj; /*< public >*/ +CPUNegativeOffsetState neg; CPULM32State env; uint32_t revision; diff --git a/target/m68k/cpu.h b/target/m68k/cpu.h index 02fbff3625..096d1eb588 100644 --- a/target/m68k/cpu.h +++ b/target/m68k/cpu.h @@ -160,6 +160,7 @@ struct M68kCPU { CPUState parent_obj; /*< public >*/ +CPUNegativeOffsetState neg; CPUM68KState env; }; diff --git a/target/microblaze/cpu.h b/target/microblaze/cpu.h index 1becb9270b..732653caed 100644 --- a/target/microblaze/cpu.h +++ b/target/microblaze/cpu.h @@ -287,6 +287,9 @@ struct MicroBlazeCPU { /*< public >*/ +CPUNegativeOffsetState neg; +CPUMBState env; + /* Microblaze Configuration Settings */ struct { bool stackprot; @@ -306,8 +309,6 @@ struct MicroBlazeCPU { char *version; uint8_t pvr; } cfg; - -CPUMBState env; }; diff --git a/target/mips/cpu.h