target-xtensa: Introduce XtensaCPU subclasses

Register a CPU type per core registered. Save the XtensaConfig in
XtensaCPUClass and copy it from there to CPUXtensaState, to avoid
touching every env->config access for now.

Prepares for storing per-class GDB register count.

Acked-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
gdbstub: Fix cpu_gdb_{read,write}_register() Coding Style

Add braces, replace tabs, remove trailing whitespace, drop space before
parenthesis and place break etc. below case statements.

Signed-off-by: Andreas Färber <afaerber@suse.de>
gdbstub: Drop dead code in cpu_gdb_{read,write}_register()

GET_REG*() macros include a return statement, thus no need for break.

Acked-by: Michael Walle <michael@walle.cc> (for lm32)
Signed-off-by: Andreas Färber <afaerber@suse.de>
cpu: Introduce CPUState::gdb_num_regs and CPUClass::gdb_num_core_regs

CPUState::gdb_num_regs replaces num_g_regs.
CPUClass::gdb_num_core_regs replaces NUM_CORE_REGS.

Allows building gdb_register_coprocessor() for xtensa, too.

As a side effect this should fix coprocessor register numbering for SMP.

Acked-by: Michael Walle <michael@walle.cc> (for lm32)
Acked-by: Max Filippov <jcmvbkbc@gmail.com> (for xtensa)
Signed-off-by: Andreas Färber <afaerber@suse.de>
target-i386: Move cpu_gdb_{read,write}_register()

Signed-off-by: Andreas Färber <afaerber@suse.de>
target-ppc: Move cpu_gdb_{read,write}_register()

Signed-off-by: Andreas Färber <afaerber@suse.de>
target-sparc: Move cpu_gdb_{read,write}_register()

Signed-off-by: Andreas Färber <afaerber@suse.de>
target-arm: Move cpu_gdb_{read,write}_register()

Signed-off-by: Andreas Färber <afaerber@suse.de>
target-m68k: Move cpu_gdb_{read,write}_register()

Signed-off-by: Andreas Färber <afaerber@suse.de>
target-mips: Move cpu_gdb_{read,write}_register()

Signed-off-by: Andreas Färber <afaerber@suse.de>
target-openrisc: Move cpu_gdb_{read,write}_register()

Signed-off-by: Andreas Färber <afaerber@suse.de>
target-sh4: Move cpu_gdb_{read,write}_register()

Signed-off-by: Andreas Färber <afaerber@suse.de>
target-microblaze: Move cpu_gdb_{read,write}_register()

Signed-off-by: Andreas Färber <afaerber@suse.de>
target-cris: Move cpu_gdb_{read,write}_register()

Signed-off-by: Andreas Färber <afaerber@suse.de>
target-alpha: Move cpu_gdb_{read,write}_register()

Signed-off-by: Andreas Färber <afaerber@suse.de>
target-s390x: Move cpu_gdb_{read,write}_register()

Signed-off-by: Andreas Färber <afaerber@suse.de>
target-lm32: Move cpu_gdb_{read,write}_register()

Acked-by: Michael Walle <michael@walle.cc>
Signed-off-by: Andreas Färber <afaerber@suse.de>
target-xtensa: Move cpu_gdb_{read,write}_register()

Acked-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
gdbstub: Replace GET_REG*() macros with gdb_get_reg*() functions

This avoids polluting the global namespace with a non-prefixed macro and
makes it obvious in the call sites that we return.

Semi-automatic conversion using, e.g.,
 sed -i 's/GET_REGL(/return gdb_get_regl(mem_buf, /g' target-*/gdbstub.c
followed by manual tweaking for sparc's GET_REGA() and Coding Style.

Acked-by: Michael Walle <michael@walle.cc> (for lm32)
Acked-by: Max Filippov <jcmvbkbc@gmail.com> (for xtensa)
Signed-off-by: Andreas Färber <afaerber@suse.de>
cpu: Introduce CPUClass::gdb_{read,write}_register()

Completes migration of target-specific code to new target-*/gdbstub.c.

Acked-by: Michael Walle <michael@walle.cc> (for lm32)
Acked-by: Max Filippov <jcmvbkbc@gmail.com> (for xtensa)
Signed-off-by: Andreas Färber <afaerber@suse.de>