On 29 October 2015 at 15:15, Alex Bennée <alex.ben...@linaro.org> wrote: > > Peter Maydell <peter.mayd...@linaro.org> writes: > >> If this CPU supports EL3, enhance the printing of the current >> CPU mode in debug logging to distinguish S from NS modes as >> appropriate. >> >> Signed-off-by: Peter Maydell <peter.mayd...@linaro.org> >> --- >> target-arm/translate-a64.c | 11 ++++++++++- >> target-arm/translate.c | 12 +++++++++++- >> 2 files changed, 21 insertions(+), 2 deletions(-) >> >> diff --git a/target-arm/translate-a64.c b/target-arm/translate-a64.c >> index ccefa7b..8ebdcb7 100644 >> --- a/target-arm/translate-a64.c >> +++ b/target-arm/translate-a64.c >> @@ -127,6 +127,7 @@ void aarch64_cpu_dump_state(CPUState *cs, FILE *f, >> uint32_t psr = pstate_read(env); >> int i; >> int el = arm_current_el(env); >> + const char *ns_status; >> >> cpu_fprintf(f, "PC=%016"PRIx64" SP=%016"PRIx64"\n", >> env->pc, env->xregs[31]); >> @@ -138,12 +139,20 @@ void aarch64_cpu_dump_state(CPUState *cs, FILE *f, >> cpu_fprintf(f, " "); >> } >> } >> - cpu_fprintf(f, "\nPSTATE=%08x %c%c%c%c EL%d%c\n", >> + >> + if (arm_feature(env, ARM_FEATURE_EL3) && el != 3) { >> + ns_status = env->cp15.scr_el3 & SCR_NS ? "NS " : "S "; >> + } else { >> + ns_status = ""; >> + } > > Looks fine to me. I might of gone for a default: > > const char *ns_status = "legacy"; > ... > if (arm_feature(env, ARM_FEATURE_EL3) && el != 3) { > ns_status = env->cp15.scr_el3 & SCR_NS ? "NS " : "S "; > }
We don't want to print "legacy", as that is just confusing for CPUs which don't have TrustZone. "" is the right value there. thanks -- PMM