Honor CPU_DUMP_FPU
cover Honor CPU_DUMP_FPU
With Peter's new patch for "-d fpu", it makes sense to honor this setting in as many targets as currently dump the fpu.
r~
Richard Henderson (9):
target/alpha: Honor CPU_DUMP_FPU
target/mips: Honor CPU_DUMP_FPU
target/ppc: Honor CPU_DUMP_FPU
target/riscv: Introduce cpu_riscv_get_fcsr
target/riscv: Honor CPU_DUMP_FPU
target/s390x: Honor CPU_DUMP_FPU
target/sparc: Honor CPU_DUMP_FPU
target/unicore32: Honor CPU_DUMP_FPU
target/xtensa: Honor CPU_DUMP_FPU
target/riscv/cpu.h | 1 + target/alpha/helper.c | 17 ++++++++--------- target/mips/translate.c | 3 ++- target/ppc/translate.c | 20 +++++++++++++------- target/riscv/cpu.c | 16 +++++++++++----- target/riscv/fpu_helper.c | 6 ++++++ target/riscv/op_helper.c | 3 +-- target/s390x/helper.c | 23 ++++++++++++----------- target/sparc/cpu.c | 17 ++++++++++------- target/unicore32/translate.c | 4 +++- target/xtensa/translate.c | 3 ++- 11 files changed, 69 insertions(+), 44 deletions(-)
Signature · 1 line
2.17.0
PATCH 1/9 target/alpha: Honor CPU_DUMP_FPU
--- target/alpha/helper.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)
target/alpha/helper.c +8 -9
@@ -442,20 +442,19 @@ void alpha_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,cpu_fprintf (f," PC " TARGET_FMT_lx" PS %02x\n" , env->pc,extract32 (env->flags,ENV_FLAG_PS_SHIFT ,8 ));for (i =0 ; i <31 ; i++) { -cpu_fprintf (f,"IR%02d %s " TARGET_FMT_lx" " , i, - linux_reg_names[i],cpu_alpha_load_gr (env, i)); -if ((i %3 ) ==2 ) -cpu_fprintf (f,"\n" ); +cpu_fprintf (f,"IR%02d %s " TARGET_FMT_lx"%c" , i, + linux_reg_names[i],cpu_alpha_load_gr (env, i), + (i %3 ) ==2 ?'\n' :' ' ); }cpu_fprintf (f,"lock_a " TARGET_FMT_lx" lock_v " TARGET_FMT_lx"\n" , env->lock_addr, env->lock_value); -for (i =0 ; i <31 ; i++) { -cpu_fprintf (f,"FIR%02d " TARGET_FMT_lx" " , i, - *((uint64_t *)(&env->fir[i]))); -if ((i %3 ) ==2 ) -cpu_fprintf (f,"\n" ); +if (flags &CPU_DUMP_FPU ) { +for (i =0 ; i <31 ; i++) { +cpu_fprintf (f,"FIR%02d %016" PRIx64"%c" , i, env->fir[i], + (i %3 ) ==2 ?'\n' :' ' ); + } }cpu_fprintf (f,"\n" ); }
Signature · 1 line
2.17.0
Re: [Qemu-devel] [PATCH 1/9] target/alpha: Honor CPU_DUMP_FPU
Quoted 23 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>--- target/alpha/helper.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)target/alpha/helper.c +3
-4@@ -442,20 +442,19 @@ void alpha_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,cpu_fprintf (f," PC " TARGET_FMT_lx" PS %02x\n" , env->pc,extract32 (env->flags,ENV_FLAG_PS_SHIFT ,8 ));for (i =0 ; i <31 ; i++) { -cpu_fprintf (f,"IR%02d %s " TARGET_FMT_lx" " , i, - linux_reg_names[i],cpu_alpha_load_gr (env, i)); -if ((i %3 ) ==2 ) -cpu_fprintf (f,"\n" ); +cpu_fprintf (f,"IR%02d %s " TARGET_FMT_lx"%c" , i, + linux_reg_names[i],cpu_alpha_load_gr (env, i), + (i %3 ) ==2 ?'\n' :' ' ); } cpu_fprintf(f, "lock_a " TARGET_FMT_lx " lock_v " TARGET_FMT_lx "\n",
target/alpha/helper.c void alpha_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf, · line 455
Quoted 10 lines
target/alpha/helper.c +3
-5env->lock_addr, env->lock_value); -for (i =0 ; i <31 ; i++) { -cpu_fprintf (f,"FIR%02d " TARGET_FMT_lx" " , i, - *((uint64_t *)(&env->fir[i]))); -if ((i %3 ) ==2 ) -cpu_fprintf (f,"\n" ); +if (flags &CPU_DUMP_FPU ) { +for (i =0 ; i <31 ; i++) { + cpu_fprintf(f, "FIR%02d %016" PRIx64 "%c", i, env->fir[i],
Cleaner :)
Quoted 6 lines
target/alpha/helper.c +2
-0+ (i % 3) == 2 ? '\n' : ' '); + } }cpu_fprintf (f,"\n" ); }
PATCH 2/9 target/mips: Honor CPU_DUMP_FPU
In reply to Richard Henderson--- target/mips/translate.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
target/mips/translate.c +2 -1
@@ -20445,8 +20445,9 @@ void mips_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf, env->CP0_Config2, env->CP0_Config3);cpu_fprintf (f," Config4 0x%08x Config5 0x%08x\n" , env->CP0_Config4, env->CP0_Config5); -if (env->hflags &MIPS_HFLAG_FPU ) +if ((flags &CPU_DUMP_FPU ) && (env->hflags &MIPS_HFLAG_FPU )) {fpu_dump_state (env, f, cpu_fprintf, flags); + } }void mips_tcg_init (void )
Signature · 1 line
2.17.0
Re: [Qemu-devel] [PATCH 2/9] target/mips: Honor CPU_DUMP_FPU
Quoted 3 lines · Richard Henderson
Cc Aurelien Jarno <[email protected]>Cc Yongbok Kim <[email protected]>Signed-off-by Richard Henderson <[email protected]>
Quoted 20 lines
--- target/mips/translate.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)target/mips/translate.c +2
-1@@ -20445,8 +20445,9 @@ void mips_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf, env->CP0_Config2, env->CP0_Config3);cpu_fprintf (f," Config4 0x%08x Config5 0x%08x\n" , env->CP0_Config4, env->CP0_Config5); -if (env->hflags &MIPS_HFLAG_FPU ) +if ((flags &CPU_DUMP_FPU ) && (env->hflags &MIPS_HFLAG_FPU )) {fpu_dump_state (env, f, cpu_fprintf, flags); + } }void mips_tcg_init (void )
PATCH 3/9 target/ppc: Honor CPU_DUMP_FPU
In reply to Richard Henderson--- target/ppc/translate.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-)
target/ppc/translate.c +13 -7
@@ -7048,14 +7048,20 @@ void ppc_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf, }cpu_fprintf (f," ] RES " TARGET_FMT_lx"\n" , env->reserve_addr); -for (i =0 ; i <32 ; i++) { -if ((i & (RFPL -1 )) ==0 ) -cpu_fprintf (f,"FPR%02d" , i); -cpu_fprintf (f," %016" PRIx64, *((uint64_t *)&env->fpr[i])); -if ((i & (RFPL -1 )) == (RFPL -1 )) -cpu_fprintf (f,"\n" ); + +if (flags &CPU_DUMP_FPU ) { +for (i =0 ; i <32 ; i++) { +if ((i & (RFPL -1 )) ==0 ) { +cpu_fprintf (f,"FPR%02d" , i); + } +cpu_fprintf (f," %016" PRIx64, *((uint64_t *)&env->fpr[i])); +if ((i & (RFPL -1 )) == (RFPL -1 )) { +cpu_fprintf (f,"\n" ); + } + } +cpu_fprintf (f,"FPSCR " TARGET_FMT_lx"\n" , env->fpscr); } -cpu_fprintf (f,"FPSCR " TARGET_FMT_lx"\n" , env->fpscr); +#if !defined(CONFIG_USER_ONLY ) cpu_fprintf(f, " SRR0 " TARGET_FMT_lx " SRR1 " TARGET_FMT_lx " PVR " TARGET_FMT_lx " VRSAVE " TARGET_FMT_lx "\n",
Signature · 1 line
2.17.0
Re: [Qemu-devel] [PATCH 3/9] target/ppc: Honor CPU_DUMP_FPU
Quoted 3 lines · Richard Henderson
Cc Alexander Graf <[email protected]>Cc David Gibson <[email protected]>Signed-off-by Richard Henderson <[email protected]>
Quoted 37 lines
--- target/ppc/translate.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-)target/ppc/translate.c +13
-7@@ -7048,14 +7048,20 @@ void ppc_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf, }cpu_fprintf (f," ] RES " TARGET_FMT_lx"\n" , env->reserve_addr); -for (i =0 ; i <32 ; i++) { -if ((i & (RFPL -1 )) ==0 ) -cpu_fprintf (f,"FPR%02d" , i); -cpu_fprintf (f," %016" PRIx64, *((uint64_t *)&env->fpr[i])); -if ((i & (RFPL -1 )) == (RFPL -1 )) -cpu_fprintf (f,"\n" ); + +if (flags &CPU_DUMP_FPU ) { +for (i =0 ; i <32 ; i++) { +if ((i & (RFPL -1 )) ==0 ) { +cpu_fprintf (f,"FPR%02d" , i); + } +cpu_fprintf (f," %016" PRIx64, *((uint64_t *)&env->fpr[i])); +if ((i & (RFPL -1 )) == (RFPL -1 )) { +cpu_fprintf (f,"\n" ); + } + } +cpu_fprintf (f,"FPSCR " TARGET_FMT_lx"\n" , env->fpscr); } -cpu_fprintf (f,"FPSCR " TARGET_FMT_lx"\n" , env->fpscr); +#if !defined(CONFIG_USER_ONLY ) cpu_fprintf(f, " SRR0 " TARGET_FMT_lx " SRR1 " TARGET_FMT_lx " PVR " TARGET_FMT_lx " VRSAVE " TARGET_FMT_lx "\n",
PATCH 4/9 target/riscv: Introduce cpu_riscv_get_fcsr
In reply to Richard Henderson--- target/riscv/cpu.h | 1 + target/riscv/fpu_helper.c | 6 ++++++ target/riscv/op_helper.c | 3 +-- 3 files changed, 8 insertions(+), 2 deletions(-)
target/riscv/cpu.h +1 -0
@@ -265,6 +265,7 @@ void QEMU_NORETURN do_raise_exception_err(CPURISCVState *env, uint32_t exception, uintptr_t pc);target_ulong cpu_riscv_get_fflags (CPURISCVState *env); +target_ulong cpu_riscv_get_fcsr (CPURISCVState *env);void cpu_riscv_set_fflags (CPURISCVState *env,target_ulong );#define TB_FLAGS_MMU_MASK 3
target/riscv/fpu_helper.c +6 -0
@@ -37,6 +37,12 @@ target_ulong cpu_riscv_get_fflags(CPURISCVState *env)return hard; } +target_ulong cpu_riscv_get_fcsr (CPURISCVState *env) +{ +return (cpu_riscv_get_fflags (env) <<FSR_AEXC_SHIFT ) + | (env->frm <<FSR_RD_SHIFT ); +} +void cpu_riscv_set_fflags (CPURISCVState *env,target_ulong hard) {int soft =0 ;
target/riscv/op_helper.c +1 -2
@@ -423,8 +423,7 @@ target_ulong csr_read_helper(CPURISCVState *env, target_ulong csrno)return env->frm;case CSR_FCSR :validate_mstatus_fs (env,GETPC ()); -return (cpu_riscv_get_fflags (env) <<FSR_AEXC_SHIFT ) - | (env->frm <<FSR_RD_SHIFT ); +return cpu_riscv_get_fcsr (env);/* rdtime/rdtimeh is trapped and emulated by bbl in system mode */ #ifdef CONFIG_USER_ONLY case CSR_TIME :
Signature · 1 line
2.17.0
Re: [Qemu-devel] [PATCH 4/9] target/riscv: Introduce cpu_riscv_get_fcsr
Quoted 5 lines · Richard Henderson
Cc Michael Clark <[email protected]>Cc Palmer Dabbelt <[email protected]>Cc Sagar Karandikar <[email protected]>Cc Bastian Koppelmann <[email protected]>Signed-off-by Richard Henderson <[email protected]>
Quoted 50 lines
--- target/riscv/cpu.h | 1 + target/riscv/fpu_helper.c | 6 ++++++ target/riscv/op_helper.c | 3 +-- 3 files changed, 8 insertions(+), 2 deletions(-)target/riscv/cpu.h +1
-0@@ -265,6 +265,7 @@ void QEMU_NORETURN do_raise_exception_err(CPURISCVState *env, uint32_t exception, uintptr_t pc);target_ulong cpu_riscv_get_fflags (CPURISCVState *env); +target_ulong cpu_riscv_get_fcsr (CPURISCVState *env);void cpu_riscv_set_fflags (CPURISCVState *env,target_ulong );#define TB_FLAGS_MMU_MASK 3target/riscv/fpu_helper.c +6
-0@@ -37,6 +37,12 @@ target_ulong cpu_riscv_get_fflags(CPURISCVState *env)return hard; } +target_ulong cpu_riscv_get_fcsr (CPURISCVState *env) +{ +return (cpu_riscv_get_fflags (env) <<FSR_AEXC_SHIFT ) + | (env->frm <<FSR_RD_SHIFT ); +} +void cpu_riscv_set_fflags (CPURISCVState *env,target_ulong hard) {int soft =0 ;target/riscv/op_helper.c +1
-2@@ -423,8 +423,7 @@ target_ulong csr_read_helper(CPURISCVState *env, target_ulong csrno)return env->frm;case CSR_FCSR :validate_mstatus_fs (env,GETPC ()); -return (cpu_riscv_get_fflags (env) <<FSR_AEXC_SHIFT ) - | (env->frm <<FSR_RD_SHIFT ); +return cpu_riscv_get_fcsr (env);/* rdtime/rdtimeh is trapped and emulated by bbl in system mode */ #ifdef CONFIG_USER_ONLY case CSR_TIME :
Re: [Qemu-devel] [PATCH 4/9] target/riscv: Introduce cpu_riscv_get_fcsr
In reply to Richard HendersonQuoted 6 lines · Richard Henderson
Cc Michael Clark <[email protected]>Cc Palmer Dabbelt <[email protected]>Cc Sagar Karandikar <[email protected]>Cc Bastian Koppelmann <[email protected]>Signed-off-by Richard Henderson <[email protected]>
I'm not against this change but it conflicts with changes in the riscv repo. I should post my patch queue to the list...
We have made a somewhat medium sized change and have unraveled two monolithic switch statements out of csr_read_helper switch and csr_write_helper into clearly decomposed functions for modifying control and status registers, along with an interface to allow CPUs to hook custom control and status registers. This was done to support atomic read/modify/write CSRs which was not possible to achieve with the current helpers which separately called via the csr_read_helper followed by csr_write_helper. Given the only way to modify CSRs was via the switch statements, we needed to move them out to provide a mechanism for CSRs that wish to be truly atomic. e.g. 'mip'. The CSR functions are defined in The RISC-V Instruction Set Manual Volume I: User-Level ISA Document Version 2.2 as "atomic" instructions:
- CSRRW (Atomic Read/Write CSR)
- CSRRS (Atomic Read and Set Bits in CSR)
- CSRRC (Atomic Read and Clear Bits in CSR)
We have thus changed QEMU to allow truly atomic CSR implementations. The new implementation replaces the compiler doing compare/branch vs jump table switch codegen for a sparse CSR address space with a single array of function pointers. i.e. load, indirect jump. Along with this change we have also renamed functions in target/riscv to use riscv_ prefix and added a public interface to hook custom CSRs. The CSR changes will allow out of tree code to hook custom CSRs without needing to change target/riscv code.
- riscv_cpu_ won over cpu_riscv_ given the number of functions conforming with the former riscv_ prefix and the desire for consistency in target/riscv
In the riscv tree we now have riscv_csr_read(env, CSR_FCSR)
and riscv_csr_write(env, CSR_FCSR, fcsr) as the method to read and write the composite. There is also a user in linux-user/riscv/signal.c that should probably use the new interface. We could change linux-user/riscv/signal.c to use your new interface however your interface only provides a read method and no write method, so the write interface remains in the (current) big CSR switch statement, leaving an inconsitency between the encapsulation of read and write. We currently have the new fcsr read and write encapsulated in static functions read_fcsr and write_fcsr in a new csr module (which should perhaps be called csr_helper.c).
See:
- https://github.com/riscv/riscv-qemu/commits/qemu-2.13-for-upstream
-
https://github.com/riscv/riscv-qemu/commit/0783ce5ea580552b1f8e2f16a3e3cc1af19db69b
-
https://github.com/riscv/riscv-qemu/commit/fa17549fbc726e83a3c163b1534c7465147c6718
Quoted 56 lines
--- target/riscv/cpu.h | 1 + target/riscv/fpu_helper.c | 6 ++++++ target/riscv/op_helper.c | 3 +-- 3 files changed, 8 insertions(+), 2 deletions(-)target/riscv/cpu.h +1
-0@@ -265,6 +265,7 @@ void QEMU_NORETURN do_raise_exception_err(CPURISCVState *env, uint32_t exception, uintptr_t pc);target_ulong cpu_riscv_get_fflags (CPURISCVState *env); +target_ulong cpu_riscv_get_fcsr (CPURISCVState *env);void cpu_riscv_set_fflags (CPURISCVState *env,target_ulong );#define
TB_FLAGS_MMU_MASK3target/riscv/fpu_helper.c +6
-0@@ -37,6 +37,12 @@ target_ulong cpu_riscv_get_fflags(CPURISCVState *env)return hard; } +target_ulong cpu_riscv_get_fcsr (CPURISCVState *env) +{ +return (cpu_riscv_get_fflags (env) <<FSR_AEXC_SHIFT ) + | (env->frm <<FSR_RD_SHIFT ); +} +void cpu_riscv_set_fflags (CPURISCVState *env,target_ulong hard) {int soft =0 ;target/riscv/op_helper.c +1
-2@@ -423,8 +423,7 @@ target_ulong csr_read_helper(CPURISCVState *env, target_ulong csrno)return env->frm;case CSR_FCSR :validate_mstatus_fs (env,GETPC ()); -return (cpu_riscv_get_fflags (env) <<FSR_AEXC_SHIFT ) - | (env->frm <<FSR_RD_SHIFT ); +return cpu_riscv_get_fcsr (env);/* rdtime/rdtimeh is trapped and emulated by bbl in system mode */ #ifdef CONFIG_USER_ONLY case
CSR_TIME:
--
2.17.0
Re: [Qemu-devel] [PATCH 4/9] target/riscv: Introduce cpu_riscv_get_fcsr
Quoted 11 lines · Michael Clark
On Fri, May 11, 2018 at 3:52 PM, Richard Henderson <[email protected] <mailto:[email protected]>> wrote:
Cc: Michael Clark <[email protected] <mailto:[email protected]>>
Cc: Palmer Dabbelt <[email protected] <mailto:[email protected]>>
Cc: Sagar Karandikar <[email protected] <mailto:[email protected]>>
Cc: Bastian Koppelmann <[email protected] <mailto:[email protected]>>
Quoted 6 lines
Signed-off-by Richard Henderson <[email protected]<mailto:[email protected]>>
I'm not against this change but it conflicts with changes in the riscv repo. I should post my patch queue to the list...
Ok, I'll drop this for now, and the dump of the FCSR in the next patch. To be revisited once your csr reorg is upstream...
r~
PATCH 5/9 target/riscv: Honor CPU_DUMP_FPU
In reply to Richard Henderson--- target/riscv/cpu.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
target/riscv/cpu.c +11 -5
@@ -199,6 +199,10 @@ static void riscv_cpu_dump_state(CPUState *cs, FILE *f,int i;cpu_fprintf (f," %s " TARGET_FMT_lx"\n" ,"pc " , env->pc); +if (flags &CPU_DUMP_FPU ) { +cpu_fprintf (f," %s " TARGET_FMT_lx"\n" ,"fcsr " , +cpu_riscv_get_fcsr (env)); + }#ifndef CONFIG_USER_ONLY cpu_fprintf (f," %s " TARGET_FMT_lx"\n" ,"mhartid " , env->mhartid);cpu_fprintf (f," %s " TARGET_FMT_lx"\n" ,"mstatus " , env->mstatus);
@@ -219,11 +223,13 @@ static void riscv_cpu_dump_state(CPUState *cs, FILE *f,cpu_fprintf (f,"\n" ); } } -for (i =0 ; i <32 ; i++) { -cpu_fprintf (f," %s %016" PRIx64, - riscv_fpr_regnames[i], env->fpr[i]); -if ((i &3 ) ==3 ) { -cpu_fprintf (f,"\n" ); +if (flags &CPU_DUMP_FPU ) { +for (i =0 ; i <32 ; i++) { +cpu_fprintf (f," %s %016" PRIx64, + riscv_fpr_regnames[i], env->fpr[i]); +if ((i &3 ) ==3 ) { +cpu_fprintf (f,"\n" ); + } } } }
Signature · 1 line
2.17.0
Re: [Qemu-devel] [PATCH 5/9] target/riscv: Honor CPU_DUMP_FPU
Quoted 5 lines · Richard Henderson
Cc Michael Clark <[email protected]>Cc Palmer Dabbelt <[email protected]>Cc Sagar Karandikar <[email protected]>Cc Bastian Koppelmann <[email protected]>Signed-off-by Richard Henderson <[email protected]>
Quoted 39 lines
--- target/riscv/cpu.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)target/riscv/cpu.c +11
-5@@ -199,6 +199,10 @@ static void riscv_cpu_dump_state(CPUState *cs, FILE *f,int i;cpu_fprintf (f," %s " TARGET_FMT_lx"\n" ,"pc " , env->pc); +if (flags &CPU_DUMP_FPU ) { +cpu_fprintf (f," %s " TARGET_FMT_lx"\n" ,"fcsr " , +cpu_riscv_get_fcsr (env)); + }#ifndef CONFIG_USER_ONLY cpu_fprintf (f," %s " TARGET_FMT_lx"\n" ,"mhartid " , env->mhartid);cpu_fprintf (f," %s " TARGET_FMT_lx"\n" ,"mstatus " , env->mstatus);@@ -219,11 +223,13 @@ static void riscv_cpu_dump_state(CPUState *cs, FILE *f,cpu_fprintf (f,"\n" ); } } -for (i =0 ; i <32 ; i++) { -cpu_fprintf (f," %s %016" PRIx64, - riscv_fpr_regnames[i], env->fpr[i]); -if ((i &3 ) ==3 ) { -cpu_fprintf (f,"\n" ); +if (flags &CPU_DUMP_FPU ) { +for (i =0 ; i <32 ; i++) { +cpu_fprintf (f," %s %016" PRIx64, + riscv_fpr_regnames[i], env->fpr[i]); +if ((i &3 ) ==3 ) { +cpu_fprintf (f,"\n" ); + } } } }
Michael Clark
Reviewed-byRe: [Qemu-devel] [PATCH 5/9] target/riscv: Honor CPU_DUMP_FPU
Quoted 8 lines · Philippe Mathieu-Daudé
Quoted 5 lines · Richard Henderson
Cc Michael Clark <[email protected]>Cc Palmer Dabbelt <[email protected]>Cc Sagar Karandikar <[email protected]>Cc Bastian Koppelmann <[email protected]>Signed-off-by Richard Henderson <[email protected]>Reviewed-by Philippe Mathieu-Daudé <[email protected]>
Quoted 42 lines
target/riscv/cpu.c static void riscv_cpu_dump_state(CPUState *cs, FILE
Quoted 9 lines
--- target/riscv/cpu.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)target/riscv/cpu.c +0
-0@@ -199,6 +199,10 @@ static void riscv_cpu_dump_state(CPUState *cs, FILE*f,
target/riscv/cpu.c static void riscv_cpu_dump_state(CPUState *cs,
Quoted 11 lines
target/riscv/cpu.c +4
-0int i;cpu_fprintf (f," %s " TARGET_FMT_lx"\n" ,"pc " , env->pc); +if (flags &CPU_DUMP_FPU ) { +cpu_fprintf (f," %s " TARGET_FMT_lx"\n" ,"fcsr " , +cpu_riscv_get_fcsr (env)); + }#ifndef CONFIG_USER_ONLY cpu_fprintf (f," %s " TARGET_FMT_lx"\n" ,"mhartid " , env->mhartid);cpu_fprintf (f," %s " TARGET_FMT_lx"\n" ,"mstatus " , env->mstatus);@@ -219,11 +223,13 @@ static void riscv_cpu_dump_state(CPUState *cs,FILE *f,
Quoted 19 lines
target/riscv/cpu.c +7
-5cpu_fprintf (f,"\n" ); } } -for (i =0 ; i <32 ; i++) { -cpu_fprintf (f," %s %016" PRIx64, - riscv_fpr_regnames[i], env->fpr[i]); -if ((i &3 ) ==3 ) { -cpu_fprintf (f,"\n" ); +if (flags &CPU_DUMP_FPU ) { +for (i =0 ; i <32 ; i++) { +cpu_fprintf (f," %s %016" PRIx64, + riscv_fpr_regnames[i], env->fpr[i]); +if ((i &3 ) ==3 ) { +cpu_fprintf (f,"\n" ); + } } } }
PATCH 6/9 target/s390x: Honor CPU_DUMP_FPU
In reply to Richard HendersonAlso do not dump both "fpu" and "vector" registers as the former overlaps the latter.
--- target/s390x/helper.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-)
target/s390x/helper.c +12 -11
@@ -327,21 +327,22 @@ void s390_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf, } } -for (i =0 ; i <16 ; i++) { -cpu_fprintf (f,"F%02d=%016" PRIx64, i,get_freg (env, i)->ll); -if ((i %4 ) ==3 ) { -cpu_fprintf (f,"\n" ); +if (flags &CPU_DUMP_FPU ) { +if (s390_has_feat (S390_FEAT_VECTOR )) { +for (i =0 ; i <32 ; i++) { +cpu_fprintf (f,"V%02d=%016" PRIx64"%016" PRIx64"%c" , + i, env->vregs[i][0 ].ll, env->vregs[i][1 ].ll, + i %2 ?'\n' :' ' ); + } }else { -cpu_fprintf (f," " ); +for (i =0 ; i <16 ; i++) { +cpu_fprintf (f,"F%02d=%016" PRIx64"%c" , + i,get_freg (env, i)->ll, + (i %4 ) ==3 ?'\n' :' ' ); + } } } -for (i =0 ; i <32 ; i++) { -cpu_fprintf (f,"V%02d=%016" PRIx64"%016" PRIx64, i, - env->vregs[i][0 ].ll, env->vregs[i][1 ].ll); -cpu_fprintf (f, (i %2 ) ?"\n" :" " ); - } -#ifndef CONFIG_USER_ONLY for (i =0 ; i <16 ; i++) {cpu_fprintf (f,"C%02d=%016" PRIx64, i, env->cregs[i]);
Signature · 1 line
2.17.0
Re: [Qemu-devel] [PATCH 6/9] target/s390x: Honor CPU_DUMP_FPU
Quoted 15 lines · Richard Henderson
Also do not dump both "fpu" and "vector" registers as the former overlaps the latter.
Cc Alexander Graf <[email protected]>Cc David Hildenbrand <[email protected]>Signed-off-by Richard Henderson <[email protected]>--- target/s390x/helper.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-)target/s390x/helper.c +0
-0
target/s390x/helper.c void s390_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf, · line 331
Quoted 9 lines
target/s390x/helper.c +2
-4@@ -327,21 +327,22 @@ void s390_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf, } } -for (i =0 ; i <16 ; i++) { -cpu_fprintf (f,"F%02d=%016" PRIx64, i,get_freg (env, i)->ll); -if ((i %4 ) ==3 ) { -cpu_fprintf (f,"\n" ); +if (flags &CPU_DUMP_FPU ) { +if (s390_has_feat (S390_FEAT_VECTOR )) {
CPU model should always be initialized at this point, so this check actually returns the right thing.
Quoted 25 lines
target/s390x/helper.c +10
-7+for (i =0 ; i <32 ; i++) { +cpu_fprintf (f,"V%02d=%016" PRIx64"%016" PRIx64"%c" , + i, env->vregs[i][0 ].ll, env->vregs[i][1 ].ll, + i %2 ?'\n' :' ' ); + } }else { -cpu_fprintf (f," " ); +for (i =0 ; i <16 ; i++) { +cpu_fprintf (f,"F%02d=%016" PRIx64"%c" , + i,get_freg (env, i)->ll, + (i %4 ) ==3 ?'\n' :' ' ); + } } } -for (i =0 ; i <32 ; i++) { -cpu_fprintf (f,"V%02d=%016" PRIx64"%016" PRIx64, i, - env->vregs[i][0 ].ll, env->vregs[i][1 ].ll); -cpu_fprintf (f, (i %2 ) ?"\n" :" " ); - } -#ifndef CONFIG_USER_ONLY for (i =0 ; i <16 ; i++) {cpu_fprintf (f,"C%02d=%016" PRIx64, i, env->cregs[i]);
Signature · 3 lines
Thanks, David / dhildenb
PATCH 7/9 target/sparc: Honor CPU_DUMP_FPU
In reply to Richard Henderson--- target/sparc/cpu.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
target/sparc/cpu.c +10 -7
@@ -647,15 +647,18 @@ void sparc_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf, } } -for (i =0 ; i <TARGET_DPREGS ; i++) { -if ((i &3 ) ==0 ) { -cpu_fprintf (f,"%%f%02d: " , i *2 ); - } -cpu_fprintf (f," %016" PRIx64, env->fpr[i].ll); -if ((i &3 ) ==3 ) { -cpu_fprintf (f,"\n" ); +if (flags &CPU_DUMP_FPU ) { +for (i =0 ; i <TARGET_DPREGS ; i++) { +if ((i &3 ) ==0 ) { +cpu_fprintf (f,"%%f%02d: " , i *2 ); + } +cpu_fprintf (f," %016" PRIx64, env->fpr[i].ll); +if ((i &3 ) ==3 ) { +cpu_fprintf (f,"\n" ); + } } } +#ifdef TARGET_SPARC64 cpu_fprintf (f,"pstate: %08x ccr: %02x (icc: " , env->pstate, (unsigned )cpu_get_ccr (env));
Signature · 1 line
2.17.0
Re: [Qemu-devel] [PATCH 7/9] target/sparc: Honor CPU_DUMP_FPU
Quoted 3 lines · Richard Henderson
Cc Mark Cave-Ayland <[email protected]>Cc Artyom Tarasenko <[email protected]>Signed-off-by Richard Henderson <[email protected]>
Quoted 35 lines
--- target/sparc/cpu.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)target/sparc/cpu.c +10
-7@@ -647,15 +647,18 @@ void sparc_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf, } } -for (i =0 ; i <TARGET_DPREGS ; i++) { -if ((i &3 ) ==0 ) { -cpu_fprintf (f,"%%f%02d: " , i *2 ); - } -cpu_fprintf (f," %016" PRIx64, env->fpr[i].ll); -if ((i &3 ) ==3 ) { -cpu_fprintf (f,"\n" ); +if (flags &CPU_DUMP_FPU ) { +for (i =0 ; i <TARGET_DPREGS ; i++) { +if ((i &3 ) ==0 ) { +cpu_fprintf (f,"%%f%02d: " , i *2 ); + } +cpu_fprintf (f," %016" PRIx64, env->fpr[i].ll); +if ((i &3 ) ==3 ) { +cpu_fprintf (f,"\n" ); + } } } +#ifdef TARGET_SPARC64 cpu_fprintf (f,"pstate: %08x ccr: %02x (icc: " , env->pstate, (unsigned )cpu_get_ccr (env));
PATCH 8/9 target/unicore32: Honor CPU_DUMP_FPU
In reply to Richard Henderson--- target/unicore32/translate.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
target/unicore32/translate.c +3 -1
@@ -2101,7 +2101,9 @@ void uc32_cpu_dump_state(CPUState *cs, FILE *f, psr & (1 <<28 ) ?'V' :'-' , cpu_mode_names[psr & 0xf]); -cpu_dump_state_ucf64 (env, f, cpu_fprintf, flags); +if (flags &CPU_DUMP_FPU ) { +cpu_dump_state_ucf64 (env, f, cpu_fprintf, flags); + } } void restore_state_to_opc(CPUUniCore32State *env, TranslationBlock *tb,
Signature · 1 line
2.17.0
Re: [Qemu-devel] [PATCH 8/9] target/unicore32: Honor CPU_DUMP_FPU
Quoted 2 lines · Richard Henderson
Cc Guan Xuetao <[email protected]>Signed-off-by Richard Henderson <[email protected]>
Quoted 20 lines
--- target/unicore32/translate.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)target/unicore32/translate.c +3
-1@@ -2101,7 +2101,9 @@ void uc32_cpu_dump_state(CPUState *cs, FILE *f, psr & (1 <<28 ) ?'V' :'-' , cpu_mode_names[psr & 0xf]); -cpu_dump_state_ucf64 (env, f, cpu_fprintf, flags); +if (flags &CPU_DUMP_FPU ) { +cpu_dump_state_ucf64 (env, f, cpu_fprintf, flags); + } } void restore_state_to_opc(CPUUniCore32State *env, TranslationBlock *tb,
PATCH 9/9 target/xtensa: Honor CPU_DUMP_FPU
In reply to Richard Henderson--- target/xtensa/translate.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
target/xtensa/translate.c +2 -1
@@ -1244,7 +1244,8 @@ void xtensa_cpu_dump_state(CPUState *cs, FILE *f, } } -if (xtensa_option_enabled (env->config,XTENSA_OPTION_FP_COPROCESSOR )) { +if ((flags &CPU_DUMP_FPU ) && +xtensa_option_enabled (env->config,XTENSA_OPTION_FP_COPROCESSOR )) {cpu_fprintf (f,"\n" );for (i =0 ; i <16 ; ++i) {
Signature · 1 line
2.17.0
Re: [Qemu-devel] [PATCH 9/9] target/xtensa: Honor CPU_DUMP_FPU
Quoted 5 lines · Richard Henderson
Cc Max Filippov <[email protected]>Signed-off-by Richard Henderson <[email protected]>--- target/xtensa/translate.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Signature · 2 lines
Thanks. -- Max
Re: [Qemu-devel] [PATCH 9/9] target/xtensa: Honor CPU_DUMP_FPU
In reply to Richard HendersonQuoted 2 lines · Richard Henderson
Cc Max Filippov <[email protected]>Signed-off-by Richard Henderson <[email protected]>
Quoted 19 lines
--- target/xtensa/translate.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)target/xtensa/translate.c +2
-1@@ -1244,7 +1244,8 @@ void xtensa_cpu_dump_state(CPUState *cs, FILE *f, } } -if (xtensa_option_enabled (env->config,XTENSA_OPTION_FP_COPROCESSOR )) { +if ((flags &CPU_DUMP_FPU ) && +xtensa_option_enabled (env->config,XTENSA_OPTION_FP_COPROCESSOR )) {cpu_fprintf (f,"\n" );for (i =0 ; i <16 ; ++i) {