[PATCH 04/11] target/ppc: moved ppc_store_msr into gdbstub.c

Bruno Larsen (billionai) posted 11 patches 4 years, 9 months ago
There is a newer version of this series
[PATCH 04/11] target/ppc: moved ppc_store_msr into gdbstub.c
Posted by Bruno Larsen (billionai) 4 years, 9 months ago
This function is used by !TCG cases, so it was moved to a common code
file. We chose gdbstub.c since it was the one giving us grief over it.

Signed-off-by: Bruno Larsen (billionai) <bruno.larsen@eldorado.org.br>
---
 target/ppc/gdbstub.c     | 7 +++++++
 target/ppc/misc_helper.c | 6 ------
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/target/ppc/gdbstub.c b/target/ppc/gdbstub.c
index 9339e7eafe..17e41fc113 100644
--- a/target/ppc/gdbstub.c
+++ b/target/ppc/gdbstub.c
@@ -22,6 +22,7 @@
 #include "exec/gdbstub.h"
 #include "exec/helper-proto.h"
 #include "internal.h"
+#include "helper_regs.h"
 
 static int ppc_gdb_register_len_apple(int n)
 {
@@ -622,6 +623,12 @@ gchar *ppc_gdb_arch_name(CPUState *cs)
 #endif
 }
 
+/* GDBstub can read and write MSR... */
+void ppc_store_msr(CPUPPCState *env, target_ulong value)
+{
+    hreg_store_msr(env, value, 0);
+}
+
 void ppc_gdb_init(CPUState *cs, PowerPCCPUClass *pcc)
 {
     if (pcc->insns_flags & PPC_FLOAT) {
diff --git a/target/ppc/misc_helper.c b/target/ppc/misc_helper.c
index 08a31da289..b910ac6479 100644
--- a/target/ppc/misc_helper.c
+++ b/target/ppc/misc_helper.c
@@ -255,12 +255,6 @@ target_ulong helper_clcs(CPUPPCState *env, uint32_t arg)
 /*****************************************************************************/
 /* Special registers manipulation */
 
-/* GDBstub can read and write MSR... */
-void ppc_store_msr(CPUPPCState *env, target_ulong value)
-{
-    hreg_store_msr(env, value, 0);
-}
-
 void ppc_store_lpcr(PowerPCCPU *cpu, target_ulong val)
 {
     PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cpu);
-- 
2.17.1


Re: [PATCH 04/11] target/ppc: moved ppc_store_msr into gdbstub.c
Posted by Richard Henderson 4 years, 9 months ago
On 5/12/21 9:08 AM, Bruno Larsen (billionai) wrote:
> This function is used by !TCG cases, so it was moved to a common code
> file. We chose gdbstub.c since it was the one giving us grief over it.
> 
> Signed-off-by: Bruno Larsen (billionai)<bruno.larsen@eldorado.org.br>
> ---
>   target/ppc/gdbstub.c     | 7 +++++++
>   target/ppc/misc_helper.c | 6 ------
>   2 files changed, 7 insertions(+), 6 deletions(-)

gdbstub.c is not the only !tcg user; e.g. machine.c.

I think this should go in cpu.c, next to the other special register read/write 
functions.


r~

Re: [PATCH 04/11] target/ppc: moved ppc_store_msr into gdbstub.c
Posted by David Gibson 4 years, 9 months ago
On Wed, May 12, 2021 at 12:05:04PM -0500, Richard Henderson wrote:
> On 5/12/21 9:08 AM, Bruno Larsen (billionai) wrote:
> > This function is used by !TCG cases, so it was moved to a common code
> > file. We chose gdbstub.c since it was the one giving us grief over it.
> > 
> > Signed-off-by: Bruno Larsen (billionai)<bruno.larsen@eldorado.org.br>
> > ---
> >   target/ppc/gdbstub.c     | 7 +++++++
> >   target/ppc/misc_helper.c | 6 ------
> >   2 files changed, 7 insertions(+), 6 deletions(-)
> 
> gdbstub.c is not the only !tcg user; e.g. machine.c.
> 
> I think this should go in cpu.c, next to the other special register
> read/write functions.

I agree.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson