Skip to contentSkip to conversation

hmp: fix info cpus for sparc targets

PATCH Applied Aurelien Jarno 3 participants 6 messages Oct 16, 2012 – Oct 20, 2012

v1 of 2 Applied Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 hmp: fix info cpus for sparc targets

On sparc targets, info cpus returns this kind of output:

| info cpus
| * CPU #0: pc=0x0000000000424d18pc=0x0000000000424d18npc=0x0000000000424d1c thread_id=19460

pc is printed twice, there is no space between pc, pc and npc. As npc implies pc, don't set has_pc on sparc, and add a space between pc and npc.

Cc Luiz Capitulino <[email protected]>
Cc Markus Armbruster <[email protected]>
Cc Blue Swirl <[email protected]>
---
 cpus.c |    2 --
 hmp.c  |    2 +-
 2 files changed, 1 insertion(+), 3 deletions(-)
cpus.c +0 -2
index 750a76f..cbc8556 100644
@@ -1216,8 +1216,6 @@ CpuInfoList *qmp_query_cpus(Error **errp)
         info->value->has_nip = true;
         info->value->nip = env->nip;
 #elif defined(TARGET_SPARC)
-        info->value->has_pc = true;
-        info->value->pc = env->pc;
         info->value->has_npc = true;
         info->value->npc = env->npc;
 #elif defined(TARGET_MIPS)
hmp.c +1 -1
index 70bdec2..64b6ab5 100644
@@ -242,7 +242,7 @@ void hmp_info_cpus(Monitor *mon)
             monitor_printf(mon, "nip=0x%016" PRIx64, cpu->value->nip);
         }
         if (cpu->value->has_npc) {
-            monitor_printf(mon, "pc=0x%016" PRIx64, cpu->value->pc);
+            monitor_printf(mon, "pc=0x%016 " PRIx64, cpu->value->pc);
             monitor_printf(mon, "npc=0x%016" PRIx64, cpu->value->npc);
         }
         if (cpu->value->has_PC) {
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 2/2 target-sparc: fix FMOVr instruction

Like the MOVr instruction, the FMOVr instruction has the condition encoded between bits 10 and 12.

---
 target-sparc/translate.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target-sparc/translate.c +1 -1
index 6cef96b..6d05e7d 100644
@@ -3154,7 +3154,7 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn)
 #define FMOVR(sz)                                                  \
                 do {                                               \
                     DisasCompare cmp;                              \
-                    cond = GET_FIELD_SP(insn, 14, 17);             \
+                    cond = GET_FIELD_SP(insn, 10, 12);             \
                     cpu_src1 = get_src1(insn, cpu_src1);           \
                     gen_compare_reg(&cmp, cond, cpu_src1);         \
                     gen_fmov##sz(dc, &cmp, rd, rs2);               \
Signature · 1 line
1.7.10.4
Applied
#2 lore raw

Re: [Qemu-devel] [PATCH 2/2] target-sparc: fix FMOVr instruction

Quoted 2 lines · Aurelien Jarno

Like the MOVr instruction, the FMOVr instruction has the condition encoded between bits 10 and 12.

Thanks, applied.

Quoted 23 lines
---
 target-sparc/translate.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target-sparc/translate.c +1 -2
index 6cef96b..6d05e7d 100644
@@ -3154,7 +3154,7 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn)
 #define FMOVR(sz)                                                  \
                 do {                                               \
                     DisasCompare cmp;                              \
-                    cond = GET_FIELD_SP(insn, 14, 17);             \
+                    cond = GET_FIELD_SP(insn, 10, 12);             \
                     cpu_src1 = get_src1(insn, cpu_src1);           \
                     gen_compare_reg(&cmp, cond, cpu_src1);         \
                     gen_fmov##sz(dc, &cmp, rd, rs2);               \
--

1.7.10.4

#3 lore raw
In reply to Aurelien Jarno
Quoted 36 lines · On Wed, 17 Oct 2012 01:28:34 +0200 Aurelien Jarno <[email protected]> wrote:

On sparc targets, info cpus returns this kind of output:

| info cpus
| * CPU #0: pc=0x0000000000424d18pc=0x0000000000424d18npc=0x0000000000424d1c thread_id=19460

pc is printed twice, there is no space between pc, pc and npc. As npc implies pc, don't set has_pc on sparc, and add a space between pc and npc.

Cc Luiz Capitulino <[email protected]>
Cc Markus Armbruster <[email protected]>
Cc Blue Swirl <[email protected]>
---
 cpus.c |    2 --
 hmp.c  |    2 +-
 2 files changed, 1 insertion(+), 3 deletions(-)
cpus.c +0 -2
index 750a76f..cbc8556 100644
@@ -1216,8 +1216,6 @@ CpuInfoList *qmp_query_cpus(Error **errp)
         info->value->has_nip = true;
         info->value->nip = env->nip;
 #elif defined(TARGET_SPARC)
-        info->value->has_pc = true;
-        info->value->pc = env->pc;
         info->value->has_npc = true;
         info->value->npc = env->npc;
 #elif defined(TARGET_MIPS)
hmp.c +0 -0
index 70bdec2..64b6ab5 100644

hmp.c void hmp_info_cpus(Monitor *mon) · line 245

Quoted 5 lines
hmp.c +1 -1
@@ -242,7 +242,7 @@ void hmp_info_cpus(Monitor *mon)
             monitor_printf(mon, "nip=0x%016" PRIx64, cpu->value->nip);
         }
         if (cpu->value->has_npc) {
-            monitor_printf(mon, "pc=0x%016" PRIx64, cpu->value->pc);
+            monitor_printf(mon, "pc=0x%016 " PRIx64, cpu->value->pc);

This patch changes qmp_query_cpus() to never set pc, so why do you print it?

Quoted 3 lines
hmp.c +0 -0
             monitor_printf(mon, "npc=0x%016" PRIx64, cpu->value->npc);
         }
         if (cpu->value->has_PC) {
#4 lore raw
Quoted 38 lines · Luiz Capitulino
Quoted 35 lines · On Wed, 17 Oct 2012 01:28:34 +0200 Aurelien Jarno <[email protected]> wrote:

On sparc targets, info cpus returns this kind of output:

| info cpus
| * CPU #0: pc=0x0000000000424d18pc=0x0000000000424d18npc=0x0000000000424d1c thread_id=19460

pc is printed twice, there is no space between pc, pc and npc. As npc implies pc, don't set has_pc on sparc, and add a space between pc and npc.

Cc Luiz Capitulino <[email protected]>
Cc Markus Armbruster <[email protected]>
Cc Blue Swirl <[email protected]>
---
 cpus.c |    2 --
 hmp.c  |    2 +-
 2 files changed, 1 insertion(+), 3 deletions(-)
cpus.c +0 -2
index 750a76f..cbc8556 100644
@@ -1216,8 +1216,6 @@ CpuInfoList *qmp_query_cpus(Error **errp)
         info->value->has_nip = true;
         info->value->nip = env->nip;
 #elif defined(TARGET_SPARC)
-        info->value->has_pc = true;
-        info->value->pc = env->pc;
         info->value->has_npc = true;
         info->value->npc = env->npc;
 #elif defined(TARGET_MIPS)
hmp.c +0 -0
index 70bdec2..64b6ab5 100644
Quoted 8 lines

hmp.c void hmp_info_cpus(Monitor *mon) · line 245

Quoted 6 lines
hmp.c +1 -1
@@ -242,7 +242,7 @@ void hmp_info_cpus(Monitor *mon)
             monitor_printf(mon, "nip=0x%016" PRIx64, cpu->value->nip);
         }
         if (cpu->value->has_npc) {
-            monitor_printf(mon, "pc=0x%016" PRIx64, cpu->value->pc);
+            monitor_printf(mon, "pc=0x%016 " PRIx64, cpu->value->pc);

This patch changes qmp_query_cpus() to never set pc, so why do you print it?

Well the print part of the code isn't change beside adding a space at the end. With the current code, has_npc implies has_pc, that's why I have removed the latter from qmp_query_cpus() in the sparc case.

If you prefer to change this behavior and not have has_npc implying has_pc, I can send another patch.

Quoted 5 lines
Quoted 3 lines
hmp.c +0 -0
             monitor_printf(mon, "npc=0x%016" PRIx64, cpu->value->npc);
         }
         if (cpu->value->has_PC) {
Signature · 2 lines
Aurelien Jarno                          GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net
#5 lore raw
Quoted 48 lines · On Wed, 17 Oct 2012 08:06:13 +0200 Aurelien Jarno <[email protected]> wrote:
Quoted 38 lines · Luiz Capitulino
Quoted 35 lines · On Wed, 17 Oct 2012 01:28:34 +0200 Aurelien Jarno <[email protected]> wrote:

On sparc targets, info cpus returns this kind of output:

| info cpus
| * CPU #0: pc=0x0000000000424d18pc=0x0000000000424d18npc=0x0000000000424d1c thread_id=19460

pc is printed twice, there is no space between pc, pc and npc. As npc implies pc, don't set has_pc on sparc, and add a space between pc and npc.

Cc Luiz Capitulino <[email protected]>
Cc Markus Armbruster <[email protected]>
Cc Blue Swirl <[email protected]>
---
 cpus.c |    2 --
 hmp.c  |    2 +-
 2 files changed, 1 insertion(+), 3 deletions(-)
cpus.c +0 -2
index 750a76f..cbc8556 100644
@@ -1216,8 +1216,6 @@ CpuInfoList *qmp_query_cpus(Error **errp)
         info->value->has_nip = true;
         info->value->nip = env->nip;
 #elif defined(TARGET_SPARC)
-        info->value->has_pc = true;
-        info->value->pc = env->pc;
         info->value->has_npc = true;
         info->value->npc = env->npc;
 #elif defined(TARGET_MIPS)
hmp.c +0 -0
index 70bdec2..64b6ab5 100644
Quoted 8 lines

hmp.c void hmp_info_cpus(Monitor *mon) · line 245

Quoted 6 lines
hmp.c +1 -1
@@ -242,7 +242,7 @@ void hmp_info_cpus(Monitor *mon)
             monitor_printf(mon, "nip=0x%016" PRIx64, cpu->value->nip);
         }
         if (cpu->value->has_npc) {
-            monitor_printf(mon, "pc=0x%016" PRIx64, cpu->value->pc);
+            monitor_printf(mon, "pc=0x%016 " PRIx64, cpu->value->pc);

This patch changes qmp_query_cpus() to never set pc, so why do you print it?

Quoted 3 lines

Well the print part of the code isn't change beside adding a space at the end. With the current code, has_npc implies has_pc, that's why I have removed the latter from qmp_query_cpus() in the sparc case.

My point is that you dropped the pc assignment along:

- info->value->pc = env->pc;

So, value->pc will be zeroed.

Quoted 2 lines

If you prefer to change this behavior and not have has_npc implying has_pc, I can send another patch.

If pc is going to contain relevant info, then we have to set has_pc even if has_npc implies it. If your point is that pc is irrelevant, then we have to set has_pc to false and drop its printing from HMP.

Quoted 7 lines
Quoted 6 lines
Quoted 4 lines
hmp.c +0 -0
             monitor_printf(mon, "npc=0x%016" PRIx64, cpu->value->npc);
         }
         if (cpu->value->has_PC) {