* [Qemu-devel] [PATCH] qemu-system-tricore: segfault when entering "x 0" on the monitor
@ 2017-07-27 14:30 Eduardo Otubo
2017-07-28 6:11 ` Thomas Huth
2017-07-28 11:19 ` [Qemu-devel] " Michael Tokarev
0 siblings, 2 replies; 5+ messages in thread
From: Eduardo Otubo @ 2017-07-27 14:30 UTC (permalink / raw)
To: qemu-trivial; +Cc: qemu-devel, kbastian, thuth
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.
Signed-off-by: Eduardo Otubo <otubo@redhat.com>
---
target/tricore/cpu.c | 10 ++++++++++
target/tricore/cpu.h | 1 +
2 files changed, 11 insertions(+)
diff --git a/target/tricore/cpu.c b/target/tricore/cpu.c
index 08f50e2ba7..5ab5b56454 100644
--- a/target/tricore/cpu.c
+++ b/target/tricore/cpu.c
@@ -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)
diff --git a/target/tricore/cpu.h b/target/tricore/cpu.h
index a3493a123c..2663723955 100644
--- a/target/tricore/cpu.h
+++ b/target/tricore/cpu.h
@@ -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);
--
2.13.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] qemu-system-tricore: segfault when entering "x 0" on the monitor
2017-07-27 14:30 [Qemu-devel] [PATCH] qemu-system-tricore: segfault when entering "x 0" on the monitor Eduardo Otubo
@ 2017-07-28 6:11 ` Thomas Huth
2017-07-28 11:19 ` [Qemu-devel] " Michael Tokarev
1 sibling, 0 replies; 5+ messages in thread
From: Thomas Huth @ 2017-07-28 6:11 UTC (permalink / raw)
To: Eduardo Otubo, qemu-trivial; +Cc: qemu-devel, kbastian
On 27.07.2017 16:30, Eduardo Otubo wrote:
> 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.
>
> Signed-off-by: Eduardo Otubo <otubo@redhat.com>
> ---
> target/tricore/cpu.c | 10 ++++++++++
> target/tricore/cpu.h | 1 +
> 2 files changed, 11 insertions(+)
>
> diff --git a/target/tricore/cpu.c b/target/tricore/cpu.c
> index 08f50e2ba7..5ab5b56454 100644
> --- a/target/tricore/cpu.c
> +++ b/target/tricore/cpu.c
> @@ -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)
> diff --git a/target/tricore/cpu.h b/target/tricore/cpu.h
> index a3493a123c..2663723955 100644
> --- a/target/tricore/cpu.h
> +++ b/target/tricore/cpu.h
> @@ -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?
> void 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:
Tested-by: Thomas Huth <thuth@redhat.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] qemu-system-tricore: segfault when entering "x 0" on the monitor
2017-07-27 14:30 [Qemu-devel] [PATCH] qemu-system-tricore: segfault when entering "x 0" on the monitor Eduardo Otubo
2017-07-28 6:11 ` Thomas Huth
@ 2017-07-28 11:19 ` Michael Tokarev
2017-07-28 11:20 ` Bastian Koppelmann
1 sibling, 1 reply; 5+ messages in thread
From: Michael Tokarev @ 2017-07-28 11:19 UTC (permalink / raw)
To: Eduardo Otubo, qemu-trivial; +Cc: kbastian, thuth, qemu-devel
27.07.2017 17:30, Eduardo Otubo wrote:
> 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.
Applied to -trivial, without the extra newline in target/tricore/cpu.h
/mjt
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] qemu-system-tricore: segfault when entering "x 0" on the monitor
2017-07-28 11:19 ` [Qemu-devel] " Michael Tokarev
@ 2017-07-28 11:20 ` Bastian Koppelmann
0 siblings, 0 replies; 5+ messages in thread
From: Bastian Koppelmann @ 2017-07-28 11:20 UTC (permalink / raw)
To: Michael Tokarev, Eduardo Otubo, qemu-trivial; +Cc: thuth, qemu-devel
On 07/28/2017 01:19 PM, Michael Tokarev wrote:
> 27.07.2017 17:30, Eduardo Otubo wrote:
>> 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.
>
> Applied to -trivial, without the extra newline in target/tricore/cpu.h
>
> /mjt
>
Thanks for picking this up :)
Cheers,
Bastian
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] qemu-system-tricore: segfault when entering "x 0" on the monitor
[not found] <20170727123710.29817-1-otubo@redhat.com>
@ 2017-07-27 13:36 ` Thomas Huth
0 siblings, 0 replies; 5+ messages in thread
From: Thomas Huth @ 2017-07-27 13:36 UTC (permalink / raw)
To: Eduardo Otubo, qemu-trivial; +Cc: Bastian Koppelmann, QEMU Developers
Hi Eduardo,
Meta comment: Please always put the maintainer(s) and qemu-devel on CC:
On 27.07.2017 14:37, Eduardo Otubo wrote:
> 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 do
> just abort the execution with exit(1).
>
> Signed-off-by: Eduardo Otubo <otubo@redhat.com>
> ---
> target/tricore/cpu.c | 10 ++++++++++
> target/tricore/cpu.h | 3 +++
> 2 files changed, 13 insertions(+)
>
> diff --git a/target/tricore/cpu.c b/target/tricore/cpu.c
> index 08f50e2ba7..822c7f4092 100644
> --- a/target/tricore/cpu.c
> +++ b/target/tricore/cpu.c
> @@ -22,6 +22,15 @@
> #include "cpu.h"
> #include "qemu-common.h"
> #include "exec/exec-all.h"
> +#include "qemu/error-report.h"
> +
> +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");
> + exit(1);
Looking at the description in include/qom/cpu.h and the callers in
exec.c, it seems like it is OK if these functions return -1 if the page
could not be found. I think you should do that here, too, instead of
exiting - it's always a little bit annoying for the users if QEMU exits
unexpectedly, so we should try to avoid that if possible.
> +}
>
> 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)
> diff --git a/target/tricore/cpu.h b/target/tricore/cpu.h
> index a3493a123c..c374ed3213 100644
> --- a/target/tricore/cpu.h
> +++ b/target/tricore/cpu.h
> @@ -224,6 +224,9 @@ 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);
I think you could also remove that prototype above now - since there is
no implementation for this.
> +hwaddr tricore_cpu_get_phys_page_attrs_debug(CPUState *cpu, vaddr addr,
> + MemTxAttrs *attrs);
> +
> void tricore_cpu_dump_state(CPUState *cpu, FILE *f,
> fprintf_function cpu_fprintf, int flags);
>
>
Thomas
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-07-28 11:21 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-27 14:30 [Qemu-devel] [PATCH] qemu-system-tricore: segfault when entering "x 0" on the monitor Eduardo Otubo
2017-07-28 6:11 ` Thomas Huth
2017-07-28 11:19 ` [Qemu-devel] " Michael Tokarev
2017-07-28 11:20 ` Bastian Koppelmann
[not found] <20170727123710.29817-1-otubo@redhat.com>
2017-07-27 13:36 ` [Qemu-devel] [PATCH] " Thomas Huth
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.