The implementation had been incomplete, as we did not store the machine type.
Signed-off-by: Richard Henderson <r...@twiddle.net> --- target-s390x/cpu.c | 2 ++ target-s390x/cpu.h | 14 +++++++++++++- target-s390x/translate.c | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/target-s390x/cpu.c b/target-s390x/cpu.c index 01ff49b..d003dcf 100644 --- a/target-s390x/cpu.c +++ b/target-s390x/cpu.c @@ -257,6 +257,8 @@ static void s390_cpu_initfn(Object *obj) env->facilities[0] |= FAC0_Z9_109; #endif + env->machine_type = 0x20940000; /* ??? Also Z9-109. */ + if (tcg_enabled() && !inited) { inited = true; s390x_translate_init(); diff --git a/target-s390x/cpu.h b/target-s390x/cpu.h index a0bafef..95f9cab 100644 --- a/target-s390x/cpu.h +++ b/target-s390x/cpu.h @@ -197,7 +197,19 @@ typedef struct CPUS390XState { /* reset does memset(0) up to here */ uint64_t facilities[2]; - int cpu_num; + union { + uint64_t cpuid; + struct { +#ifdef HOST_WORDS_BIGENDIAN + uint32_t cpu_num; + uint32_t machine_type; +#else + uint32_t machine_type; + uint32_t cpu_num; +#endif + }; + }; + uint8_t *storage_keys; uint64_t tod_offset; diff --git a/target-s390x/translate.c b/target-s390x/translate.c index 192d54e..25a6537 100644 --- a/target-s390x/translate.c +++ b/target-s390x/translate.c @@ -3242,7 +3242,7 @@ static ExitStatus op_stctl(DisasContext *s, DisasOps *o) static ExitStatus op_stidp(DisasContext *s, DisasOps *o) { check_privileged(s); - tcg_gen_ld32u_i64(o->out, cpu_env, offsetof(CPUS390XState, cpu_num)); + tcg_gen_ld_i64(o->out, cpu_env, offsetof(CPUS390XState, cpuid)); return NO_EXIT; } -- 1.8.1.4