Re: [Qemu-devel] [PATCH qom-cpu v3 00/41] QOM CPUState, part 11: GDB stub

2013-07-26 Thread Edgar E. Iglesias
On Fri, Jul 26, 2013 at 11:32:29PM +0200, Andreas Färber wrote:
> Am 23.07.2013 12:32, schrieb Max Filippov:
> > On Wed, Jul 10, 2013 at 2:23 AM, Andreas Färber  wrote:
> >> Hello,
> >>
> >> This series cleans up gdbstub by changing all its internal CPU state to 
> >> CPUState
> >> and by moving most target-specific code into the target directories.
> >>
> >> Support for m68k, moxie and unicore32 to set the PC via gdbstub is added.
> >>
> >> Lightweight subclasses for XtensaCPU are introduced, keeping the 
> >> XtensaConfig
> >> mechanisms, to stop xtensa from deviating at gdbstub level wrt register 
> >> count.
> >>
> >> I still wonder whether there would be interest in adding a 
> >> "program-counter"
> >> dynamic property to the CPU, given that a setter has been factored out 
> >> here?
> >>
> >> v3 avoids find_cpu() related breakages by deferring GDBState::c_cpu 
> >> conversion
> >> until GDBState::g_cpu and find_cpu() can easily be converted, too.
> >>
> >> Available for testing at:
> >> git://github.com/afaerber/qemu-cpu.git qom-cpu-11.v3
> >> https://github.com/afaerber/qemu-cpu/commits/qom-cpu-11.v3
> > 
> > xtensa parts: Acked-by: Max Filippov 
> 
> Thanks, applied to qom-cpu:
> https://github.com/afaerber/qemu-cpu/commits/qom-cpu
> 
> Edgar, since I got no feedback on the crisv10 patch but got an ack on
> the equivalent do_interrupt() change, I'm assuming you're okay with
> this. We can still do code cleanups unifying pre-v32 stuff as follow-up.

Yes, these are good changes, thanks!

Cheers,
Edgar



Re: [Qemu-devel] [PATCH qom-cpu v3 00/41] QOM CPUState, part 11: GDB stub

2013-07-26 Thread Andreas Färber
Am 23.07.2013 12:32, schrieb Max Filippov:
> On Wed, Jul 10, 2013 at 2:23 AM, Andreas Färber  wrote:
>> Hello,
>>
>> This series cleans up gdbstub by changing all its internal CPU state to 
>> CPUState
>> and by moving most target-specific code into the target directories.
>>
>> Support for m68k, moxie and unicore32 to set the PC via gdbstub is added.
>>
>> Lightweight subclasses for XtensaCPU are introduced, keeping the XtensaConfig
>> mechanisms, to stop xtensa from deviating at gdbstub level wrt register 
>> count.
>>
>> I still wonder whether there would be interest in adding a "program-counter"
>> dynamic property to the CPU, given that a setter has been factored out here?
>>
>> v3 avoids find_cpu() related breakages by deferring GDBState::c_cpu 
>> conversion
>> until GDBState::g_cpu and find_cpu() can easily be converted, too.
>>
>> Available for testing at:
>> git://github.com/afaerber/qemu-cpu.git qom-cpu-11.v3
>> https://github.com/afaerber/qemu-cpu/commits/qom-cpu-11.v3
> 
> xtensa parts: Acked-by: Max Filippov 

Thanks, applied to qom-cpu:
https://github.com/afaerber/qemu-cpu/commits/qom-cpu

Edgar, since I got no feedback on the crisv10 patch but got an ack on
the equivalent do_interrupt() change, I'm assuming you're okay with
this. We can still do code cleanups unifying pre-v32 stuff as follow-up.

Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg



Re: [Qemu-devel] [PATCH qom-cpu v3 00/41] QOM CPUState, part 11: GDB stub

2013-07-23 Thread Max Filippov
On Wed, Jul 10, 2013 at 2:23 AM, Andreas Färber  wrote:
> Hello,
>
> This series cleans up gdbstub by changing all its internal CPU state to 
> CPUState
> and by moving most target-specific code into the target directories.
>
> Support for m68k, moxie and unicore32 to set the PC via gdbstub is added.
>
> Lightweight subclasses for XtensaCPU are introduced, keeping the XtensaConfig
> mechanisms, to stop xtensa from deviating at gdbstub level wrt register count.
>
> I still wonder whether there would be interest in adding a "program-counter"
> dynamic property to the CPU, given that a setter has been factored out here?
>
> v3 avoids find_cpu() related breakages by deferring GDBState::c_cpu conversion
> until GDBState::g_cpu and find_cpu() can easily be converted, too.
>
> Available for testing at:
> git://github.com/afaerber/qemu-cpu.git qom-cpu-11.v3
> https://github.com/afaerber/qemu-cpu/commits/qom-cpu-11.v3

xtensa parts: Acked-by: Max Filippov 

-- 
Thanks.
-- Max



Re: [Qemu-devel] [PATCH qom-cpu v3 00/41] QOM CPUState, part 11: GDB stub

2013-07-22 Thread Andreas Färber
Am 10.07.2013 00:23, schrieb Andreas Färber:
> Andreas Färber (41):
>   cpu: Introduce vaddr type
>   cpu: Introduce CPUClass::set_pc() for gdb_set_cpu_pc()
>   target-m68k: Implement CPUClass::set_pc()
>   target-moxie: Implement CPUClass::set_pc()
>   target-unicore32: Implement CPUClass::set_pc()
>   cpu: Introduce CPUClass::synchronize_from_tb() for cpu_pc_from_tb()
>   cpu: Move singlestep_enabled field from CPU_COMMON to CPUState
>   gdbstub: Update gdb_handlesig() and gdb_signalled() Coding Style
>   cpu: Change cpu_single_step() argument to CPUState
>   kvm: Change kvm_{insert,remove}_breakpoint() argument to CPUState
>   gdbstub: Change syscall callback argument to CPUState
>   gdbstub: Change gdb_handlesig() argument to CPUState
>   gdbstub: Change gdb_{read,write}_register() argument to CPUState
>   cpu: Turn cpu_get_phys_page_debug() into a CPUClass hook
>   exec: Change cpu_memory_rw_debug() argument to CPUState
>   cpu: Introduce CPUClass::memory_rw_debug() for
> target_memory_rw_debug()
>   gdbstub: Change GDBState::{c,g}_cpu and find_cpu() to CPUState
>   cpu: Move gdb_regs field from CPU_COMMON to CPUState
>   gdbstub: Change gdb_register_coprocessor() argument to CPUState

Applied up to here, incorporating addition of a gtk-doc comment for
vaddr type:
https://github.com/afaerber/qemu-cpu/commits/qom-cpu

Pull intended soon due to NULL pointer dereference in gdbstub, reported
by Max.

Andreas

>   target-xtensa: Introduce XtensaCPU subclasses
>   gdbstub: Fix cpu_gdb_{read,write}_register() Coding Style
>   gdbstub: Drop dead code in cpu_gdb_{read,write}_register()
>   cpu: Introduce CPUState::gdb_num_regs and CPUClass::gdb_num_core_regs
>   target-i386: Move cpu_gdb_{read,write}_register()
>   target-ppc: Move cpu_gdb_{read,write}_register()
>   target-sparc: Move cpu_gdb_{read,write}_register()
>   target-arm: Move cpu_gdb_{read,write}_register()
>   target-m68k: Move cpu_gdb_{read,write}_register()
>   target-mips: Move cpu_gdb_{read,write}_register()
>   target-openrisc: Move cpu_gdb_{read,write}_register()
>   target-sh4: Move cpu_gdb_{read,write}_register()
>   target-microblaze: Move cpu_gdb_{read,write}_register()
>   target-cris: Move cpu_gdb_{read,write}_register()
>   target-alpha: Move cpu_gdb_{read,write}_register()
>   target-s390x: Move cpu_gdb_{read,write}_register()
>   target-lm32: Move cpu_gdb_{read,write}_register()
>   target-xtensa: Move cpu_gdb_{read,write}_register()
>   gdbstub: Replace GET_REG*() macros with gdb_get_reg*() functions
>   cpu: Introduce CPUClass::gdb_{read,write}_register()
>   target-cris: Factor out CPUClass::gdb_read_register() hook for v10
>   cpu: Introduce CPUClass::gdb_core_xml_file for GDB_CORE_XML
> 
>  bsd-user/main.c |   10 +-
>  cpu-exec.c  |   10 +-
>  cpus.c  |6 +-
>  disas.c |4 +-
>  exec.c  |   36 +-
>  gdbstub.c   | 1621 
> ---
>  hw/i386/kvmvapic.c  |   78 +-
>  hw/xtensa/xtensa_lx60.c |8 +-
>  hw/xtensa/xtensa_sim.c  |   10 +-
>  include/exec/cpu-all.h  |   14 +-
>  include/exec/cpu-defs.h |3 -
>  include/exec/gdbstub.h  |   51 +-
>  include/exec/softmmu-semi.h |   18 +-
>  include/qom/cpu.h   |  122 +--
>  include/sysemu/kvm.h|4 +-
>  kvm-all.c   |   12 +-
>  kvm-stub.c  |4 +-
>  linux-user/main.c   |   35 +-
>  linux-user/signal.c |3 +-
>  monitor.c   |2 +-
>  qom/cpu.c   |   22 +
>  stubs/Makefile.objs |1 +
>  stubs/gdbstub.c |5 +
>  target-alpha/Makefile.objs  |1 +
>  target-alpha/cpu-qom.h  |3 +
>  target-alpha/cpu.c  |   18 +-
>  target-alpha/cpu.h  |5 -
>  target-alpha/gdbstub.c  |   93 +++
>  target-alpha/helper.c   |5 +-
>  target-alpha/translate.c|3 +-
>  target-arm/Makefile.objs|1 +
>  target-arm/arm-semi.c   |   10 +-
>  target-arm/cpu-qom.h|5 +
>  target-arm/cpu.c|   17 +-
>  target-arm/cpu.h|5 -
>  target-arm/gdbstub.c|  102 +++
>  target-arm/helper.c |   15 +-
>  target-arm/translate.c  |7 +-
>  target-cris/Makefile.objs   |1 +
>  target-cris/cpu-qom.h   |6 +
>  target-cris/cpu.c   |   19 +
>  target-cris/cpu.h   |4 -
>  target-cris/gdbstub.c   |  130 
>  target-cris/helper.c|7 +-
>  target-cris/translate.c |7 +-
>  target-i386/Makefile.objs   |1 +
>  target-i386/cpu-qom.h   |5 +
>  target-i386/cpu.c   |   22 +-
>  target-i386/cpu.h   |5 -
>  target-i386/gdbstub.c   |  231 +

[Qemu-devel] [PATCH qom-cpu v3 00/41] QOM CPUState, part 11: GDB stub

2013-07-09 Thread Andreas Färber
Hello,

This series cleans up gdbstub by changing all its internal CPU state to CPUState
and by moving most target-specific code into the target directories.

Support for m68k, moxie and unicore32 to set the PC via gdbstub is added.

Lightweight subclasses for XtensaCPU are introduced, keeping the XtensaConfig
mechanisms, to stop xtensa from deviating at gdbstub level wrt register count.

I still wonder whether there would be interest in adding a "program-counter"
dynamic property to the CPU, given that a setter has been factored out here?

v3 avoids find_cpu() related breakages by deferring GDBState::c_cpu conversion
until GDBState::g_cpu and find_cpu() can easily be converted, too.

Available for testing at:
git://github.com/afaerber/qemu-cpu.git qom-cpu-11.v3
https://github.com/afaerber/qemu-cpu/commits/qom-cpu-11.v3

Regards,
Andreas

v2 -> v3:
* Rebased onto c52a6b67c1d7c6fc9fb2e3ba988d7b978e1487d3 revert (Max).
* Don't replace find_cpu() with qemu_get_cpu() (Max).
* Squashed GDBState::c_cpu and GDBState::g_cpu() conversion.

v1 -> v2:
* Applied some patches.
* Introduced new vaddr type, name courtesy of PMM.
* Avoided making the TranslationBlock typedef generally available.
* Rebased to avoid env/cpu field in alpha DisasContext (rth).
* Added missing ppc_cpu_get_phys_page_debug assignment.
* Converted two more cpu_get_phys_page_debug()s breaking xtensa (Max).
* Simplified xtensa subclasses by keeping CPUXtensaState::config for now (Max).
* Split up cpu_gdb_{read,write}_register() conversion (rth).
* Documented all CPUClass and CPUState field additions.
* Appended patch to drop GDB_CORE_XML.

Cc: Anthony Liguori 
Cc: Blue Swirl 
Cc: Aurélien Jarno 
Cc: Paolo Bonzini 
Cc: Jan Kiszka  (gdbstub)
Cc: Anthony Green  (moxie)
Cc: Guan Xuetao  (unicore32)
Cc: Max Filippov  (xtensa)
Cc: Richard Henderson 
Cc: Michael Walle  (lm32)
Cc: Peter Maydell  (vaddr)

Andreas Färber (41):
  cpu: Introduce vaddr type
  cpu: Introduce CPUClass::set_pc() for gdb_set_cpu_pc()
  target-m68k: Implement CPUClass::set_pc()
  target-moxie: Implement CPUClass::set_pc()
  target-unicore32: Implement CPUClass::set_pc()
  cpu: Introduce CPUClass::synchronize_from_tb() for cpu_pc_from_tb()
  cpu: Move singlestep_enabled field from CPU_COMMON to CPUState
  gdbstub: Update gdb_handlesig() and gdb_signalled() Coding Style
  cpu: Change cpu_single_step() argument to CPUState
  kvm: Change kvm_{insert,remove}_breakpoint() argument to CPUState
  gdbstub: Change syscall callback argument to CPUState
  gdbstub: Change gdb_handlesig() argument to CPUState
  gdbstub: Change gdb_{read,write}_register() argument to CPUState
  cpu: Turn cpu_get_phys_page_debug() into a CPUClass hook
  exec: Change cpu_memory_rw_debug() argument to CPUState
  cpu: Introduce CPUClass::memory_rw_debug() for
target_memory_rw_debug()
  gdbstub: Change GDBState::{c,g}_cpu and find_cpu() to CPUState
  cpu: Move gdb_regs field from CPU_COMMON to CPUState
  gdbstub: Change gdb_register_coprocessor() argument to CPUState
  target-xtensa: Introduce XtensaCPU subclasses
  gdbstub: Fix cpu_gdb_{read,write}_register() Coding Style
  gdbstub: Drop dead code in cpu_gdb_{read,write}_register()
  cpu: Introduce CPUState::gdb_num_regs and CPUClass::gdb_num_core_regs
  target-i386: Move cpu_gdb_{read,write}_register()
  target-ppc: Move cpu_gdb_{read,write}_register()
  target-sparc: Move cpu_gdb_{read,write}_register()
  target-arm: Move cpu_gdb_{read,write}_register()
  target-m68k: Move cpu_gdb_{read,write}_register()
  target-mips: Move cpu_gdb_{read,write}_register()
  target-openrisc: Move cpu_gdb_{read,write}_register()
  target-sh4: Move cpu_gdb_{read,write}_register()
  target-microblaze: Move cpu_gdb_{read,write}_register()
  target-cris: Move cpu_gdb_{read,write}_register()
  target-alpha: Move cpu_gdb_{read,write}_register()
  target-s390x: Move cpu_gdb_{read,write}_register()
  target-lm32: Move cpu_gdb_{read,write}_register()
  target-xtensa: Move cpu_gdb_{read,write}_register()
  gdbstub: Replace GET_REG*() macros with gdb_get_reg*() functions
  cpu: Introduce CPUClass::gdb_{read,write}_register()
  target-cris: Factor out CPUClass::gdb_read_register() hook for v10
  cpu: Introduce CPUClass::gdb_core_xml_file for GDB_CORE_XML

 bsd-user/main.c |   10 +-
 cpu-exec.c  |   10 +-
 cpus.c  |6 +-
 disas.c |4 +-
 exec.c  |   36 +-
 gdbstub.c   | 1621 ---
 hw/i386/kvmvapic.c  |   78 +-
 hw/xtensa/xtensa_lx60.c |8 +-
 hw/xtensa/xtensa_sim.c  |   10 +-
 include/exec/cpu-all.h  |   14 +-
 include/exec/cpu-defs.h |3 -
 include/exec/gdbstub.h  |   51 +-
 include/exec/softmmu-semi.h |   18 +-
 include/qom/cpu.h   |  122 +--
 include/sysemu/kvm.h|4 +-
 kvm-all.c   |   12 +-
 kvm-stub.c