Log reset events
PATCH RESEND 1/2 Log reset events
[ Also available via git://git.kiszka.org/qemu.git queue/assorted ]
Original idea&code by Kevin Wolf, now split-up in two patches and added more archs.
This patch introduces a flag to log CPU resets. Useful for tracing unexpected resets (such as those triggered by x86 triple faults).
---
cpu-all.h | 1 + exec.c | 2 ++ target-arm/helper.c | 6 ++++++ target-cris/translate.c | 5 +++++ target-i386/helper.c | 5 +++++ target-m68k/helper.c | 5 +++++ target-mips/translate.c | 5 +++++ target-ppc/helper.c | 8 ++++++-- target-sh4/translate.c | 5 +++++ target-sparc/helper.c | 5 +++++ 10 files changed, 45 insertions(+), 2 deletions(-)
cpu-all.h +1 -0
@@ -816,6 +816,7 @@ target_phys_addr_t cpu_get_phys_page_debug(CPUState *env, target_ulong addr);#define CPU_LOG_PCALL (1 << 6)#define CPU_LOG_IOPORT (1 << 7)#define CPU_LOG_TB_CPU (1 << 8) +#define CPU_LOG_RESET (1 << 9)/* define log items */ typedef struct CPULogItem {
exec.c +2 -0
@@ -1569,6 +1569,8 @@ const CPULogItem cpu_log_items[] = {#ifdef TARGET_I386 {CPU_LOG_PCALL ,"pcall" , "show protected mode far calls/returns/exceptions" }, + { CPU_LOG_RESET, "cpu_reset", + "show CPU state before CPU resets" }, #endif #ifdef DEBUG_IOPORT { CPU_LOG_IOPORT, "ioport",
target-arm/helper.c +6 -0
@@ -159,6 +159,12 @@ static void cpu_reset_model_id(CPUARMState *env, uint32_t id)void cpu_reset (CPUARMState *env) {uint32_t id; + +if (loglevel &CPU_LOG_RESET ) { +fprintf (logfile,"CPU Reset (CPU %d)\n" , env->cpu_index); +cpu_dump_state (env, logfile, fprintf,0 ); + } + id = env->cp15.c0_cpuid;memset (env,0 , offsetof(CPUARMState , breakpoints));if (id)
target-cris/translate.c +5 -0
@@ -3458,6 +3458,11 @@ CPUCRISState *cpu_cris_init (const char *cpu_model)void cpu_reset (CPUCRISState *env) { +if (loglevel &CPU_LOG_RESET ) { +fprintf (logfile,"CPU Reset (CPU %d)\n" , env->cpu_index); +cpu_dump_state (env, logfile, fprintf,0 ); + } +memset (env,0 , offsetof(CPUCRISState , breakpoints));tlb_flush (env,1 );
target-i386/helper.c +5 -0
@@ -418,6 +418,11 @@ void cpu_reset(CPUX86State *env) {int i; +if (loglevel &CPU_LOG_RESET ) { +fprintf (logfile,"CPU Reset (CPU %d)\n" , env->cpu_index); +cpu_dump_state (env, logfile, fprintf,X86_DUMP_FPU |X86_DUMP_CCOP ); + } +memset (env,0 , offsetof(CPUX86State , breakpoints));tlb_flush (env,1 );
target-m68k/helper.c +5 -0
@@ -143,6 +143,11 @@ static int cpu_m68k_set_model(CPUM68KState *env, const char *name)void cpu_reset (CPUM68KState *env) { +if (loglevel &CPU_LOG_RESET ) { +fprintf (logfile,"CPU Reset (CPU %d)\n" , env->cpu_index); +cpu_dump_state (env, logfile, fprintf,0 ); + } +memset (env,0 , offsetof(CPUM68KState , breakpoints));#if !defined (CONFIG_USER_ONLY ) env->sr =0x2700 ;
target-mips/translate.c +5 -0
@@ -8489,6 +8489,11 @@ CPUMIPSState *cpu_mips_init (const char *cpu_model)void cpu_reset (CPUMIPSState *env) { +if (loglevel &CPU_LOG_RESET ) { +fprintf (logfile,"CPU Reset (CPU %d)\n" , env->cpu_index); +cpu_dump_state (env, logfile, fprintf,0 ); + } +memset (env,0 , offsetof(CPUMIPSState , breakpoints));tlb_flush (env,1 );
target-ppc/helper.c +6 -2
@@ -2709,10 +2709,14 @@ void cpu_dump_rfi (target_ulong RA, target_ulong msr)void cpu_ppc_reset (void *opaque) { -CPUPPCState *env; +CPUPPCState *env = opaque;target_ulong msr; - env = opaque; +if (loglevel &CPU_LOG_RESET ) { +fprintf (logfile,"CPU Reset (CPU %d)\n" , env->cpu_index); +cpu_dump_state (env, logfile, fprintf,0 ); + } + msr = (target_ulong )0 ;if (0 ) {/* XXX: find a suitable condition to enable the hypervisor mode */
target-sh4/translate.c +5 -0
@@ -184,6 +184,11 @@ void cpu_dump_state(CPUState * env, FILE * f,static void cpu_sh4_reset (CPUSH4State * env) { +if (loglevel &CPU_LOG_RESET ) { +fprintf (logfile,"CPU Reset (CPU %d)\n" , env->cpu_index); +cpu_dump_state (env, logfile, fprintf,0 ); + } +#if defined(CONFIG_USER_ONLY ) env->sr =0 ;#else
target-sparc/helper.c +5 -0
@@ -639,6 +639,11 @@ target_phys_addr_t cpu_get_phys_page_debug(CPUState *env, target_ulong addr)void cpu_reset (CPUSPARCState *env) { +if (loglevel &CPU_LOG_RESET ) { +fprintf (logfile,"CPU Reset (CPU %d)\n" , env->cpu_index); +cpu_dump_state (env, logfile, fprintf,0 ); + } +tlb_flush (env,1 ); env->cwp =0 ; env->wim =1 ;
On Fri, Jan 16, 2009 at 11:05 AM, Jan Kiszka <[email protected]> wrote:
[...]
Quoted 3 lines
This patch introduces a flag to log CPU resets. Useful for tracing unexpected resets (such as those triggered by x86 triple faults).
[...]
target-arm/helper.c static void cpu_reset_model_id(CPUARMState *env, uint32_t id) · line 166
Quoted 13 lines
target-arm/helper.c +5
-0@@ -159,6 +159,12 @@ static void cpu_reset_model_id(CPUARMState *env, uint32_t id)void cpu_reset (CPUARMState *env) {uint32_t id; + +if (loglevel &CPU_LOG_RESET ) { +fprintf (logfile,"CPU Reset (CPU %d)\n" , env->cpu_index); +cpu_dump_state (env, logfile, fprintf,0 ); + }
You should use the new log API which has been introduced yesterday (look in qemu-common.h).
Laurent
Quoted 7 lines · Laurent Desnogues
On Fri, Jan 16, 2009 at 11:05 AM, Jan Kiszka <[email protected]> wrote:
[...]Quoted 2 lines
This patch introduces a flag to log CPU resets. Useful for tracing unexpected resets (such as those triggered by x86 triple faults).
[...]
Quoted 17 lines
target-arm/helper.c static void cpu_reset_model_id(CPUARMState *env, uint32_t id) · line 166
Quoted 13 lines
target-arm/helper.c +5
-0@@ -159,6 +159,12 @@ static void cpu_reset_model_id(CPUARMState *env, uint32_t id)void cpu_reset (CPUARMState *env) {uint32_t id; + +if (loglevel &CPU_LOG_RESET ) { +fprintf (logfile,"CPU Reset (CPU %d)\n" , env->cpu_index); +cpu_dump_state (env, logfile, fprintf,0 ); + }You should use the new log API which has been introduced yesterday (look in
qemu-common.h).
Oh, OK, will check this.
Thanks,
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT SE 26 Corporate Competence Center Embedded Linux
PATCH 1/2 Log reset events
[ Updated to use new log API. ]
Original idea&code by Kevin Wolf, now split-up in two patches and added more archs.
This patch introduces a flag to log CPU resets. Useful for tracing unexpected resets (such as those triggered by x86 triple faults).
---
cpu-all.h | 1 + exec.c | 2 ++ target-arm/helper.c | 6 ++++++ target-cris/translate.c | 5 +++++ target-i386/helper.c | 5 +++++ target-m68k/helper.c | 5 +++++ target-mips/translate.c | 5 +++++ target-ppc/helper.c | 8 ++++++-- target-sh4/translate.c | 5 +++++ target-sparc/helper.c | 5 +++++ 10 files changed, 45 insertions(+), 2 deletions(-)
cpu-all.h +1 -0
@@ -816,6 +816,7 @@ target_phys_addr_t cpu_get_phys_page_debug(CPUState *env, target_ulong addr);#define CPU_LOG_PCALL (1 << 6)#define CPU_LOG_IOPORT (1 << 7)#define CPU_LOG_TB_CPU (1 << 8) +#define CPU_LOG_RESET (1 << 9)/* define log items */ typedef struct CPULogItem {
exec.c +2 -0
@@ -1569,6 +1569,8 @@ const CPULogItem cpu_log_items[] = {#ifdef TARGET_I386 {CPU_LOG_PCALL ,"pcall" , "show protected mode far calls/returns/exceptions" }, + { CPU_LOG_RESET, "cpu_reset", + "show CPU state before CPU resets" }, #endif #ifdef DEBUG_IOPORT { CPU_LOG_IOPORT, "ioport",
target-arm/helper.c +6 -0
@@ -159,6 +159,12 @@ static void cpu_reset_model_id(CPUARMState *env, uint32_t id)void cpu_reset (CPUARMState *env) {uint32_t id; + +if (qemu_loglevel_mask (CPU_LOG_RESET )) { +fprintf (logfile,"CPU Reset (CPU %d)\n" , env->cpu_index); +cpu_dump_state (env, logfile, fprintf,0 ); + } + id = env->cp15.c0_cpuid;memset (env,0 , offsetof(CPUARMState , breakpoints));if (id)
target-cris/translate.c +5 -0
@@ -3458,6 +3458,11 @@ CPUCRISState *cpu_cris_init (const char *cpu_model)void cpu_reset (CPUCRISState *env) { +if (qemu_loglevel_mask (CPU_LOG_RESET )) { +fprintf (logfile,"CPU Reset (CPU %d)\n" , env->cpu_index); +cpu_dump_state (env, logfile, fprintf,0 ); + } +memset (env,0 , offsetof(CPUCRISState , breakpoints));tlb_flush (env,1 );
target-i386/helper.c +5 -0
@@ -418,6 +418,11 @@ void cpu_reset(CPUX86State *env) {int i; +if (qemu_loglevel_mask (CPU_LOG_RESET )) { +fprintf (logfile,"CPU Reset (CPU %d)\n" , env->cpu_index); +cpu_dump_state (env, logfile, fprintf,X86_DUMP_FPU |X86_DUMP_CCOP ); + } +memset (env,0 , offsetof(CPUX86State , breakpoints));tlb_flush (env,1 );
target-m68k/helper.c +5 -0
@@ -143,6 +143,11 @@ static int cpu_m68k_set_model(CPUM68KState *env, const char *name)void cpu_reset (CPUM68KState *env) { +if (qemu_loglevel_mask (CPU_LOG_RESET )) { +fprintf (logfile,"CPU Reset (CPU %d)\n" , env->cpu_index); +cpu_dump_state (env, logfile, fprintf,0 ); + } +memset (env,0 , offsetof(CPUM68KState , breakpoints));#if !defined (CONFIG_USER_ONLY ) env->sr =0x2700 ;
target-mips/translate.c +5 -0
@@ -8489,6 +8489,11 @@ CPUMIPSState *cpu_mips_init (const char *cpu_model)void cpu_reset (CPUMIPSState *env) { +if (qemu_loglevel_mask (CPU_LOG_RESET )) { +fprintf (logfile,"CPU Reset (CPU %d)\n" , env->cpu_index); +cpu_dump_state (env, logfile, fprintf,0 ); + } +memset (env,0 , offsetof(CPUMIPSState , breakpoints));tlb_flush (env,1 );
target-ppc/helper.c +6 -2
@@ -2709,10 +2709,14 @@ void cpu_dump_rfi (target_ulong RA, target_ulong msr)void cpu_ppc_reset (void *opaque) { -CPUPPCState *env; +CPUPPCState *env = opaque;target_ulong msr; - env = opaque; +if (qemu_loglevel_mask (CPU_LOG_RESET )) { +fprintf (logfile,"CPU Reset (CPU %d)\n" , env->cpu_index); +cpu_dump_state (env, logfile, fprintf,0 ); + } + msr = (target_ulong )0 ;if (0 ) {/* XXX: find a suitable condition to enable the hypervisor mode */
target-sh4/translate.c +5 -0
@@ -184,6 +184,11 @@ void cpu_dump_state(CPUState * env, FILE * f,static void cpu_sh4_reset (CPUSH4State * env) { +if (qemu_loglevel_mask (CPU_LOG_RESET )) { +fprintf (logfile,"CPU Reset (CPU %d)\n" , env->cpu_index); +cpu_dump_state (env, logfile, fprintf,0 ); + } +#if defined(CONFIG_USER_ONLY ) env->sr =0 ;#else
target-sparc/helper.c +5 -0
@@ -639,6 +639,11 @@ target_phys_addr_t cpu_get_phys_page_debug(CPUState *env, target_ulong addr)void cpu_reset (CPUSPARCState *env) { +if (qemu_loglevel_mask (CPU_LOG_RESET )) { +fprintf (logfile,"CPU Reset (CPU %d)\n" , env->cpu_index); +cpu_dump_state (env, logfile, fprintf,0 ); + } +tlb_flush (env,1 ); env->cwp =0 ; env->wim =1 ;
Quoted 54 lines · Jan Kiszka
[ Updated to use new log API. ]
Original idea&code by Kevin Wolf, now split-up in two patches and added more archs.
This patch introduces a flag to log CPU resets. Useful for tracing unexpected resets (such as those triggered by x86 triple faults).
Signed-off-by Jan Kiszka <[email protected]>Acked-by Kevin Wolf <[email protected]>---
cpu-all.h | 1 + exec.c | 2 ++ target-arm/helper.c | 6 ++++++ target-cris/translate.c | 5 +++++ target-i386/helper.c | 5 +++++ target-m68k/helper.c | 5 +++++ target-mips/translate.c | 5 +++++ target-ppc/helper.c | 8 ++++++-- target-sh4/translate.c | 5 +++++ target-sparc/helper.c | 5 +++++ 10 files changed, 45 insertions(+), 2 deletions(-)cpu-all.h +1
-0@@ -816,6 +816,7 @@ target_phys_addr_t cpu_get_phys_page_debug(CPUState *env, target_ulong addr);#define CPU_LOG_PCALL (1 << 6)#define CPU_LOG_IOPORT (1 << 7)#define CPU_LOG_TB_CPU (1 << 8) +#define CPU_LOG_RESET (1 << 9)/* define log items */ typedef struct CPULogItem {exec.c +2
-0@@ -1569,6 +1569,8 @@ const CPULogItem cpu_log_items[] = {#ifdef TARGET_I386 {CPU_LOG_PCALL ,"pcall" , "show protected mode far calls/returns/exceptions" }, + { CPU_LOG_RESET, "cpu_reset", + "show CPU state before CPU resets" }, #endif #ifdef DEBUG_IOPORT { CPU_LOG_IOPORT, "ioport",target-arm/helper.c +0
-0
target-arm/helper.c static void cpu_reset_model_id(CPUARMState *env, uint32_t id) · line 165
Quoted 7 lines
target-arm/helper.c +4
-0@@ -159,6 +159,12 @@ static void cpu_reset_model_id(CPUARMState *env, uint32_t id)void cpu_reset (CPUARMState *env) {uint32_t id; + +if (qemu_loglevel_mask (CPU_LOG_RESET )) { +fprintf (logfile,"CPU Reset (CPU %d)\n" , env->cpu_index); +cpu_dump_state (env, logfile, fprintf,0 );
Shouldn't that be qemu_log() and log_cpu_state() now?
Kevin
On Fri, Jan 16, 2009 at 1:14 PM, Kevin Wolf <[email protected]> wrote:
[..]
Quoted 10 lines
target-arm/helper.c static void cpu_reset_model_id(CPUARMState *env, uint32_t id) · line 165
Quoted 8 lines
target-arm/helper.c +4
-0@@ -159,6 +159,12 @@ static void cpu_reset_model_id(CPUARMState *env, uint32_t id)void cpu_reset (CPUARMState *env) {uint32_t id; + +if (qemu_loglevel_mask (CPU_LOG_RESET )) { +fprintf (logfile,"CPU Reset (CPU %d)\n" , env->cpu_index); +cpu_dump_state (env, logfile, fprintf,0 );Shouldn't that be
qemu_log()andlog_cpu_state()now?
Yes. Sorry Jan :)
A trick to check things are done properly is to make sure you don't ever use logfile or loglevel variables.
Laurent
Quoted 12 lines · Laurent Desnogues
On Fri, Jan 16, 2009 at 1:14 PM, Kevin Wolf <[email protected]> wrote:
[..]Quoted 9 lines
target-arm/helper.c static void cpu_reset_model_id(CPUARMState *env, uint32_t id) · line 165
Quoted 8 lines
target-arm/helper.c +4
-0@@ -159,6 +159,12 @@ static void cpu_reset_model_id(CPUARMState *env, uint32_t id)void cpu_reset (CPUARMState *env) {uint32_t id; + +if (qemu_loglevel_mask (CPU_LOG_RESET )) { +fprintf (logfile,"CPU Reset (CPU %d)\n" , env->cpu_index); +cpu_dump_state (env, logfile, fprintf,0 );Shouldn't that be
qemu_log()andlog_cpu_state()now?
Quoted 4 lines
Yes. Sorry Jan :)
A trick to check things are done properly is to make sure you don't ever use logfile or loglevel variables.
Maybe qemu_log() should be a function rather than a macro? Then loglevel and logfile could be static and the build would break if you try to use them outside the logging code.
Kevin
Quoted 3 lines · Kevin Wolf
Maybe
qemu_log()should be a function rather than a macro? Then loglevel and logfile could be static and the build would break if you try to use them outside the logging code.
I think the intent is to make sure no useless call is made if not needed. Of course that'd mean conditionally defining "empty" macros which is currently not the case.
Laurent
Quoted 12 lines · Kevin Wolf
Quoted 11 lines · Laurent Desnogues
On Fri, Jan 16, 2009 at 1:14 PM, Kevin Wolf <[email protected]> wrote:
[..]Quoted 9 lines
target-arm/helper.c static void cpu_reset_model_id(CPUARMState *env, uint32_t id) · line 165
Quoted 8 lines
target-arm/helper.c +4
-0@@ -159,6 +159,12 @@ static void cpu_reset_model_id(CPUARMState *env, uint32_t id)void cpu_reset (CPUARMState *env) {uint32_t id; + +if (qemu_loglevel_mask (CPU_LOG_RESET )) { +fprintf (logfile,"CPU Reset (CPU %d)\n" , env->cpu_index); +cpu_dump_state (env, logfile, fprintf,0 );Shouldn't that be
qemu_log()andlog_cpu_state()now?
Quoted 1 line
Quoted 1 line
Yes. Sorry Jan :)
Well, the patch description misled me a bit ("global s/loglevel & X/qemu_loglevel_mask(X)/"), but I also could have checked more carefully what actually changed.
Quoted 7 lines
Quoted 3 lines
A trick to check things are done properly is to make sure you don't ever use logfile or loglevel variables.
Maybe
qemu_log()should be a function rather than a macro? Then loglevel and logfile could be static and the build would break if you try to use them outside the logging code.
Sounds good (function-like macros are for corner cases only).
I will try to make logfile/loglevel static and fix my patch accordingly.
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT SE 26 Corporate Competence Center Embedded Linux
Quoted 21 lines · Jan Kiszka
Quoted 12 lines · Kevin Wolf
Quoted 11 lines · Laurent Desnogues
On Fri, Jan 16, 2009 at 1:14 PM, Kevin Wolf <[email protected]> wrote:
[..]Quoted 9 lines
target-arm/helper.c static void cpu_reset_model_id(CPUARMState *env, uint32_t id) · line 165
Quoted 8 lines
target-arm/helper.c +4
-0@@ -159,6 +159,12 @@ static void cpu_reset_model_id(CPUARMState *env, uint32_t id)void cpu_reset (CPUARMState *env) {uint32_t id; + +if (qemu_loglevel_mask (CPU_LOG_RESET )) { +fprintf (logfile,"CPU Reset (CPU %d)\n" , env->cpu_index); +cpu_dump_state (env, logfile, fprintf,0 );Shouldn't that be
qemu_log()andlog_cpu_state()now?Quoted 1 line
Quoted 1 line
Yes. Sorry Jan :)
Well, the patch description misled me a bit ("global s/loglevel & X/qemu_loglevel_mask(X)/"), but I also could have checked more carefully what actually changed.
Quoted 2 lines
Quoted 2 lines
A trick to check things are done properly is to make sure you don't ever use logfile or loglevel variables.
Quoted 7 lines
Quoted 3 lines
Maybe
qemu_log()should be a function rather than a macro? Then loglevel and logfile could be static and the build would break if you try to use them outside the logging code.Sounds good (function-like macros are for corner cases only).
I will try to make logfile/loglevel static and fix my patch accordingly.
Making logfile and loglevel static means enforcing a function call just to check if we perform logging. Would the additional overhead be acceptable for all qemu_log* spots? Unless maintainers tell me "yes", I will not touch this part for now.
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT SE 26 Corporate Competence Center Embedded Linux
Quoted 4 lines · Jan Kiszka
Making logfile and loglevel static means enforcing a function call just to check if we perform logging. Would the additional overhead be acceptable for all qemu_log* spots? Unless maintainers tell me "yes", I will not touch this part for now.
Well, seems you have a point... I guess that's not acceptable. But leaving loglevel global and making logfile static should still be possible, right?
Kevin
PATCH 1/2 Log reset events
In reply to Jan Kiszka[ Updated to use the new log API, but now consistently - I hope. ]
Original idea&code by Kevin Wolf, split-up in two patches and added more archs.
This patch introduces a flag to log CPU resets. Useful for tracing unexpected resets (such as those triggered by x86 triple faults).
---
cpu-all.h | 1 + exec.c | 2 ++ target-arm/helper.c | 6 ++++++ target-cris/translate.c | 5 +++++ target-i386/helper.c | 5 +++++ target-m68k/helper.c | 5 +++++ target-mips/translate.c | 5 +++++ target-ppc/helper.c | 8 ++++++-- target-sh4/translate.c | 5 +++++ target-sparc/helper.c | 5 +++++ 10 files changed, 45 insertions(+), 2 deletions(-)
cpu-all.h +1 -0
@@ -816,6 +816,7 @@ target_phys_addr_t cpu_get_phys_page_debug(CPUState *env, target_ulong addr);#define CPU_LOG_PCALL (1 << 6)#define CPU_LOG_IOPORT (1 << 7)#define CPU_LOG_TB_CPU (1 << 8) +#define CPU_LOG_RESET (1 << 9)/* define log items */ typedef struct CPULogItem {
exec.c +2 -0
@@ -1569,6 +1569,8 @@ const CPULogItem cpu_log_items[] = {#ifdef TARGET_I386 {CPU_LOG_PCALL ,"pcall" , "show protected mode far calls/returns/exceptions" }, + { CPU_LOG_RESET, "cpu_reset", + "show CPU state before CPU resets" }, #endif #ifdef DEBUG_IOPORT { CPU_LOG_IOPORT, "ioport",
target-arm/helper.c +6 -0
@@ -159,6 +159,12 @@ static void cpu_reset_model_id(CPUARMState *env, uint32_t id)void cpu_reset (CPUARMState *env) {uint32_t id; + +if (qemu_loglevel_mask (CPU_LOG_RESET )) { +qemu_log ("CPU Reset (CPU %d)\n" , env->cpu_index); +log_cpu_state (env,0 ); + } + id = env->cp15.c0_cpuid;memset (env,0 , offsetof(CPUARMState , breakpoints));if (id)
target-cris/translate.c +5 -0
@@ -3458,6 +3458,11 @@ CPUCRISState *cpu_cris_init (const char *cpu_model)void cpu_reset (CPUCRISState *env) { +if (qemu_loglevel_mask (CPU_LOG_RESET )) { +qemu_log ("CPU Reset (CPU %d)\n" , env->cpu_index); +log_cpu_state (env,0 ); + } +memset (env,0 , offsetof(CPUCRISState , breakpoints));tlb_flush (env,1 );
target-i386/helper.c +5 -0
@@ -418,6 +418,11 @@ void cpu_reset(CPUX86State *env) {int i; +if (qemu_loglevel_mask (CPU_LOG_RESET )) { +qemu_log ("CPU Reset (CPU %d)\n" , env->cpu_index); +log_cpu_state (env,X86_DUMP_FPU |X86_DUMP_CCOP ); + } +memset (env,0 , offsetof(CPUX86State , breakpoints));tlb_flush (env,1 );
target-m68k/helper.c +5 -0
@@ -143,6 +143,11 @@ static int cpu_m68k_set_model(CPUM68KState *env, const char *name)void cpu_reset (CPUM68KState *env) { +if (qemu_loglevel_mask (CPU_LOG_RESET )) { +qemu_log ("CPU Reset (CPU %d)\n" , env->cpu_index); +log_cpu_state (env,0 ); + } +memset (env,0 , offsetof(CPUM68KState , breakpoints));#if !defined (CONFIG_USER_ONLY ) env->sr =0x2700 ;
target-mips/translate.c +5 -0
@@ -8489,6 +8489,11 @@ CPUMIPSState *cpu_mips_init (const char *cpu_model)void cpu_reset (CPUMIPSState *env) { +if (qemu_loglevel_mask (CPU_LOG_RESET )) { +qemu_log ("CPU Reset (CPU %d)\n" , env->cpu_index); +log_cpu_state (env,0 ); + } +memset (env,0 , offsetof(CPUMIPSState , breakpoints));tlb_flush (env,1 );
target-ppc/helper.c +6 -2
@@ -2709,10 +2709,14 @@ void cpu_dump_rfi (target_ulong RA, target_ulong msr)void cpu_ppc_reset (void *opaque) { -CPUPPCState *env; +CPUPPCState *env = opaque;target_ulong msr; - env = opaque; +if (qemu_loglevel_mask (CPU_LOG_RESET )) { +qemu_log ("CPU Reset (CPU %d)\n" , env->cpu_index); +log_cpu_state (env,0 ); + } + msr = (target_ulong )0 ;if (0 ) {/* XXX: find a suitable condition to enable the hypervisor mode */
target-sh4/translate.c +5 -0
@@ -184,6 +184,11 @@ void cpu_dump_state(CPUState * env, FILE * f,static void cpu_sh4_reset (CPUSH4State * env) { +if (qemu_loglevel_mask (CPU_LOG_RESET )) { +qemu_log ("CPU Reset (CPU %d)\n" , env->cpu_index); +log_cpu_state (env,0 ); + } +#if defined(CONFIG_USER_ONLY ) env->sr =0 ;#else
target-sparc/helper.c +5 -0
@@ -639,6 +639,11 @@ target_phys_addr_t cpu_get_phys_page_debug(CPUState *env, target_ulong addr)void cpu_reset (CPUSPARCState *env) { +if (qemu_loglevel_mask (CPU_LOG_RESET )) { +qemu_log ("CPU Reset (CPU %d)\n" , env->cpu_index); +log_cpu_state (env,0 ); + } +tlb_flush (env,1 ); env->cwp =0 ; env->wim =1 ;
Quoted 9 lines · Jan Kiszka
[ Updated to use the new log API, but now consistently - I hope. ]
Original idea&code by Kevin Wolf, split-up in two patches and added more archs.
This patch introduces a flag to log CPU resets. Useful for tracing unexpected resets (such as those triggered by x86 triple faults).
Signed-off-by Jan Kiszka <[email protected]>
Looks good now. So here is my line back again... ;-)
Quoted 6 lines · Kevin Wolf
Quoted 5 lines · Jan Kiszka
[ Updated to use the new log API, but now consistently - I hope. ]
Original idea&code by Kevin Wolf, split-up in two patches and added more archs.
Quoted 9 lines
Quoted 4 lines
This patch introduces a flag to log CPU resets. Useful for tracing unexpected resets (such as those triggered by x86 triple faults).
Signed-off-by Jan Kiszka <[email protected]>Looks good now. So here is my line back again... ;-)
Acked-by Kevin Wolf <[email protected]>
Puh! :)
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT SE 26 Corporate Competence Center Embedded Linux