qemu-system-tricore: segfault when entering "x 0" on the monitor
PATCH 1/1 qemu-system-tricore: segfault when entering "x 0" on the monitor
Starting Qemu with "qemu-system-tricore -nographic -M tricore_testboard -S" and entering "x 0" at the monitor prompt leads to Segmentation fault. This happens because tricore_cpu_get_phys_page_debug() is not implemented yet, this is a temporary workaround to avoid the crash.
--- target/tricore/cpu.c | 10 ++++++++++ target/tricore/cpu.h | 1 + 2 files changed, 11 insertions(+)
target/tricore/cpu.c +10 -0
@@ -22,6 +22,15 @@#include "cpu.h" #include "qemu-common.h" #include "exec/exec-all.h" +#include "qemu/error-report.h" + +static hwaddr tricore_cpu_get_phys_page_attrs_debug (CPUState *cpu,vaddr addr, +MemTxAttrs *attrs) +{ +error_report ("function cpu_get_phys_page_attrs_debug not " +"implemented, aborting" ); +return -1 ; +}static inline void set_feature (CPUTriCoreState *env,int feature) {
@@ -176,6 +185,7 @@ static void tricore_cpu_class_init(ObjectClass *c, void *data) cc->dump_state = tricore_cpu_dump_state; cc->set_pc = tricore_cpu_set_pc; cc->synchronize_from_tb = tricore_cpu_synchronize_from_tb; + cc->get_phys_page_attrs_debug = tricore_cpu_get_phys_page_attrs_debug; }static void cpu_register (const TriCoreCPUInfo *info)
target/tricore/cpu.h +1 -0
@@ -224,6 +224,7 @@ static inline TriCoreCPU *tricore_env_get_cpu(CPUTriCoreState *env)#define ENV_OFFSET offsetof(TriCoreCPU, env)hwaddr tricore_cpu_get_phys_page_debug (CPUState *cpu,vaddr addr); +void tricore_cpu_dump_state (CPUState *cpu,FILE *f,fprintf_function cpu_fprintf,int flags);
Signature · 1 line
2.13.3
Quoted 44 lines · Eduardo Otubo
Starting Qemu with "qemu-system-tricore -nographic -M
tricore_testboard-S" and entering "x 0" at the monitor prompt leads to Segmentation fault. This happens becausetricore_cpu_get_phys_page_debug()is not implemented yet, this is a temporary workaround to avoid the crash.Signed-off-by Eduardo Otubo <[email protected]>--- target/tricore/cpu.c | 10 ++++++++++ target/tricore/cpu.h | 1 + 2 files changed, 11 insertions(+)target/tricore/cpu.c +10
-0@@ -22,6 +22,15 @@#include "cpu.h" #include "qemu-common.h" #include "exec/exec-all.h" +#include "qemu/error-report.h" + +static hwaddr tricore_cpu_get_phys_page_attrs_debug (CPUState *cpu,vaddr addr, +MemTxAttrs *attrs) +{ +error_report ("function cpu_get_phys_page_attrs_debug not " +"implemented, aborting" ); +return -1 ; +}static inline void set_feature (CPUTriCoreState *env,int feature) {@@ -176,6 +185,7 @@ static void tricore_cpu_class_init(ObjectClass *c, void *data) cc->dump_state = tricore_cpu_dump_state; cc->set_pc = tricore_cpu_set_pc; cc->synchronize_from_tb = tricore_cpu_synchronize_from_tb; + cc->get_phys_page_attrs_debug = tricore_cpu_get_phys_page_attrs_debug; }static void cpu_register (const TriCoreCPUInfo *info)target/tricore/cpu.h +0
-0
target/tricore/cpu.h static inline TriCoreCPU *tricore_env_get_cpu(CPUTriCoreState *env) · line 227
Quoted 4 lines
target/tricore/cpu.h +1
-0@@ -224,6 +224,7 @@ static inline TriCoreCPU *tricore_env_get_cpu(CPUTriCoreState *env)#define ENV_OFFSET offsetof(TriCoreCPU, env)hwaddr tricore_cpu_get_phys_page_debug (CPUState *cpu,vaddr addr); +
Unnecessary white-space change ... rather remove the tricore_cpu_get_phys_page_debug() line instead?
target/tricore/cpu.h static inline TriCoreCPU *tricore_env_get_cpu(CPUTriCoreState *env) · line 229
Quoted 2 lines
target/tricore/cpu.h +0
-0void tricore_cpu_dump_state (CPUState *cpu,FILE *f,fprintf_function cpu_fprintf,int flags);
Apart from the nit above, looks like this fixes the crash indeed:
Michael Tokarev
AppliedQuoted 4 lines · Eduardo Otubo
Starting Qemu with "qemu-system-tricore -nographic -M
tricore_testboard-S" and entering "x 0" at the monitor prompt leads to Segmentation fault. This happens becausetricore_cpu_get_phys_page_debug()is not implemented yet, this is a temporary workaround to avoid the crash.
Applied to -trivial, without the extra newline in target/tricore/cpu.h
/mjt
Quoted 10 lines · Michael Tokarev
Quoted 4 lines · Eduardo Otubo
Starting Qemu with "qemu-system-tricore -nographic -M
tricore_testboard-S" and entering "x 0" at the monitor prompt leads to Segmentation fault. This happens becausetricore_cpu_get_phys_page_debug()is not implemented yet, this is a temporary workaround to avoid the crash.Applied to -trivial, without the extra newline in
target/tricore/cpu.h/mjt
Thanks for picking this up :)
Cheers,
Bastian