This commit was manufactured by cvs2svn to create branch 'gdb_6_0-branch'.

Sprout from jimb-ppc64-linux-20030613-branch 2003-06-13 21:56:28 UTC nobody 'This commit was manufactured by cvs2svn to create branch 'jimb-'
Cherrypick from master 2003-06-22 18:32:49 UTC Daniel Jacobowitz <drow@false.org> '	* symfile.c (add_symbol_file_command): Use parse_and_eval_address.':
    ChangeLog
    Makefile.in
    Makefile.tpl
    bfd/ChangeLog
    bfd/bfd-in2.h
    bfd/config.bfd
    bfd/elf32-cris.c
    bfd/elf64-ppc.c
    bfd/elf64-ppc.h
    bfd/elf64-sparc.c
    bfd/elflink.h
    bfd/elfxx-ia64.c
    bfd/section.c
    bfd/version.h
    config.guess
    config.sub
    configure
    configure.in
    gdb/ChangeLog
    gdb/Makefile.in
    gdb/NEWS
    gdb/README
    gdb/ada-lang.c
    gdb/ada-lex.l
    gdb/ada-tasks.c
    gdb/alpha-tdep.c
    gdb/arch-utils.c
    gdb/arch-utils.h
    gdb/avr-tdep.c
    gdb/breakpoint.c
    gdb/c-valprint.c
    gdb/cli/cli-cmds.c
    gdb/config/alpha/alpha-linux.mh
    gdb/config/arm/linux.mh
    gdb/config/arm/linux.mt
    gdb/config/arm/nm-linux.h
    gdb/config/arm/tm-linux.h
    gdb/config/djgpp/fnchange.lst
    gdb/config/i386/linux.mh
    gdb/config/i386/linux.mt
    gdb/config/i386/nm-x86-64linux.h
    gdb/config/i386/tm-i386.h
    gdb/config/i386/x86-64linux.mh
    gdb/config/ia64/linux.mh
    gdb/config/ia64/linux.mt
    gdb/config/ia64/nm-linux.h
    gdb/config/ia64/tm-ia64.h
    gdb/config/m68k/linux.mh
    gdb/config/mips/embed.mt
    gdb/config/mips/embed64.mt
    gdb/config/mips/embedl.mt
    gdb/config/mips/embedl64.mt
    gdb/config/mips/linux.mh
    gdb/config/mips/linux.mt
    gdb/config/mips/tm-irix5.h
    gdb/config/mips/tm-irix6.h
    gdb/config/mips/tm-mips.h
    gdb/config/mips/tm-mips64.h
    gdb/config/nm-linux.h
    gdb/config/pa/nm-hppah.h
    gdb/config/powerpc/linux.mh
    gdb/config/s390/s390.mh
    gdb/config/s390/tm-linux.h
    gdb/config/s390/tm-s390.h
    gdb/config/sh/linux.mt
    gdb/config/sparc/linux.mh
    gdb/cp-valprint.c
    gdb/cris-tdep.c
    gdb/doc/ChangeLog
    gdb/doc/Makefile.in
    gdb/doc/agentexpr.texi
    gdb/doc/gdb.texinfo
    gdb/doc/gdbint.texinfo
    gdb/dummy-frame.c
    gdb/findvar.c
    gdb/frame.c
    gdb/frame.h
    gdb/gdbarch.c
    gdb/gdbarch.h
    gdb/gdbarch.sh
    gdb/gdbserver/ChangeLog
    gdb/gdbserver/Makefile.in
    gdb/gdbserver/linux-low.c
    gdb/gdbserver/server.c
    gdb/gdbserver/target.h
    gdb/gnu-nat.c
    gdb/h8300-tdep.c
    gdb/hppa-tdep.c
    gdb/hppah-nat.c
    gdb/i386-nto-tdep.c
    gdb/i386-tdep.c
    gdb/i387-tdep.c
    gdb/i387-tdep.h
    gdb/ia64-tdep.c
    gdb/infcall.c
    gdb/infcmd.c
    gdb/infrun.c
    gdb/infttrace.c
    gdb/lin-lwp.c
    gdb/linux-nat.c
    gdb/linux-nat.h
    gdb/linux-proc.c
    gdb/mcore-tdep.c
    gdb/mi/ChangeLog
    gdb/mi/mi-cmds.c
    gdb/mips-tdep.c
    gdb/mn10300-tdep.c
    gdb/nto-tdep.c
    gdb/osabi.c
    gdb/ppc-linux-tdep.c
    gdb/rdi-share/host.h
    gdb/regcache.c
    gdb/remote-fileio.h
    gdb/remote-rdi.c
    gdb/remote.c
    gdb/rs6000-tdep.c
    gdb/s390-nat.c
    gdb/s390-tdep.c
    gdb/solib.c
    gdb/sparc-nat.c
    gdb/symfile.c
    gdb/target.c
    gdb/target.h
    gdb/testsuite/ChangeLog
    gdb/testsuite/gdb.base/attach.exp
    gdb/testsuite/gdb.base/fileio.c
    gdb/testsuite/gdb.base/fileio.exp
    gdb/testsuite/gdb.base/relocate.exp
    gdb/testsuite/gdb.base/store.c
    gdb/testsuite/gdb.base/store.exp
    gdb/testsuite/gdb.c++/pr-1210.cc
    gdb/testsuite/gdb.c++/pr-1210.exp
    gdb/testsuite/lib/mi-support.exp
    gdb/trad-frame.h
    gdb/tui/ChangeLog
    gdb/tui/tui-hooks.c
    gdb/tui/tui.c
    gdb/tui/tuiCommand.c
    gdb/tui/tuiData.c
    gdb/tui/tuiDataWin.c
    gdb/tui/tuiDisassem.c
    gdb/tui/tuiGeneralWin.c
    gdb/tui/tuiIO.c
    gdb/tui/tuiLayout.c
    gdb/tui/tuiRegs.c
    gdb/tui/tuiSource.c
    gdb/tui/tuiSourceWin.c
    gdb/tui/tuiStack.c
    gdb/tui/tuiWin.c
    gdb/valops.c
    gdb/varobj.c
    gdb/version.in
    gdb/x86-64-tdep.c
    gdb/xstormy16-tdep.c
    include/ChangeLog
    include/ansidecl.h
    include/opcode/ChangeLog
    include/safe-ctype.h
    libiberty/ChangeLog
    libiberty/Makefile.in
    libiberty/config.in
    libiberty/configure
    libiberty/configure.in
    libiberty/functions.texi
    libiberty/hashtab.c
    libiberty/hex.c
    libiberty/safe-ctype.c
    opcodes/ChangeLog
    opcodes/z8k-dis.c
    opcodes/z8k-opc.h
    opcodes/z8kgen.c
    readline/ChangeLog.gdb
    readline/support/config.guess
    readline/support/config.sub
    sim/common/ChangeLog
    sim/common/cgen-trace.c
    sim/common/cgen-trace.h
    sim/common/sim-fpu.c
    sim/common/sim-fpu.h
    sim/d10v/ChangeLog
    sim/d10v/interp.c
    sim/h8300/ChangeLog
    sim/h8300/compile.c
    sim/h8300/sim-main.h
    sim/mips/ChangeLog
    sim/mips/mips.igen
    sim/ppc/ChangeLog
    sim/ppc/Makefile.in
    sim/ppc/altivec.igen
    sim/ppc/altivec_expression.h
    sim/ppc/altivec_registers.h
    sim/ppc/configure
    sim/ppc/configure.in
    sim/ppc/e500.igen
    sim/ppc/e500_expression.h
    sim/ppc/e500_registers.h
    sim/ppc/emul_chirp.c
    sim/ppc/gen-idecode.c
    sim/ppc/gen-itable.c
    sim/ppc/gen-model.c
    sim/ppc/gen-support.c
    sim/ppc/hw_com.c
    sim/ppc/hw_htab.c
    sim/ppc/hw_init.c
    sim/ppc/hw_nvram.c
    sim/ppc/hw_register.c
    sim/ppc/idecode_expression.h
    sim/ppc/igen.c
    sim/ppc/interrupts.c
    sim/ppc/ld-cache.c
    sim/ppc/ld-cache.h
    sim/ppc/ld-insn.c
    sim/ppc/ld-insn.h
    sim/ppc/ppc-instructions
    sim/ppc/ppc-spr-table
    sim/ppc/psim.c
    sim/ppc/psim.h
    sim/ppc/registers.c
    sim/ppc/registers.h
    sim/ppc/sim_calls.c
    sim/testsuite/sim/h8300/ChangeLog
    sim/testsuite/sim/h8300/addx.s
    sim/testsuite/sim/h8300/allinsn.exp
    sim/testsuite/sim/h8300/andb.s
    sim/testsuite/sim/h8300/band.s
    sim/testsuite/sim/h8300/biand.s
    sim/testsuite/sim/h8300/brabc.s
    sim/testsuite/sim/h8300/bset.s
    sim/testsuite/sim/h8300/div.s
    sim/testsuite/sim/h8300/jmp.s
    sim/testsuite/sim/h8300/ldm.s
    sim/testsuite/sim/h8300/mac.s
    sim/testsuite/sim/h8300/mul.s
    sim/testsuite/sim/h8300/orb.s
    sim/testsuite/sim/h8300/stack.s
    sim/testsuite/sim/h8300/subs.s
    sim/testsuite/sim/h8300/subx.s
    sim/testsuite/sim/h8300/tas.s
    sim/testsuite/sim/h8300/testutils.inc
    sim/testsuite/sim/h8300/xorb.s
Delete:
    gdb/config/mips/bigmips.mt
    gdb/config/mips/bigmips64.mt
    gdb/config/mips/decstation.mt
    gdb/config/mips/littlemips.mt
    gdb/config/mips/tm-bigmips.h
    gdb/config/mips/tm-bigmips64.h
    gdb/config/mips/tm-embed64.h
    gdb/config/mips/tm-embedl.h
    gdb/config/mips/tm-embedl64.h
    gdb/config/mips/tm-tx39l.h
    gdb/config/mips/tm-vr4100.h
    gdb/config/mips/tm-vr4300.h
    gdb/config/mips/tm-vr4300el.h
    gdb/config/mips/tm-vr4xxx.h
    gdb/config/mips/tm-vr4xxxel.h
    gdb/config/mips/tm-vr5000.h
    gdb/config/mips/tm-vr5000el.h
    gdb/config/mips/vr4100.mt
    gdb/config/mips/vr4300.mt
    gdb/config/mips/vr4300el.mt
    gdb/config/mips/vr4xxx.mt
    gdb/config/mips/vr4xxxel.mt
    gdb/config/mips/vr5000.mt
    gdb/config/mips/vr5000el.mt
    gdb/dwarf2cfi.c
    gdb/dwarf2cfi.h
    gdb/gdbserver/linux-ppc64-low.c
    gdb/gdbserver/low-hppabsd.c
    gdb/gdbserver/low-lynx.c
    gdb/gdbserver/low-nbsd.c
    gdb/gdbserver/low-sim.c
    gdb/gdbserver/low-sparc.c
    gdb/gdbserver/low-sun3.c
    gdb/regformats/reg-ppc64.dat
    gdb/remote-array.c
    sim/ppc/ppc-cache-rules
diff --git a/ChangeLog b/ChangeLog
index c882a50..071af0e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2003-06-17  Benjamin Kosnik  <bkoz@redhat.com>
+
+	* configure.in: Update testsuite_flags to new location.
+	* configure. Regenerate.
+	
+2003-06-18  Nathanael Nerode  <neroden@gcc.gnu.org>
+
+	* Makefile.tpl: Remove BUILD_CC stuff.
+	* Makefile.in: Regenerate.
+
+2003-06-14  H.J. Lu <hongjiu.lu@intel.com>
+ 
+	* config.guess: Update to 2003-06-12 version.
+	* config.sub: Update to 2003-06-13 version.
+
 2003-06-12  Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
 
 	* MAINTAINERS: Add myself as MIPS co-maintainer.
diff --git a/Makefile.in b/Makefile.in
index 82f67cf..0085863 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -150,7 +150,6 @@
 
 # Special variables passed down in EXTRA_GCC_FLAGS.  They are defined
 # here so that they can be overridden by Makefile fragments.
-BUILD_CC = $(CC_FOR_BUILD)
 BUILD_PREFIX = @BUILD_PREFIX@
 BUILD_PREFIX_1 = @BUILD_PREFIX_1@
 
@@ -520,7 +519,6 @@
 	'CC=$(CC)' \
 	'CXX=$(CXX)' \
 	'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \
-	'BUILD_CC=$(CC_FOR_BUILD)' \
 	'BUILD_PREFIX=$(BUILD_PREFIX)' \
 	'BUILD_PREFIX_1=$(BUILD_PREFIX_1)' \
 	'NM=$(NM)' \
diff --git a/Makefile.tpl b/Makefile.tpl
index d660e3a4..f3a875b 100644
--- a/Makefile.tpl
+++ b/Makefile.tpl
@@ -153,7 +153,6 @@
 
 # Special variables passed down in EXTRA_GCC_FLAGS.  They are defined
 # here so that they can be overridden by Makefile fragments.
-BUILD_CC = $(CC_FOR_BUILD)
 BUILD_PREFIX = @BUILD_PREFIX@
 BUILD_PREFIX_1 = @BUILD_PREFIX_1@
 
@@ -523,7 +522,6 @@
 	'CC=$(CC)' \
 	'CXX=$(CXX)' \
 	'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \
-	'BUILD_CC=$(CC_FOR_BUILD)' \
 	'BUILD_PREFIX=$(BUILD_PREFIX)' \
 	'BUILD_PREFIX_1=$(BUILD_PREFIX_1)' \
 	'NM=$(NM)' \
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 487f23c..2e1a2a3 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,135 @@
+2003-06-20  Alan Modra  <amodra@bigpond.net.au>
+
+	* elf64-ppc.c (struct ppc_link_hash_table): Add top_id.
+	(ppc64_elf_setup_section_lists): Set it.
+	(ppc64_elf_relocate_section): Check sym section id against top_id.
+	(ppc_build_one_stub): Comment on top_id.
+
+2003-06-20  Ralf Corsepius  <corsepiu@faw.uni-ulm.de>
+
+	* config.bfd: Add tic4x-*-rtems*.
+
+2003-06-20  Alan Modra  <amodra@bigpond.net.au>
+
+	* elf64-ppc.c: Convert to C90 function definitions, remove unnecessary
+	prototypes and casts.  Replace PTR with void *.  Format copyright.
+	Mention ABI links.
+	(struct ppc_link_hash_table): Rename sgot, srelgot, splt, srelplt,
+	sdynbss, srelbss, sglink, sbrlt and srelbrlt to got, relgot .. relbrlt.
+	(ppc_type_of_stub): Make r_type an enum.
+	(ppc64_elf_size_stubs): Likewise.
+	* elf64-ppc.h: Remove PARAMS macro.
+
+2003-06-19  Alan Modra  <amodra@bigpond.net.au>
+
+	* elf64-ppc.c (ppc64_elf_link_hash_table_create): Reinstate init of
+	elf hash tab fields.
+
+	* elf64-ppc.c (ppc64_elf_reloc_type_lookup): Tidy prototype.
+	(ppc64_elf_info_to_howto): Likewise.
+	(ppc64_elf_build_stubs): Add "stats" param, and print statistics.
+	* elf64-ppc.h (ppc64_elf_build_stubs): Adjust prototype.
+
+2003-06-19  Alan Modra  <amodra@bigpond.net.au>
+
+	* elf64-sparc.c (sparc64_elf_relocate_section): Ignore R_SPARC_DISP32
+	reloc overflow on discarded eh_frame entries.
+
+2003-06-19  Alan Modra  <amodra@bigpond.net.au>
+
+	* elf64-ppc.c (toc_adjusting_stub_needed): New function.
+	(ppc64_elf_next_input_section): Use it here to set has_gp_reloc.
+	Return error condition.
+	(ppc64_elf_size_stubs): Restrict toc adjusting stubs to sections
+	that have has_gp_reloc set.
+	(struct ppc_link_hash_table): Add stub_count.
+	(ppc_build_one_stub): Increment it.
+	(ppc64_elf_link_hash_table_create): zmalloc rather than clearing
+	individual fields.
+	* elf64-ppc.h (ppc64_elf_next_input_section): Update prototype.
+
+2003-06-18  Alan Modra  <amodra@bigpond.net.au>
+
+	* elflink.h (elf_gc_record_vtentry): Revert last change.  Correct
+	size calculation from addend.  Round size up.
+
+2003-06-18  Hans-Peter Nilsson  <hp@axis.com>
+
+	* elf32-cris.c (cris_elf_relocate_section) <case
+	R_CRIS_32_GOTREL>: When linking a program, don't complain about a
+	symbol from a normal object or an undefined weak symbol.
+
+2003-06-18  Alan Modra  <amodra@bigpond.net.au>
+
+	* elf64-ppc.c (ppc64_elf_relocate_section): Accept a symbol on
+	R_PPC64_TOC relocs.
+
+2003-06-17  H.J. Lu <hongjiu.lu@intel.com>
+
+	* section.c (struct sec): Put back kept_section.
+	(STD_SECTION): Put back kept_section initialization.
+	* bfd-in2.h: Regenerate.
+
+	* elflink.h (elf_link_input_bfd): Also check discarded linkonce
+	sections for relocateable output. Use kept_section to preserve
+	debug information discarded by linkonce.
+
+2003-06-17  Roland McGrath  <roland@redhat.com>
+
+	* elfxx-ia64.c (elfNN_ia64_relocate_section): Support
+	segment-relative relocation between different segments.
+
+2003-06-17  Alan Modra  <amodra@bigpond.net.au>
+
+	* elf64-ppc.c (ppc64_elf_relocate_section): Do unaligned reloc
+	optimizations earlier.
+
+	* elf64-ppc.c (struct ppc_link_hash_table): Reinstate top_index.
+	Restore previous input_list type.
+	(ppc64_elf_link_hash_table_create): Undo last change.
+	(ppc64_elf_setup_section_lists): Reinstate code setting up input lists
+	per output section, but don't bother with bfd_abs_section marker.
+	(ppc64_elf_next_input_section): Adjust for multiple input section
+	lists.
+	(group_sections): Likewise.
+
+2003-06-17  Jakub Jelinek  <jakub@redhat.com>
+
+	* elf64-ppc.c (ppc64_elf_relocation_section): Ensure
+	*r_offset == r_addend for RELATIVE relocs against .got.
+
+2003-06-17  Alan Modra  <amodra@bigpond.net.au>
+
+	* elf64-ppc.c (ppc64_elf_relocate_section): Optimize unaligned relocs.
+
+2003-06-17  Nick Clifton  <nickc@redhat.com>
+
+	* elflink.h (elf_gc_record_vtentry): Allocate an extra element
+	in the vtable_entries_used array to allow for the accessing
+	the largest element.
+
+2003-06-17  Alan Modra  <amodra@bigpond.net.au>
+
+	* elf64-ppc.c (struct ppc_link_hash_table): Remove top_index.  Modify
+	input_list.
+	(ppc64_elf_link_hash_table_create): Init input_list here.
+	(ppc64_elf_setup_section_lists): Remove code setting up input lists
+	per output section.  Set toc_off for abs and other standard sections.
+	(ppc64_elf_reinit_toc): Don't set elf_gp on input bfds lacking a toc.
+	(ppc64_elf_next_input_section): Adjust for single input section list.
+	Don't set toc_curr from input bfds that haven't set elf_gp.
+	(group_sections): Adjust for single input section list.
+
+	* elf64-ppc.c (ppc64_elf_relocate_section): Correct pcrel section zero.
+
+2003-06-16  Alan Modra  <amodra@bigpond.net.au>
+
+	* elf64-ppc.c (ppc64_elf_relocate_section): When optimizing toctprel
+	tls, check that a TOC16_DS or TOC16_LO_DS reloc isn't pointing to a
+	dtprel entry.  Ensure TLS_LD DTPMOD reloc has a zero addend.  Write
+	got section for RELATIVE relocs.  Fix wrong comment.  Change condition
+	under which dynamic relocs update the section contents.
+
 2003-06-13  Robert Millan  <zeratul2@wanadoo.es>
 
 	* config.bfd: Add i386-netbsd-gnu target.
@@ -6,18 +138,18 @@
 
 	* opncls.c (calc_crc32): Rename to
 	bfd_calc_gnu_debuglink_crc32 and export.
-        (GNU_DEBUGLINK): Define and use to replace occurrences of
+	(GNU_DEBUGLINK): Define and use to replace occurrences of
 	hard-coded ".gnu_debuglink" in the code.
-        (get_debug_link_info): Prevent aborts by replacing call to
+	(get_debug_link_info): Prevent aborts by replacing call to
 	xmalloc with a call to malloc.
-        (find_separate_debug_file): Prevent aborts by replacing calls
+	(find_separate_debug_file): Prevent aborts by replacing calls
 	to xmalloc and xstrdup with calls to malloc and strdup.
-        (bfd_add_gnu_debuglink): New function.  Add a .gnu_debuglink
+	(bfd_add_gnu_debuglink): New function.  Add a .gnu_debuglink
 	section to a bfd.
 	* bfd-in2.h: Regenerate.
 
 2003-06-12 Federico G. Schwindt <fgsch@lodoss.net>
-	
+
 	* config.bfd (i[3-7]86-*-openbsd[0-2].* | i[3-7]86-*-openbsd3.[0-3]):
 	New target (was i[3-7]86-*-openbsd* before).
 	(i[3-7]86-*-openbsd*): Change to use bfd_elf32_i386_vec.
@@ -81,11 +213,11 @@
 	(_bfd_mips_elf_sign_extend): New prototype.
 
 2003-06-11 Federico G. Schwindt <fgsch@lodoss.net>
-	
+
 	* config.bfd (sparc-*-openbsd[0-2].* | sparc-*-openbsd3.[0-1]):
 	New target (was sparc-*-openbsd* before).
 	(sparc-*-openbsd*): Change to use bfd_elf32_sparc_vec.
-	
+
 	* configure.in (vax-*-openbsd*): Set COREFILE to netbsd-core.lo.
 	* configure: Regenerate.
 
@@ -337,7 +469,7 @@
 	for X_STORMY16_REL_12 reloc.
 
 	* elf.c (bfd_elf_get_needed_list): Use is_elf_hash_table to check
-	the type of the has table in the bfd_link_info structure.
+	the type of the hash table in the bfd_link_info structure.
 	(bfd_elf_get_runpath_list): Likewise.
 
 2003-05-19  Roland McGrath  <roland@redhat.com>
@@ -481,7 +613,7 @@
 
 	* elf32-sh.c (sh_elf_adjust_dynamic_symbol): For weak symbols,
 	copy ELF_LINK_NON_GOT_REF from weakdef.
-	(allocate_dynrelocs):  For undef weak syms with non-default
+	(allocate_dynrelocs): For undef weak syms with non-default
 	visibility, a) don't allocate plt entries, b) don't allocate
 	.got relocs, c) discard dyn rel space
 	(sh_elf_relocate_section): d) don't generate .got relocs, e)
@@ -1217,7 +1349,7 @@
 2003-03-25  Stan Cox   <scox@redhat.com>
 	    Nick Clifton  <nickc@redhat.com>
 
-	Contribute support for Intel's iWMMXt chip - an	ARM variant:
+	Contribute support for Intel's iWMMXt chip - an ARM variant:
 
 	* archures.c: Add bfd_mach_arm_iWMMXt.
 	* reloc.c: Add BFD_RELOC_ARM_CP_OFF_IMM_S2.
@@ -1232,7 +1364,7 @@
 	* cpu-arm.c (processors): Add iWMMXt.
 	(arch_inf): Likewise.
 	* elf32-arm.h (arm_object_p): Handle note section.
-	(elf32_arm_merge_private_bfd_data):  Allow iWMMXt object files to
+	(elf32_arm_merge_private_bfd_data): Allow iWMMXt object files to
 	be linked with XScale ones.
 	(elf32_arm_section_flags): New function: Set flags on note section.
 	(elf32_arm_final_write_processing): Handle note section.
@@ -1725,7 +1857,7 @@
 	variables, structure fields or function params to tls_mask or
 	similar to better reflect usage.
 	(struct got_entry): Comment.
-	(struct ppc_link_hash_entry):  Expand comment, and renumber TLS_*.
+	(struct ppc_link_hash_entry): Expand comment, and renumber TLS_*.
 	(get_tls_mask): Rename from get_tls_type.
 
 2003-02-09  Alan Modra  <amodra@bigpond.net.au>
@@ -2076,13 +2208,11 @@
 2003-01-23  Nick Clifton  <nickc@redhat.com>
 
 	* Add sh2e support:
-
 	2002-04-02  Elena Zannoni  <ezannoni@redhat.com>
-
-		* archures.c (bfd_mach_sh2e): Added.
-		* bfd-in2.h: Rebuilt.
-		* cpu-sh.c (arch_info_struct): Added SH2e.
-		* elf32-sh.c (sh_elf_set_mach_from_flags): Handle EF_SH2E.
+	* archures.c (bfd_mach_sh2e): Added.
+	* bfd-in2.h: Rebuilt.
+	* cpu-sh.c (arch_info_struct): Added SH2e.
+	* elf32-sh.c (sh_elf_set_mach_from_flags): Handle EF_SH2E.
 
 2003-01-23  Alan Modra  <amodra@bigpond.net.au>
 
@@ -2997,7 +3127,7 @@
 
 2002-11-07  Michal Ludvig  <mludvig@suse.cz>
 
-	* dwarf2.c (read_indirect_string, read_abbrevs,	decode_line_info,
+	* dwarf2.c (read_indirect_string, read_abbrevs, decode_line_info,
 	_bfd_dwarf2_find_nearest_line): Use
 	bfd_simple_get_relocated_section_contents() instead of
 	bfd_get_section_contents().
@@ -3555,7 +3685,7 @@
 	* Makefile.am: Add entries for elf32-sh64-lin.c and
 	elf64-sh64-lin.c. Regenerate.
 	* Makefile.in: Regenerate.
-	* config.bfd:  Change sh64eb-*-linux* and sh64-*-linux*
+	* config.bfd: Change sh64eb-*-linux* and sh64-*-linux*
 	to use sh64 vectors rather than sh vectors.
 	* configure.in: Add bfd_elf32_sh64lin_vec, bfd_elf32_sh64blin_vec,
 	bfd_elf64_sh64lin_vec, bfd_elf64_sh64blin_vec.
@@ -3981,7 +4111,7 @@
 
 2002-08-28  Catherine Moore  <clm@redhat.com>
 
-	* elf32-v850.c (v850_elf_reloc_map):  Add new relocs.
+	* elf32-v850.c (v850_elf_reloc_map): Add new relocs.
 	(v850-elf-reloc): Don't resolve pc relative relocs.
 	(v850_elf_ignore_reloc): New routine.
 	(v850_elf_final_link_relocate): Handle new relocs.
@@ -4990,7 +5120,7 @@
 
 2002-07-04  Alan Modra  <amodra@bigpond.net.au>
 
-	* section.c (_bfd_strip_section_from_output):  Remove unnecessary
+	* section.c (_bfd_strip_section_from_output): Remove unnecessary
 	link order code.  Don't actually remove the output section here;
 	Just set a flag for the linker to do so.
 	* elflink.c (_bfd_elf_link_renumber_dynsyms): Test for removed
@@ -5285,7 +5415,7 @@
 
 	* elf64-hppa.c (elf64_hppa_mark_milli_and_exported_functions): New
 	function.
-	(allocate_global_data_dlt):  Don't add millicode symbols to dynamic
+	(allocate_global_data_dlt): Don't add millicode symbols to dynamic
 	symbol table.
 	(allocate_global_data_opd, allocate_dynrel_entries): Likewise.
 	(elf64_hppa_size_dynamic_sections): Revise to use
@@ -6162,7 +6292,7 @@
 
 2002-05-18  Tom Rix  <trix@redhat.com>
 
-	* coff64-rs6000.c (_bfd_xcoff64_swap_aux_out):  Fix C_FILE auxent.
+	* coff64-rs6000.c (_bfd_xcoff64_swap_aux_out): Fix C_FILE auxent.
 
 2002-05-17  Alan Modra  <amodra@bigpond.net.au>
 
@@ -7095,7 +7225,7 @@
 
 	* coff-rs6000.c (_bfd_xcoff_stat_arch_elt): Renamed from
 	_bfd_xcoff_generic_stat_arch_elt.  Fix format check.
-	* coff64-rs6000.c :  Use _bfd_xcoff_stat_arch_elt.
+	* coff64-rs6000.c : Use _bfd_xcoff_stat_arch_elt.
 
 2002-03-19  Tom Rix  <trix@redhat.com>
 
@@ -7362,7 +7492,7 @@
 
 2002-02-20  Peter Schauer  <pes@regent.e-technik.tu-muenchen.de>
 
-	* osf-core.c (osf_core_vec):  OSF/1 (Digital Unix) core files are
+	* osf-core.c (osf_core_vec): OSF/1 (Digital Unix) core files are
 	little endian.
 
 2002-02-19  Martin Schwidefsky  <schwidefsky@de.ibm.com>
@@ -7408,7 +7538,7 @@
 	* elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
 	* elf64-s390.c (elf_s390_relocate_section): Likewise.
 	* elf64-sh64.c (sh_elf64_relocate_section): Likewise.
-	* elf64-sparc.c	(sparc64_elf_relocate_section): Likewise.
+	* elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
 	* elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise.
 	* elf64-alpha.c (elf64_alpha_relocate_section): Handle
 	_bfd_elf_section_offset returning -2 the same way as -1.
@@ -7636,7 +7766,7 @@
 	datalabel_got_offset.
 	(sh_elf_link_hash_newfunc): Initialize it.
 	(sh_elf_relocate_section): Augment the scope of
-	seen_stt_datalabel.  Introduce GOTPLT support.	Extend GOTPC, PLT,
+	seen_stt_datalabel.  Introduce GOTPLT support.  Extend GOTPC, PLT,
 	GOT and GOTOFF handling to new SHmedia relocation types.  Support
 	GOT_BIAS.
 	(sh_elf_check_relocs): Likewise.
@@ -7683,14 +7813,14 @@
 	match official numbers and names; moved unmaching ones to the
 	range 0xf2-0xff.
 	* elf32-sh64.c, elf64-sh64.c: Likewise.
-	2001-03-12  DJ Delorie	<dj@redhat.com>
+	2001-03-12  DJ Delorie  <dj@redhat.com>
 	* elf32-sh.c (sh_elf_relax_section): Don't relax SHmedia
 	sections.
-	2001-03-12  DJ Delorie	<dj@redhat.com>
+	2001-03-12  DJ Delorie  <dj@redhat.com>
 	* elf32-sh64.c (shmedia_prepare_reloc): Validate relocs that must
 	be aligned.
 	* elf64-sh64.c (sh_elf64_relocate_section): Ditto.
-	2001-01-14  Hans-Peter Nilsson	<hpn@cygnus.com>
+	2001-01-14  Hans-Peter Nilsson  <hpn@cygnus.com>
 	* elf32-sh64.c (bfd_elf32_bfd_copy_private_section_data): Define.
 	(sh64_elf_fake_sections): Set type to SHT_SH5_CR_SORTED for a
 	.cranges section with SEC_SORT_ENTRIES set.
@@ -7701,9 +7831,9 @@
 	start address if called by linker.
 	2001-01-08  Ben Elliston  <bje@redhat.com>
 	* elf32-sh64.c (sh64_elf_final_write_processing): Activate
-	Hans-Peter Nilsson's set bit 0 patch from	2001-01-06.
+	Hans-Peter Nilsson's set bit 0 patch from 2001-01-06.
 	* elf64-sh64.c (sh64_elf64_final_write_processing): Ditto.
-	2001-01-06  Hans-Peter Nilsson	<hpn@cygnus.com>
+	2001-01-06  Hans-Peter Nilsson  <hpn@cygnus.com>
 	* elf64-sh64.c (sh_elf64_howto_table): No open brace at start of
 	line.  Add comments before all entries.
 	<R_SH_PT_16, R_SH_SHMEDIA_CODE>: Correct and clarify describing
@@ -7723,7 +7853,7 @@
 	clarify describing comment.  Add comments before all entries.
 	(sh_elf_relocate_section) <relocating for a local symbol>: Do not
 	honour STO_SH5_ISA32; instead call reloc_dangerous callback.
-	2001-01-06  Hans-Peter Nilsson	<hpn@cygnus.com>
+	2001-01-06  Hans-Peter Nilsson  <hpn@cygnus.com>
 	Sort .cranges section in final link.  Prepare to set bit 0 on
 	entry address.
 	* elf32-sh64.c (struct sh64_find_section_vma_data): New.
@@ -7746,7 +7876,7 @@
 	* elf32-sh64.c (sh64_elf64_final_write_processing): New, (but
 	temporarily disabled) setting bit 0 on entry address.
 	(elf_backend_final_write_processing): Define.
-	2001-01-05  Hans-Peter Nilsson	<hpn@cygnus.com>
+	2001-01-05  Hans-Peter Nilsson  <hpn@cygnus.com>
 	* elf32-sh.c (sh_elf_howto_table) <R_SH_PT_16>: Adjust fields to
 	be a proper relocation for PTA and PTB rather than a marker.
 	<R_SH_IMMU5, R_SH_IMMS6, R_SH_IMMU6, R_SH_IMMS10, R_SH_IMMS10BY2,
@@ -7764,7 +7894,7 @@
 	<case R_SH_PT_16>: New case.
 	* Makefile.am (elf32-sh64.lo): Add dependency on sh64-opc.h.
 	* Makefile.in: Regenerate.
-	2000-12-30  Hans-Peter Nilsson	<hpn@cygnus.com>
+	2000-12-30  Hans-Peter Nilsson  <hpn@cygnus.com>
 	* elf64-sh64.c (sh64_elf64_fake_sections): Set SHF_SH5_ISA32 for
 	all code sections.
 	(sh_elf64_set_mach_from_flags): Change from EF_SH64 to EF_SH5.
@@ -7777,11 +7907,11 @@
 	(sh64_elf_copy_private_data): Add missing "return true".
 	(sh64_elf_set_mach_from_flags): Change from EF_SH64 to EF_SH5.
 	(sh_elf64_merge_private_data): Ditto.
-	2000-12-19  Hans-Peter Nilsson	<hpn@cygnus.com>
+	2000-12-19  Hans-Peter Nilsson  <hpn@cygnus.com>
 	* elf64-sh64.c (sh64_elf64_fake_sections): New, copy of
 	elf64-sh64.c:sh64_elf_fake_sections.
 	(elf_backend_fake_sections): Define as sh64_elf64_fake_sections.
-	2000-12-18  Hans-Peter Nilsson	<hpn@cygnus.com>
+	2000-12-18  Hans-Peter Nilsson  <hpn@cygnus.com>
 	* elf32-sh64.c (sh64_elf_copy_private_data_internal): Delete.
 	(sh64_elf_final_write_processing): New.
 	(elf_backend_final_write_processing): Define.
@@ -7790,7 +7920,7 @@
 	sh64_elf_copy_private_data_internal, just copy e_flags field.
 	(sh64_elf_merge_private_data): Do not call
 	sh64_elf_copy_private_data_internal.
-	2000-12-12  Hans-Peter Nilsson	<hpn@cygnus.com>
+	2000-12-12  Hans-Peter Nilsson  <hpn@cygnus.com>
 	Remove EF_SH64_ABI64, let ELF size make difference.
 	Remove SH64-specific BFD section flag.
 	* elf32-sh64.c (sh64_elf_fake_sections): Recognize section as
@@ -7806,7 +7936,7 @@
 	* section.c (Section flags definitions): Don't define
 	SEC_SH_ISA_SHMEDIA.
 	(bfd-in2.h): Regenerate.
-	2000-12-09  Hans-Peter Nilsson	<hpn@cygnus.com>
+	2000-12-09  Hans-Peter Nilsson  <hpn@cygnus.com>
 	Make DataLabel references work with partial linking.
 	* elf32-sh64.c: Fix formatting.
 	(sh64_elf_link_output_symbol_hook): New.
@@ -7819,7 +7949,7 @@
 	sh64_elf64_link_output_symbol_hook.
 	(sh64_elf64_add_symbol_hook): Make DataLabel symbol just global
 	undefined if partial linking.  Adjust sanity check.
-	2000-12-07  Hans-Peter Nilsson	<hpn@cygnus.com>
+	2000-12-07  Hans-Peter Nilsson  <hpn@cygnus.com>
 	Implement semantics for inter-file DataLabel references.
 	* elf64-sh64.c (DATALABEL_SUFFIX): Define.
 	(sh64_elf64_add_symbol_hook): New.
@@ -7835,13 +7965,13 @@
 	* elf32-sh.c (sh_elf_relocate_section): If passing an indirect
 	symbol with st_type STT_DATALABEL on the way to a symbol with
 	st_other STO_SH5_ISA32, do not bitor 1 to the relocation.
-	2000-12-05  Hans-Peter Nilsson	<hpn@cygnus.com>
+	2000-12-05  Hans-Peter Nilsson  <hpn@cygnus.com>
 	Pass through STT_DATALABEL.
 	* elf32-sh64.c (sh64_elf_get_symbol_type): New.
 	(elf_backend_get_symbol_type): Define.
 	* elf64-sh64.c (sh64_elf64_get_symbol_type): New.
 	(elf_backend_get_symbol_type): Define.
-	2000-11-30  Hans-Peter Nilsson	<hpn@cygnus.com>
+	2000-11-30  Hans-Peter Nilsson  <hpn@cygnus.com>
 	* elf32-sh64.c: Tweak comments.
 	(sh64_elf_copy_private_data_internal): Add prototype.
 	(bfd_elf32_bfd_set_private_flags): Define.
@@ -7865,7 +7995,7 @@
 	* configure: Regenerate.
 	* po/POTFILES.in: Regenerate.
 	* po/bfd.pot: Regenerate.
-	2000-11-29  Hans-Peter Nilsson	<hpn@cygnus.com>
+	2000-11-29  Hans-Peter Nilsson  <hpn@cygnus.com>
 	* elf32-sh64.c (sh64_elf_set_mach_from_flags): Do not recognize
 	anything else but EF_SH64 and EF_SH64_ABI64.
 	(sh64_elf_merge_private_data): Emit error for anything else but
@@ -7875,7 +8005,7 @@
 	* configure.in: Add cofflink.lo to bfd_elf32_sh64_vec and
 	bfd_elf32_sh64l_vec as a temporary measure.
 	* configure: Regenerate.
-	2000-11-27  Hans-Peter Nilsson	<hpn@cygnus.com>
+	2000-11-27  Hans-Peter Nilsson  <hpn@cygnus.com>
 	* cpu-sh.c (arch_info_struct): Include sh5 item
 	unconditionalized.
 	* config.bfd (sh64-*-elf*): Do not set targ_cflags.
@@ -7893,7 +8023,7 @@
 	<global symbol>: Ditto.
 	(sh_elf_set_mach_from_flags): Remove code refusing
 	deleted EF_SH64_32BIT_ABI flag.
-	2000-11-26  Hans-Peter Nilsson	<hpn@cygnus.com>
+	2000-11-26  Hans-Peter Nilsson  <hpn@cygnus.com>
 	* elf32-sh.c (sh_elf_howto_table) <R_SH_IMM_LOW16_PCREL,
 	R_SH_IMM_MEDLOW16_PCREL, R_SH_IMM_MEDHI16_PCREL,
 	R_SH_IMM_HI16_PCREL, R_SH_64_PCREL>: Set pcrel_offset to true.
@@ -7902,7 +8032,7 @@
 	<global symbol>: Ditto if h->other & STO_SH5_ISA32.
 	* elf32-sh64.c (shmedia_prepare_reloc): Add rel->r_addend to
 	relocation.
-	2000-11-24  Hans-Peter Nilsson	<hpn@cygnus.com>
+	2000-11-24  Hans-Peter Nilsson  <hpn@cygnus.com>
 	* Makefile.am (BFD32_BACKENDS): Add elf32-sh64.lo.
 	(BFD32_BACKENDS_CFILES): Add elf32-sh64.c.
 	Regenerate dependencies.
@@ -8125,7 +8255,7 @@
 
 	* peXXigen.c (pe_print_idata): Rearrange message to aid in
 	translation.
-	(pe_print_pdata):  Rearrange message to aid in translation.
+	(pe_print_pdata): Rearrange message to aid in translation.
 
 	* libbfd.c (warn_deprecated): Rearrange error message to aid in
 	translation.
@@ -8622,7 +8752,7 @@
 	* ptrace-core.c (ptrace_unix_core_file_p): Likewise.
 	* trad-core.c (trad_unix_core_file_p): Likewise.
 
-	* hppabsd-core.c (hppabsd_core_core_file_p):  Clean up after errors
+	* hppabsd-core.c (hppabsd_core_core_file_p): Clean up after errors
 	with bfd_release and bfd_section_list_clear.
 	* hpux-core.c (hpux_core_core_file_p): Likewise.
 	* irix-core.c (irix_core_core_file_p): Likewise.
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index 072812e..71346c1 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -1408,6 +1408,10 @@
   /* Optional information about a COMDAT entry; NULL if not COMDAT.  */
   struct bfd_comdat_info *comdat;
 
+  /* Points to the kept section if this section is a link-once section,
+     and is discarded.  */
+  struct sec *kept_section;
+
   /* When a section is being output, this value changes as more
      linenumbers are written out.  */
   file_ptr moving_line_filepos;
diff --git a/bfd/config.bfd b/bfd/config.bfd
index 90b52cc..e1aa6b7 100644
--- a/bfd/config.bfd
+++ b/bfd/config.bfd
@@ -284,7 +284,7 @@
     targ_defvec=tic30_coff_vec
     ;;
 
-  c4x-*-*coff* | tic4x-*-*coff*)
+  c4x-*-*coff* | tic4x-*-*coff* | tic4x-*-rtems*)
     targ_defvec=tic4x_coff1_vec
     targ_selvecs="tic4x_coff1_beh_vec tic4x_coff2_vec tic4x_coff2_beh_vec tic4x_coff0_vec tic4x_coff0_beh_vec"
     targ_underscore=yes
diff --git a/bfd/elf32-cris.c b/bfd/elf32-cris.c
index 40327b6..1d278a0 100644
--- a/bfd/elf32-cris.c
+++ b/bfd/elf32-cris.c
@@ -1129,8 +1129,15 @@
 	  break;
 
 	case R_CRIS_32_GOTREL:
-	  /* This relocation must only be performed against local symbols.  */
-	  if (h != NULL && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
+	  /* This relocation must only be performed against local symbols.
+	     It's also ok when we link a program and the symbol is either
+	     defined in an ordinary (non-DSO) object or is undefined weak.  */
+	  if (h != NULL
+	      && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+	      && !(!info->shared
+		   && ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0
+		       || ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0
+			   && h->root.type == bfd_link_hash_undefweak))))
 	    {
 	      (*_bfd_error_handler)
 		(_("%s: relocation %s is not allowed for global symbol: `%s' from %s section"),
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index bc47809..68879de 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -15,12 +15,13 @@
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
 
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU General Public License along
+   with this program; if not, write to the Free Software Foundation, Inc.,
+   59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
-/* This file is based on the 64-bit PowerPC ELF ABI.  It is also based
-   on the file elf32-ppc.c.  */
+/* The 64-bit PowerPC ELF ABI may be found at
+   http://www.linuxbase.org/spec/ELF/ppc64/PPC-elf64abi.txt, and
+   http://www.linuxbase.org/spec/ELF/ppc64/spec/book1.html  */
 
 #include "bfd.h"
 #include "sysdep.h"
@@ -30,34 +31,22 @@
 #include "elf/ppc64.h"
 #include "elf64-ppc.h"
 
-static void ppc_howto_init
-  PARAMS ((void));
-static reloc_howto_type *ppc64_elf_reloc_type_lookup
-  PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
-static void ppc64_elf_info_to_howto
-  PARAMS ((bfd *abfd, arelent *cache_ptr, Elf_Internal_Rela *dst));
 static bfd_reloc_status_type ppc64_elf_ha_reloc
-  PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+  (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
 static bfd_reloc_status_type ppc64_elf_brtaken_reloc
-  PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+  (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
 static bfd_reloc_status_type ppc64_elf_sectoff_reloc
-  PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+  (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
 static bfd_reloc_status_type ppc64_elf_sectoff_ha_reloc
-  PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+  (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
 static bfd_reloc_status_type ppc64_elf_toc_reloc
-  PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+  (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
 static bfd_reloc_status_type ppc64_elf_toc_ha_reloc
-  PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+  (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
 static bfd_reloc_status_type ppc64_elf_toc64_reloc
-  PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+  (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
 static bfd_reloc_status_type ppc64_elf_unhandled_reloc
-  PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-static bfd_boolean ppc64_elf_object_p
-  PARAMS ((bfd *));
-static bfd_boolean ppc64_elf_merge_private_bfd_data
-  PARAMS ((bfd *, bfd *));
-static bfd_boolean ppc64_elf_new_section_hook
-  PARAMS ((bfd *, asection *));
+  (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
 
 
 #define TARGET_LITTLE_SYM	bfd_elf64_powerpcle_vec
@@ -1858,7 +1847,7 @@
    be done.  */
 
 static void
-ppc_howto_init ()
+ppc_howto_init (void)
 {
   unsigned int i, type;
 
@@ -1874,9 +1863,8 @@
 }
 
 static reloc_howto_type *
-ppc64_elf_reloc_type_lookup (abfd, code)
-     bfd *abfd ATTRIBUTE_UNUSED;
-     bfd_reloc_code_real_type code;
+ppc64_elf_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+			     bfd_reloc_code_real_type code)
 {
   enum elf_ppc64_reloc_type r = R_PPC64_NONE;
 
@@ -1884,10 +1872,10 @@
     /* Initialize howto table if needed.  */
     ppc_howto_init ();
 
-  switch ((int) code)
+  switch (code)
     {
     default:
-      return (reloc_howto_type *) NULL;
+      return NULL;
 
     case BFD_RELOC_NONE:			r = R_PPC64_NONE;
       break;
@@ -2093,16 +2081,14 @@
       break;
     }
 
-  return ppc64_elf_howto_table[(int) r];
+  return ppc64_elf_howto_table[r];
 };
 
 /* Set the howto pointer for a PowerPC ELF reloc.  */
 
 static void
-ppc64_elf_info_to_howto (abfd, cache_ptr, dst)
-     bfd *abfd ATTRIBUTE_UNUSED;
-     arelent *cache_ptr;
-     Elf_Internal_Rela *dst;
+ppc64_elf_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED, arelent *cache_ptr,
+			 Elf_Internal_Rela *dst)
 {
   unsigned int type;
 
@@ -2119,15 +2105,9 @@
 /* Handle the R_PPC64_ADDR16_HA and similar relocs.  */
 
 static bfd_reloc_status_type
-ppc64_elf_ha_reloc (abfd, reloc_entry, symbol, data,
-		    input_section, output_bfd, error_message)
-     bfd *abfd;
-     arelent *reloc_entry;
-     asymbol *symbol;
-     PTR data;
-     asection *input_section;
-     bfd *output_bfd;
-     char **error_message;
+ppc64_elf_ha_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
+		    void *data, asection *input_section,
+		    bfd *output_bfd, char **error_message)
 {
   /* If this is a relocatable link (output_bfd test tells us), just
      call the generic function.  Any adjustment will be done at final
@@ -2144,15 +2124,9 @@
 }
 
 static bfd_reloc_status_type
-ppc64_elf_brtaken_reloc (abfd, reloc_entry, symbol, data,
-			 input_section, output_bfd, error_message)
-     bfd *abfd;
-     arelent *reloc_entry;
-     asymbol *symbol;
-     PTR data;
-     asection *input_section;
-     bfd *output_bfd;
-     char **error_message;
+ppc64_elf_brtaken_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
+			 void *data, asection *input_section,
+			 bfd *output_bfd, char **error_message)
 {
   long insn;
   enum elf_ppc64_reloc_type r_type;
@@ -2170,7 +2144,7 @@
   octets = reloc_entry->address * bfd_octets_per_byte (abfd);
   insn = bfd_get_32 (abfd, (bfd_byte *) data + octets);
   insn &= ~(0x01 << 21);
-  r_type = (enum elf_ppc64_reloc_type) reloc_entry->howto->type;
+  r_type = reloc_entry->howto->type;
   if (r_type == R_PPC64_ADDR14_BRTAKEN
       || r_type == R_PPC64_REL14_BRTAKEN)
     insn |= 0x01 << 21; /* 'y' or 't' bit, lowest bit of BO field.  */
@@ -2206,20 +2180,14 @@
       if ((bfd_signed_vma) (target - from) < 0)
 	insn ^= 0x01 << 21;
     }
-  bfd_put_32 (abfd, (bfd_vma) insn, (bfd_byte *) data + octets);
+  bfd_put_32 (abfd, insn, (bfd_byte *) data + octets);
   return bfd_reloc_continue;
 }
 
 static bfd_reloc_status_type
-ppc64_elf_sectoff_reloc (abfd, reloc_entry, symbol, data,
-			 input_section, output_bfd, error_message)
-     bfd *abfd;
-     arelent *reloc_entry;
-     asymbol *symbol;
-     PTR data;
-     asection *input_section;
-     bfd *output_bfd;
-     char **error_message;
+ppc64_elf_sectoff_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
+			 void *data, asection *input_section,
+			 bfd *output_bfd, char **error_message)
 {
   /* If this is a relocatable link (output_bfd test tells us), just
      call the generic function.  Any adjustment will be done at final
@@ -2234,15 +2202,9 @@
 }
 
 static bfd_reloc_status_type
-ppc64_elf_sectoff_ha_reloc (abfd, reloc_entry, symbol, data,
-			    input_section, output_bfd, error_message)
-     bfd *abfd;
-     arelent *reloc_entry;
-     asymbol *symbol;
-     PTR data;
-     asection *input_section;
-     bfd *output_bfd;
-     char **error_message;
+ppc64_elf_sectoff_ha_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
+			    void *data, asection *input_section,
+			    bfd *output_bfd, char **error_message)
 {
   /* If this is a relocatable link (output_bfd test tells us), just
      call the generic function.  Any adjustment will be done at final
@@ -2260,15 +2222,9 @@
 }
 
 static bfd_reloc_status_type
-ppc64_elf_toc_reloc (abfd, reloc_entry, symbol, data,
-		     input_section, output_bfd, error_message)
-     bfd *abfd;
-     arelent *reloc_entry;
-     asymbol *symbol;
-     PTR data;
-     asection *input_section;
-     bfd *output_bfd;
-     char **error_message;
+ppc64_elf_toc_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
+		     void *data, asection *input_section,
+		     bfd *output_bfd, char **error_message)
 {
   bfd_vma TOCstart;
 
@@ -2289,15 +2245,9 @@
 }
 
 static bfd_reloc_status_type
-ppc64_elf_toc_ha_reloc (abfd, reloc_entry, symbol, data,
-			input_section, output_bfd, error_message)
-     bfd *abfd;
-     arelent *reloc_entry;
-     asymbol *symbol;
-     PTR data;
-     asection *input_section;
-     bfd *output_bfd;
-     char **error_message;
+ppc64_elf_toc_ha_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
+			void *data, asection *input_section,
+			bfd *output_bfd, char **error_message)
 {
   bfd_vma TOCstart;
 
@@ -2321,15 +2271,9 @@
 }
 
 static bfd_reloc_status_type
-ppc64_elf_toc64_reloc (abfd, reloc_entry, symbol, data,
-		       input_section, output_bfd, error_message)
-     bfd *abfd;
-     arelent *reloc_entry;
-     asymbol *symbol;
-     PTR data;
-     asection *input_section;
-     bfd *output_bfd;
-     char **error_message;
+ppc64_elf_toc64_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
+		       void *data, asection *input_section,
+		       bfd *output_bfd, char **error_message)
 {
   bfd_vma TOCstart;
   bfd_size_type octets;
@@ -2351,15 +2295,9 @@
 }
 
 static bfd_reloc_status_type
-ppc64_elf_unhandled_reloc (abfd, reloc_entry, symbol, data,
-			   input_section, output_bfd, error_message)
-     bfd *abfd;
-     arelent *reloc_entry;
-     asymbol *symbol;
-     PTR data;
-     asection *input_section;
-     bfd *output_bfd;
-     char **error_message;
+ppc64_elf_unhandled_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
+			   void *data, asection *input_section,
+			   bfd *output_bfd, char **error_message)
 {
   /* If this is a relocatable link (output_bfd test tells us), just
      call the generic function.  Any adjustment will be done at final
@@ -2382,8 +2320,7 @@
    default is 32 bit.  */
 
 static bfd_boolean
-ppc64_elf_object_p (abfd)
-     bfd *abfd;
+ppc64_elf_object_p (bfd *abfd)
 {
   if (abfd->arch_info->the_default && abfd->arch_info->bits_per_word == 32)
     {
@@ -2403,9 +2340,7 @@
    object file when linking.  */
 
 static bfd_boolean
-ppc64_elf_merge_private_bfd_data (ibfd, obfd)
-     bfd *ibfd;
-     bfd *obfd;
+ppc64_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
 {
   /* Check if we have the same endianess.  */
   if (ibfd->xvec->byteorder != obfd->xvec->byteorder
@@ -2415,9 +2350,11 @@
       const char *msg;
 
       if (bfd_big_endian (ibfd))
-	msg = _("%s: compiled for a big endian system and target is little endian");
+	msg = _("%s: compiled for a big endian system "
+		"and target is little endian");
       else
-	msg = _("%s: compiled for a little endian system and target is big endian");
+	msg = _("%s: compiled for a little endian system "
+		"and target is big endian");
 
       (*_bfd_error_handler) (msg, bfd_archive_filename (ibfd));
 
@@ -2450,17 +2387,15 @@
   ((struct _ppc64_elf_section_data *) elf_section_data (sec))
 
 static bfd_boolean
-ppc64_elf_new_section_hook (abfd, sec)
-     bfd *abfd;
-     asection *sec;
+ppc64_elf_new_section_hook (bfd *abfd, asection *sec)
 {
   struct _ppc64_elf_section_data *sdata;
   bfd_size_type amt = sizeof (*sdata);
 
-  sdata = (struct _ppc64_elf_section_data *) bfd_zalloc (abfd, amt);
+  sdata = bfd_zalloc (abfd, amt);
   if (sdata == NULL)
     return FALSE;
-  sec->used_by_bfd = (PTR) sdata;
+  sec->used_by_bfd = sdata;
 
   return _bfd_elf_new_section_hook (abfd, sec);
 }
@@ -2752,8 +2687,8 @@
   bfd *stub_bfd;
 
   /* Linker call-backs.  */
-  asection * (*add_stub_section) PARAMS ((const char *, asection *));
-  void (*layout_sections_again) PARAMS ((void));
+  asection * (*add_stub_section) (const char *, asection *);
+  void (*layout_sections_again) (void);
 
   /* Array to keep track of which stub sections have been created, and
      information on stub grouping.  */
@@ -2773,21 +2708,26 @@
   /* Temp used when calculating TOC pointers.  */
   bfd_vma toc_curr;
 
-  /* Assorted information used by ppc64_elf_size_stubs.  */
+  /* Highest input section id.  */
+  int top_id;
+
+  /* Highest output section index.  */
   int top_index;
+
+  /* List of input sections for each output section.  */
   asection **input_list;
 
   /* Short-cuts to get to dynamic linker sections.  */
-  asection *sgot;
-  asection *srelgot;
-  asection *splt;
-  asection *srelplt;
-  asection *sdynbss;
-  asection *srelbss;
-  asection *sglink;
+  asection *got;
+  asection *relgot;
+  asection *plt;
+  asection *relplt;
+  asection *dynbss;
+  asection *relbss;
+  asection *glink;
   asection *sfpr;
-  asection *sbrlt;
-  asection *srelbrlt;
+  asection *brlt;
+  asection *relbrlt;
 
   /* Short-cut to first output tls section.  */
   asection *tls_sec;
@@ -2801,6 +2741,9 @@
     bfd_vma offset;
   } tlsld_got;
 
+  /* Statistics.  */
+  unsigned long stub_count[ppc_stub_plt_call];
+
   /* Set if we should emit symbols for stubs.  */
   unsigned int emit_stub_syms;
 
@@ -2821,88 +2764,6 @@
   struct sym_sec_cache sym_sec;
 };
 
-static struct bfd_hash_entry *stub_hash_newfunc
-  PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
-static struct bfd_hash_entry *branch_hash_newfunc
-  PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
-static struct bfd_hash_entry *link_hash_newfunc
-  PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
-static struct bfd_link_hash_table *ppc64_elf_link_hash_table_create
-  PARAMS ((bfd *));
-static void ppc64_elf_link_hash_table_free
-  PARAMS ((struct bfd_link_hash_table *));
-static char *ppc_stub_name
-  PARAMS ((const asection *, const asection *,
-	   const struct ppc_link_hash_entry *, const Elf_Internal_Rela *));
-static struct ppc_stub_hash_entry *ppc_get_stub_entry
-  PARAMS ((const asection *, const asection *, struct elf_link_hash_entry *,
-	   const Elf_Internal_Rela *, struct ppc_link_hash_table *));
-static struct ppc_stub_hash_entry *ppc_add_stub
-  PARAMS ((const char *, asection *, struct ppc_link_hash_table *));
-static bfd_boolean create_linkage_sections
-  PARAMS ((bfd *, struct bfd_link_info *));
-static bfd_boolean create_got_section
-  PARAMS ((bfd *, struct bfd_link_info *));
-static bfd_boolean ppc64_elf_create_dynamic_sections
-  PARAMS ((bfd *, struct bfd_link_info *));
-static void ppc64_elf_copy_indirect_symbol
-  PARAMS ((struct elf_backend_data *, struct elf_link_hash_entry *,
-	   struct elf_link_hash_entry *));
-static bfd_boolean update_local_sym_info
-  PARAMS ((bfd *, Elf_Internal_Shdr *, unsigned long, bfd_vma, int));
-static bfd_boolean update_plt_info
-  PARAMS ((bfd *, struct ppc_link_hash_entry *, bfd_vma));
-static bfd_boolean ppc64_elf_check_relocs
-  PARAMS ((bfd *, struct bfd_link_info *, asection *,
-	   const Elf_Internal_Rela *));
-static asection * ppc64_elf_gc_mark_hook
-  PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *,
-	   struct elf_link_hash_entry *, Elf_Internal_Sym *));
-static bfd_boolean ppc64_elf_gc_sweep_hook
-  PARAMS ((bfd *, struct bfd_link_info *, asection *,
-	   const Elf_Internal_Rela *));
-static bfd_boolean func_desc_adjust
-  PARAMS ((struct elf_link_hash_entry *, PTR));
-static bfd_boolean ppc64_elf_func_desc_adjust
-  PARAMS ((bfd *, struct bfd_link_info *));
-static bfd_boolean ppc64_elf_adjust_dynamic_symbol
-  PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
-static void ppc64_elf_hide_symbol
-  PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *, bfd_boolean));
-static bfd_boolean get_sym_h
-  PARAMS ((struct elf_link_hash_entry **, Elf_Internal_Sym **, asection **,
-	   char **, Elf_Internal_Sym **, unsigned long, bfd *));
-static int get_tls_mask
-  PARAMS ((char **, Elf_Internal_Sym **, const Elf_Internal_Rela *, bfd *));
-static bfd_boolean allocate_dynrelocs
-  PARAMS ((struct elf_link_hash_entry *, PTR));
-static bfd_boolean readonly_dynrelocs
-  PARAMS ((struct elf_link_hash_entry *, PTR));
-static enum elf_reloc_type_class ppc64_elf_reloc_type_class
-  PARAMS ((const Elf_Internal_Rela *));
-static bfd_boolean ppc64_elf_size_dynamic_sections
-  PARAMS ((bfd *, struct bfd_link_info *));
-static enum ppc_stub_type ppc_type_of_stub
-  PARAMS ((asection *, const Elf_Internal_Rela *,
-	   struct ppc_link_hash_entry **, bfd_vma));
-static bfd_byte *build_plt_stub
-  PARAMS ((bfd *, bfd_byte *, int));
-static bfd_boolean ppc_build_one_stub
-  PARAMS ((struct bfd_hash_entry *, PTR));
-static bfd_boolean ppc_size_one_stub
-  PARAMS ((struct bfd_hash_entry *, PTR));
-static void group_sections
-  PARAMS ((struct ppc_link_hash_table *, bfd_size_type, bfd_boolean));
-static bfd_boolean ppc64_elf_relocate_section
-  PARAMS ((bfd *, struct bfd_link_info *info, bfd *, asection *, bfd_byte *,
-	   Elf_Internal_Rela *relocs, Elf_Internal_Sym *local_syms,
-	   asection **));
-static bfd_boolean ppc64_elf_finish_dynamic_symbol
-  PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *,
-	   Elf_Internal_Sym *));
-static bfd_boolean ppc64_elf_finish_dynamic_sections
-  PARAMS ((bfd *, struct bfd_link_info *));
-
 /* Get the ppc64 ELF linker hash table from a link_info structure.  */
 
 #define ppc_hash_table(p) \
@@ -2919,10 +2780,9 @@
 /* Create an entry in the stub hash table.  */
 
 static struct bfd_hash_entry *
-stub_hash_newfunc (entry, table, string)
-     struct bfd_hash_entry *entry;
-     struct bfd_hash_table *table;
-     const char *string;
+stub_hash_newfunc (struct bfd_hash_entry *entry,
+		   struct bfd_hash_table *table,
+		   const char *string)
 {
   /* Allocate the structure if it has not already been allocated by a
      subclass.  */
@@ -2956,10 +2816,9 @@
 /* Create an entry in the branch hash table.  */
 
 static struct bfd_hash_entry *
-branch_hash_newfunc (entry, table, string)
-     struct bfd_hash_entry *entry;
-     struct bfd_hash_table *table;
-     const char *string;
+branch_hash_newfunc (struct bfd_hash_entry *entry,
+		     struct bfd_hash_table *table,
+		     const char *string)
 {
   /* Allocate the structure if it has not already been allocated by a
      subclass.  */
@@ -2988,10 +2847,9 @@
 /* Create an entry in a ppc64 ELF linker hash table.  */
 
 static struct bfd_hash_entry *
-link_hash_newfunc (entry, table, string)
-     struct bfd_hash_entry *entry;
-     struct bfd_hash_table *table;
-     const char *string;
+link_hash_newfunc (struct bfd_hash_entry *entry,
+		   struct bfd_hash_table *table,
+		   const char *string)
 {
   /* Allocate the structure if it has not already been allocated by a
      subclass.  */
@@ -3023,13 +2881,12 @@
 /* Create a ppc64 ELF linker hash table.  */
 
 static struct bfd_link_hash_table *
-ppc64_elf_link_hash_table_create (abfd)
-     bfd *abfd;
+ppc64_elf_link_hash_table_create (bfd *abfd)
 {
   struct ppc_link_hash_table *htab;
   bfd_size_type amt = sizeof (struct ppc_link_hash_table);
 
-  htab = (struct ppc_link_hash_table *) bfd_malloc (amt);
+  htab = bfd_zmalloc (amt);
   if (htab == NULL)
     return NULL;
 
@@ -3047,32 +2904,6 @@
   if (!bfd_hash_table_init (&htab->branch_hash_table, branch_hash_newfunc))
     return NULL;
 
-  htab->stub_bfd = NULL;
-  htab->add_stub_section = NULL;
-  htab->layout_sections_again = NULL;
-  htab->stub_group = NULL;
-  htab->no_multi_toc = 0;
-  htab->multi_toc_needed = 0;
-  htab->toc_curr = 0;
-  htab->sgot = NULL;
-  htab->srelgot = NULL;
-  htab->splt = NULL;
-  htab->srelplt = NULL;
-  htab->sdynbss = NULL;
-  htab->srelbss = NULL;
-  htab->sglink = NULL;
-  htab->sfpr = NULL;
-  htab->sbrlt = NULL;
-  htab->srelbrlt = NULL;
-  htab->tls_sec = NULL;
-  htab->tls_get_addr = NULL;
-  htab->tlsld_got.refcount = 0;
-  htab->emit_stub_syms = 0;
-  htab->stub_error = 0;
-  htab->has_14bit_branch = 0;
-  htab->have_undefweak = 0;
-  htab->stub_iteration = 0;
-  htab->sym_sec.abfd = NULL;
   /* Initializing two fields of the union is just cosmetic.  We really
      only care about glist, but when compiled on a 32-bit host the
      bfd_vma fields are larger.  Setting the bfd_vma to zero makes
@@ -3088,8 +2919,7 @@
 /* Free the derived linker hash table.  */
 
 static void
-ppc64_elf_link_hash_table_free (hash)
-     struct bfd_link_hash_table *hash;
+ppc64_elf_link_hash_table_free (struct bfd_link_hash_table *hash)
 {
   struct ppc_link_hash_table *ret = (struct ppc_link_hash_table *) hash;
 
@@ -3101,11 +2931,10 @@
 /* Build a name for an entry in the stub hash table.  */
 
 static char *
-ppc_stub_name (input_section, sym_sec, h, rel)
-     const asection *input_section;
-     const asection *sym_sec;
-     const struct ppc_link_hash_entry *h;
-     const Elf_Internal_Rela *rel;
+ppc_stub_name (const asection *input_section,
+	       const asection *sym_sec,
+	       const struct ppc_link_hash_entry *h,
+	       const Elf_Internal_Rela *rel)
 {
   char *stub_name;
   bfd_size_type len;
@@ -3147,12 +2976,11 @@
    creating the stub name takes a bit of time.  */
 
 static struct ppc_stub_hash_entry *
-ppc_get_stub_entry (input_section, sym_sec, hash, rel, htab)
-     const asection *input_section;
-     const asection *sym_sec;
-     struct elf_link_hash_entry *hash;
-     const Elf_Internal_Rela *rel;
-     struct ppc_link_hash_table *htab;
+ppc_get_stub_entry (const asection *input_section,
+		    const asection *sym_sec,
+		    struct elf_link_hash_entry *hash,
+		    const Elf_Internal_Rela *rel,
+		    struct ppc_link_hash_table *htab)
 {
   struct ppc_stub_hash_entry *stub_entry;
   struct ppc_link_hash_entry *h = (struct ppc_link_hash_entry *) hash;
@@ -3194,10 +3022,9 @@
    stub entry are initialised.  */
 
 static struct ppc_stub_hash_entry *
-ppc_add_stub (stub_name, section, htab)
-     const char *stub_name;
-     asection *section;
-     struct ppc_link_hash_table *htab;
+ppc_add_stub (const char *stub_name,
+	      asection *section,
+	      struct ppc_link_hash_table *htab)
 {
   asection *link_sec;
   asection *stub_sec;
@@ -3250,9 +3077,7 @@
 /* Create sections for linker generated code.  */
 
 static bfd_boolean
-create_linkage_sections (dynobj, info)
-     bfd *dynobj;
-     struct bfd_link_info *info;
+create_linkage_sections (bfd *dynobj, struct bfd_link_info *info)
 {
   struct ppc_link_hash_table *htab;
   flagword flags;
@@ -3269,29 +3094,29 @@
     return FALSE;
 
   /* Create .glink for lazy dynamic linking support.  */
-  htab->sglink = bfd_make_section_anyway (dynobj, ".glink");
-  if (htab->sglink == NULL
-      || ! bfd_set_section_flags (dynobj, htab->sglink, flags)
-      || ! bfd_set_section_alignment (dynobj, htab->sglink, 2))
+  htab->glink = bfd_make_section_anyway (dynobj, ".glink");
+  if (htab->glink == NULL
+      || ! bfd_set_section_flags (dynobj, htab->glink, flags)
+      || ! bfd_set_section_alignment (dynobj, htab->glink, 2))
     return FALSE;
 
   /* Create .branch_lt for plt_branch stubs.  */
   flags = (SEC_ALLOC | SEC_LOAD
 	   | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED);
-  htab->sbrlt = bfd_make_section_anyway (dynobj, ".branch_lt");
-  if (htab->sbrlt == NULL
-      || ! bfd_set_section_flags (dynobj, htab->sbrlt, flags)
-      || ! bfd_set_section_alignment (dynobj, htab->sbrlt, 3))
+  htab->brlt = bfd_make_section_anyway (dynobj, ".branch_lt");
+  if (htab->brlt == NULL
+      || ! bfd_set_section_flags (dynobj, htab->brlt, flags)
+      || ! bfd_set_section_alignment (dynobj, htab->brlt, 3))
     return FALSE;
 
   if (info->shared)
     {
       flags = (SEC_ALLOC | SEC_LOAD | SEC_READONLY
 	       | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED);
-      htab->srelbrlt = bfd_make_section_anyway (dynobj, ".rela.branch_lt");
-      if (!htab->srelbrlt
-	  || ! bfd_set_section_flags (dynobj, htab->srelbrlt, flags)
-	  || ! bfd_set_section_alignment (dynobj, htab->srelbrlt, 3))
+      htab->relbrlt = bfd_make_section_anyway (dynobj, ".rela.branch_lt");
+      if (!htab->relbrlt
+	  || ! bfd_set_section_flags (dynobj, htab->relbrlt, flags)
+	  || ! bfd_set_section_alignment (dynobj, htab->relbrlt, 3))
 	return FALSE;
     }
   return TRUE;
@@ -3301,9 +3126,7 @@
    shortcuts to them in our hash table.  */
 
 static bfd_boolean
-create_got_section (dynobj, info)
-     bfd *dynobj;
-     struct bfd_link_info *info;
+create_got_section (bfd *dynobj, struct bfd_link_info *info)
 {
   struct ppc_link_hash_table *htab;
 
@@ -3311,17 +3134,17 @@
     return FALSE;
 
   htab = ppc_hash_table (info);
-  htab->sgot = bfd_get_section_by_name (dynobj, ".got");
-  if (!htab->sgot)
+  htab->got = bfd_get_section_by_name (dynobj, ".got");
+  if (!htab->got)
     abort ();
 
-  htab->srelgot = bfd_make_section (dynobj, ".rela.got");
-  if (!htab->srelgot
-      || ! bfd_set_section_flags (dynobj, htab->srelgot,
+  htab->relgot = bfd_make_section (dynobj, ".rela.got");
+  if (!htab->relgot
+      || ! bfd_set_section_flags (dynobj, htab->relgot,
 				  (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
 				   | SEC_IN_MEMORY | SEC_LINKER_CREATED
 				   | SEC_READONLY))
-      || ! bfd_set_section_alignment (dynobj, htab->srelgot, 3))
+      || ! bfd_set_section_alignment (dynobj, htab->relgot, 3))
     return FALSE;
   return TRUE;
 }
@@ -3329,27 +3152,25 @@
 /* Create the dynamic sections, and set up shortcuts.  */
 
 static bfd_boolean
-ppc64_elf_create_dynamic_sections (dynobj, info)
-     bfd *dynobj;
-     struct bfd_link_info *info;
+ppc64_elf_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info)
 {
   struct ppc_link_hash_table *htab;
 
   htab = ppc_hash_table (info);
-  if (!htab->sgot && !create_got_section (dynobj, info))
+  if (!htab->got && !create_got_section (dynobj, info))
     return FALSE;
 
   if (!_bfd_elf_create_dynamic_sections (dynobj, info))
     return FALSE;
 
-  htab->splt = bfd_get_section_by_name (dynobj, ".plt");
-  htab->srelplt = bfd_get_section_by_name (dynobj, ".rela.plt");
-  htab->sdynbss = bfd_get_section_by_name (dynobj, ".dynbss");
+  htab->plt = bfd_get_section_by_name (dynobj, ".plt");
+  htab->relplt = bfd_get_section_by_name (dynobj, ".rela.plt");
+  htab->dynbss = bfd_get_section_by_name (dynobj, ".dynbss");
   if (!info->shared)
-    htab->srelbss = bfd_get_section_by_name (dynobj, ".rela.bss");
+    htab->relbss = bfd_get_section_by_name (dynobj, ".rela.bss");
 
-  if (!htab->splt || !htab->srelplt || !htab->sdynbss
-      || (!info->shared && !htab->srelbss))
+  if (!htab->plt || !htab->relplt || !htab->dynbss
+      || (!info->shared && !htab->relbss))
     abort ();
 
   return TRUE;
@@ -3358,9 +3179,9 @@
 /* Copy the extra info we tack onto an elf_link_hash_entry.  */
 
 static void
-ppc64_elf_copy_indirect_symbol (bed, dir, ind)
-     struct elf_backend_data *bed ATTRIBUTE_UNUSED;
-     struct elf_link_hash_entry *dir, *ind;
+ppc64_elf_copy_indirect_symbol (struct elf_backend_data *bed ATTRIBUTE_UNUSED,
+				struct elf_link_hash_entry *dir,
+				struct elf_link_hash_entry *ind)
 {
   struct ppc_link_hash_entry *edir, *eind;
   flagword mask;
@@ -3499,8 +3320,7 @@
    symbols undefined on the command-line.  */
 
 bfd_boolean
-ppc64_elf_mark_entry_syms (info)
-     struct bfd_link_info *info;
+ppc64_elf_mark_entry_syms (struct bfd_link_info *info)
 {
   struct ppc_link_hash_table *htab;
   struct bfd_sym_chain *sym;
@@ -3518,12 +3338,8 @@
 }
 
 static bfd_boolean
-update_local_sym_info (abfd, symtab_hdr, r_symndx, r_addend, tls_type)
-     bfd *abfd;
-     Elf_Internal_Shdr *symtab_hdr;
-     unsigned long r_symndx;
-     bfd_vma r_addend;
-     int tls_type;
+update_local_sym_info (bfd *abfd, Elf_Internal_Shdr *symtab_hdr,
+		       unsigned long r_symndx, bfd_vma r_addend, int tls_type)
 {
   struct got_entry **local_got_ents = elf_local_got_ents (abfd);
   char *local_got_tls_masks;
@@ -3533,7 +3349,7 @@
       bfd_size_type size = symtab_hdr->sh_info;
 
       size *= sizeof (*local_got_ents) + sizeof (*local_got_tls_masks);
-      local_got_ents = (struct got_entry **) bfd_zalloc (abfd, size);
+      local_got_ents = bfd_zalloc (abfd, size);
       if (local_got_ents == NULL)
 	return FALSE;
       elf_local_got_ents (abfd) = local_got_ents;
@@ -3549,7 +3365,7 @@
       if (ent == NULL)
 	{
 	  bfd_size_type amt = sizeof (*ent);
-	  ent = (struct got_entry *) bfd_alloc (abfd, amt);
+	  ent = bfd_alloc (abfd, amt);
 	  if (ent == NULL)
 	    return FALSE;
 	  ent->next = local_got_ents[r_symndx];
@@ -3567,10 +3383,7 @@
 }
 
 static bfd_boolean
-update_plt_info (abfd, eh, addend)
-     bfd *abfd;
-     struct ppc_link_hash_entry *eh;
-     bfd_vma addend;
+update_plt_info (bfd *abfd, struct ppc_link_hash_entry *eh, bfd_vma addend)
 {
   struct plt_entry *ent;
 
@@ -3580,7 +3393,7 @@
   if (ent == NULL)
     {
       bfd_size_type amt = sizeof (*ent);
-      ent = (struct plt_entry *) bfd_alloc (abfd, amt);
+      ent = bfd_alloc (abfd, amt);
       if (ent == NULL)
 	return FALSE;
       ent->next = eh->elf.plt.plist;
@@ -3599,11 +3412,8 @@
    linkage table, and dynamic reloc sections.  */
 
 static bfd_boolean
-ppc64_elf_check_relocs (abfd, info, sec, relocs)
-     bfd *abfd;
-     struct bfd_link_info *info;
-     asection *sec;
-     const Elf_Internal_Rela *relocs;
+ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
+			asection *sec, const Elf_Internal_Rela *relocs)
 {
   struct ppc_link_hash_table *htab;
   Elf_Internal_Shdr *symtab_hdr;
@@ -3644,7 +3454,7 @@
       bfd_size_type amt;
 
       amt = sec->_raw_size * sizeof (union opd_info) / 24;
-      opd_sym_map = (asection **) bfd_zalloc (abfd, amt);
+      opd_sym_map = bfd_zalloc (abfd, amt);
       if (opd_sym_map == NULL)
 	return FALSE;
       ppc64_elf_section_data (sec)->opd.func_sec = opd_sym_map;
@@ -3670,7 +3480,7 @@
       else
 	h = sym_hashes[r_symndx - symtab_hdr->sh_info];
 
-      r_type = (enum elf_ppc64_reloc_type) ELF64_R_TYPE (rel->r_info);
+      r_type = ELF64_R_TYPE (rel->r_info);
       switch (r_type)
 	{
 	case R_PPC64_GOT_TLSLD16:
@@ -3714,7 +3524,7 @@
 	case R_PPC64_GOT16_LO_DS:
 	  /* This symbol requires a global offset table entry.  */
 	  sec->has_gp_reloc = 1;
-	  if (htab->sgot == NULL
+	  if (htab->got == NULL
 	      && !create_got_section (htab->elf.dynobj, info))
 	    return FALSE;
 
@@ -3731,7 +3541,7 @@
 	      if (ent == NULL)
 		{
 		  bfd_size_type amt = sizeof (*ent);
-		  ent = (struct got_entry *) bfd_alloc (abfd, amt);
+		  ent = bfd_alloc (abfd, amt);
 		  if (ent == NULL)
 		    return FALSE;
 		  ent->next = eh->elf.got.glist;
@@ -3888,8 +3698,7 @@
 	    {
 	      /* One extra to simplify get_tls_mask.  */
 	      bfd_size_type amt = sec->_raw_size * sizeof (unsigned) / 8 + 1;
-	      ppc64_elf_section_data (sec)->t_symndx
-		= (unsigned *) bfd_zalloc (abfd, amt);
+	      ppc64_elf_section_data (sec)->t_symndx = bfd_zalloc (abfd, amt);
 	      if (ppc64_elf_section_data (sec)->t_symndx == NULL)
 		return FALSE;
 	    }
@@ -3942,8 +3751,7 @@
 	  if (opd_sym_map != NULL
 	      && h == NULL
 	      && rel + 1 < rel_end
-	      && ((enum elf_ppc64_reloc_type) ELF64_R_TYPE ((rel + 1)->r_info)
-		  == R_PPC64_TOC))
+	      && ELF64_R_TYPE ((rel + 1)->r_info) == R_PPC64_TOC)
 	    {
 	      asection *s;
 
@@ -4098,9 +3906,7 @@
 	      p = *head;
 	      if (p == NULL || p->sec != sec)
 		{
-		  p = ((struct ppc_dyn_relocs *)
-		       bfd_alloc (htab->elf.dynobj,
-				  (bfd_size_type) sizeof *p));
+		  p = bfd_alloc (htab->elf.dynobj, sizeof *p);
 		  if (p == NULL)
 		    return FALSE;
 		  p->next = *head;
@@ -4128,12 +3934,11 @@
    relocation.  */
 
 static asection *
-ppc64_elf_gc_mark_hook (sec, info, rel, h, sym)
-     asection *sec;
-     struct bfd_link_info *info ATTRIBUTE_UNUSED;
-     Elf_Internal_Rela *rel;
-     struct elf_link_hash_entry *h;
-     Elf_Internal_Sym *sym;
+ppc64_elf_gc_mark_hook (asection *sec,
+			struct bfd_link_info *info ATTRIBUTE_UNUSED,
+			Elf_Internal_Rela *rel,
+			struct elf_link_hash_entry *h,
+			Elf_Internal_Sym *sym)
 {
   asection *rsec = NULL;
 
@@ -4142,7 +3947,7 @@
       enum elf_ppc64_reloc_type r_type;
       struct ppc_link_hash_entry *fdh;
 
-      r_type = (enum elf_ppc64_reloc_type) ELF64_R_TYPE (rel->r_info);
+      r_type = ELF64_R_TYPE (rel->r_info);
       switch (r_type)
 	{
 	case R_PPC64_GNU_VTINHERIT:
@@ -4199,11 +4004,8 @@
    section being removed.  */
 
 static bfd_boolean
-ppc64_elf_gc_sweep_hook (abfd, info, sec, relocs)
-     bfd *abfd;
-     struct bfd_link_info *info;
-     asection *sec;
-     const Elf_Internal_Rela *relocs;
+ppc64_elf_gc_sweep_hook (bfd *abfd, struct bfd_link_info *info,
+			 asection *sec, const Elf_Internal_Rela *relocs)
 {
   struct ppc_link_hash_table *htab;
   Elf_Internal_Shdr *symtab_hdr;
@@ -4227,7 +4029,7 @@
       char tls_type = 0;
 
       r_symndx = ELF64_R_SYM (rel->r_info);
-      r_type = (enum elf_ppc64_reloc_type) ELF64_R_TYPE (rel->r_info);
+      r_type = ELF64_R_TYPE (rel->r_info);
       if (r_symndx >= symtab_hdr->sh_info)
 	{
 	  struct ppc_link_hash_entry *eh;
@@ -4337,9 +4139,7 @@
    information on function code symbol entries to their corresponding
    function descriptor symbol entries.  */
 static bfd_boolean
-func_desc_adjust (h, inf)
-     struct elf_link_hash_entry *h;
-     PTR inf;
+func_desc_adjust (struct elf_link_hash_entry *h, void *inf)
 {
   struct bfd_link_info *info;
   struct ppc_link_hash_table *htab;
@@ -4351,7 +4151,7 @@
   if (h->root.type == bfd_link_hash_warning)
     h = (struct elf_link_hash_entry *) h->root.u.i.link;
 
-  info = (struct bfd_link_info *) inf;
+  info = inf;
   htab = ppc_hash_table (info);
 
   /* If this is a function code symbol, transfer dynamic linking
@@ -4462,9 +4262,8 @@
    dynamic linking information gathered so far on function code symbol
    entries, to their corresponding function descriptor symbol entries.  */
 static bfd_boolean
-ppc64_elf_func_desc_adjust (obfd, info)
-     bfd *obfd ATTRIBUTE_UNUSED;
-     struct bfd_link_info *info;
+ppc64_elf_func_desc_adjust (bfd *obfd ATTRIBUTE_UNUSED,
+			    struct bfd_link_info *info)
 {
   struct ppc_link_hash_table *htab;
   unsigned int lowest_savef = MAX_SAVE_FPR + 2;
@@ -4522,7 +4321,7 @@
 	}
     }
 
-  elf_link_hash_traverse (&htab->elf, func_desc_adjust, (PTR) info);
+  elf_link_hash_traverse (&htab->elf, func_desc_adjust, info);
 
   htab->sfpr->_raw_size = ((MAX_SAVE_FPR + 2 - lowest_savef) * 4
 			   + (MAX_SAVE_FPR + 2 - lowest_restf) * 4);
@@ -4538,7 +4337,7 @@
       htab->sfpr->_raw_size = 4;
     }
 
-  p = (bfd_byte *) bfd_alloc (htab->elf.dynobj, htab->sfpr->_raw_size);
+  p = bfd_alloc (htab->elf.dynobj, htab->sfpr->_raw_size);
   if (p == NULL)
     return FALSE;
   htab->sfpr->contents = p;
@@ -4579,9 +4378,8 @@
    understand.  */
 
 static bfd_boolean
-ppc64_elf_adjust_dynamic_symbol (info, h)
-     struct bfd_link_info *info;
-     struct elf_link_hash_entry *h;
+ppc64_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
+				 struct elf_link_hash_entry *h)
 {
   struct ppc_link_hash_table *htab;
   asection *s;
@@ -4681,7 +4479,7 @@
      .rela.bss section we are going to use.  */
   if ((h->root.u.def.section->flags & SEC_ALLOC) != 0)
     {
-      htab->srelbss->_raw_size += sizeof (Elf64_External_Rela);
+      htab->relbss->_raw_size += sizeof (Elf64_External_Rela);
       h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY;
     }
 
@@ -4692,7 +4490,7 @@
     power_of_two = 4;
 
   /* Apply the required alignment.  */
-  s = htab->sdynbss;
+  s = htab->dynbss;
   s->_raw_size = BFD_ALIGN (s->_raw_size, (bfd_size_type) (1 << power_of_two));
   if (power_of_two > bfd_get_section_alignment (htab->elf.dynobj, s))
     {
@@ -4713,10 +4511,9 @@
 /* If given a function descriptor symbol, hide both the function code
    sym and the descriptor.  */
 static void
-ppc64_elf_hide_symbol (info, h, force_local)
-     struct bfd_link_info *info;
-     struct elf_link_hash_entry *h;
-     bfd_boolean force_local;
+ppc64_elf_hide_symbol (struct bfd_link_info *info,
+		       struct elf_link_hash_entry *h,
+		       bfd_boolean force_local)
 {
   _bfd_elf_link_hash_hide_symbol (info, h, force_local);
 
@@ -4770,14 +4567,9 @@
 }
 
 static bfd_boolean
-get_sym_h (hp, symp, symsecp, tls_maskp, locsymsp, r_symndx, ibfd)
-     struct elf_link_hash_entry **hp;
-     Elf_Internal_Sym **symp;
-     asection **symsecp;
-     char **tls_maskp;
-     Elf_Internal_Sym **locsymsp;
-     unsigned long r_symndx;
-     bfd *ibfd;
+get_sym_h (struct elf_link_hash_entry **hp, Elf_Internal_Sym **symp,
+	   asection **symsecp, char **tls_maskp, Elf_Internal_Sym **locsymsp,
+	   unsigned long r_symndx, bfd *ibfd)
 {
   Elf_Internal_Shdr *symtab_hdr = &elf_tdata (ibfd)->symtab_hdr;
 
@@ -4871,11 +4663,8 @@
    type suitable for optimization, and 1 otherwise.  */
 
 static int
-get_tls_mask (tls_maskp, locsymsp, rel, ibfd)
-     char **tls_maskp;
-     Elf_Internal_Sym **locsymsp;
-     const Elf_Internal_Rela *rel;
-     bfd *ibfd;
+get_tls_mask (char **tls_maskp, Elf_Internal_Sym **locsymsp,
+	      const Elf_Internal_Rela *rel, bfd *ibfd)
 {
   unsigned long r_symndx;
   unsigned int next_r;
@@ -4922,9 +4711,7 @@
 }
 
 bfd_boolean
-ppc64_elf_edit_opd (obfd, info)
-     bfd *obfd;
-     struct bfd_link_info *info;
+ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info)
 {
   bfd *ibfd;
 
@@ -4950,10 +4737,10 @@
 	{
 	  /* Must be a ld -r link.  ie. check_relocs hasn't been
 	     called.  */
-	  adjust = (long *) bfd_zalloc (obfd, amt);
+	  adjust = bfd_zalloc (obfd, amt);
 	  ppc64_elf_section_data (sec)->opd.adjust = adjust;
 	}
-      memset (adjust, 0, (size_t) amt);
+      memset (adjust, 0, amt);
 
       if (sec->output_section == bfd_abs_section_ptr)
 	continue;
@@ -4967,8 +4754,7 @@
       sym_hashes = elf_sym_hashes (ibfd);
 
       /* Read the relocations.  */
-      relstart = _bfd_elf_link_read_relocs (ibfd, sec, (PTR) NULL,
-					    (Elf_Internal_Rela *) NULL,
+      relstart = _bfd_elf_link_read_relocs (ibfd, sec, NULL, NULL,
 					    info->keep_memory);
       if (relstart == NULL)
 	return FALSE;
@@ -4989,7 +4775,7 @@
 	  /* .opd contains a regular array of 24 byte entries.  We're
 	     only interested in the reloc pointing to a function entry
 	     point.  */
-	  r_type = (enum elf_ppc64_reloc_type) ELF64_R_TYPE (rel->r_info);
+	  r_type = ELF64_R_TYPE (rel->r_info);
 	  if (r_type == R_PPC64_TOC)
 	    continue;
 
@@ -5004,7 +4790,7 @@
 
 	  if (rel + 1 >= relend)
 	    continue;
-	  r_type = (enum elf_ppc64_reloc_type) ELF64_R_TYPE ((rel + 1)->r_info);
+	  r_type = ELF64_R_TYPE ((rel + 1)->r_info);
 	  if (r_type != R_PPC64_TOC)
 	    continue;
 
@@ -5071,7 +4857,7 @@
 	    {
 	      bfd_byte *loc = bfd_alloc (ibfd, sec->_raw_size);
 	      if (loc == NULL
-		  || !bfd_get_section_contents (ibfd, sec, loc, (bfd_vma) 0,
+		  || !bfd_get_section_contents (ibfd, sec, loc, 0,
 						sec->_raw_size))
 		{
 		  if (local_syms != NULL
@@ -5230,9 +5016,7 @@
 /* Set htab->tls_sec.  */
 
 bfd_boolean
-ppc64_elf_tls_setup (obfd, info)
-     bfd *obfd;
-     struct bfd_link_info *info;
+ppc64_elf_tls_setup (bfd *obfd, struct bfd_link_info *info)
 {
   asection *tls;
   struct ppc_link_hash_table *htab;
@@ -5267,9 +5051,7 @@
    dynamic relocations.  */
 
 bfd_boolean
-ppc64_elf_tls_optimize (obfd, info)
-     bfd *obfd ATTRIBUTE_UNUSED;
-     struct bfd_link_info *info;
+ppc64_elf_tls_optimize (bfd *obfd ATTRIBUTE_UNUSED, struct bfd_link_info *info)
 {
   bfd *ibfd;
   asection *sec;
@@ -5290,8 +5072,7 @@
 	    int expecting_tls_get_addr;
 
 	    /* Read the relocations.  */
-	    relstart = _bfd_elf_link_read_relocs (ibfd, sec, (PTR) NULL,
-						  (Elf_Internal_Rela *) NULL,
+	    relstart = _bfd_elf_link_read_relocs (ibfd, sec, NULL, NULL,
 						  info->keep_memory);
 	    if (relstart == NULL)
 	      return FALSE;
@@ -5347,8 +5128,7 @@
 				< (bfd_vma) 1 << 32);
 		  }
 
-		r_type
-		  = (enum elf_ppc64_reloc_type) ELF64_R_TYPE (rel->r_info);
+		r_type = ELF64_R_TYPE (rel->r_info);
 		switch (r_type)
 		  {
 		  case R_PPC64_GOT_TLSLD16:
@@ -5569,9 +5349,7 @@
    dynamic relocs.  */
 
 static bfd_boolean
-allocate_dynrelocs (h, inf)
-     struct elf_link_hash_entry *h;
-     PTR inf;
+allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
 {
   struct bfd_link_info *info;
   struct ppc_link_hash_table *htab;
@@ -5602,7 +5380,7 @@
 
 	    /* If this is the first .plt entry, make room for the special
 	       first entry.  */
-	    s = htab->splt;
+	    s = htab->plt;
 	    if (s->_raw_size == 0)
 	      s->_raw_size += PLT_INITIAL_ENTRY_SIZE;
 
@@ -5612,7 +5390,7 @@
 	    s->_raw_size += PLT_ENTRY_SIZE;
 
 	    /* Make room for the .glink code.  */
-	    s = htab->sglink;
+	    s = htab->glink;
 	    if (s->_raw_size == 0)
 	      s->_raw_size += GLINK_CALL_STUB_SIZE;
 	    /* We need bigger stubs past index 32767.  */
@@ -5621,7 +5399,7 @@
 	    s->_raw_size += 2*4;
 
 	    /* We also need to make an entry in the .rela.plt section.  */
-	    s = htab->srelplt;
+	    s = htab->relplt;
 	    s->_raw_size += sizeof (Elf64_External_Rela);
 	    doneone = TRUE;
 	  }
@@ -5686,7 +5464,7 @@
 	    continue;
 	  }
 
-	s = htab->sgot;
+	s = htab->got;
 	gent->got.offset = s->_raw_size;
 	s->_raw_size
 	  += (gent->tls_type & eh->tls_mask & (TLS_GD | TLS_LD)) ? 16 : 8;
@@ -5695,7 +5473,7 @@
 	     || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h))
 	    && (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
 		|| h->root.type != bfd_link_hash_undefweak))
-	  htab->srelgot->_raw_size
+	  htab->relgot->_raw_size
 	    += (gent->tls_type & eh->tls_mask & TLS_GD
 		? 2 * sizeof (Elf64_External_Rela)
 		: sizeof (Elf64_External_Rela));
@@ -5784,9 +5562,7 @@
 /* Find any dynamic relocs that apply to read-only sections.  */
 
 static bfd_boolean
-readonly_dynrelocs (h, inf)
-     struct elf_link_hash_entry *h;
-     PTR inf;
+readonly_dynrelocs (struct elf_link_hash_entry *h, void *inf)
 {
   struct ppc_link_hash_entry *eh;
   struct ppc_dyn_relocs *p;
@@ -5801,7 +5577,7 @@
 
       if (s != NULL && (s->flags & SEC_READONLY) != 0)
 	{
-	  struct bfd_link_info *info = (struct bfd_link_info *) inf;
+	  struct bfd_link_info *info = inf;
 
 	  info->flags |= DF_TEXTREL;
 
@@ -5815,9 +5591,8 @@
 /* Set the sizes of the dynamic sections.  */
 
 static bfd_boolean
-ppc64_elf_size_dynamic_sections (output_bfd, info)
-     bfd *output_bfd ATTRIBUTE_UNUSED;
-     struct bfd_link_info *info;
+ppc64_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
+				 struct bfd_link_info *info)
 {
   struct ppc_link_hash_table *htab;
   bfd *dynobj;
@@ -5845,10 +5620,10 @@
 
   if (htab->tlsld_got.refcount > 0)
     {
-      htab->tlsld_got.offset = htab->sgot->_raw_size;
-      htab->sgot->_raw_size += 16;
+      htab->tlsld_got.offset = htab->got->_raw_size;
+      htab->got->_raw_size += 16;
       if (info->shared)
-	htab->srelgot->_raw_size += sizeof (Elf64_External_Rela);
+	htab->relgot->_raw_size += sizeof (Elf64_External_Rela);
     }
   else
     htab->tlsld_got.offset = (bfd_vma) -1;
@@ -5902,8 +5677,8 @@
       locsymcount = symtab_hdr->sh_info;
       end_lgot_ents = lgot_ents + locsymcount;
       lgot_masks = (char *) end_lgot_ents;
-      s = htab->sgot;
-      srel = htab->srelgot;
+      s = htab->got;
+      srel = htab->relgot;
       for (; lgot_ents < end_lgot_ents; ++lgot_ents, ++lgot_masks)
 	{
 	  struct got_entry *ent;
@@ -5946,7 +5721,7 @@
 
   /* Allocate global sym .plt and .got entries, and space for global
      sym dynamic relocs.  */
-  elf_link_hash_traverse (&htab->elf, allocate_dynrelocs, (PTR) info);
+  elf_link_hash_traverse (&htab->elf, allocate_dynrelocs, info);
 
   /* We now have determined the sizes of the various dynamic sections.
      Allocate memory for them.  */
@@ -5960,10 +5735,10 @@
 	 and a non-zero _cooked_size sticks.  */
       s->_cooked_size = 0;
 
-      if (s == htab->sbrlt || s == htab->srelbrlt)
+      if (s == htab->brlt || s == htab->relbrlt)
 	/* These haven't been allocated yet;  don't strip.  */
 	continue;
-      else if (s == htab->sgot)
+      else if (s == htab->got)
 	{
 	  /* Automatic multiple tocs aren't possible if we are using the
 	     GOT.  The GOT is accessed via r2, so we can't adjust r2.
@@ -5972,8 +5747,8 @@
 	  if (s->_raw_size > elf_backend_got_header_size)
 	    htab->no_multi_toc = 1;
 	}
-      else if (s == htab->splt
-	       || s == htab->sglink)
+      else if (s == htab->plt
+	       || s == htab->glink)
 	{
 	  /* Strip this section if we don't need it; see the
 	     comment below.  */
@@ -5994,7 +5769,7 @@
 	    }
 	  else
 	    {
-	      if (s != htab->srelplt)
+	      if (s != htab->relplt)
 		relocs = TRUE;
 
 	      /* We use the reloc_count field as a counter if we need
@@ -6025,7 +5800,7 @@
 	 sections instead of garbage.
 	 We also rely on the section contents being zero when writing
 	 the GOT.  */
-      s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size);
+      s->contents = bfd_zalloc (dynobj, s->_raw_size);
       if (s->contents == NULL)
 	return FALSE;
     }
@@ -6038,7 +5813,7 @@
 	 the .dynamic section.  The DT_DEBUG entry is filled in by the
 	 dynamic linker and used by the debugger.  */
 #define add_dynamic_entry(TAG, VAL) \
-  bfd_elf64_add_dynamic_entry (info, (bfd_vma) (TAG), (bfd_vma) (VAL))
+  bfd_elf64_add_dynamic_entry (info, (TAG), (VAL))
 
       if (info->executable)
 	{
@@ -6046,7 +5821,7 @@
 	    return FALSE;
 	}
 
-      if (htab->splt != NULL && htab->splt->_raw_size != 0)
+      if (htab->plt != NULL && htab->plt->_raw_size != 0)
 	{
 	  if (!add_dynamic_entry (DT_PLTGOT, 0)
 	      || !add_dynamic_entry (DT_PLTRELSZ, 0)
@@ -6073,8 +5848,7 @@
 	  /* If any dynamic relocs apply to a read-only section,
 	     then we need a DT_TEXTREL entry.  */
 	  if ((info->flags & DF_TEXTREL) == 0)
-	    elf_link_hash_traverse (&htab->elf, readonly_dynrelocs,
-				    (PTR) info);
+	    elf_link_hash_traverse (&htab->elf, readonly_dynrelocs, info);
 
 	  if ((info->flags & DF_TEXTREL) != 0)
 	    {
@@ -6090,18 +5864,17 @@
 
 /* Determine the type of stub needed, if any, for a call.  */
 
-static INLINE enum ppc_stub_type
-ppc_type_of_stub (input_sec, rel, hash, destination)
-     asection *input_sec;
-     const Elf_Internal_Rela *rel;
-     struct ppc_link_hash_entry **hash;
-     bfd_vma destination;
+static inline enum ppc_stub_type
+ppc_type_of_stub (asection *input_sec,
+		  const Elf_Internal_Rela *rel,
+		  struct ppc_link_hash_entry **hash,
+		  bfd_vma destination)
 {
   struct ppc_link_hash_entry *h = *hash;
   bfd_vma location;
   bfd_vma branch_offset;
   bfd_vma max_branch_offset;
-  unsigned int r_type;
+  enum elf_ppc64_reloc_type r_type;
 
   if (h != NULL)
     {
@@ -6133,7 +5906,7 @@
 
   /* Determine if a long branch stub is needed.  */
   max_branch_offset = 1 << 25;
-  if (r_type != (unsigned int) R_PPC64_REL24)
+  if (r_type != R_PPC64_REL24)
     max_branch_offset = 1 << 15;
 
   if (branch_offset + max_branch_offset >= 2 * max_branch_offset)
@@ -6146,11 +5919,8 @@
 
 /* Build a .plt call stub.  */
 
-static bfd_byte *
-build_plt_stub (obfd, p, offset)
-     bfd *obfd;
-     bfd_byte *p;
-     int offset;
+static inline bfd_byte *
+build_plt_stub (bfd *obfd, bfd_byte *p, int offset)
 {
 #define PPC_LO(v) ((v) & 0xffff)
 #define PPC_HI(v) (((v) >> 16) & 0xffff)
@@ -6173,9 +5943,7 @@
 }
 
 static bfd_boolean
-ppc_build_one_stub (gen_entry, in_arg)
-     struct bfd_hash_entry *gen_entry;
-     PTR in_arg;
+ppc_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
 {
   struct ppc_stub_hash_entry *stub_entry;
   struct ppc_branch_hash_entry *br_entry;
@@ -6192,7 +5960,7 @@
 
   /* Massage our args to the form they really have.  */
   stub_entry = (struct ppc_stub_hash_entry *) gen_entry;
-  info = (struct bfd_link_info *) in_arg;
+  info = in_arg;
 
   htab = ppc_hash_table (info);
   stub_sec = stub_entry->stub_sec;
@@ -6219,6 +5987,7 @@
 
   stub_bfd = stub_sec->owner;
 
+  htab->stub_count[stub_entry->stub_type - 1] += 1;
   switch (stub_entry->stub_type)
     {
     case ppc_stub_long_branch:
@@ -6241,16 +6010,16 @@
 
 	  r2off = (htab->stub_group[stub_entry->target_section->id].toc_off
 		   - htab->stub_group[stub_entry->id_sec->id].toc_off);
-	  bfd_put_32 (stub_bfd, (bfd_vma) STD_R2_40R1, loc);
+	  bfd_put_32 (stub_bfd, STD_R2_40R1, loc);
 	  loc += 4;
-	  bfd_put_32 (stub_bfd, (bfd_vma) ADDIS_R2_R2 | PPC_HA (r2off), loc);
+	  bfd_put_32 (stub_bfd, ADDIS_R2_R2 | PPC_HA (r2off), loc);
 	  loc += 4;
-	  bfd_put_32 (stub_bfd, (bfd_vma) ADDI_R2_R2 | PPC_LO (r2off), loc);
+	  bfd_put_32 (stub_bfd, ADDI_R2_R2 | PPC_LO (r2off), loc);
 	  loc += 4;
 	  off -= 12;
 	  size = 16;
 	}
-      bfd_put_32 (stub_bfd, (bfd_vma) B_DOT | (off & 0x3fffffc), loc);
+      bfd_put_32 (stub_bfd, B_DOT | (off & 0x3fffffc), loc);
 
       BFD_ASSERT (off + (1 << 25) < (bfd_vma) (1 << 26));
       break;
@@ -6272,8 +6041,8 @@
 	     + stub_entry->target_section->output_offset
 	     + stub_entry->target_section->output_section->vma);
 
-      bfd_put_64 (htab->sbrlt->owner, off,
-		  htab->sbrlt->contents + br_entry->offset);
+      bfd_put_64 (htab->brlt->owner, off,
+		  htab->brlt->contents + br_entry->offset);
 
       if (info->shared)
 	{
@@ -6282,20 +6051,20 @@
 	  bfd_byte *rl;
 
 	  rela.r_offset = (br_entry->offset
-			   + htab->sbrlt->output_offset
-			   + htab->sbrlt->output_section->vma);
+			   + htab->brlt->output_offset
+			   + htab->brlt->output_section->vma);
 	  rela.r_info = ELF64_R_INFO (0, R_PPC64_RELATIVE);
 	  rela.r_addend = off;
 
-	  rl = htab->srelbrlt->contents;
-	  rl += htab->srelbrlt->reloc_count++ * sizeof (Elf64_External_Rela);
-	  bfd_elf64_swap_reloca_out (htab->srelbrlt->owner, &rela, rl);
+	  rl = htab->relbrlt->contents;
+	  rl += htab->relbrlt->reloc_count++ * sizeof (Elf64_External_Rela);
+	  bfd_elf64_swap_reloca_out (htab->relbrlt->owner, &rela, rl);
 	}
 
       off = (br_entry->offset
-	     + htab->sbrlt->output_offset
-	     + htab->sbrlt->output_section->vma
-	     - elf_gp (htab->sbrlt->output_section->owner)
+	     + htab->brlt->output_offset
+	     + htab->brlt->output_section->vma
+	     - elf_gp (htab->brlt->output_section->owner)
 	     - htab->stub_group[stub_entry->id_sec->id].toc_off);
 
       if (off + 0x80008000 > 0xffffffff || (off & 7) != 0)
@@ -6311,9 +6080,9 @@
       indx = off;
       if (stub_entry->stub_type != ppc_stub_plt_branch_r2off)
 	{
-	  bfd_put_32 (stub_bfd, (bfd_vma) ADDIS_R12_R2 | PPC_HA (indx), loc);
+	  bfd_put_32 (stub_bfd, ADDIS_R12_R2 | PPC_HA (indx), loc);
 	  loc += 4;
-	  bfd_put_32 (stub_bfd, (bfd_vma) LD_R11_0R12 | PPC_LO (indx), loc);
+	  bfd_put_32 (stub_bfd, LD_R11_0R12 | PPC_LO (indx), loc);
 	  size = 16;
 	}
       else
@@ -6322,21 +6091,21 @@
 
 	  r2off = (htab->stub_group[stub_entry->target_section->id].toc_off
 		   - htab->stub_group[stub_entry->id_sec->id].toc_off);
-	  bfd_put_32 (stub_bfd, (bfd_vma) STD_R2_40R1, loc);
+	  bfd_put_32 (stub_bfd, STD_R2_40R1, loc);
 	  loc += 4;
-	  bfd_put_32 (stub_bfd, (bfd_vma) ADDIS_R12_R2 | PPC_HA (indx), loc);
+	  bfd_put_32 (stub_bfd, ADDIS_R12_R2 | PPC_HA (indx), loc);
 	  loc += 4;
-	  bfd_put_32 (stub_bfd, (bfd_vma) LD_R11_0R12 | PPC_LO (indx), loc);
+	  bfd_put_32 (stub_bfd, LD_R11_0R12 | PPC_LO (indx), loc);
 	  loc += 4;
-	  bfd_put_32 (stub_bfd, (bfd_vma) ADDIS_R2_R2 | PPC_HA (r2off), loc);
+	  bfd_put_32 (stub_bfd, ADDIS_R2_R2 | PPC_HA (r2off), loc);
 	  loc += 4;
-	  bfd_put_32 (stub_bfd, (bfd_vma) ADDI_R2_R2 | PPC_LO (r2off), loc);
+	  bfd_put_32 (stub_bfd, ADDI_R2_R2 | PPC_LO (r2off), loc);
 	  size = 28;
 	}
       loc += 4;
-      bfd_put_32 (stub_bfd, (bfd_vma) MTCTR_R11, loc);
+      bfd_put_32 (stub_bfd, MTCTR_R11, loc);
       loc += 4;
-      bfd_put_32 (stub_bfd, (bfd_vma) BCTR, loc);
+      bfd_put_32 (stub_bfd, BCTR, loc);
       break;
 
     case ppc_stub_plt_call:
@@ -6348,7 +6117,9 @@
 	{
 	  /* Point the symbol at the stub.  There may be multiple stubs,
 	     we don't really care;  The main thing is to make this sym
-	     defined somewhere.  */
+	     defined somewhere.  Maybe defining the symbol in the stub
+	     section is a silly idea.  If we didn't do this, htab->top_id
+	     could disappear.  */
 	  stub_entry->h->oh->root.type = bfd_link_hash_defined;
 	  stub_entry->h->oh->root.u.def.section = stub_entry->stub_sec;
 	  stub_entry->h->oh->root.u.def.value = stub_entry->stub_offset;
@@ -6366,9 +6137,9 @@
 	abort ();
 
       off &= ~ (bfd_vma) 1;
-      off += (htab->splt->output_offset
-	      + htab->splt->output_section->vma
-	      - elf_gp (htab->splt->output_section->owner)
+      off += (htab->plt->output_offset
+	      + htab->plt->output_section->vma
+	      - elf_gp (htab->plt->output_section->owner)
 	      - htab->stub_group[stub_entry->id_sec->id].toc_off);
 
       if (off + 0x80008000 > 0xffffffff || (off & 7) != 0)
@@ -6381,7 +6152,7 @@
 	  return FALSE;
 	}
 
-      p = build_plt_stub (stub_bfd, loc, (int) off);
+      p = build_plt_stub (stub_bfd, loc, off);
       size = p - loc;
       break;
 
@@ -6399,9 +6170,7 @@
    long_branch stubs won't do.  */
 
 static bfd_boolean
-ppc_size_one_stub (gen_entry, in_arg)
-     struct bfd_hash_entry *gen_entry;
-     PTR in_arg;
+ppc_size_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
 {
   struct ppc_stub_hash_entry *stub_entry;
   struct ppc_link_hash_table *htab;
@@ -6410,7 +6179,7 @@
 
   /* Massage our args to the form they really have.  */
   stub_entry = (struct ppc_stub_hash_entry *) gen_entry;
-  htab = (struct ppc_link_hash_table *) in_arg;
+  htab = in_arg;
 
   if (stub_entry->stub_type == ppc_stub_plt_call)
     {
@@ -6424,13 +6193,13 @@
 	  }
       if (off >= (bfd_vma) -2)
 	abort ();
-      off += (htab->splt->output_offset
-	      + htab->splt->output_section->vma
-	      - elf_gp (htab->splt->output_section->owner)
+      off += (htab->plt->output_offset
+	      + htab->plt->output_section->vma
+	      - elf_gp (htab->plt->output_section->owner)
 	      - htab->stub_group[stub_entry->id_sec->id].toc_off);
 
       size = PLT_CALL_STUB_SIZE;
-      if (PPC_HA ((int) off + 16) != PPC_HA ((int) off))
+      if (PPC_HA (off + 16) != PPC_HA (off))
 	size += 4;
     }
   else
@@ -6475,8 +6244,8 @@
 	  if (br_entry->iter != htab->stub_iteration)
 	    {
 	      br_entry->iter = htab->stub_iteration;
-	      br_entry->offset = htab->sbrlt->_raw_size;
-	      htab->sbrlt->_raw_size += 8;
+	      br_entry->offset = htab->brlt->_raw_size;
+	      htab->brlt->_raw_size += 8;
 	    }
 
 	  stub_entry->stub_type += ppc_stub_plt_branch - ppc_stub_long_branch;
@@ -6495,22 +6264,20 @@
    0 when no stubs will be needed, and 1 on success.  */
 
 int
-ppc64_elf_setup_section_lists (output_bfd, info)
-     bfd *output_bfd;
-     struct bfd_link_info *info;
+ppc64_elf_setup_section_lists (bfd *output_bfd, struct bfd_link_info *info)
 {
   bfd *input_bfd;
-  int top_id, top_index;
+  int top_id, top_index, id;
   asection *section;
-  asection **input_list, **list;
+  asection **input_list;
   bfd_size_type amt;
   struct ppc_link_hash_table *htab = ppc_hash_table (info);
 
-  if (htab->sbrlt == NULL)
+  if (htab->brlt == NULL)
     return 0;
 
   /* Find the top input section id.  */
-  for (input_bfd = info->input_bfds, top_id = 0;
+  for (input_bfd = info->input_bfds, top_id = 3;
        input_bfd != NULL;
        input_bfd = input_bfd->link_next)
     {
@@ -6523,11 +6290,16 @@
 	}
     }
 
+  htab->top_id = top_id;
   amt = sizeof (struct map_stub) * (top_id + 1);
-  htab->stub_group = (struct map_stub *) bfd_zmalloc (amt);
+  htab->stub_group = bfd_zmalloc (amt);
   if (htab->stub_group == NULL)
     return -1;
 
+  /* Set toc_off for com, und, abs and ind sections.  */
+  for (id = 0; id < 3; id++)
+    htab->stub_group[id].toc_off = TOC_BASE_OFF;
+
   elf_gp (output_bfd) = htab->toc_curr = ppc64_elf_toc (output_bfd);
 
   /* We can't use output_bfd->section_count here to find the top output
@@ -6543,26 +6315,11 @@
 
   htab->top_index = top_index;
   amt = sizeof (asection *) * (top_index + 1);
-  input_list = (asection **) bfd_malloc (amt);
+  input_list = bfd_zmalloc (amt);
   htab->input_list = input_list;
   if (input_list == NULL)
     return -1;
 
-  /* For sections we aren't interested in, mark their entries with a
-     value we can check later.  */
-  list = input_list + top_index;
-  do
-    *list = bfd_abs_section_ptr;
-  while (list-- != input_list);
-
-  for (section = output_bfd->sections;
-       section != NULL;
-       section = section->next)
-    {
-      if ((section->flags & SEC_CODE) != 0)
-	input_list[section->index] = NULL;
-    }
-
   return 1;
 }
 
@@ -6572,9 +6329,7 @@
    that play games with dot in the output toc section.  */
 
 void
-ppc64_elf_next_toc_section (info, isec)
-     struct bfd_link_info *info;
-     asection *isec;
+ppc64_elf_next_toc_section (struct bfd_link_info *info, asection *isec)
 {
   struct ppc_link_hash_table *htab = ppc_hash_table (info);
 
@@ -6596,27 +6351,71 @@
 /* Called after the last call to the above function.  */
 
 void
-ppc64_elf_reinit_toc (output_bfd, info)
-     bfd *output_bfd ATTRIBUTE_UNUSED;
-     struct bfd_link_info *info;
+ppc64_elf_reinit_toc (bfd *output_bfd ATTRIBUTE_UNUSED,
+		      struct bfd_link_info *info)
 {
   struct ppc_link_hash_table *htab = ppc_hash_table (info);
-  bfd *ibfd;
-  bfd_vma curr;
 
   /* toc_curr tracks the TOC offset used for code sections below in
      ppc64_elf_next_input_section.  Start off at 0x8000.  */
-  htab->toc_curr = curr = TOC_BASE_OFF;
+  htab->toc_curr = TOC_BASE_OFF;
+}
 
-  /* Set the TOC base in all input bfds.  Some may not have a TOC
-     section and thus not be set in ppc64_elf_next_toc_section.  */
-  for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
+/* No toc references were found in ISEC.  If the code in ISEC makes no
+   calls, then there's no need to use toc adjusting stubs when branching
+   into ISEC.  Actually, indirect calls from ISEC are OK as they will
+   load r2.  */
+
+static int
+toc_adjusting_stub_needed (struct bfd_link_info *info, asection *isec)
+{
+  bfd_byte *contents;
+  bfd_size_type i;
+  int ret;
+  int branch_ok;
+
+  /* Hack for linux kernel.  .fixup contains branches, but only back to
+     the function that hit an exception.  */
+  branch_ok = strcmp (isec->name, ".fixup") == 0;
+
+  contents = elf_section_data (isec)->this_hdr.contents;
+  if (contents == NULL)
     {
-      if (elf_gp (ibfd) == 0)
-	elf_gp (ibfd) = curr;
-      else
-	curr = elf_gp (ibfd);
+      contents = bfd_malloc (isec->_raw_size);
+      if (contents == NULL)
+	return -1;
+      if (! bfd_get_section_contents (isec->owner, isec, contents,
+				      (file_ptr) 0, isec->_raw_size))
+	{
+	  free (contents);
+	  return -1;
+	}
+      if (info->keep_memory)
+	elf_section_data (isec)->this_hdr.contents = contents;
     }
+
+  /* Code scan, because we don't necessarily have relocs on calls to
+     static functions.  */
+  ret = 0;
+  for (i = 0; i < isec->_raw_size; i += 4)
+    {
+      unsigned long insn = bfd_get_32 (isec->owner, contents + i);
+      /* Is this a branch?  */
+      if ((insn & (0x1f << 26)) == (18 << 26)
+	  /* If branch and link, it's a function call.  */
+	  && ((insn & 1) != 0
+	      /* Sibling calls use a plain branch.  I don't know a way
+		 of deciding whether a branch is really a sibling call.  */
+	      || !branch_ok))
+	{
+	  ret = 1;
+	  break;
+	}
+    }
+
+  if (elf_section_data (isec)->this_hdr.contents != contents)
+    free (contents);
+  return ret;
 }
 
 /* The linker repeatedly calls this function for each input section,
@@ -6624,37 +6423,42 @@
    Build lists of input sections to determine groupings between which
    we may insert linker stubs.  */
 
-void
-ppc64_elf_next_input_section (info, isec)
-     struct bfd_link_info *info;
-     asection *isec;
+bfd_boolean
+ppc64_elf_next_input_section (struct bfd_link_info *info, asection *isec)
 {
   struct ppc_link_hash_table *htab = ppc_hash_table (info);
+  int ret;
 
-  if (isec->output_section->index <= htab->top_index)
+  if ((isec->output_section->flags & SEC_CODE) != 0
+      && isec->output_section->index <= htab->top_index)
     {
       asection **list = htab->input_list + isec->output_section->index;
-      if (*list != bfd_abs_section_ptr)
-	{
-	  /* Steal the link_sec pointer for our list.  */
+      /* Steal the link_sec pointer for our list.  */
 #define PREV_SEC(sec) (htab->stub_group[(sec)->id].link_sec)
-	  /* This happens to make the list in reverse order,
-	     which is what we want.  */
-	  PREV_SEC (isec) = *list;
-	  *list = isec;
-	}
+      /* This happens to make the list in reverse order,
+	 which is what we want.  */
+      PREV_SEC (isec) = *list;
+      *list = isec;
     }
 
   /* If a code section has a function that uses the TOC then we need
      to use the right TOC (obviously).  Also, make sure that .opd gets
      the correct TOC value.  */
   if (isec->has_gp_reloc || (isec->flags & SEC_CODE) == 0)
-    htab->toc_curr = elf_gp (isec->owner);
+    {
+      if (elf_gp (isec->owner) != 0)
+	htab->toc_curr = elf_gp (isec->owner);
+    }
+  else if ((ret = toc_adjusting_stub_needed (info, isec)) < 0)
+    return FALSE;
+  else
+    isec->has_gp_reloc = ret;
 
   /* Functions that don't use the TOC can belong in any TOC group.
      Use the last TOC base.  This happens to make _init and _fini
      pasting work.  */
   htab->stub_group[isec->id].toc_off = htab->toc_curr;
+  return TRUE;
 }
 
 /* See whether we can group stub sections together.  Grouping stub
@@ -6665,17 +6469,14 @@
    the middle of a function is not a good idea.  */
 
 static void
-group_sections (htab, stub_group_size, stubs_always_before_branch)
-     struct ppc_link_hash_table *htab;
-     bfd_size_type stub_group_size;
-     bfd_boolean stubs_always_before_branch;
+group_sections (struct ppc_link_hash_table *htab,
+		bfd_size_type stub_group_size,
+		bfd_boolean stubs_always_before_branch)
 {
   asection **list = htab->input_list + htab->top_index;
   do
     {
       asection *tail = *list;
-      if (tail == bfd_abs_section_ptr)
-	continue;
       while (tail != NULL)
 	{
 	  asection *curr;
@@ -6749,14 +6550,12 @@
    instruction.  */
 
 bfd_boolean
-ppc64_elf_size_stubs (output_bfd, stub_bfd, info, group_size,
-		      add_stub_section, layout_sections_again)
-     bfd *output_bfd;
-     bfd *stub_bfd;
-     struct bfd_link_info *info;
-     bfd_signed_vma group_size;
-     asection * (*add_stub_section) PARAMS ((const char *, asection *));
-     void (*layout_sections_again) PARAMS ((void));
+ppc64_elf_size_stubs (bfd *output_bfd,
+		      bfd *stub_bfd,
+		      struct bfd_link_info *info,
+		      bfd_signed_vma group_size,
+		      asection *(*add_stub_section) (const char *, asection *),
+		      void (*layout_sections_again) (void))
 {
   bfd_size_type stub_group_size;
   bfd_boolean stubs_always_before_branch;
@@ -6834,8 +6633,7 @@
 
 	      /* Get the relocs.  */
 	      internal_relocs
-		= _bfd_elf_link_read_relocs (input_bfd, section, NULL,
-					     (Elf_Internal_Rela *) NULL,
+		= _bfd_elf_link_read_relocs (input_bfd, section, NULL, NULL,
 					     info->keep_memory);
 	      if (internal_relocs == NULL)
 		goto error_ret_free_local;
@@ -6845,7 +6643,8 @@
 	      irelaend = irela + section->reloc_count;
 	      for (; irela < irelaend; irela++)
 		{
-		  unsigned int r_type, r_indx;
+		  enum elf_ppc64_reloc_type r_type;
+		  unsigned int r_indx;
 		  enum ppc_stub_type stub_type;
 		  struct ppc_stub_hash_entry *stub_entry;
 		  asection *sym_sec;
@@ -6860,17 +6659,17 @@
 		  r_type = ELF64_R_TYPE (irela->r_info);
 		  r_indx = ELF64_R_SYM (irela->r_info);
 
-		  if (r_type >= (unsigned int) R_PPC64_max)
+		  if (r_type >= R_PPC64_max)
 		    {
 		      bfd_set_error (bfd_error_bad_value);
 		      goto error_ret_free_internal;
 		    }
 
 		  /* Only look for stubs on branch instructions.  */
-		  if (r_type != (unsigned int) R_PPC64_REL24
-		      && r_type != (unsigned int) R_PPC64_REL14
-		      && r_type != (unsigned int) R_PPC64_REL14_BRTAKEN
-		      && r_type != (unsigned int) R_PPC64_REL14_BRNTAKEN)
+		  if (r_type != R_PPC64_REL24
+		      && r_type != R_PPC64_REL14
+		      && r_type != R_PPC64_REL14_BRTAKEN
+		      && r_type != R_PPC64_REL14_BRNTAKEN)
 		    continue;
 
 		  /* Now determine the call target, its name, value,
@@ -6928,7 +6727,9 @@
 		      if (sym_sec != NULL
 			  && sym_sec->output_section != NULL
 			  && (htab->stub_group[sym_sec->id].toc_off
-			      != htab->stub_group[section->id].toc_off))
+			      != htab->stub_group[section->id].toc_off)
+			  && sym_sec->has_gp_reloc
+			  && section->has_gp_reloc)
 			stub_type = ppc_stub_long_branch_r2off;
 		    }
 
@@ -7019,8 +6820,8 @@
 	  stub_sec->_raw_size = 0;
 	  stub_sec->_cooked_size = 0;
 	}
-      htab->sbrlt->_raw_size = 0;
-      htab->sbrlt->_cooked_size = 0;
+      htab->brlt->_raw_size = 0;
+      htab->brlt->_cooked_size = 0;
 
       bfd_hash_traverse (&htab->stub_hash_table, ppc_size_one_stub, htab);
 
@@ -7040,8 +6841,7 @@
    move, we'll be called again.  Provide a value for TOCstart.  */
 
 bfd_vma
-ppc64_elf_toc (obfd)
-     bfd *obfd;
+ppc64_elf_toc (bfd *obfd)
 {
   asection *s;
   bfd_vma TOCstart;
@@ -7098,9 +6898,9 @@
    hash table.  This function is called via gldelf64ppc_finish.  */
 
 bfd_boolean
-ppc64_elf_build_stubs (emit_stub_syms, info)
-     bfd_boolean emit_stub_syms;
-     struct bfd_link_info *info;
+ppc64_elf_build_stubs (bfd_boolean emit_stub_syms,
+		       struct bfd_link_info *info,
+		       char **stats)
 {
   struct ppc_link_hash_table *htab = ppc_hash_table (info);
   asection *stub_sec;
@@ -7117,23 +6917,23 @@
       size = stub_sec->_raw_size;
       if (size != 0)
 	{
-	  stub_sec->contents = (bfd_byte *) bfd_zalloc (htab->stub_bfd, size);
+	  stub_sec->contents = bfd_zalloc (htab->stub_bfd, size);
 	  if (stub_sec->contents == NULL)
 	    return FALSE;
 	}
       stub_sec->_cooked_size = 0;
     }
 
-  if (htab->splt != NULL)
+  if (htab->plt != NULL)
     {
       unsigned int indx;
       bfd_vma plt0;
 
       /* Build the .glink plt call stub.  */
-      plt0 = (htab->splt->output_section->vma
-	      + htab->splt->output_offset
-	      - (htab->sglink->output_section->vma
-		 + htab->sglink->output_offset
+      plt0 = (htab->plt->output_section->vma
+	      + htab->plt->output_offset
+	      - (htab->glink->output_section->vma
+		 + htab->glink->output_offset
 		 + GLINK_CALL_STUB_SIZE));
       if (plt0 + 0x80008000 > 0xffffffff)
 	{
@@ -7142,69 +6942,69 @@
 	  return FALSE;
 	}
 
-      p = htab->sglink->contents;
-      bfd_put_32 (htab->sglink->owner, MFCTR_R12, p);
+      p = htab->glink->contents;
+      bfd_put_32 (htab->glink->owner, MFCTR_R12, p);
       p += 4;
-      bfd_put_32 (htab->sglink->owner, SLDI_R11_R0_3, p);
+      bfd_put_32 (htab->glink->owner, SLDI_R11_R0_3, p);
       p += 4;
-      bfd_put_32 (htab->sglink->owner, ADDIC_R2_R0_32K, p);
+      bfd_put_32 (htab->glink->owner, ADDIC_R2_R0_32K, p);
       p += 4;
-      bfd_put_32 (htab->sglink->owner, SUB_R12_R12_R11, p);
+      bfd_put_32 (htab->glink->owner, SUB_R12_R12_R11, p);
       p += 4;
-      bfd_put_32 (htab->sglink->owner, SRADI_R2_R2_63, p);
+      bfd_put_32 (htab->glink->owner, SRADI_R2_R2_63, p);
       p += 4;
-      bfd_put_32 (htab->sglink->owner, SLDI_R11_R0_2, p);
+      bfd_put_32 (htab->glink->owner, SLDI_R11_R0_2, p);
       p += 4;
-      bfd_put_32 (htab->sglink->owner, AND_R2_R2_R11, p);
+      bfd_put_32 (htab->glink->owner, AND_R2_R2_R11, p);
       p += 4;
-      bfd_put_32 (htab->sglink->owner, SUB_R12_R12_R11, p);
+      bfd_put_32 (htab->glink->owner, SUB_R12_R12_R11, p);
       p += 4;
-      bfd_put_32 (htab->sglink->owner, ADD_R12_R12_R2, p);
+      bfd_put_32 (htab->glink->owner, ADD_R12_R12_R2, p);
       p += 4;
-      bfd_put_32 (htab->sglink->owner, ADDIS_R12_R12 | PPC_HA (plt0), p);
+      bfd_put_32 (htab->glink->owner, ADDIS_R12_R12 | PPC_HA (plt0), p);
       p += 4;
-      bfd_put_32 (htab->sglink->owner, LD_R11_0R12 | PPC_LO (plt0), p);
+      bfd_put_32 (htab->glink->owner, LD_R11_0R12 | PPC_LO (plt0), p);
       p += 4;
-      bfd_put_32 (htab->sglink->owner, ADDI_R12_R12 | PPC_LO (plt0), p);
+      bfd_put_32 (htab->glink->owner, ADDI_R12_R12 | PPC_LO (plt0), p);
       p += 4;
-      bfd_put_32 (htab->sglink->owner, LD_R2_0R12 | 8, p);
+      bfd_put_32 (htab->glink->owner, LD_R2_0R12 | 8, p);
       p += 4;
-      bfd_put_32 (htab->sglink->owner, MTCTR_R11, p);
+      bfd_put_32 (htab->glink->owner, MTCTR_R11, p);
       p += 4;
-      bfd_put_32 (htab->sglink->owner, LD_R11_0R12 | 16, p);
+      bfd_put_32 (htab->glink->owner, LD_R11_0R12 | 16, p);
       p += 4;
-      bfd_put_32 (htab->sglink->owner, BCTR, p);
+      bfd_put_32 (htab->glink->owner, BCTR, p);
       p += 4;
 
       /* Build the .glink lazy link call stubs.  */
       indx = 0;
-      while (p < htab->sglink->contents + htab->sglink->_raw_size)
+      while (p < htab->glink->contents + htab->glink->_raw_size)
 	{
 	  if (indx < 0x8000)
 	    {
-	      bfd_put_32 (htab->sglink->owner, LI_R0_0 | indx, p);
+	      bfd_put_32 (htab->glink->owner, LI_R0_0 | indx, p);
 	      p += 4;
 	    }
 	  else
 	    {
-	      bfd_put_32 (htab->sglink->owner, LIS_R0_0 | PPC_HI (indx), p);
+	      bfd_put_32 (htab->glink->owner, LIS_R0_0 | PPC_HI (indx), p);
 	      p += 4;
-	      bfd_put_32 (htab->sglink->owner, ORI_R0_R0_0 | PPC_LO (indx), p);
+	      bfd_put_32 (htab->glink->owner, ORI_R0_R0_0 | PPC_LO (indx), p);
 	      p += 4;
 	    }
-	  bfd_put_32 (htab->sglink->owner,
-		      B_DOT | ((htab->sglink->contents - p) & 0x3fffffc), p);
+	  bfd_put_32 (htab->glink->owner,
+		      B_DOT | ((htab->glink->contents - p) & 0x3fffffc), p);
 	  indx++;
 	  p += 4;
 	}
-      htab->sglink->_cooked_size = p - htab->sglink->contents;
+      htab->glink->_cooked_size = p - htab->glink->contents;
     }
 
-  if (htab->sbrlt->_raw_size != 0)
+  if (htab->brlt->_raw_size != 0)
     {
-      htab->sbrlt->contents = (bfd_byte *) bfd_zalloc (htab->sbrlt->owner,
-						       htab->sbrlt->_raw_size);
-      if (htab->sbrlt->contents == NULL)
+      htab->brlt->contents = bfd_zalloc (htab->brlt->owner,
+					 htab->brlt->_raw_size);
+      if (htab->brlt->contents == NULL)
 	return FALSE;
     }
 
@@ -7220,13 +7020,35 @@
     }
 
   if (stub_sec != NULL
-      || htab->sglink->_raw_size != htab->sglink->_cooked_size)
+      || htab->glink->_raw_size != htab->glink->_cooked_size)
     {
       htab->stub_error = TRUE;
       (*_bfd_error_handler) (_("stubs don't match calculated size"));
     }
 
-  return !htab->stub_error;
+  if (htab->stub_error)
+    return FALSE;
+
+  if (stats != NULL)
+    {
+      *stats = bfd_malloc (500);
+      if (*stats == NULL)
+	return FALSE;
+
+      sprintf (*stats, _("linker stubs in %u groups\n"
+			 "  branch       %lu\n"
+			 "  toc adjust   %lu\n"
+			 "  long branch  %lu\n"
+			 "  long toc adj %lu\n"
+			 "  plt call     %lu"),
+	       htab->stub_bfd->section_count,
+	       htab->stub_count[ppc_stub_long_branch - 1],
+	       htab->stub_count[ppc_stub_long_branch_r2off - 1],
+	       htab->stub_count[ppc_stub_plt_branch - 1],
+	       htab->stub_count[ppc_stub_plt_branch_r2off - 1],
+	       htab->stub_count[ppc_stub_plt_call - 1]);
+    }
+  return TRUE;
 }
 
 /* The RELOCATE_SECTION function is called by the ELF backend linker
@@ -7259,16 +7081,14 @@
    accordingly.  */
 
 static bfd_boolean
-ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
-			    contents, relocs, local_syms, local_sections)
-     bfd *output_bfd;
-     struct bfd_link_info *info;
-     bfd *input_bfd;
-     asection *input_section;
-     bfd_byte *contents;
-     Elf_Internal_Rela *relocs;
-     Elf_Internal_Sym *local_syms;
-     asection **local_sections;
+ppc64_elf_relocate_section (bfd *output_bfd,
+			    struct bfd_link_info *info,
+			    bfd *input_bfd,
+			    asection *input_section,
+			    bfd_byte *contents,
+			    Elf_Internal_Rela *relocs,
+			    Elf_Internal_Sym *local_syms,
+			    asection **local_sections)
 {
   struct ppc_link_hash_table *htab;
   Elf_Internal_Shdr *symtab_hdr;
@@ -7320,21 +7140,16 @@
       bfd_vma max_br_offset;
       bfd_vma from;
 
-      r_type = (enum elf_ppc64_reloc_type) ELF64_R_TYPE (rel->r_info);
+      r_type = ELF64_R_TYPE (rel->r_info);
       r_symndx = ELF64_R_SYM (rel->r_info);
-      sym = (Elf_Internal_Sym *) 0;
-      sec = (asection *) 0;
-      h = (struct elf_link_hash_entry *) 0;
-      sym_name = (const char *) 0;
+      sym = NULL;
+      sec = NULL;
+      h = NULL;
+      sym_name = NULL;
       unresolved_reloc = FALSE;
       warned = FALSE;
 
-      if (r_type == R_PPC64_TOC)
-	{
-	  /* Relocation value is TOC base.  */
-	  relocation = TOCstart + htab->stub_group[input_section->id].toc_off;
-	}
-      else if (r_symndx < symtab_hdr->sh_info)
+      if (r_symndx < symtab_hdr->sh_info)
 	{
 	  /* It's a local symbol.  */
 	  sym = local_syms + r_symndx;
@@ -7445,7 +7260,11 @@
 		tls_mask = *toc_tls;
 		if (r_type == R_PPC64_TOC16_DS
 		    || r_type == R_PPC64_TOC16_LO_DS)
-		  goto toctprel;
+		  {
+		    if (tls_mask != 0
+			&& (tls_mask & (TLS_DTPREL | TLS_TPREL)) == 0)
+		      goto toctprel;
+		  }
 		else
 		  {
 		    /* If we found a GD reloc pair, then we might be
@@ -7468,11 +7287,11 @@
 
 	case R_PPC64_GOT_TPREL16_DS:
 	case R_PPC64_GOT_TPREL16_LO_DS:
-	toctprel:
 	  if (tls_mask != 0
 	      && (tls_mask & TLS_TPREL) == 0)
 	    {
 	      bfd_vma insn;
+	    toctprel:
 	      insn = bfd_get_32 (output_bfd, contents + rel->r_offset - 2);
 	      insn &= 31 << 21;
 	      insn |= 0x3c0d0000;	/* addis 0,13,0 */
@@ -7584,8 +7403,7 @@
 
 		  /* The next instruction should be a call to
 		     __tls_get_addr.  Peek at the reloc to be sure.  */
-		  r_type2
-		    = (enum elf_ppc64_reloc_type) ELF64_R_TYPE (rel[1].r_info);
+		  r_type2 = ELF64_R_TYPE (rel[1].r_info);
 		  r_symndx2 = ELF64_R_SYM (rel[1].r_info);
 		  if (r_symndx2 < symtab_hdr->sh_info
 		      || (r_type2 != R_PPC64_REL14
@@ -7672,8 +7490,7 @@
 		    r_type = R_PPC64_TPREL64;
 		  else
 		    {
-		      bfd_put_64 (output_bfd, (bfd_vma) 1,
-				  contents + rel->r_offset);
+		      bfd_put_64 (output_bfd, 1, contents + rel->r_offset);
 		      r_type = R_PPC64_NONE;
 		    }
 		  rel->r_info = ELF64_R_INFO (r_symndx, r_type);
@@ -7683,8 +7500,7 @@
 	    {
 	      if ((tls_mask & TLS_LD) == 0)
 		{
-		  bfd_put_64 (output_bfd, (bfd_vma) 1,
-			      contents + rel->r_offset);
+		  bfd_put_64 (output_bfd, 1, contents + rel->r_offset);
 		  r_type = R_PPC64_NONE;
 		  rel->r_info = ELF64_R_INFO (r_symndx, r_type);
 		}
@@ -7741,7 +7557,7 @@
 		insn ^= 0x01 << 21;
 	    }
 
-	  bfd_put_32 (output_bfd, (bfd_vma) insn, contents + rel->r_offset);
+	  bfd_put_32 (output_bfd, insn, contents + rel->r_offset);
 	  break;
 
 	case R_PPC64_REL24:
@@ -7772,7 +7588,7 @@
 		  if (insn == NOP
 		      || insn == CROR_151515 || insn == CROR_313131)
 		    {
-		      bfd_put_32 (input_bfd, (bfd_vma) LD_R2_40R1,
+		      bfd_put_32 (input_bfd, LD_R2_40R1,
 				  contents + rel->r_offset + 4);
 		      can_plt_call = 1;
 		    }
@@ -7920,7 +7736,7 @@
 	    bfd_vma off;
 	    unsigned long indx = 0;
 
-	    if (htab->sgot == NULL)
+	    if (htab->got == NULL)
 	      abort ();
 
 	    if (tls_type == (TLS_TLS | TLS_LD)
@@ -7982,21 +7798,23 @@
 			|| ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
 			|| h->root.type != bfd_link_hash_undefweak))
 		  {
-		    outrel.r_offset = (htab->sgot->output_section->vma
-				       + htab->sgot->output_offset
+		    outrel.r_offset = (htab->got->output_section->vma
+				       + htab->got->output_offset
 				       + off);
+		    outrel.r_addend = rel->r_addend;
 		    if (tls_type & (TLS_LD | TLS_GD))
 		      {
 			outrel.r_addend = 0;
 			outrel.r_info = ELF64_R_INFO (indx, R_PPC64_DTPMOD64);
 			if (tls_type == (TLS_TLS | TLS_GD))
 			  {
-			    loc = htab->srelgot->contents;
-			    loc += (htab->srelgot->reloc_count++
+			    loc = htab->relgot->contents;
+			    loc += (htab->relgot->reloc_count++
 				    * sizeof (Elf64_External_Rela));
 			    bfd_elf64_swap_reloca_out (output_bfd,
 						       &outrel, loc);
 			    outrel.r_offset += 8;
+			    outrel.r_addend = rel->r_addend;
 			    outrel.r_info
 			      = ELF64_R_INFO (indx, R_PPC64_DTPREL64);
 			  }
@@ -8006,25 +7824,32 @@
 		    else if (tls_type == (TLS_TLS | TLS_TPREL))
 		      outrel.r_info = ELF64_R_INFO (indx, R_PPC64_TPREL64);
 		    else if (indx == 0)
-		      outrel.r_info = ELF64_R_INFO (indx, R_PPC64_RELATIVE);
+		      {
+			outrel.r_info = ELF64_R_INFO (indx, R_PPC64_RELATIVE);
+
+			/* Write the .got section contents for the sake
+			   of prelink.  */
+			loc = htab->got->contents + off;
+			bfd_put_64 (output_bfd, outrel.r_addend + relocation,
+				    loc);
+		      }
 		    else
 		      outrel.r_info = ELF64_R_INFO (indx, R_PPC64_GLOB_DAT);
-		    outrel.r_addend = rel->r_addend;
-		    if (indx == 0)
+
+		    if (indx == 0 && tls_type != (TLS_TLS | TLS_LD))
 		      {
 			outrel.r_addend += relocation;
 			if (tls_type & (TLS_GD | TLS_DTPREL | TLS_TPREL))
 			  outrel.r_addend -= htab->tls_sec->vma;
 		      }
-		    loc = htab->srelgot->contents;
-		    loc += (htab->srelgot->reloc_count++
+		    loc = htab->relgot->contents;
+		    loc += (htab->relgot->reloc_count++
 			    * sizeof (Elf64_External_Rela));
 		    bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
 		  }
 
 		/* Init the .got section contents here if we're not
-		   emitting a reloc.  A reloc will also init the
-		   section contents via _bfd_final_link_relocate.  */
+		   emitting a reloc.  */
 		else
 		  {
 		    relocation += rel->r_addend;
@@ -8039,20 +7864,20 @@
 			if (tls_type == (TLS_TLS | TLS_GD))
 			  {
 			    bfd_put_64 (output_bfd, relocation,
-					htab->sgot->contents + off + 8);
+					htab->got->contents + off + 8);
 			    relocation = 1;
 			  }
 		      }
 
 		    bfd_put_64 (output_bfd, relocation,
-				htab->sgot->contents + off);
+				htab->got->contents + off);
 		  }
 	      }
 
 	    if (off >= (bfd_vma) -2)
 	      abort ();
 
-	    relocation = htab->sgot->output_offset + off;
+	    relocation = htab->got->output_offset + off;
 
 	    /* TOC base (r2) is TOC start plus 0x8000.  */
 	    addend = - TOC_BASE_OFF;
@@ -8076,21 +7901,32 @@
 	     symbol.  This happens when statically linking PIC code,
 	     or when using -Bsymbolic.  Go find a match if there is a
 	     PLT entry.  */
-	  if (htab->splt != NULL)
+	  if (htab->plt != NULL)
 	    {
 	      struct plt_entry *ent;
 	      for (ent = h->plt.plist; ent != NULL; ent = ent->next)
 		if (ent->addend == rel->r_addend
 		    && ent->plt.offset != (bfd_vma) -1)
 		  {
-		    relocation = (htab->splt->output_section->vma
-				  + htab->splt->output_offset
+		    relocation = (htab->plt->output_section->vma
+				  + htab->plt->output_offset
 				  + ent->plt.offset);
 		    unresolved_reloc = FALSE;
 		  }
 	    }
 	  break;
 
+	case R_PPC64_TOC:
+	  /* Relocation value is TOC base.  */
+	  relocation = TOCstart;
+	  if (r_symndx == 0)
+	    relocation += htab->stub_group[input_section->id].toc_off;
+	  else if (sec != NULL && !unresolved_reloc)
+	    relocation += htab->stub_group[sec->id].toc_off;
+	  else
+	    unresolved_reloc = TRUE;
+	  goto dodyn2;
+
 	  /* TOC16 relocs.  We want the offset relative to the TOC base,
 	     which is the address of the start of the TOC plus 0x8000.
 	     The TOC consists of sections .got, .toc, .tocbss, and .plt,
@@ -8111,7 +7947,7 @@
 	case R_PPC64_SECTOFF_DS:
 	case R_PPC64_SECTOFF_LO_DS:
 	case R_PPC64_SECTOFF_HA:
-	  if (sec != (asection *) 0)
+	  if (sec != NULL)
 	    addend -= sec->output_section->vma;
 	  break;
 
@@ -8197,7 +8033,7 @@
 	    break;
 	  /* Fall thru.  */
 
-	case R_PPC64_TOC:
+	dodyn2:
 	  if ((input_section->flags & SEC_ALLOC) == 0)
 	    break;
 
@@ -8223,6 +8059,7 @@
 	      bfd_boolean skip, relocate;
 	      asection *sreloc;
 	      bfd_byte *loc;
+	      bfd_vma out_off;
 
 	      /* When generating a dynamic object, these relocations
 		 are copied into the output file to be resolved at run
@@ -8231,22 +8068,34 @@
 	      skip = FALSE;
 	      relocate = FALSE;
 
-	      outrel.r_offset =
-		_bfd_elf_section_offset (output_bfd, info, input_section,
-					 rel->r_offset);
-	      if (outrel.r_offset == (bfd_vma) -1)
+	      out_off = _bfd_elf_section_offset (output_bfd, info,
+						 input_section, rel->r_offset);
+	      if (out_off == (bfd_vma) -1)
 		skip = TRUE;
-	      else if (outrel.r_offset == (bfd_vma) -2)
+	      else if (out_off == (bfd_vma) -2)
 		skip = TRUE, relocate = TRUE;
-	      outrel.r_offset += (input_section->output_section->vma
-				  + input_section->output_offset);
+	      out_off += (input_section->output_section->vma
+			  + input_section->output_offset);
+	      outrel.r_offset = out_off;
 	      outrel.r_addend = rel->r_addend;
 
+	      /* Optimize unaligned reloc use.  */
+	      if ((r_type == R_PPC64_ADDR64 && (out_off & 7) != 0)
+		  || (r_type == R_PPC64_UADDR64 && (out_off & 7) == 0))
+		r_type ^= R_PPC64_ADDR64 ^ R_PPC64_UADDR64;
+	      else if ((r_type == R_PPC64_ADDR32 && (out_off & 3) != 0)
+		       || (r_type == R_PPC64_UADDR32 && (out_off & 3) == 0))
+		r_type ^= R_PPC64_ADDR32 ^ R_PPC64_UADDR32;
+	      else if ((r_type == R_PPC64_ADDR16 && (out_off & 1) != 0)
+		       || (r_type == R_PPC64_UADDR16 && (out_off & 1) == 0))
+		r_type ^= R_PPC64_ADDR16 ^ R_PPC64_UADDR16;
+
 	      if (skip)
 		memset (&outrel, 0, sizeof outrel);
 	      else if (h != NULL
 		       && !SYMBOL_REFERENCES_LOCAL (info, h)
-		       && !is_opd)
+		       && !is_opd
+		       && r_type != R_PPC64_TOC)
 		outrel.r_info = ELF64_R_INFO (h->dynindx, r_type);
 	      else
 		{
@@ -8254,9 +8103,6 @@
 		     or this is an opd section reloc which must point
 		     at a local function.  */
 		  outrel.r_addend += relocation;
-		  /* We need to relocate .opd contents for ld.so, and
-		     it doesn't hurt to relocate in other cases.  */
-		  relocate = TRUE;
 		  if (r_type == R_PPC64_ADDR64 || r_type == R_PPC64_TOC)
 		    {
 		      if (is_opd && h != NULL)
@@ -8274,6 +8120,12 @@
 			  unresolved_reloc = FALSE;
 			}
 		      outrel.r_info = ELF64_R_INFO (0, R_PPC64_RELATIVE);
+
+		      /* We need to relocate .opd contents for ld.so.
+			 Prelink also wants simple and consistent rules
+			 for relocs.  This make all RELATIVE relocs have
+			 *r_offset equal to r_addend.  */
+		      relocate = TRUE;
 		    }
 		  else
 		    {
@@ -8315,9 +8167,29 @@
 
 	      /* If this reloc is against an external symbol, it will
 		 be computed at runtime, so there's no need to do
-		 anything now.  */
+		 anything now.  However, for the sake of prelink ensure
+		 that the section contents are a known value.  */
 	      if (! relocate)
-		continue;
+		{
+		  unresolved_reloc = FALSE;
+		  /* The value chosen here is quite arbitrary as ld.so
+		     ignores section contents except for the special
+		     case of .opd where the contents might be accessed
+		     before relocation.  Choose zero, as that won't
+		     cause reloc overflow.  */
+		  relocation = 0;
+		  addend = 0;
+		  /* Use *r_offset == r_addend for R_PPC64_ADDR64 relocs
+		     to improve backward compatibility with older
+		     versions of ld.  */
+		  if (r_type == R_PPC64_ADDR64)
+		    addend = outrel.r_addend;
+		  /* Adjust pc_relative relocs to have zero in *r_offset.  */
+		  else if (ppc64_elf_howto_table[r_type]->pc_relative)
+		    addend = (input_section->output_section->vma
+			      + input_section->output_offset
+			      + rel->r_offset);
+		}
 	    }
 	  break;
 
@@ -8342,7 +8214,7 @@
 	  (*_bfd_error_handler)
 	    (_("%s: relocation %s is not supported for symbol %s."),
 	     bfd_archive_filename (input_bfd),
-	     ppc64_elf_howto_table[(int) r_type]->name, sym_name);
+	     ppc64_elf_howto_table[r_type]->name, sym_name);
 
 	  bfd_set_error (bfd_error_invalid_operation);
 	  ret = FALSE;
@@ -8421,7 +8293,7 @@
 	      (*_bfd_error_handler)
 		(_("%s: error: relocation %s not a multiple of %d"),
 		 bfd_archive_filename (input_bfd),
-		 ppc64_elf_howto_table[(int) r_type]->name,
+		 ppc64_elf_howto_table[r_type]->name,
 		 mask + 1);
 	      bfd_set_error (bfd_error_bad_value);
 	      ret = FALSE;
@@ -8448,6 +8320,7 @@
 	  if ((relocation + addend - from + max_br_offset >= 2 * max_br_offset
 	       || (sec != NULL
 		   && sec->output_section != NULL
+		   && sec->id <= htab->top_id
 		   && (htab->stub_group[sec->id].toc_off
 		       != htab->stub_group[input_section->id].toc_off)))
 	      && (stub_entry = ppc_get_stub_entry (input_section, sec, h,
@@ -8498,7 +8371,7 @@
 		continue;
 	      if (h != NULL
 		  && h->root.type == bfd_link_hash_undefweak
-		  && ppc64_elf_howto_table[(int) r_type]->pc_relative)
+		  && ppc64_elf_howto_table[r_type]->pc_relative)
 		{
 		  /* Assume this is a call protected by other code that
 		     detects the symbol is undefined.  If this is the case,
@@ -8510,7 +8383,7 @@
 		}
 
 	      if (!((*info->callbacks->reloc_overflow)
-		    (info, sym_name, ppc64_elf_howto_table[(int) r_type]->name,
+		    (info, sym_name, ppc64_elf_howto_table[r_type]->name,
 		     rel->r_addend, input_bfd, input_section, rel->r_offset)))
 		return FALSE;
 	    }
@@ -8521,7 +8394,7 @@
 		 bfd_archive_filename (input_bfd),
 		 bfd_get_section_name (input_bfd, input_section),
 		 (long) rel->r_offset,
-		 ppc64_elf_howto_table[(int) r_type]->name,
+		 ppc64_elf_howto_table[r_type]->name,
 		 sym_name,
 		 (int) r);
 	      ret = FALSE;
@@ -8536,11 +8409,10 @@
    dynamic sections here.  */
 
 static bfd_boolean
-ppc64_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
-     bfd *output_bfd;
-     struct bfd_link_info *info;
-     struct elf_link_hash_entry *h;
-     Elf_Internal_Sym *sym;
+ppc64_elf_finish_dynamic_symbol (bfd *output_bfd,
+				 struct bfd_link_info *info,
+				 struct elf_link_hash_entry *h,
+				 Elf_Internal_Sym *sym)
 {
   struct ppc_link_hash_table *htab;
   bfd *dynobj;
@@ -8560,20 +8432,20 @@
 	    /* This symbol has an entry in the procedure linkage
 	       table.  Set it up.  */
 
-	    if (htab->splt == NULL
-		|| htab->srelplt == NULL
-		|| htab->sglink == NULL)
+	    if (htab->plt == NULL
+		|| htab->relplt == NULL
+		|| htab->glink == NULL)
 	      abort ();
 
 	    /* Create a JMP_SLOT reloc to inform the dynamic linker to
 	       fill in the PLT entry.  */
-	    rela.r_offset = (htab->splt->output_section->vma
-			     + htab->splt->output_offset
+	    rela.r_offset = (htab->plt->output_section->vma
+			     + htab->plt->output_offset
 			     + ent->plt.offset);
 	    rela.r_info = ELF64_R_INFO (h->dynindx, R_PPC64_JMP_SLOT);
 	    rela.r_addend = ent->addend;
 
-	    loc = htab->srelplt->contents;
+	    loc = htab->relplt->contents;
 	    loc += ((ent->plt.offset - PLT_INITIAL_ENTRY_SIZE) / PLT_ENTRY_SIZE
 		    * sizeof (Elf64_External_Rela));
 	    bfd_elf64_swap_reloca_out (output_bfd, &rela, loc);
@@ -8590,7 +8462,7 @@
       if (h->dynindx == -1
 	  || (h->root.type != bfd_link_hash_defined
 	      && h->root.type != bfd_link_hash_defweak)
-	  || htab->srelbss == NULL)
+	  || htab->relbss == NULL)
 	abort ();
 
       rela.r_offset = (h->root.u.def.value
@@ -8598,8 +8470,8 @@
 		       + h->root.u.def.section->output_offset);
       rela.r_info = ELF64_R_INFO (h->dynindx, R_PPC64_COPY);
       rela.r_addend = 0;
-      loc = htab->srelbss->contents;
-      loc += htab->srelbss->reloc_count++ * sizeof (Elf64_External_Rela);
+      loc = htab->relbss->contents;
+      loc += htab->relbss->reloc_count++ * sizeof (Elf64_External_Rela);
       bfd_elf64_swap_reloca_out (output_bfd, &rela, loc);
     }
 
@@ -8614,12 +8486,11 @@
    dynamic linker, before writing them out.  */
 
 static enum elf_reloc_type_class
-ppc64_elf_reloc_type_class (rela)
-     const Elf_Internal_Rela *rela;
+ppc64_elf_reloc_type_class (const Elf_Internal_Rela *rela)
 {
   enum elf_ppc64_reloc_type r_type;
 
-  r_type = (enum elf_ppc64_reloc_type) ELF64_R_TYPE (rela->r_info);
+  r_type = ELF64_R_TYPE (rela->r_info);
   switch (r_type)
     {
     case R_PPC64_RELATIVE:
@@ -8636,9 +8507,8 @@
 /* Finish up the dynamic sections.  */
 
 static bfd_boolean
-ppc64_elf_finish_dynamic_sections (output_bfd, info)
-     bfd *output_bfd;
-     struct bfd_link_info *info;
+ppc64_elf_finish_dynamic_sections (bfd *output_bfd,
+				   struct bfd_link_info *info)
 {
   struct ppc_link_hash_table *htab;
   bfd *dynobj;
@@ -8652,7 +8522,7 @@
     {
       Elf64_External_Dyn *dyncon, *dynconend;
 
-      if (sdyn == NULL || htab->sgot == NULL)
+      if (sdyn == NULL || htab->got == NULL)
 	abort ();
 
       dyncon = (Elf64_External_Dyn *) sdyn->contents;
@@ -8670,7 +8540,7 @@
 	      continue;
 
 	    case DT_PPC64_GLINK:
-	      s = htab->sglink;
+	      s = htab->glink;
 	      dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
 	      /* We stupidly defined DT_PPC64_GLINK to be the start
 		 of glink rather than the first entry point, which is
@@ -8694,23 +8564,23 @@
 	      break;
 
 	    case DT_PLTGOT:
-	      s = htab->splt;
+	      s = htab->plt;
 	      dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
 	      break;
 
 	    case DT_JMPREL:
-	      s = htab->srelplt;
+	      s = htab->relplt;
 	      dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
 	      break;
 
 	    case DT_PLTRELSZ:
-	      dyn.d_un.d_val = htab->srelplt->_raw_size;
+	      dyn.d_un.d_val = htab->relplt->_raw_size;
 	      break;
 
 	    case DT_RELASZ:
 	      /* Don't count procedure linkage table relocs in the
 		 overall reloc count.  */
-	      s = htab->srelplt;
+	      s = htab->relplt;
 	      if (s == NULL)
 		continue;
 	      dyn.d_un.d_val -= s->_raw_size;
@@ -8720,7 +8590,7 @@
 	      /* We may not be using the standard ELF linker script.
 		 If .rela.plt is the first .rela section, we adjust
 		 DT_RELA to not include it.  */
-	      s = htab->srelplt;
+	      s = htab->relplt;
 	      if (s == NULL)
 		continue;
 	      if (dyn.d_un.d_ptr != s->output_section->vma + s->output_offset)
@@ -8733,22 +8603,22 @@
 	}
     }
 
-  if (htab->sgot != NULL && htab->sgot->_raw_size != 0)
+  if (htab->got != NULL && htab->got->_raw_size != 0)
     {
       /* Fill in the first entry in the global offset table.
 	 We use it to hold the link-time TOCbase.  */
       bfd_put_64 (output_bfd,
 		  elf_gp (output_bfd) + TOC_BASE_OFF,
-		  htab->sgot->contents);
+		  htab->got->contents);
 
       /* Set .got entry size.  */
-      elf_section_data (htab->sgot->output_section)->this_hdr.sh_entsize = 8;
+      elf_section_data (htab->got->output_section)->this_hdr.sh_entsize = 8;
     }
 
-  if (htab->splt != NULL && htab->splt->_raw_size != 0)
+  if (htab->plt != NULL && htab->plt->_raw_size != 0)
     {
       /* Set .plt entry size.  */
-      elf_section_data (htab->splt->output_section)->this_hdr.sh_entsize
+      elf_section_data (htab->plt->output_section)->this_hdr.sh_entsize
 	= PLT_ENTRY_SIZE;
     }
 
diff --git a/bfd/elf64-ppc.h b/bfd/elf64-ppc.h
index 1968c4e..0572d52 100644
--- a/bfd/elf64-ppc.h
+++ b/bfd/elf64-ppc.h
@@ -18,25 +18,25 @@
 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 bfd_boolean ppc64_elf_mark_entry_syms
-  PARAMS ((struct bfd_link_info *));
+  (struct bfd_link_info *);
 bfd_boolean ppc64_elf_edit_opd
-  PARAMS ((bfd *, struct bfd_link_info *));
+  (bfd *, struct bfd_link_info *);
 bfd_boolean ppc64_elf_tls_setup
-  PARAMS ((bfd *, struct bfd_link_info *));
+  (bfd *, struct bfd_link_info *);
 bfd_boolean ppc64_elf_tls_optimize
-  PARAMS ((bfd *, struct bfd_link_info *));
+  (bfd *, struct bfd_link_info *);
 bfd_vma ppc64_elf_toc
-  PARAMS ((bfd *));
+  (bfd *);
 int ppc64_elf_setup_section_lists
-  PARAMS ((bfd *, struct bfd_link_info *));
+  (bfd *, struct bfd_link_info *);
 void ppc64_elf_next_toc_section
-  PARAMS ((struct bfd_link_info *, asection *));
+  (struct bfd_link_info *, asection *);
 void ppc64_elf_reinit_toc
-  PARAMS ((bfd *, struct bfd_link_info *));
-void ppc64_elf_next_input_section
-  PARAMS ((struct bfd_link_info *, asection *));
+  (bfd *, struct bfd_link_info *);
+bfd_boolean ppc64_elf_next_input_section
+  (struct bfd_link_info *, asection *);
 bfd_boolean ppc64_elf_size_stubs
-  PARAMS ((bfd *, bfd *, struct bfd_link_info *, bfd_signed_vma,
-	   asection *(*) (const char *, asection *), void (*) (void)));
+  (bfd *, bfd *, struct bfd_link_info *, bfd_signed_vma,
+   asection *(*) (const char *, asection *), void (*) (void));
 bfd_boolean ppc64_elf_build_stubs
-  PARAMS ((bfd_boolean, struct bfd_link_info *));
+  (bfd_boolean, struct bfd_link_info *, char **);
diff --git a/bfd/elf64-sparc.c b/bfd/elf64-sparc.c
index d25b429..080c4e7 100644
--- a/bfd/elf64-sparc.c
+++ b/bfd/elf64-sparc.c
@@ -2684,7 +2684,7 @@
 	       overflows.  We don't, but this breaks stabs debugging
 	       info, whose relocations are only 32-bits wide.  Ignore
 	       overflows for discarded entries.  */
-	    if (r_type == R_SPARC_32
+	    if ((r_type == R_SPARC_32 || r_type == R_SPARC_DISP32)
 		&& _bfd_elf_section_offset (output_bfd, info, input_section,
 					    rel->r_offset) == (bfd_vma) -1)
 	      break;
diff --git a/bfd/elflink.h b/bfd/elflink.h
index 8acb7a9..4a7d27d 100644
--- a/bfd/elflink.h
+++ b/bfd/elflink.h
@@ -5005,9 +5005,9 @@
 	     from discarded sections and section symbols from
 	     removed link-once sections.  Complain about relocs
 	     against discarded sections.  Zero relocs against removed
-	     link-once sections.  */
-	  if (!finfo->info->relocateable
-	      && !elf_section_ignore_discarded_relocs (o))
+	     link-once sections.  Preserve debug information as much
+	     as we can.  */
+	  if (!elf_section_ignore_discarded_relocs (o))
 	    {
 	      Elf_Internal_Rela *rel, *relend;
 
@@ -5016,6 +5016,7 @@
 	      for ( ; rel < relend; rel++)
 		{
 		  unsigned long r_symndx = ELF_R_SYM (rel->r_info);
+		  asection *sec;
 
 		  if (r_symndx >= locsymcount
 		      || (elf_bad_symtab (input_bfd)
@@ -5030,14 +5031,22 @@
 
 		      /* Complain if the definition comes from a
 			 discarded section.  */
+		      sec = h->root.u.def.section;
 		      if ((h->root.type == bfd_link_hash_defined
 			   || h->root.type == bfd_link_hash_defweak)
-			  && elf_discarded_section (h->root.u.def.section))
+			  && elf_discarded_section (sec))
 			{
 			  if ((o->flags & SEC_DEBUGGING) != 0)
 			    {
 			      BFD_ASSERT (r_symndx != 0);
-			      memset (rel, 0, sizeof (*rel));
+			      /* Try to preserve debug information.  */
+			      if ((o->flags & SEC_DEBUGGING) != 0
+				  && sec->kept_section != NULL
+				  && sec->_cooked_size == sec->kept_section->_cooked_size)
+				h->root.u.def.section
+				  = sec->kept_section;
+			      else
+				memset (rel, 0, sizeof (*rel));
 			    }
 			  else
 			    finfo->info->callbacks->error_handler
@@ -5051,7 +5060,7 @@
 		    }
 		  else
 		    {
-		      asection *sec = finfo->sections[r_symndx];
+		      sec = finfo->sections[r_symndx];
 
 		      if (sec != NULL && elf_discarded_section (sec))
 			{
@@ -5059,9 +5068,18 @@
 			      || (sec->flags & SEC_LINK_ONCE) != 0)
 			    {
 			      BFD_ASSERT (r_symndx != 0);
-			      rel->r_info
-				= ELF_R_INFO (0, ELF_R_TYPE (rel->r_info));
-			      rel->r_addend = 0;
+			      /* Try to preserve debug information.  */
+			      if ((o->flags & SEC_DEBUGGING) != 0
+				  && sec->kept_section != NULL
+				  && sec->_cooked_size == sec->kept_section->_cooked_size)
+				finfo->sections[r_symndx]
+				  = sec->kept_section;
+			      else
+				{
+				  rel->r_info
+				    = ELF_R_INFO (0, ELF_R_TYPE (rel->r_info));
+				  rel->r_addend = 0;
+				}
 			    }
 			  else
 			    {
@@ -6285,23 +6303,25 @@
 
   if (addend >= h->vtable_entries_size)
     {
-      size_t size, bytes;
+      size_t size, bytes, file_align;
       bfd_boolean *ptr = h->vtable_entries_used;
 
       /* While the symbol is undefined, we have to be prepared to handle
 	 a zero size.  */
+      file_align = 1 << log_file_align;
       if (h->root.type == bfd_link_hash_undefined)
-	size = addend;
+	size = addend + file_align;
       else
 	{
 	  size = h->size;
-	  if (size < addend)
+	  if (addend >= size)
 	    {
 	      /* Oops!  We've got a reference past the defined end of
 		 the table.  This is probably a bug -- shall we warn?  */
-	      size = addend;
+	      size = addend + file_align;
 	    }
 	}
+      size = (size + file_align - 1) & -file_align;
 
       /* Allocate one extra entry for use as a "done" flag for the
 	 consolidation pass.  */
diff --git a/bfd/elfxx-ia64.c b/bfd/elfxx-ia64.c
index 37fc968..5e8dadf 100644
--- a/bfd/elfxx-ia64.c
+++ b/bfd/elfxx-ia64.c
@@ -4325,7 +4325,7 @@
 		{
 		  int i;
 		  for (i = m->count - 1; i >= 0; i--)
-		    if (m->sections[i] == sym_sec->output_section)
+		    if (m->sections[i] == input_section->output_section)
 		      break;
 		  if (i >= 0)
 		    break;
diff --git a/bfd/section.c b/bfd/section.c
index 6facfe2..44edb07 100644
--- a/bfd/section.c
+++ b/bfd/section.c
@@ -493,6 +493,10 @@
 .  {* Optional information about a COMDAT entry; NULL if not COMDAT.  *}
 .  struct bfd_comdat_info *comdat;
 .
+.  {* Points to the kept section if this section is a link-once section,
+.     and is discarded.  *}
+.  struct sec *kept_section;
+.
 .  {* When a section is being output, this value changes as more
 .     linenumbers are written out.  *}
 .  file_ptr moving_line_filepos;
@@ -640,8 +644,8 @@
     /* line_filepos, userdata, contents, lineno, lineno_count,       */	\
        0,            NULL,     NULL,     NULL,   0,			\
 									\
-    /* entsize, comdat, moving_line_filepos,                         */	\
-       0,       NULL,   0,						\
+    /* entsize, comdat, kept_section, moving_line_filepos,           */	\
+       0,       NULL,   NULL,	      0,				\
 									\
     /* target_index, used_by_bfd, constructor_chain, owner,          */	\
        0,            NULL,        NULL,              NULL,		\
diff --git a/bfd/version.h b/bfd/version.h
index 809db7a..775cc74 100644
--- a/bfd/version.h
+++ b/bfd/version.h
@@ -1,3 +1,3 @@
-#define BFD_VERSION_DATE 20030613
+#define BFD_VERSION_DATE 20030621
 #define BFD_VERSION @bfd_version@
 #define BFD_VERSION_STRING @bfd_version_string@
diff --git a/config.guess b/config.guess
index 04c91cc..fa58459 100755
--- a/config.guess
+++ b/config.guess
@@ -3,7 +3,7 @@
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
 #   2000, 2001, 2002, 2003 Free Software Foundation, Inc.
 
-timestamp='2003-06-06'
+timestamp='2003-06-12'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -283,6 +283,9 @@
 	# 1.2 uses "1.2" for uname -r.
 	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
 	exit 0 ;;
+    Alpha*:OpenVMS:*:*)
+	echo alpha-hp-vms
+	exit 0 ;;
     Alpha\ *:Windows_NT*:*)
 	# How do we know it's Interix rather than the generic POSIX subsystem?
 	# Should we change UNAME_MACHINE based on the output of uname instead
diff --git a/config.sub b/config.sub
index 97e405b..725707f 100755
--- a/config.sub
+++ b/config.sub
@@ -3,7 +3,7 @@
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
 #   2000, 2001, 2002, 2003 Free Software Foundation, Inc.
 
-timestamp='2003-06-06'
+timestamp='2003-06-13'
 
 # This file is (in principle) common to ALL GNU software.
 # The presence of a machine in this file suggests that SOME GNU software
@@ -229,7 +229,7 @@
 	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
 	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
 	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
-	| clipper \
+	| c4x | clipper \
 	| d10v | d30v | dlx | dsp16xx \
 	| fr30 | frv \
 	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
@@ -261,7 +261,7 @@
 	| sh64 | sh64le \
 	| sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \
 	| strongarm \
-	| tahoe | thumb | tic80 | tron \
+	| tahoe | thumb | tic4x | tic80 | tron \
 	| v850 | v850e \
 	| we32k \
 	| x86 | xscale | xstormy16 | xtensa \
@@ -928,10 +928,6 @@
 		basic_machine=t90-cray
 		os=-unicos
 		;;
-        tic4x | c4x*)
-		basic_machine=tic4x-unknown
-		os=-coff
-		;;
 	tic54x | c54x*)
 		basic_machine=tic54x-unknown
 		os=-coff
@@ -1283,6 +1279,9 @@
 	arm*-semi)
 		os=-aout
 		;;
+    c4x-* | tic4x-*)
+        os=-coff
+        ;;
 	# This must come before the *-dec entry.
 	pdp10-*)
 		os=-tops20
diff --git a/configure b/configure
index 22f8673..1492a10 100755
--- a/configure
+++ b/configure
@@ -2595,7 +2595,7 @@
 GCJ_FOR_TARGET=$GCJ_FOR_TARGET' $(FLAGS_FOR_TARGET)'
 
 # Don't use libstdc++-v3's flags to configure/build itself.
-libstdcxx_flags='`test ! -f $$r/$(TARGET_SUBDIR)/libstdc++-v3/testsuite_flags || $(SHELL) $$r/$(TARGET_SUBDIR)/libstdc++-v3/testsuite_flags --build-includes` -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs'
+libstdcxx_flags='`test ! -f $$r/$(TARGET_SUBDIR)/libstdc++-v3/scripts/testsuite_flags || $(SHELL) $$r/$(TARGET_SUBDIR)/libstdc++-v3/scripts/testsuite_flags --build-includes` -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs'
 raw_libstdcxx_flags=' -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs'
 
 if test "x${CXX_FOR_TARGET+set}" = xset; then
@@ -3969,15 +3969,34 @@
 # Transform confdefs.h into DEFS.
 # Protect against shell expansion while executing Makefile rules.
 # Protect against Makefile macro expansion.
-cat > conftest.defs <<\EOF
-s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g
-s%[ 	`~#$^&*(){}\\|;'"<>?]%\\&%g
-s%\[%\\&%g
-s%\]%\\&%g
-s%\$%$$%g
-EOF
-DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
-rm -f conftest.defs
+#
+# If the first sed substitution is executed (which looks for macros that
+# take arguments), then we branch to the quote section.  Otherwise,
+# look for a macro that doesn't take arguments.
+cat >confdef2opt.sed <<\_ACEOF
+t clear
+: clear
+s,^[ 	]*#[ 	]*define[ 	][ 	]*\([^ 	(][^ 	(]*([^)]*)\)[ 	]*\(.*\),-D\1=\2,g
+t quote
+s,^[ 	]*#[ 	]*define[ 	][ 	]*\([^ 	][^ 	]*\)[ 	]*\(.*\),-D\1=\2,g
+t quote
+d
+: quote
+s,[ 	`~#$^&*(){}\\|;'"<>?],\\&,g
+s,\[,\\&,g
+s,\],\\&,g
+s,\$,$$,g
+p
+_ACEOF
+# We use echo to avoid assuming a particular line-breaking character.
+# The extra dot is to prevent the shell from consuming trailing
+# line-breaks from the sub-command output.  A line-break within
+# single-quotes doesn't work because, if this script is created in a
+# platform that uses two characters for line-breaks (e.g., DOS), tr
+# would break.
+ac_LF_and_DOT=`echo; echo .`
+DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'`
+rm -f confdef2opt.sed
 
 
 # Without the "./", some shells look in PATH for config.status.
diff --git a/configure.in b/configure.in
index 646a1c9..bdc08b2 100644
--- a/configure.in
+++ b/configure.in
@@ -1908,7 +1908,7 @@
 GCJ_FOR_TARGET=$GCJ_FOR_TARGET' $(FLAGS_FOR_TARGET)'
 
 # Don't use libstdc++-v3's flags to configure/build itself.
-libstdcxx_flags='`test ! -f $$r/$(TARGET_SUBDIR)/libstdc++-v3/testsuite_flags || $(SHELL) $$r/$(TARGET_SUBDIR)/libstdc++-v3/testsuite_flags --build-includes` -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs'
+libstdcxx_flags='`test ! -f $$r/$(TARGET_SUBDIR)/libstdc++-v3/scripts/testsuite_flags || $(SHELL) $$r/$(TARGET_SUBDIR)/libstdc++-v3/scripts/testsuite_flags --build-includes` -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs'
 raw_libstdcxx_flags=' -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs'
 
 if test "x${CXX_FOR_TARGET+set}" = xset; then
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 5237edf..c6dc51d 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,635 @@
+2003-06-22  Daniel Jacobowitz  <drow@mvista.com>
+
+	* symfile.c (add_symbol_file_command): Use parse_and_eval_address.
+	Suggested by Nick Hibma <n_hibma@webweaving.org>.
+
+2003-06-22  Andrew Cagney  <cagney@redhat.com>
+
+	* osabi.c (generic_elf_osabi_sniff_abi_tag_sections): Handle
+	GNU_ABI_TAG_FREEBSD and GNU_ABI_TAG_NETBSD.  Suggested by Momchil
+	Velikov.
+
+2003-06-22  Daniel Jacobowitz  <drow@mvista.com>
+
+	* cli/cli-cmds.c (shell_escape): Silence warnings from old
+	compilers.
+
+2003-06-21  Daniel Jacobowitz  <drow@mvista.com>
+
+	* c-valprint.c (c_value_print): Add VALUE_OFFSET to the address
+	argument of val_print.
+	* cp-valprint.c (cp_print_value): Don't add the offset parameter
+	to the address argument of baseclass_offset or target_read_memory.
+	Do add it to the argument of cp_print_value_fields.
+
+2003-06-21  Andrew Cagney  <cagney@redhat.com>
+
+	* mips-tdep.c: Include "reggroups.h" and "sim-regno.h".
+	(mips_register_name): Return names for NUM_REGS..2*NUM_REGS
+	instead of 0..NUM_REGS.
+	(mips_register_reggroup_p): New function.
+	(mips_pseudo_register_write): New function.
+	(mips_pseudo_register_read): New function.
+	(mips_register_raw_size): For NUM_REGS..2*NUM_REGS return the size
+	based on the register's type.
+	(read_next_frame_reg): Simplify.  Assert that REGNO is a pseudo /
+	cooked.
+	(mips_get_saved_register): Simplify.  Assert that REGNO is a
+	pseudo / cooked.
+	(mips_register_byte): New function.  Use MIPS_REGISTER_BYTE.
+	(mips_register_type): Replace mips_register_virtual_type.  Map
+	NUM_REGS..2*NUM_REGS onto 0..NUM_REGS.  Use MIPS_REGISTER_TYPE
+	when available.
+	(read_next_frame_reg): Simplify, but handle SP_REGNUM.  Assert
+	that the register is cooked / virtual.
+	(mips_frame_saved_pc): Fetch the cooked PC, and not the raw PC.
+	Only get the extra info when needed.
+	(set_reg_offset): Save the offset in NUM_REGS..2*NUM_REGS as well.
+	(mips32_heuristic_proc_desc): Fetch the cooked register.
+	(heuristic_proc_desc, mips_pop_frame, get_frame_pointer): Ditto.
+	(mips_init_extra_frame_info, get_frame_pointer): Ditto.
+	(mips_print_register): Use gdbarch_register_type, instead of
+	REGISTER_VIRTUAL_TYPE.
+	(print_gp_register_row): Use gdbarch_register_type, instead of
+	REGISTER_VIRTUAL_TYPE.  Allow for a pseudo / cooked REGNUM.
+	(mips_print_registers_info): Assert REGNO is pseodo / cooked.
+	Print the pseudo / cooked registers.
+	(mips_print_registers_info): Assert REGNO is pseodo / cooked.
+	Print the pseudo / cooked registers.
+	(mips_xfer_register): Use regcache_cooked_read_part.  Assert that
+	REG_NUM is pseudo / cooked.
+	(mips_o32_xfer_return_value): Xfer the pseudo / cooked register.
+	(mips_n32n64_xfer_return_value): Ditto.
+	(mips_stab_reg_to_regnum): Map onto NUM_REGS..2*NUM_REGS.
+	(mips_dwarf_dwarf2_ecoff_reg_to_regnum): Ditto.
+	(mips_register_sim_regno): New function.
+	(mips_gdbarch_init): Set deprecated_register_byte,
+	register_group_p, pseudo_register_write, pseudo_register_read,
+	register_sim_regno, and num_pseudo_regs.  Set register_type,
+	instead of register_virtual_type.
+	* Makefile.in (mips-tdep.o): Update dependencies.
+	* config/mips/tm-mips64.h (MIPS_REGISTER_TYPE): Rename
+	REGISTER_VIRTUAL_TYPE.
+	* config/mips/tm-mips.h	(MIPS_REGISTER_TYPE): Ditto.
+	* config/mips/tm-irix5.h (MIPS_REGISTER_TYPE): Ditto.
+	* config/mips/tm-mips.h (MIPS_REGISTER_BYTE): Rename REGISTER_BYTE.
+	* config/mips/tm-irix6.h (MIPS_REGISTER_BYTE): Ditto.
+	* config/mips/tm-irix5.h (MIPS_REGISTER_BYTE): Ditto.
+
+2003-06-21  Daniel Jacobowitz  <drow@mvista.com>
+
+	* Makefile.in (cli-cmds.o): Depend on $(gdb_vfork_h)
+	* cli/cli-cmds.c: Include "gdb_vfork.h".
+	(shell_escape): Use vfork.
+
+2003-06-21  Andrew Cagney  <cagney@redhat.com>
+
+	* mips-tdep.c (mips_find_saved_regs): Rewrite mdebug code handling
+	32 bit floating-point register saves.
+
+	* frame.h (deprecated_unwind_get_saved_register): Delete.
+	* frame.c (deprecated_unwind_get_saved_register): Delete function.
+	* mips-tdep.c (mips_get_saved_register): Use frame_register_unwind
+	and deprecated_get_next_frame_hack instead of
+	deprecated_unwind_get_saved_register.
+
+	* mips-tdep.c (mips_dump_tdep): Do not print
+	REGISTER_CONVERT_FROM_TYPE or REGISTER_CONVERT_TO_TYPE.
+
+	* frame.c (get_frame_register): New function.
+	(frame_unwind_register_signed): New function.
+	(get_frame_register_signed): New function.
+	(frame_unwind_register_unsigned): New function.
+	(get_frame_register_unsigned): New function.
+	* frame.h: Add comments on naming schema.
+	(get_frame_register, frame_unwind_register_signed): Declare.
+	(get_frame_register_signed, get_frame_register_signed): Declare.
+	(frame_unwind_register_unsigned): Declare.
+	(get_frame_register_unsigned): Declare.
+
+2003-06-20  Theodore A. Roth  <troth@openavr.org>
+
+	* avr-tdep.c (avr_gdbarch_init): Don't call set_gdbarch_bfd_vma_bit.
+
+2003-06-20  Theodore A. Roth  <troth@openavr.org>
+
+	* avr-tdep.c (avr_read_pc): Use regcache instead of read_register.
+	(avr_read_sp): Ditto.
+
+2003-06-20  Daniel Jacobowitz  <drow@mvista.com>
+
+	* config/arm/linux.mt: Remove code protected by GDBSERVER define.
+	* config/arm/nm-linux.h: Likewise.
+	* config/arm/tm-linux.h: Likewise.
+	* config/ia64/nm-linux.h: Likewise.
+	* config/ia64/tm-ia64.h: Likewise.
+	* config/s390/tm-linux.h: Likewise.
+	* config/s390/tm-s390.h: Likewise.
+	* s390-nat.c: Likewise.
+	* s390-tdep.c: Likewise.
+
+	* config/i386/linux.mt: Don't set GDBSERVER_DEPFILES.
+	* config/ia64/linux.mt: Likewise.
+	* config/m68k/linux.mh: Likewise.
+	* config/mips/linux.mt: Likewise.
+	* config/powerpc/linux.mh: Likewise.
+	* config/sh/linux.mt: Likewise.
+
+2003-06-19  Kris Warkentin  <kewarken@qnx.com>
+
+	* solib.c (solib_open): Change tests for whether to search
+	LD_LIBRARY_PATH and PATH to better deal with remotes.  Update
+	comments.
+
+2003-06-19  Theodore A. Roth  <troth@openavr.org>
+
+	* avr-tdep.c (avr_frame_address): Delete function.
+	(avr_gdbarch_init): Don't call set_gdbarch_frame_args_address,
+	set_gdbarch_frame_args_address.
+
+2003-06-19  Andrew Cagney  <cagney@redhat.com>
+
+	* config/mips/tm-mips.h (REGISTER_CONVERT_TO_TYPE): Delete.
+	(REGISTER_CONVERT_FROM_TYPE): Delete.
+	(mips_register_convert_to_type): Delete declaration.
+	(mips_register_convert_from_type): Delete declaration.
+	* linux-nat.h (struct target_ops): Declare opaque.  s/Linux/Linux
+	kernel/.
+
+2003-06-19  Michael Snyder  <msnyder@redhat.com>
+
+	* linux-nat.h: New file.
+	* linux-nat.c: Include linux-nat.h.
+	* lin-lwp.c: Include linux-nat.h.  
+	Move struct lwp_info def to linux-nat.h.
+	* linux-proc.c: Include linux-nat.h.  
+	(linux_make_note_section): Iterate over lwps instead of threads.
+	(linux_do_thread_registers): Use lwp instead of merged pid.
+	* config/nm-linux.h: Move miscelaneous def'ns to linux-nat.h.
+	* Makefile.in (lin-lwp.o, linux-proc.o, linux-nat.o): 
+	Add dependency on linux_nat_h.
+
+2003-06-19  Theodore A. Roth  <troth@openavr.org>
+
+	* avr-tdep.c (avr_extract_return_value): Delete debugging fprintf.
+
+2003-06-19  Daniel Jacobowitz  <drow@mvista.com>
+
+	* varobj.c (get_type, get_target_type): Use check_typedef.
+
+2003-06-19  Daniel Jacobowitz  <drow@mvista.com>
+
+	* breakpoint.c (insert_catchpoint): Call internal_error.
+
+2003-06-19  Theodore A. Roth  <troth@openavr.org>
+
+	* avr-tdep.c (avr_push_dummy_code): Delete function.
+	(avr_gdbarch_init): Don't call set_gdbarch_push_dummy_code.
+
+2003-06-19  Daniel Jacobowitz  <drow@mvista.com>
+
+	* arch-utils.c (default_prepare_to_proceed): Remove.
+	(generic_prepare_to_proceed): Remove.
+	* arch-utils.h (default_prepare_to_proceed): Remove prototype.
+	(generic_prepare_to_proceed): Remove prototype.
+	* gdbarch.sh (PREPARE_TO_PROCEED): Remove.
+	* gdbarch.c: Regenerate.
+	* gdbarch.h: Regenerate.
+	* hppa-tdep.c (hppa_prepare_to_proceed): Remove dangling prototype.
+	* hppah-nat.c (hppa_switched_threads): Remove.
+	* infrun.c (prepare_to_proceed): New static function, copied from
+	generic_prepare_to_proceed.  Remove select_it argument.
+	(proceed): Call prepare_to_proceed.
+	* infttrace.c (old_gdb_pid, reported_pid, reported_bpt): Remove
+	variables.
+	(ptrace_wait): Don't set the removed variables.
+	(hppa_switched_threads): Remove.
+	* lin-lwp.c (lin_lwp_prepare_to_proceed): Remove.
+	* config/nm-linux.h (PREPARE_TO_PROCEED): Don't define.
+	(lin_lwp_prepare_to_proceed): Remove prototype.
+	* config/i386/nm-x86-64linux.h (PREPARE_TO_PROCEED): Don't undefine.
+	* config/pa/nm-hppah.h (PREPARE_TO_PROCEED): Don't define.
+
+2003-06-18  Theodore A. Roth  <troth@openavr.org>
+
+	* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and
+	trad-frame.h.
+	(AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64.
+	(AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define.
+	(AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define.
+	(AVR_PROLOGUE_*): Enumerate prologue types.
+	(struct frame_extra_info): Remove.
+	(struct avr_unwind_cache): Define.
+	(avr_write_sp): Delete function.
+	(avr_read_fp): Ditto.
+	(avr_init_extra_frame_info): Ditto.
+	(avr_pop_frame): Ditto.
+	(avr_frame_saved_pc): Ditto.
+	(avr_saved_pc_after_call): Ditto.
+	(avr_push_return_address): Ditto.
+	(avr_frame_chain): Ditto.
+	(avr_store_struct_return): Ditto.
+	(avr_push_arguments): Ditto.
+	(avr_scan_prologue): Update comments. Changed to set up the info for
+	cache unwinding. Now returns end of prologue PC.
+	(avr_skip_prologue): Better handling of functions lacking a prologue
+	by using avr_scan_prologue.
+	(avr_scan_arg_moves): New function.
+	(avr_saved_regs_unwinder): Ditto.
+	(avr_frame_unwind_cache): Ditto.
+	(avr_unwind_pc): Ditto.
+	(avr_frame_this_id): Ditto.
+	(avr_frame_prev_register): Ditto.
+	(avr_frame_p): Ditto.
+	(avr_frame_base_address ): Ditto.
+	(avr_unwind_dummy_id): Ditto.
+	(avr_push_dummy_code): Ditto.
+	(push_stack_item): Ditto.
+	(pop_stack_item): Ditto.
+	(avr_push_dummy_call): Ditto.
+	(struct stack_item): Define.
+	(avr_frame_unwind): Declare structure.
+	(avr_frame_base): Ditto.
+	(avr_gdbarch_init): Remove calls to
+	set_gdbarch_deprecated_init_frame_pc,
+	set_gdbarch_deprecated_target_read_fp,
+	set_gdbarch_deprecated_dummy_write_sp,
+	set_gdbarch_deprecated_fp_regnum,
+	set_gdbarch_deprecated_push_arguments,
+	set_gdbarch_deprecated_push_return_address,
+	set_gdbarch_deprecated_pop_frame,
+	set_gdbarch_deprecated_store_struct_return,
+	set_gdbarch_deprecated_frame_init_saved_regs,
+	set_gdbarch_deprecated_init_extra_frame_info,
+	set_gdbarch_deprecated_frame_chain,
+	set_gdbarch_deprecated_frame_saved_pc,
+	set_gdbarch_deprecated_saved_pc_after_call.
+	Add calls to set_gdbarch_push_dummy_call,
+	set_gdbarch_push_dummy_code,
+	frame_unwind_append_predicate,
+	frame_base_set_default,
+	set_gdbarch_unwind_dummy_id,
+	set_gdbarch_unwind_pc.
+	Wrap a long line.
+
+2003-06-18  Corinna Vinschen  <vinschen@redhat.com>
+
+	* h8300-tdep.c (h8300s_register_name): Enable MACH and MACL
+	registers for H8/300S.
+	(h8300_print_registers_info): Ditto.
+	(h8300_gdbarch_init): Accommodate register count for H8/300S. 
+
+2003-06-18  Daniel Jacobowitz  <drow@mvista.com>
+
+	* config/nm-linux.h (linux_record_stopped_pid): New prototype.
+	* lin-lwp.c (child_wait): Call linux_record_stopped_pid.
+	(lin_lwp_wait): Likewise.  Update comments.
+	* linux-nat.c (struct simple_pid_list, add_to_pid_list)
+	(pull_pid_from_list, linux_record_stopped_pid): New.
+
+2003-06-17  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* ada-lang.c (scan_discrim_bound): Name first argument.
+	(ada_add_block_symbols): Remove BLOCK_SYM to use local variable
+	declared by ALL_BLOCK_SYMBOLS.
+
+2003-06-17  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* ada-tasks.c (find_function_in_inferior): Don't declare it.
+	("regcache.h"): Include it.
+	* ada-lex.l (block_lookup): Replace VAR_NAMESPACE with VAR_DOMAIN.
+
+2003-06-17  Daniel Jacobowitz  <drow@mvista.com>
+
+        * NEWS: Mention gdbserver detach change and "disconnect" command.
+        * infcmd.c (disconnect_command): New function.
+        (_initialize_infcmd): Add ``disconnect'' command.
+        * remote.c (remote_async_detach): Delete.
+        (remote_detach): Merge remote_async_detach.
+        (remote_disconnect): New.
+        (init_remote_ops): Set to_disconnect.
+        (init_remote_cisco_ops): Likewise.
+        (init_remote_async_ops): Likewise.  Use remote_detach.
+        * target.c (cleanup_target): Default to_disconnect.
+        (update_current_target): Inherit to_disconnect.
+        (target_disconnect, debug_to_disconnect): New functions.
+        (setup_target_debug): Set to_disconnect.
+        * target.h (struct target_ops): Add to_disconnect.
+        (target_disconnect): Add prototype.
+
+2003-06-17  Daniel Jacobowitz  <drow@mvista.com>
+
+	* breakpoint.c (insert_catchpoint): New function.
+	(insert_breakpoints): Use catch_exceptions to call
+	insert_catchpoint.  Disable catchpoints if they fail to insert.
+
+2003-06-17  Daniel Jacobowitz  <drow@mvista.com>
+
+	* symfile.c (reread_symbols): Clear sym_private.
+
+2003-06-17  Andrew Cagney  <cagney@redhat.com>
+
+	* trad-frame.h (struct frame_info): Add opaque declaration.
+	* remote-fileio.h (struct cmd_list_element): Add opaque
+	declaration.
+	* h8300-tdep.c (h8300s_register_name): Avoid C++ // style
+	comments.
+
+2003-06-17  Daniel Jacobowitz  <drow@mvista.com>
+
+	* remote.c (remote_prepare_to_store): Replace call to
+	deprecated_read_register_bytes with multiple regcache_raw_read
+	calls.
+
+2003-06-17  Kris Warkentin  <kewarken@qnx.com>
+
+	* nto-tdep.c (nto_map_arch_to_cputype): Recognize "powerpc".
+	(nto_find_and_open_solib): Likewise.
+	(nto_init_solib_absolute_prefix): Likewise.
+	(_initialize_nto_tdep): Fix indentation.
+
+2003-06-17  Kris Warkentin  <kewarken@qnx.com>
+
+	* i386-nto-tdep.c (i386nto_sigcontext_addr): Make sp a CORE_ADDR.
+
+2003-06-17  Kris Warkentin  <kewarken@qnx.com>
+
+	* i386-nto-tdep.c (i386nto_sigcontext_addr): Declare sp before using.
+
+2003-06-17  Jim Blandy  <jimb@redhat.com>
+
+	* ppc-linux-tdep.c: "Linux" -> "GNU/Linux"
+
+2003-06-16  Theodore A. Roth  <troth@openavr.org>
+
+	* avr-tdep.c (avr_extract_return_value): New function.
+	(avr_gdbarch_init): Set extract_return_value method.
+
+2003-06-16  Andrew Cagney  <cagney@redhat.com>
+
+	* frame.h (deprecated_get_next_frame_hack): Declare.
+	* frame.c (legacy_saved_regs_prev_register): Only require
+	DEPRECATED_FRAME_INIT_SAVED_REGS when it is needed.  Assert that
+	there are always saved regs.
+	(deprecated_generic_get_saved_register): Do not require
+	DEPRECATED_FRAME_INIT_SAVED_REGS.
+	(legacy_get_prev_frame): Do not require DEPRECATED_FRAME_CHAIN,
+	use frame ID unwind instead.
+	(deprecated_get_next_frame_hack): New function.
+
+2003-06-16  Corinna Vinschen  <vinschen@redhat.com>
+
+	* h8300-tdep.c (h8300_push_arguments): Remove.  Substitute by...
+	(h8300_push_dummy_call): ...this function.  Some minor optimization.
+	(h8300_push_return_address): Remove.
+	(h8300_gdbarch_init): Remove calls to
+	set_gdbarch_deprecated_dummy_write_sp,
+	set_gdbarch_deprecated_push_arguments and
+	set_gdbarch_deprecated_push_return_address.
+	Add call to set_gdbarch_push_dummy_call.
+
+2003-06-16  Corinna Vinschen  <vinschen@redhat.com>
+
+	* h8300-tdep.c (E_PSEUDO_CCR_REGNUM): New define.
+	(E_PSEUDO_EXR_REGNUM): Ditto.
+	(h8300_is_argument_spill): Check for instructions moving argument
+	registers into safe registers. 
+	(h8300_skip_prologue): Check for stm instruction to push registers
+	used for register variables onto stack.
+	(gdb_print_insn_h8300): Remove.
+	(h8300_examine_prologue): Add a comment.
+	(h8300_register_name): Take pseudo registers into account.
+	(h8300s_register_name): Ditto.
+	(h8300sx_register_name): Ditto.
+	(h8300_print_register): Ditto.
+	(h8300_print_registers_info): Define "nice" printing order.
+	(h8300_saved_pc_after_call): Take pseudo registers into account.
+	(h8300_register_type): Ditto.  Return type used for remote connection
+	when requesting real CCR or EXR register, return actual type when
+	requesting pseudo CCR or EXR.
+	(h8300_pseudo_register_read): New function.
+	(h8300_pseudo_register_write): Ditto.
+	(h8300_dbg_reg_to_regnum): Ditto.
+	(h8300s_dbg_reg_to_regnum): Ditto.
+	(h8300_gdbarch_init): Call set_gdbarch_num_pseudo_regs,
+	set_gdbarch_ecoff_reg_to_regnum, set_gdbarch_dwarf_reg_to_regnum,
+	set_gdbarch_dwarf2_reg_to_regnum, set_gdbarch_stab_reg_to_regnum and
+	set_gdbarch_print_insn architecture dependent.
+	Call set_gdbarch_pseudo_register_read and
+	set_gdbarch_pseudo_register_write.
+	(_initialize_h8300_tdep): Remove assignment to deprecated_tm_print_insn.
+
+2003-06-16  Andrew Cagney  <cagney@redhat.com>
+
+	* gdbarch.sh (SAVE_DUMMY_FRAME_TOS): Deprecate.
+	* gdbarch.h, gdbarch.c: Re-generate.
+	* xstormy16-tdep.c (xstormy16_gdbarch_init): Update.
+	* s390-tdep.c (s390_gdbarch_init): Update.
+	* rs6000-tdep.c (rs6000_gdbarch_init): Update.
+	* mn10300-tdep.c (mn10300_gdbarch_init): Update.
+	* mips-tdep.c (mips_gdbarch_init): Update.
+	* mcore-tdep.c (mcore_gdbarch_init): Update.
+	* cris-tdep.c (cris_gdbarch_init): Update.
+	* infcall.c (call_function_by_hand): Update.
+	* ia64-tdep.c (ia64_push_arguments): Update comment.
+	* frame.c (legacy_get_prev_frame): Do not assume
+	SAVE_DUMMY_FRAME_TOS_P.
+	* dummy-frame.c (find_dummy_frame): Update comment.
+
+2003-06-16  Andrew Cagney  <cagney@redhat.com>
+
+	* regcache.c (do_cooked_read): Do not use register_valid_p.
+
+2003-06-15  Theodore A. Roth  <troth@openavr.org>
+
+	* avr-tdep.c (avr_register_type): Remove a blank line.
+	(avr_scan_prologue): Correct some comments.
+
+2003-06-15  Theodore A. Roth  <troth@openavr.org>
+
+	* avr-tdep.c (avr_scan_prologue): Update comment describing the various
+	prologue types.
+	Properly scan prologues generated by gcc with the -mcall-prologues 
+	option.
+	Add code to scan -mcall-prologues for mega devices.
+
+2003-06-15  Theodore A. Roth  <troth@openavr.org>
+
+	* avr-tdep.c (avr_register_byte): Delete function.
+	(avr_register_raw_size): Delete function.
+	(avr_register_virtual_size): Delete function.
+	(avr_register_virtual_type): Delete function.
+	(avr_register_type): New function.
+	(avr_address_to_pointer): Remove unused code.
+	(avr_read_fp): Need to read FP as two separate bytes due to change to
+	avr_register_type() usage.
+	(avr_gdbarch_init): Don't set deprecated_register_size.
+	Don't set deprecated_register_bytes.
+	Don't set deprecated_register_byte.
+	Don't set deprecated_register_raw_size.
+	Don't set deprecated_max_register_raw_size.
+	Don't set deprecated_register_virtual_size.
+	Don't set deprecated_max_register_virtual_size.
+	Don't set deprecated_register_virtual_type.
+	Set register_type method.
+
+2003-06-15  Daniel Jacobowitz  <drow@mvista.com>
+
+	* Makefile.in (linux-nat.o): Add rule.
+	* linux-nat.c: New file.
+	* config/nm-linux.h (CHILD_INSERT_FORK_CATCHPOINT): Define.
+	(CHILD_INSERT_VFORK_CATCHPOINT): Define.
+	(CHILD_INSERT_EXEC_CATCHPOINT): Define.
+	* config/alpha/alpha-linux.mh (NATDEPFILES): Add linux-nat.o.
+	* config/arm/linux.mh (NATDEPFILES): Likewise.
+	* config/i386/linux.mh (NATDEPFILES): Likewise.
+	* config/i386/x86-64linux.mh (NATDEPFILES): Likewise.
+	* config/ia64/linux.mh (NATDEPFILES): Likewise.
+	* config/m68k/linux.mh (NATDEPFILES): Likewise.
+	* config/mips/linux.mh (NATDEPFILES): Likewise.
+	* config/powerpc/linux.mh (NATDEPFILES): Likewise.
+	* config/s390/s390.mh (NATDEPFILES): Likewise.
+	* config/sparc/linux.mh (NATDEPFILES): Likewise.
+
+2003-06-15  Mark Kettenis  <kettenis@gnu.org>
+
+	* i387-tdep.c: Reorder includes, fix some whitespace issues and
+	replace out-of-date comment.
+
+2003-06-15  Andrew Cagney  <cagney@redhat.com>
+
+	* rdi-share/host.h (Fail): Change to a varargs function.
+	* remote-rdi.c (Fail): Update.
+	
+2003-06-15  Mark Kettenis  <kettenis@gnu.org>
+
+	* i386-tdep.c (i386_next_regnum): Fix bounds checking.
+	(i386_convert_register_p, i386_register_to_value,
+	i386_register_from_value): Handle types longer than 8 bytes.
+
+2003-06-15  Mark Kettenis  <kettenis@gnu.org>
+
+	* i386-tdep.c (i386_register_to_value, i386_value_to_register):
+	Move floating-point code to new function in i387-tdep.c.
+	* i387-tdep.c (i387_register_to_value, i387_value_to_register):
+	New functions containing code moved here from i386-tdep.c.
+	* i387-tdep.h: Add opaque declaration for `struct type'.
+	(i387_register_to_value, i387_value_to_register): New prototypes.
+	* x86-64-tdep.c (x86_64_convert_register_p): New function.
+	(x86_64_init_abi): Set convert_register_p, register_to_value and
+	value_to_register here.
+	
+2003-06-14  Andrew Cagney  <cagney@redhat.com>
+
+	* mips-tdep.c (mips_register_to_value): Make static.
+	(mips_value_to_register): Make static.
+	* i386-tdep.c (i386_fetch_pointer_argument): Make static.
+	* ia64-tdep.c (ia64_register_raw_size): Make static.
+	(ia64_register_virtual_size): Make static.
+	(ia64_register_byte): Make static.
+	* i387-tdep.c: Include "i387-tdep.h".
+	(print_387_control_word): Delete function.
+	(print_387_status_word): Delete function.
+	(print_387_status_bits): Delete function.
+	(print_387_control_bits): Delete function.
+	* Makefile.in (i387-tdep.o): Update dependencies.
+	* rdi-share/host.h (Fail): Declare.
+	* remote-rdi.c (Fail): Update to match declaration.
+
+2003-06-14  Andrew Cagney  <cagney@redhat.com>
+
+	* config/mips/embedl64.mt (TDEPFILES): Delete "remote-array.o".
+	* config/mips/embedl.mt (TDEPFILES): Delete "remote-array.o".
+	* config/mips/embed64.mt (TDEPFILES): Delete "remote-array.o".
+	* config/djgpp/fnchange.lst: Delete "remote-array.c".
+	* README: Delete reference to remote-array.
+	* Makefile.in (ALLDEPFILES): Remove "remote-array.c".
+	(remote-array.o): Delete target.
+	* config/mips/embed.mt (TDEPFILES): Delete "remote-array.o".
+	* remote-array.c: Delete file.
+
+2003-06-14  Andrew Cagney  <cagney@redhat.com>
+            Mark Kettenis  <kettenis@gnu.org>
+
+	* gdbarch.sh (CONVERT_REGISTER_P): Add "type" parameter.
+	(REGISTER_TO_VALUE, VALUE_TO_REGISTER): Replace raw buffer
+	parameter with "frame".
+	* gdbarch.h, gdbarch.c: Re-generate.
+	* frame.h (put_frame_register): Declare.
+	* frame.c (put_frame_register): New function.
+	* arch-utils.c (legacy_convert_register_p): Add "type" parameter.
+	(legacy_register_to_value): Rewrite, use "frame" to get the
+	register value.
+	(legacy_value_to_register): Rewrite, use "frame" to find the
+	register's location before storing.
+	* arch-utils.h (legacy_convert_register_p): Update.
+	(legacy_register_to_value, legacy_value_to_register): Update.
+	* findvar.c (value_from_register): Rewrite, eliminate use of
+	REGISTER_CONVERT_TO_TYPE, pass "type" to CONVERT_REGISTER_P, pass
+	"frame" to REGISTER_TO_VALUE.
+	* valops.c (value_assign): Move the CONVERT_REGISTER code to the
+	lval_reg_frame_relative + lval_register branch of the switch.  Do
+	not use REGISTER_CONVERT_FROM_TYPE.  Use put_frame_register.
+	* i386-tdep.c (I386_EBX_REGNUM, I386_ECX_REGNUM, I386_ESI_REGNUM,
+	I386_EDI_REGNUM): New defines.
+	(i386_next_regnum, i386_convert_register_p,
+	i386_register_to_value, i386_value_to_register): New functions.
+	(i386_register_convertible, i386_register_convert_to_virtual,
+	i386_convert_to_raw): Remove functions.
+	(i386_gdbarch_init): Set convert_register_p, register_to_value and
+	value_to_register instead of register_convertible,
+	register_convert_to_virtual and register_convert_to_raw.
+	* mips-tdep.c (mips_convert_register_p): New function.
+	(mips_value_to_register): Replace mips_register_convert_from_type.
+	(mips_register_to_value): Replace mips_register_convert_to_type.
+	(mips_gdbarch_init): Set conver_register_p, value_to_register and
+	register_to_value.
+	* alpha-tdep.c (alpha_convert_register_p): Update.
+	(alpha_value_to_register): Update, store the register.
+	(alpha_register_to_value): Update, fetch the register.
+
+2003-06-14  Theodore A. Roth  <troth@openavr.org>
+
+	* avr-tdep.c (avr_remote_translate_xfer_address): Delete function.
+	(avr_gdbarch_init): Remove avr_call_dummy_words variable.
+	Don't set deprecated_call_dummy_words.
+	Remove commented out set_gdbarch_believe_pcc_promotion() call.
+	Don't set remote_translate_xfer_address.
+	(avr_io_reg_read_command): Remove commented out debug printf.
+	Wrap a long line.
+
+2003-06-14  Theodore A. Roth  <troth@openavr.org>
+
+	* avr-tdep.c (avr_scan_prologue): Fix to avoid a buffer over run which
+	causes gdb to seg fault.
+
+2003-06-14  Daniel Jacobowitz  <drow@mvista.com>
+
+	* sparc-nat.c (fetch_inferior_registers): Correct
+	a reference to "registers".
+
+2003-06-14  Jeroen Dekkers  <jeroen@dekkers.cx>
+
+	* Makefile.in (exc_request_U_h): Define
+	(exc_request_S_h): Likewise.
+	(msg_reply_S_h): Likewise.
+	(msg_U_h): Likewise.
+	(notify_S_h): Likewise.
+	(process_reply_S_h): Likewise.
+	(gnu-nat.o): Depend on gdb_obstack_h
+	* gnu-nat.c: Include "gdb_obstack.h".
+
+2003-06-13  Andrew Cagney  <cagney@redhat.com>
+
+	* gdbarch.sh: Document what PUSH_DUMMY_CALL replaces.
+	* gdbarch.h, gdbarch.c: Re-generate.
+	
+2003-06-13  Andrew Cagney  <cagney@redhat.com>
+
+	* gdbarch.sh: Document what UNWIND_DUMMY_ID replaces.  Clarify
+	when deprecated REGISTER macros can be deleted.
+	* gdbarch.h, gdbarch.c: Re-generate.
+
 2003-06-13  Jim Blandy  <jimb@redhat.com>
 
 	* solib-svr4.c (solib_break_names): Recognize the 64-bit PowerPC
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 6a34d2f..28433cd 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -645,6 +645,8 @@
 environ_h = environ.h
 event_loop_h = event-loop.h
 event_top_h = event-top.h
+exc_request_U_h = exc_request_U.h
+exc_request_S_h = exc_request_S.h
 expression_h = expression.h $(symtab_h) $(doublest_h)
 f_lang_h = f-lang.h
 frame_h = frame.h
@@ -683,6 +685,7 @@
 kod_h = kod.h
 language_h = language.h
 linespec_h = linespec.h
+linux_nat_h = linux-nat.h
 m2_lang_h = m2-lang.h
 m68k_tdep_h = m68k-tdep.h
 macroexp_h = macroexp.h
@@ -694,7 +697,10 @@
 mips_tdep_h = mips-tdep.h
 mipsnbsd_tdep_h = mipsnbsd-tdep.h
 monitor_h = monitor.h
+msg_reply_S_h = msg_reply_S.h
+msg_U_h = msg_U.h
 nbsd_tdep_h = nbsd-tdep.h
+notify_S_h = notify_S.h
 ns32k_tdep_h = ns32k-tdep.h
 objc_lang_h = objc-lang.h
 objfiles_h = objfiles.h $(gdb_obstack_h) $(symfile_h)
@@ -707,6 +713,7 @@
 ppc_tdep_h = ppc-tdep.h
 ppcnbsd_tdep_h = ppcnbsd-tdep.h
 proc_utils_h = proc-utils.h
+process_reply_S_h = process_reply_S.h
 regcache_h = regcache.h
 reggroups_h = reggroups.h
 remote_utils_h = remote-utils.h $(target_h)
@@ -1396,7 +1403,7 @@
 	ppc-sysv-tdep.o ppc-linux-nat.c ppc-linux-tdep.c \
 	ppcnbsd-nat.o ppcnbsd-tdep.o \
 	procfs.c \
-	remote-array.c remote-e7000.c \
+	remote-e7000.c \
 	remote-hms.c remote-mips.c \
 	remote-rdp.c remote-sim.c \
 	remote-st.c remote-utils.c dcache.c \
@@ -1767,7 +1774,7 @@
 	$(value_h) $(language_h) $(target_h) $(gdb_wait_h) $(gdbcmd_h) \
 	$(gdbcore_h) $(gdbthread_h) $(gdb_assert_h) $(gnu_nat_h) \
 	$(exc_request_S_h) $(notify_S_h) $(process_reply_S_h) \
-	$(msg_reply_S_h) $(exc_request_U_h) $(msg_U_h)
+	$(msg_reply_S_h) $(exc_request_U_h) $(msg_U_h) $(gdb_obstack_h)
 gnu-v2-abi.o: gnu-v2-abi.c $(defs_h) $(gdb_string_h) $(symtab_h) \
 	$(gdbtypes_h) $(value_h) $(demangle_h) $(cp_abi_h)
 gnu-v3-abi.o: gnu-v3-abi.c $(defs_h) $(value_h) $(cp_abi_h) $(demangle_h) \
@@ -1845,7 +1852,8 @@
 	$(i386_tdep_h) $(i387_tdep_h) $(gregset_h)
 i387-tdep.o: i387-tdep.c $(defs_h) $(frame_h) $(inferior_h) $(language_h) \
 	$(value_h) $(gdbcore_h) $(floatformat_h) $(regcache_h) \
-	$(gdb_assert_h) $(gdb_string_h) $(doublest_h) $(i386_tdep_h)
+	$(gdb_assert_h) $(gdb_string_h) $(doublest_h) $(i386_tdep_h) \
+	$(i387_tdep_h)
 ia64-aix-nat.o: ia64-aix-nat.c $(defs_h) $(inferior_h) $(target_h) \
 	$(gdbcore_h) $(regcache_h) $(symtab_h) $(bfd_h) $(symfile_h) \
 	$(objfiles_h) $(gdb_stat_h)
@@ -1905,13 +1913,16 @@
 	$(value_h) $(gdbcmd_h) $(expression_h) $(language_h) $(target_h) \
 	$(parser_defs_h) $(jv_lang_h) $(demangle_h)
 lin-lwp.o: lin-lwp.c $(defs_h) $(gdb_assert_h) $(gdb_string_h) $(gdb_wait_h) \
-	$(gdbthread_h) $(inferior_h) $(target_h) $(regcache_h) $(gdbcmd_h)
+	$(gdbthread_h) $(inferior_h) $(target_h) $(regcache_h) $(gdbcmd_h) \
+	$(linux_nat_h)
 linespec.o: linespec.c $(defs_h) $(symtab_h) $(frame_h) $(command_h) \
 	$(symfile_h) $(objfiles_h) $(source_h) $(demangle_h) $(value_h) \
 	$(completer_h) $(cp_abi_h) $(parser_defs_h) $(block_h) $(objc_lang_h)
+linux-nat.o: linux-nat.c $(defs_h) $(inferior_h) $(target_h) $(gdb_wait_h) \
+	$(linux_nat_h)
 linux-proc.o: linux-proc.c $(defs_h) $(inferior_h) $(regcache_h) \
 	$(gregset_h) $(gdbcore_h) $(gdbthread_h) $(elf_bfd_h) \
-	$(cli_decode_h) $(gdb_string_h)
+	$(cli_decode_h) $(gdb_string_h) $(linux_nat_h)
 lynx-nat.o: lynx-nat.c $(defs_h) $(frame_h) $(inferior_h) $(target_h) \
 	$(gdbcore_h) $(regcache_h)
 m2-lang.o: m2-lang.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(expression_h) \
@@ -1990,10 +2001,10 @@
 mips-nat.o: mips-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) $(regcache_h)
 mips-tdep.o: mips-tdep.c $(defs_h) $(gdb_string_h) $(gdb_assert_h) \
 	$(frame_h) $(inferior_h) $(symtab_h) $(value_h) $(gdbcmd_h) \
-	$(language_h) $(gdbcore_h) $(symfile_h) $(objfiles_h) \
-	$(gdbtypes_h) $(target_h) $(arch_utils_h) $(regcache_h) \
-	$(osabi_h) $(mips_tdep_h) $(block_h) $(opcode_mips_h) \
-	$(elf_mips_h) $(elf_bfd_h) $(symcat_h)
+	$(language_h) $(gdbcore_h) $(symfile_h) $(objfiles_h) $(gdbtypes_h) \
+	$(target_h) $(arch_utils_h) $(regcache_h) $(osabi_h) $(mips_tdep_h) \
+	$(block_h) $(reggroups_h) $(opcode_mips_h) $(elf_mips_h) \
+	$(elf_bfd_h) $(symcat_h)
 mipsm3-nat.o: mipsm3-nat.c $(defs_h) $(inferior_h) $(regcache_h)
 mipsnbsd-nat.o: mipsnbsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \
 	$(mipsnbsd_tdep_h)
@@ -2101,9 +2112,6 @@
 	$(gdb_string_h) $(gdbcmd_h)
 reggroups.o: reggroups.c $(defs_h) $(reggroups_h) $(gdbtypes_h) \
 	$(gdb_assert_h) $(regcache_h) $(command_h) $(gdbcmd_h)
-remote-array.o: remote-array.c $(defs_h) $(gdbcore_h) $(target_h) \
-	$(gdb_string_h) $(command_h) $(serial_h) $(monitor_h) \
-	$(remote_utils_h) $(inferior_h) $(version_h) $(regcache_h)
 remote-e7000.o: remote-e7000.c $(defs_h) $(gdbcore_h) $(gdbarch_h) \
 	$(inferior_h) $(target_h) $(value_h) $(command_h) $(gdb_string_h) \
 	$(gdbcmd_h) $(serial_h) $(remote_utils_h) $(symfile_h) $(regcache_h)
@@ -2408,7 +2416,7 @@
 	$(gdb_wait_h) $(gdb_regex_h) $(gdb_string_h) $(filenames_h) \
 	$(ui_out_h) $(top_h) $(cli_decode_h) $(cli_script_h) \
 	$(cli_setshow_h) $(cli_cmds_h) $(source_h) $(linespec_h) \
-	$(expression_h) $(language_h) $(objfiles_h)
+	$(expression_h) $(language_h) $(objfiles_h) $(gdb_vfork_h)
 	$(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/cli/cli-cmds.c
 cli-decode.o: $(srcdir)/cli/cli-decode.c $(defs_h) $(symtab_h) \
 	$(gdb_regex_h) $(gdb_string_h) $(ui_out_h) $(cli_cmds_h) \
diff --git a/gdb/NEWS b/gdb/NEWS
index 98aab4f..10cd468 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -3,6 +3,12 @@
 
 *** Changes since GDB 5.3:
 
+* The meaning of "detach" has changed for gdbserver
+
+The "detach" command will now resume the application, as documented.  To
+disconnect from gdbserver and leave it stopped, use the new "disconnect"
+command.
+
 * d10v `regs' command deprecated
 
 The `info registers' command has been updated so that it displays the
diff --git a/gdb/README b/gdb/README
index a8b4b82..953f1a0 100644
--- a/gdb/README
+++ b/gdb/README
@@ -462,7 +462,6 @@
    There are a number of remote interfaces for talking to existing ROM
 monitors and other hardware:
 
-	remote-array.c   Array Tech RAID controller
 	remote-e7000.c	 Hitachi E7000 ICE
 	remote-est.c	 EST emulator
 	remote-hms.c	 Hitachi Micro Systems H8/300 monitor
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index eaa5281..26780e3 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -4038,8 +4038,6 @@
 
       ALL_BLOCK_SYMBOLS (block, iter, sym)
 	  {
-	    struct symbol *sym = BLOCK_SYM (block, i);
-
 	    if (SYMBOL_DOMAIN (sym) == domain)
 	      {
 		int cmp;
@@ -7710,7 +7708,7 @@
    not alter *PX and *PNEW_K if unsuccessful. */
 
 static int
-scan_discrim_bound (char *, int k, struct value *dval, LONGEST * px,
+scan_discrim_bound (char *str, int k, struct value *dval, LONGEST * px,
 		    int *pnew_k)
 {
   static char *bound_buffer = NULL;
diff --git a/gdb/ada-lex.l b/gdb/ada-lex.l
index 2252d52..d8bc789 100644
--- a/gdb/ada-lex.l
+++ b/gdb/ada-lex.l
@@ -627,7 +627,7 @@
   int nsyms;
   struct symtab *symtab;
   nsyms = ada_lookup_symbol_list (name, left_block_context,
-				  VAR_NAMESPACE, &syms, &blocks);
+				  VAR_DOMAIN, &syms, &blocks);
   if (left_block_context == NULL &&
       (nsyms == 0 || SYMBOL_CLASS (syms[0]) != LOC_BLOCK))
     symtab = lookup_symtab (name);
@@ -652,7 +652,7 @@
     }
 }
 
-/* Look up NAME0 (assumed to be mangled) as a name in VAR_NAMESPACE,
+/* Look up NAME0 (assumed to be mangled) as a name in VAR_DOMAIN,
    setting *TOKEN_TYPE to NAME or TYPENAME, depending on what is
    found.  Try first the entire name, then the name without the last 
    segment (i.e., after the last .id), etc., and return the number of
@@ -685,10 +685,10 @@
 
       if (left_block_context == NULL) 
 	nsyms = ada_lookup_symbol_list (name, expression_context_block, 
-					VAR_NAMESPACE, &syms, &blocks);
+					VAR_DOMAIN, &syms, &blocks);
       else
 	nsyms = ada_lookup_symbol_list (name, left_block_context, 
-					VAR_NAMESPACE, &syms, &blocks);
+					VAR_DOMAIN, &syms, &blocks);
 
       /* Check for a type definition. */
 
diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c
index ad67cba..0cf4d83 100644
--- a/gdb/ada-tasks.c
+++ b/gdb/ada-tasks.c
@@ -22,6 +22,7 @@
 #include "inferior.h"
 #include "symtab.h"
 #include "target.h"
+#include "regcache.h"
 #include "gdbcore.h"
 
 #if (defined(__alpha__) && defined(__osf__) && !defined(__alpha_vxworks))
@@ -90,8 +91,6 @@
 #define READ_MEMORY(addr, var) read_memory (addr, (char*) &var, sizeof (var))
 /* external declarations */
 
-extern struct value *find_function_in_inferior (char *);
-
 /* Global visible variables */
 
 struct task_entry *task_list = NULL;
diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c
index d523577..fb2ca18 100644
--- a/gdb/alpha-tdep.c
+++ b/gdb/alpha-tdep.c
@@ -206,14 +206,17 @@
    registers is different. */
 
 static int
-alpha_convert_register_p (int regno)
+alpha_convert_register_p (int regno, struct type *type)
 {
   return (regno >= ALPHA_FP0_REGNUM && regno < ALPHA_FP0_REGNUM + 31);
 }
 
 static void
-alpha_register_to_value (int regnum, struct type *valtype, char *in, char *out)
+alpha_register_to_value (struct frame_info *frame, int regnum,
+			 struct type *valtype, void *out)
 {
+  char in[MAX_REGISTER_SIZE];
+  frame_register_read (frame, regnum, in);
   switch (TYPE_LENGTH (valtype))
     {
     case 4:
@@ -228,8 +231,10 @@
 }
 
 static void
-alpha_value_to_register (struct type *valtype, int regnum, char *in, char *out)
+alpha_value_to_register (struct frame_info *frame, int regnum,
+			 struct type *valtype, const void *in)
 {
+  char out[MAX_REGISTER_SIZE];
   switch (TYPE_LENGTH (valtype))
     {
     case 4:
@@ -241,6 +246,7 @@
     default:
       error ("Cannot store value in floating point register");
     }
+  put_frame_register (frame, regnum, out);
 }
 
 
diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c
index 9fa9cea..043600e 100644
--- a/gdb/arch-utils.c
+++ b/gdb/arch-utils.c
@@ -272,66 +272,6 @@
   return reg;
 }
 
-/* Default prepare_to_procced().  */
-int
-default_prepare_to_proceed (int select_it)
-{
-  return 0;
-}
-
-/* Generic prepare_to_proceed().  This one should be suitable for most
-   targets that support threads. */
-int
-generic_prepare_to_proceed (int select_it)
-{
-  ptid_t wait_ptid;
-  struct target_waitstatus wait_status;
-
-  /* Get the last target status returned by target_wait().  */
-  get_last_target_status (&wait_ptid, &wait_status);
-
-  /* Make sure we were stopped either at a breakpoint, or because
-     of a Ctrl-C.  */
-  if (wait_status.kind != TARGET_WAITKIND_STOPPED
-      || (wait_status.value.sig != TARGET_SIGNAL_TRAP &&
-          wait_status.value.sig != TARGET_SIGNAL_INT))
-    {
-      return 0;
-    }
-
-  if (!ptid_equal (wait_ptid, minus_one_ptid)
-      && !ptid_equal (inferior_ptid, wait_ptid))
-    {
-      /* Switched over from WAIT_PID.  */
-      CORE_ADDR wait_pc = read_pc_pid (wait_ptid);
-
-      if (wait_pc != read_pc ())
-	{
-	  if (select_it)
-	    {
-	      /* Switch back to WAIT_PID thread.  */
-	      inferior_ptid = wait_ptid;
-
-	      /* FIXME: This stuff came from switch_to_thread() in
-		 thread.c (which should probably be a public function).  */
-	      flush_cached_frames ();
-	      registers_changed ();
-	      stop_pc = wait_pc;
-	      select_frame (get_current_frame ());
-	    }
-          /* We return 1 to indicate that there is a breakpoint here,
-             so we need to step over it before continuing to avoid
-             hitting it straight away. */
-          if (breakpoint_here_p (wait_pc))
-            {
-	      return 1;
-            }
-	}
-    }
-  return 0;
-  
-}
-
 CORE_ADDR
 init_frame_pc_noop (int fromleaf, struct frame_info *prev)
 {
@@ -440,23 +380,29 @@
 }
 
 int
-legacy_convert_register_p (int regnum)
+legacy_convert_register_p (int regnum, struct type *type)
 {
   return DEPRECATED_REGISTER_CONVERTIBLE (regnum);
 }
 
 void
-legacy_register_to_value (int regnum, struct type *type,
-			  char *from, char *to)
+legacy_register_to_value (struct frame_info *frame, int regnum,
+			  struct type *type, void *to)
 {
+  char from[MAX_REGISTER_SIZE];
+  frame_read_register (frame, regnum, from);
   DEPRECATED_REGISTER_CONVERT_TO_VIRTUAL (regnum, type, from, to);
 }
 
 void
-legacy_value_to_register (struct type *type, int regnum,
-			  char *from, char *to)
+legacy_value_to_register (struct frame_info *frame, int regnum,
+			  struct type *type, const void *tmp)
 {
+  char to[MAX_REGISTER_SIZE];
+  char *from = alloca (TYPE_LENGTH (type));
+  memcpy (from, from, TYPE_LENGTH (type));
   DEPRECATED_REGISTER_CONVERT_TO_RAW (type, regnum, from, to);
+  put_frame_register (frame, regnum, to);
 }
 
 
diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h
index 8fce252..234257d 100644
--- a/gdb/arch-utils.h
+++ b/gdb/arch-utils.h
@@ -105,12 +105,6 @@
 
 extern int no_op_reg_to_regnum (int reg);
 
-/* Default prepare_to_procced. */
-
-extern int default_prepare_to_proceed (int select_it);
-
-extern int generic_prepare_to_proceed (int select_it);
-
 /* Versions of init_frame_pc().  Do nothing; do the default. */
 
 extern CORE_ADDR init_frame_pc_noop (int fromleaf, struct frame_info *prev);
@@ -160,9 +154,11 @@
    (something that is discouraged); and to convert a register to the
    type of a corresponding variable.  These legacy functions preserve
    that overloaded behavour in existing targets.  */
-extern int legacy_convert_register_p (int regnum);
-extern void legacy_register_to_value (int regnum, struct type *type, char *from, char *to);
-extern void legacy_value_to_register (struct type *type, int regnum, char *from, char *to);
+extern int legacy_convert_register_p (int regnum, struct type *type);
+extern void legacy_register_to_value (struct frame_info *frame, int regnum,
+				      struct type *type, void *to);
+extern void legacy_value_to_register (struct frame_info *frame, int regnum,
+				      struct type *type, const void *from);
 
 /* For compatibility with older architectures, returns
    (LEGACY_SIM_REGNO_IGNORE) when the register doesn't have a valid
diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c
index df1ffdd..c5d6ffe 100644
--- a/gdb/avr-tdep.c
+++ b/gdb/avr-tdep.c
@@ -25,6 +25,10 @@
    by Denis Chertykov, denisc@overta.ru */
 
 #include "defs.h"
+#include "frame.h"
+#include "frame-unwind.h"
+#include "frame-base.h"
+#include "trad-frame.h"
 #include "gdbcmd.h"
 #include "gdbcore.h"
 #include "inferior.h"
@@ -89,7 +93,7 @@
 
   AVR_PC_REG_INDEX = 35,	/* index into array of registers */
 
-  AVR_MAX_PROLOGUE_SIZE = 56,	/* bytes */
+  AVR_MAX_PROLOGUE_SIZE = 64,	/* bytes */
 
   /* Count of pushed registers. From r2 to r17 (inclusively), r28, r29 */
   AVR_MAX_PUSHES = 18,
@@ -97,6 +101,12 @@
   /* Number of the last pushed register. r17 for current avr-gcc */
   AVR_LAST_PUSHED_REGNUM = 17,
 
+  AVR_ARG1_REGNUM = 24,         /* Single byte argument */
+  AVR_ARGN_REGNUM = 25,         /* Multi byte argments */
+
+  AVR_RET1_REGNUM = 24,         /* Single byte return value */
+  AVR_RETN_REGNUM = 25,         /* Multi byte return value */
+
   /* FIXME: TRoth/2002-01-??: Can we shift all these memory masks left 8
      bits? Do these have to match the bfd vma values?. It sure would make
      things easier in the future if they didn't need to match.
@@ -130,6 +140,20 @@
 #endif
 };
 
+/* Prologue types:
+
+   NORMAL and CALL are the typical types (the -mcall-prologues gcc option
+   causes the generation of the CALL type prologues).  */
+
+enum {
+    AVR_PROLOGUE_NONE,              /* No prologue */
+    AVR_PROLOGUE_NORMAL,
+    AVR_PROLOGUE_CALL,              /* -mcall-prologues */
+    AVR_PROLOGUE_MAIN,
+    AVR_PROLOGUE_INTR,              /* interrupt handler */
+    AVR_PROLOGUE_SIG,               /* signal handler */
+};
+
 /* Any function with a frame looks like this
    .......    <-SP POINTS HERE
    LOCALS1    <-FP POINTS HERE
@@ -141,14 +165,17 @@
    FIRST ARG
    SECOND ARG */
 
-struct frame_extra_info
+struct avr_unwind_cache
 {
-  CORE_ADDR return_pc;
-  CORE_ADDR args_pointer;
-  int locals_size;
-  int framereg;
-  int framesize;
-  int is_main;
+  /* The previous frame's inner most stack address.  Used as this
+     frame ID's stack_addr.  */
+  CORE_ADDR prev_sp;
+  /* The frame's base, optionally used by the high-level debug info.  */
+  CORE_ADDR base;
+  int size;
+  int prologue_type;
+  /* Table indicating the location of each and every register.  */
+  struct trad_frame_saved_reg *saved_regs;
 };
 
 struct gdbarch_tdep
@@ -176,60 +203,18 @@
   return register_names[regnum];
 }
 
-/* Index within `registers' of the first byte of the space for
-   register REGNUM.  */
-
-static int
-avr_register_byte (int regnum)
-{
-  if (regnum < AVR_PC_REGNUM)
-    return regnum;
-  else
-    return AVR_PC_REG_INDEX;
-}
-
-/* Number of bytes of storage in the actual machine representation for
-   register REGNUM.  */
-
-static int
-avr_register_raw_size (int regnum)
-{
-  switch (regnum)
-    {
-    case AVR_PC_REGNUM:
-      return 4;
-    case AVR_SP_REGNUM:
-    case AVR_FP_REGNUM:
-      return 2;
-    default:
-      return 1;
-    }
-}
-
-/* Number of bytes of storage in the program's representation
-   for register N.  */
-
-static int
-avr_register_virtual_size (int regnum)
-{
-  return TYPE_LENGTH (REGISTER_VIRTUAL_TYPE (regnum));
-}
-
 /* Return the GDB type object for the "standard" data type
    of data in register N.  */
 
 static struct type *
-avr_register_virtual_type (int regnum)
+avr_register_type (struct gdbarch *gdbarch, int reg_nr)
 {
-  switch (regnum)
-    {
-    case AVR_PC_REGNUM:
-      return builtin_type_unsigned_long;
-    case AVR_SP_REGNUM:
-      return builtin_type_unsigned_short;
-    default:
-      return builtin_type_unsigned_char;
-    }
+  if (reg_nr == AVR_PC_REGNUM)
+    return builtin_type_uint32;
+  if (reg_nr == AVR_SP_REGNUM)
+    return builtin_type_void_data_ptr;
+  else
+    return builtin_type_uint8;
 }
 
 /* Instruction address checks and convertions. */
@@ -326,14 +311,6 @@
 {
   CORE_ADDR addr = extract_unsigned_integer (buf, TYPE_LENGTH (type));
 
-  if (TYPE_CODE_SPACE (TYPE_TARGET_TYPE (type)))
-    {
-      fprintf_unfiltered (gdb_stderr, "CODE_SPACE ---->> ptr->addr: 0x%lx\n",
-			  addr);
-      fprintf_unfiltered (gdb_stderr,
-			  "+++ If you see this, please send me an email <troth@openavr.org>\n");
-    }
-
   /* Is it a code address?  */
   if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC
       || TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_METHOD
@@ -347,12 +324,12 @@
 avr_read_pc (ptid_t ptid)
 {
   ptid_t save_ptid;
-  CORE_ADDR pc;
+  ULONGEST pc;
   CORE_ADDR retval;
 
   save_ptid = inferior_ptid;
   inferior_ptid = ptid;
-  pc = (int) read_register (AVR_PC_REGNUM);
+  regcache_cooked_read_unsigned (current_regcache, AVR_PC_REGNUM, &pc);
   inferior_ptid = save_ptid;
   retval = avr_make_iaddr (pc);
   return retval;
@@ -372,122 +349,141 @@
 static CORE_ADDR
 avr_read_sp (void)
 {
-  return (avr_make_saddr (read_register (AVR_SP_REGNUM)));
+  ULONGEST sp;
+
+  regcache_cooked_read_unsigned (current_regcache, AVR_SP_REGNUM, &sp);
+  return (avr_make_saddr (sp));
 }
 
-static void
-avr_write_sp (CORE_ADDR val)
+static int
+avr_scan_arg_moves (int vpc, unsigned char *prologue)
 {
-  write_register (AVR_SP_REGNUM, avr_convert_saddr_to_raw (val));
+  unsigned short insn;
+
+  for (; vpc < AVR_MAX_PROLOGUE_SIZE; vpc += 2)
+    {
+      insn = EXTRACT_INSN (&prologue[vpc]);
+      if ((insn & 0xff00) == 0x0100)	/* movw rXX, rYY */
+        continue;
+      else if ((insn & 0xfc00) == 0x2c00) /* mov rXX, rYY */
+        continue;
+      else
+          break;
+    }
+    
+  return vpc;
 }
 
-static CORE_ADDR
-avr_read_fp (void)
-{
-  return (avr_make_saddr (read_register (AVR_FP_REGNUM)));
-}
+/* Function: avr_scan_prologue
 
-/* Translate a GDB virtual ADDR/LEN into a format the remote target
-   understands.  Returns number of bytes that can be transfered
-   starting at TARG_ADDR.  Return ZERO if no bytes can be transfered
-   (segmentation fault).
-
-   TRoth/2002-04-08: Could this be used to check for dereferencing an invalid
-   pointer? */
-
-static void
-avr_remote_translate_xfer_address (struct gdbarch *gdbarch,
-				   struct regcache *regcache,
-				   CORE_ADDR memaddr, int nr_bytes,
-				   CORE_ADDR *targ_addr, int *targ_len)
-{
-  long out_addr;
-  long out_len;
-
-  /* FIXME: TRoth: Do nothing for now. Will need to examine memaddr at this
-     point and see if the high bit are set with the masks that we want. */
-
-  *targ_addr = memaddr;
-  *targ_len = nr_bytes;
-}
-
-/* avr_scan_prologue is also used as the
-   deprecated_frame_init_saved_regs().
-
-   Put here the code to store, into fi->saved_regs, the addresses of
-   the saved registers of frame described by FRAME_INFO.  This
-   includes special registers such as pc and fp saved in special ways
-   in the stack frame.  sp is even more special: the address we return
-   for it IS the sp for the next frame. */
-
-/* Function: avr_scan_prologue (helper function for avr_init_extra_frame_info)
-   This function decodes a AVR function prologue to determine:
+   This function decodes an AVR function prologue to determine:
      1) the size of the stack frame
      2) which registers are saved on it
      3) the offsets of saved regs
-   This information is stored in the "extra_info" field of the frame_info.
+   This information is stored in the avr_unwind_cache structure.
 
-   A typical AVR function prologue might look like this:
-        push rXX
-        push r28
-        push r29
-        in r28,__SP_L__
-        in r29,__SP_H__
-        sbiw r28,<LOCALS_SIZE>
-        in __tmp_reg__,__SREG__
+   Some devices lack the sbiw instruction, so on those replace this:
+        sbiw    r28, XX
+   with this:
+        subi    r28,lo8(XX)
+        sbci    r29,hi8(XX)
+
+   A typical AVR function prologue with a frame pointer might look like this:
+        push    rXX        ; saved regs
+        ...
+        push    r28
+        push    r29
+        in      r28,__SP_L__
+        in      r29,__SP_H__
+        sbiw    r28,<LOCALS_SIZE>
+        in      __tmp_reg__,__SREG__
         cli
-        out __SP_L__,r28
-        out __SREG__,__tmp_reg__
-        out __SP_H__,r29
+        out     __SP_H__,r29
+        out     __SREG__,__tmp_reg__
+        out     __SP_L__,r28
 
-  A `-mcall-prologues' prologue look like this:
-        ldi r26,<LOCALS_SIZE>
-        ldi r27,<LOCALS_SIZE>/265
-        ldi r30,pm_lo8(.L_foo_body)
-        ldi r31,pm_hi8(.L_foo_body)
-        rjmp __prologue_saves__+RRR
-  .L_foo_body:  */
+   A typical AVR function prologue without a frame pointer might look like
+   this:
+        push    rXX        ; saved regs
+        ...
 
-static void
-avr_scan_prologue (struct frame_info *fi)
+   A main function prologue looks like this:
+        ldi     r28,lo8(<RAM_ADDR> - <LOCALS_SIZE>)
+        ldi     r29,hi8(<RAM_ADDR> - <LOCALS_SIZE>)
+        out     __SP_H__,r29
+        out     __SP_L__,r28
+
+   A signal handler prologue looks like this:
+        push    __zero_reg__
+        push    __tmp_reg__
+        in      __tmp_reg__, __SREG__
+        push    __tmp_reg__
+        clr     __zero_reg__
+        push    rXX             ; save registers r18:r27, r30:r31
+        ...
+        push    r28             ; save frame pointer
+        push    r29
+        in      r28, __SP_L__
+        in      r29, __SP_H__
+        sbiw    r28, <LOCALS_SIZE>
+        out     __SP_H__, r29
+        out     __SP_L__, r28
+        
+   A interrupt handler prologue looks like this:
+        sei
+        push    __zero_reg__
+        push    __tmp_reg__
+        in      __tmp_reg__, __SREG__
+        push    __tmp_reg__
+        clr     __zero_reg__
+        push    rXX             ; save registers r18:r27, r30:r31
+        ...
+        push    r28             ; save frame pointer
+        push    r29
+        in      r28, __SP_L__
+        in      r29, __SP_H__
+        sbiw    r28, <LOCALS_SIZE>
+        cli
+        out     __SP_H__, r29
+        sei     
+        out     __SP_L__, r28
+
+   A `-mcall-prologues' prologue looks like this (Note that the megas use a
+   jmp instead of a rjmp, thus the prologue is one word larger since jmp is a
+   32 bit insn and rjmp is a 16 bit insn):
+        ldi     r26,lo8(<LOCALS_SIZE>)
+        ldi     r27,hi8(<LOCALS_SIZE>)
+        ldi     r30,pm_lo8(.L_foo_body)
+        ldi     r31,pm_hi8(.L_foo_body)
+        rjmp    __prologue_saves__+RRR
+        .L_foo_body:  */
+
+/* Not really part of a prologue, but still need to scan for it, is when a
+   function prologue moves values passed via registers as arguments to new
+   registers. In this case, all local variables live in registers, so there
+   may be some register saves. This is what it looks like:
+        movw    rMM, rNN
+        ...
+
+   There could be multiple movw's. If the target doesn't have a movw insn, it
+   will use two mov insns. This could be done after any of the above prologue
+   types.  */
+
+static CORE_ADDR
+avr_scan_prologue (CORE_ADDR pc, struct avr_unwind_cache *info)
 {
-  CORE_ADDR prologue_start;
-  CORE_ADDR prologue_end;
   int i;
   unsigned short insn;
-  int regno;
   int scan_stage = 0;
-  char *name;
   struct minimal_symbol *msymbol;
-  int prologue_len;
   unsigned char prologue[AVR_MAX_PROLOGUE_SIZE];
   int vpc = 0;
 
-  get_frame_extra_info (fi)->framereg = AVR_SP_REGNUM;
-
-  if (find_pc_partial_function
-      (get_frame_pc (fi), &name, &prologue_start, &prologue_end))
-    {
-      struct symtab_and_line sal = find_pc_line (prologue_start, 0);
-
-      if (sal.line == 0)	/* no line info, use current PC */
-	prologue_end = get_frame_pc (fi);
-      else if (sal.end < prologue_end)	/* next line begins after fn end */
-	prologue_end = sal.end;	/* (probably means no prologue)  */
-    }
-  else
-    /* We're in the boondocks: allow for */
-    /* 19 pushes, an add, and "mv fp,sp" */
-    prologue_end = prologue_start + AVR_MAX_PROLOGUE_SIZE;
-
-  prologue_end = min (prologue_end, get_frame_pc (fi));
-
-  /* Search the prologue looking for instructions that set up the
-     frame pointer, adjust the stack pointer, and save registers.  */
-
-  get_frame_extra_info (fi)->framesize = 0;
-  prologue_len = prologue_end - prologue_start;
-  read_memory (prologue_start, prologue, prologue_len);
+  /* FIXME: TRoth/2003-06-11: This could be made more efficient by only
+     reading in the bytes of the prologue. The problem is that the figuring
+     out where the end of the prologue is is a bit difficult. The old code 
+     tried to do that, but failed quite often.  */
+  read_memory (pc, prologue, AVR_MAX_PROLOGUE_SIZE);
 
   /* Scanning main()'s prologue
      ldi r28,lo8(<RAM_ADDR> - <LOCALS_SIZE>)
@@ -495,7 +491,7 @@
      out __SP_H__,r29
      out __SP_L__,r28 */
 
-  if (name && strcmp ("main", name) == 0 && prologue_len == 8)
+  if (1)
     {
       CORE_ADDR locals;
       unsigned char img[] = {
@@ -503,7 +499,6 @@
 	0xcd, 0xbf		/* out __SP_L__,r28 */
       };
 
-      get_frame_extra_info (fi)->framereg = AVR_FP_REGNUM;
       insn = EXTRACT_INSN (&prologue[vpc]);
       /* ldi r28,lo8(<RAM_ADDR> - <LOCALS_SIZE>) */
       if ((insn & 0xf0f0) == 0xe0c0)
@@ -516,94 +511,124 @@
 	      locals |= ((insn & 0xf) | ((insn & 0x0f00) >> 4)) << 8;
 	      if (memcmp (prologue + vpc + 4, img, sizeof (img)) == 0)
 		{
-		  deprecated_update_frame_base_hack (fi, locals);
-
-		  get_frame_extra_info (fi)->is_main = 1;
-		  return;
+                  info->prologue_type = AVR_PROLOGUE_MAIN;
+                  info->base = locals;
+                  return pc + 4;
 		}
 	    }
 	}
     }
 
   /* Scanning `-mcall-prologues' prologue
-     FIXME: mega prologue have a 12 bytes long */
+     Classic prologue is 10 bytes, mega prologue is a 12 bytes long */
 
-  while (prologue_len <= 12)	/* I'm use while to avoit many goto's */
+  while (1)	/* Using a while to avoid many goto's */
     {
       int loc_size;
       int body_addr;
       unsigned num_pushes;
+      int pc_offset = 0;
 
       insn = EXTRACT_INSN (&prologue[vpc]);
       /* ldi r26,<LOCALS_SIZE> */
       if ((insn & 0xf0f0) != 0xe0a0)
 	break;
       loc_size = (insn & 0xf) | ((insn & 0x0f00) >> 4);
+      pc_offset += 2;
 
       insn = EXTRACT_INSN (&prologue[vpc + 2]);
       /* ldi r27,<LOCALS_SIZE> / 256 */
       if ((insn & 0xf0f0) != 0xe0b0)
 	break;
       loc_size |= ((insn & 0xf) | ((insn & 0x0f00) >> 4)) << 8;
+      pc_offset += 2;
 
       insn = EXTRACT_INSN (&prologue[vpc + 4]);
       /* ldi r30,pm_lo8(.L_foo_body) */
       if ((insn & 0xf0f0) != 0xe0e0)
 	break;
       body_addr = (insn & 0xf) | ((insn & 0x0f00) >> 4);
+      pc_offset += 2;
 
       insn = EXTRACT_INSN (&prologue[vpc + 6]);
       /* ldi r31,pm_hi8(.L_foo_body) */
       if ((insn & 0xf0f0) != 0xe0f0)
 	break;
       body_addr |= ((insn & 0xf) | ((insn & 0x0f00) >> 4)) << 8;
-
-      if (body_addr != (prologue_start + 10) / 2)
-	break;
+      pc_offset += 2;
 
       msymbol = lookup_minimal_symbol ("__prologue_saves__", NULL, NULL);
       if (!msymbol)
 	break;
 
-      /* FIXME: prologue for mega have a JMP instead of RJMP */
       insn = EXTRACT_INSN (&prologue[vpc + 8]);
       /* rjmp __prologue_saves__+RRR */
-      if ((insn & 0xf000) != 0xc000)
-	break;
+      if ((insn & 0xf000) == 0xc000)
+        {
+          /* Extract PC relative offset from RJMP */
+          i = (insn & 0xfff) | (insn & 0x800 ? (-1 ^ 0xfff) : 0);
+          /* Convert offset to byte addressable mode */
+          i *= 2;
+          /* Destination address */
+          i += pc + 10;
 
-      /* Extract PC relative offset from RJMP */
-      i = (insn & 0xfff) | (insn & 0x800 ? (-1 ^ 0xfff) : 0);
-      /* Convert offset to byte addressable mode */
-      i *= 2;
-      /* Destination address */
-      i += vpc + prologue_start + 10;
-      /* Resovle offset (in words) from __prologue_saves__ symbol.
+          if (body_addr != (pc + 10)/2)
+            break;
+
+          pc_offset += 2;
+        }
+      else if ((insn & 0xfe0e) == 0x940c)
+        {
+          /* Extract absolute PC address from JMP */
+          i = (((insn & 0x1) | ((insn & 0x1f0) >> 3) << 16)
+            | (EXTRACT_INSN (&prologue[vpc + 10]) & 0xffff));
+          /* Convert address to byte addressable mode */
+          i *= 2;
+
+          if (body_addr != (pc + 12)/2)
+            break;
+
+          pc_offset += 4;
+        }
+      else
+        break;
+
+      /* Resolve offset (in words) from __prologue_saves__ symbol.
          Which is a pushes count in `-mcall-prologues' mode */
       num_pushes = AVR_MAX_PUSHES - (i - SYMBOL_VALUE_ADDRESS (msymbol)) / 2;
 
       if (num_pushes > AVR_MAX_PUSHES)
-	num_pushes = 0;
+        {
+          fprintf_unfiltered (gdb_stderr, "Num pushes too large: %d\n",
+                              num_pushes);
+          num_pushes = 0;
+        }
 
       if (num_pushes)
 	{
 	  int from;
-	  get_frame_saved_regs (fi)[AVR_FP_REGNUM + 1] = num_pushes;
+
+	  info->saved_regs[AVR_FP_REGNUM + 1].addr = num_pushes;
 	  if (num_pushes >= 2)
-	    get_frame_saved_regs (fi)[AVR_FP_REGNUM] = num_pushes - 1;
+	    info->saved_regs[AVR_FP_REGNUM].addr = num_pushes - 1;
+
 	  i = 0;
 	  for (from = AVR_LAST_PUSHED_REGNUM + 1 - (num_pushes - 2);
 	       from <= AVR_LAST_PUSHED_REGNUM; ++from)
-	    get_frame_saved_regs (fi)[from] = ++i;
+	    info->saved_regs [from].addr = ++i;
 	}
-      get_frame_extra_info (fi)->locals_size = loc_size;
-      get_frame_extra_info (fi)->framesize = loc_size + num_pushes;
-      get_frame_extra_info (fi)->framereg = AVR_FP_REGNUM;
-      return;
+      info->size = loc_size + num_pushes;
+      info->prologue_type = AVR_PROLOGUE_CALL;
+
+      return pc + pc_offset;
     }
 
-  /* Scan interrupt or signal function */
+  /* Scan for the beginning of the prologue for an interrupt or signal
+     function.  Note that we have to set the prologue type here since the
+     third stage of the prologue may not be present (e.g. no saved registered
+     or changing of the SP register).  */
 
-  if (prologue_len >= 12)
+  if (1)
     {
       unsigned char img[] = {
 	0x78, 0x94,		/* sei */
@@ -615,44 +640,52 @@
       };
       if (memcmp (prologue, img, sizeof (img)) == 0)
 	{
+          info->prologue_type = AVR_PROLOGUE_INTR;
 	  vpc += sizeof (img);
-	  get_frame_saved_regs (fi)[0] = 2;
-	  get_frame_saved_regs (fi)[1] = 1;
-	  get_frame_extra_info (fi)->framesize += 3;
+          info->saved_regs[AVR_SREG_REGNUM].addr = 3;
+          info->saved_regs[0].addr = 2;
+          info->saved_regs[1].addr = 1;
+          info->size += 3;
 	}
-      else if (memcmp (img + 1, prologue, sizeof (img) - 1) == 0)
+      else if (memcmp (img + 2, prologue, sizeof (img) - 2) == 0)
 	{
-	  vpc += sizeof (img) - 1;
-	  get_frame_saved_regs (fi)[0] = 2;
-	  get_frame_saved_regs (fi)[1] = 1;
-	  get_frame_extra_info (fi)->framesize += 3;
+          info->prologue_type = AVR_PROLOGUE_SIG;
+          vpc += sizeof (img) - 2;
+          info->saved_regs[AVR_SREG_REGNUM].addr = 3;
+          info->saved_regs[0].addr = 2;
+          info->saved_regs[1].addr = 1;
+          info->size += 3;
 	}
     }
 
   /* First stage of the prologue scanning.
-     Scan pushes */
+     Scan pushes (saved registers) */
 
-  for (; vpc <= prologue_len; vpc += 2)
+  for (; vpc < AVR_MAX_PROLOGUE_SIZE; vpc += 2)
     {
       insn = EXTRACT_INSN (&prologue[vpc]);
       if ((insn & 0xfe0f) == 0x920f)	/* push rXX */
 	{
 	  /* Bits 4-9 contain a mask for registers R0-R32. */
-	  regno = (insn & 0x1f0) >> 4;
-	  ++get_frame_extra_info (fi)->framesize;
-	  get_frame_saved_regs (fi)[regno] = get_frame_extra_info (fi)->framesize;
+	  int regno = (insn & 0x1f0) >> 4;
+	  info->size++;
+	  info->saved_regs[regno].addr = info->size;
 	  scan_stage = 1;
 	}
       else
 	break;
     }
 
+  if (vpc >= AVR_MAX_PROLOGUE_SIZE)
+     fprintf_unfiltered (gdb_stderr,
+                         "Hit end of prologue while scanning pushes\n");
+
   /* Second stage of the prologue scanning.
      Scan:
      in r28,__SP_L__
      in r29,__SP_H__ */
 
-  if (scan_stage == 1 && vpc + 4 <= prologue_len)
+  if (scan_stage == 1 && vpc < AVR_MAX_PROLOGUE_SIZE)
     {
       unsigned char img[] = {
 	0xcd, 0xb7,		/* in r28,__SP_L__ */
@@ -663,7 +696,6 @@
       if (memcmp (prologue + vpc, img, sizeof (img)) == 0)
 	{
 	  vpc += 4;
-	  get_frame_extra_info (fi)->framereg = AVR_FP_REGNUM;
 	  scan_stage = 2;
 	}
     }
@@ -671,32 +703,32 @@
   /* Third stage of the prologue scanning. (Really two stages)
      Scan for:
      sbiw r28,XX or subi r28,lo8(XX)
-     sbci r29,hi8(XX)
+                    sbci r29,hi8(XX)
      in __tmp_reg__,__SREG__
      cli
-     out __SP_L__,r28
+     out __SP_H__,r29
      out __SREG__,__tmp_reg__
-     out __SP_H__,r29 */
+     out __SP_L__,r28 */
 
-  if (scan_stage == 2 && vpc + 12 <= prologue_len)
+  if (scan_stage == 2 && vpc < AVR_MAX_PROLOGUE_SIZE)
     {
       int locals_size = 0;
       unsigned char img[] = {
 	0x0f, 0xb6,		/* in r0,0x3f */
 	0xf8, 0x94,		/* cli */
-	0xcd, 0xbf,		/* out 0x3d,r28 ; SPL */
+	0xde, 0xbf,		/* out 0x3e,r29 ; SPH */
 	0x0f, 0xbe,		/* out 0x3f,r0  ; SREG */
-	0xde, 0xbf		/* out 0x3e,r29 ; SPH */
+	0xcd, 0xbf		/* out 0x3d,r28 ; SPL */
       };
       unsigned char img_sig[] = {
-	0xcd, 0xbf,		/* out 0x3d,r28 ; SPL */
-	0xde, 0xbf		/* out 0x3e,r29 ; SPH */
+	0xde, 0xbf,		/* out 0x3e,r29 ; SPH */
+	0xcd, 0xbf		/* out 0x3d,r28 ; SPL */
       };
       unsigned char img_int[] = {
 	0xf8, 0x94,		/* cli */
-	0xcd, 0xbf,		/* out 0x3d,r28 ; SPL */
+	0xde, 0xbf,		/* out 0x3e,r29 ; SPH */
 	0x78, 0x94,		/* sei */
-	0xde, 0xbf		/* out 0x3e,r29 ; SPH */
+	0xcd, 0xbf		/* out 0x3d,r28 ; SPL */
       };
 
       insn = EXTRACT_INSN (&prologue[vpc]);
@@ -711,179 +743,35 @@
 	  locals_size += ((insn & 0xf) | ((insn & 0xf00) >> 4) << 8);
 	}
       else
-	return;
-      get_frame_extra_info (fi)->locals_size = locals_size;
-      get_frame_extra_info (fi)->framesize += locals_size;
-    }
-}
+	return pc + vpc;
 
-/* This function actually figures out the frame address for a given pc and
-   sp.  This is tricky  because we sometimes don't use an explicit
-   frame pointer, and the previous stack pointer isn't necessarily recorded
-   on the stack.  The only reliable way to get this info is to
-   examine the prologue.  */
+      /* Scan the last part of the prologue. May not be present for interrupt
+         or signal handler functions, which is why we set the prologue type
+         when we saw the beginning of the prologue previously.  */
 
-static void
-avr_init_extra_frame_info (int fromleaf, struct frame_info *fi)
-{
-  int reg;
+      if (memcmp (prologue + vpc, img_sig, sizeof (img_sig)) == 0)
+        {
+          vpc += sizeof (img_sig);
+        }
+      else if (memcmp (prologue + vpc, img_int, sizeof (img_int)) == 0)
+        {
+          vpc += sizeof (img_int);
+        }
+      if (memcmp (prologue + vpc, img, sizeof (img)) == 0)
+        {
+          info->prologue_type = AVR_PROLOGUE_NORMAL;
+          vpc += sizeof (img);
+        }
 
-  if (get_next_frame (fi))
-    deprecated_update_frame_pc_hack (fi, DEPRECATED_FRAME_SAVED_PC (get_next_frame (fi)));
+      info->size += locals_size;
 
-  frame_extra_info_zalloc (fi, sizeof (struct frame_extra_info));
-  frame_saved_regs_zalloc (fi);
-
-  get_frame_extra_info (fi)->return_pc = 0;
-  get_frame_extra_info (fi)->args_pointer = 0;
-  get_frame_extra_info (fi)->locals_size = 0;
-  get_frame_extra_info (fi)->framereg = 0;
-  get_frame_extra_info (fi)->framesize = 0;
-  get_frame_extra_info (fi)->is_main = 0;
-
-  avr_scan_prologue (fi);
-
-  if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (fi), get_frame_base (fi),
-				   get_frame_base (fi)))
-    {
-      /* We need to setup fi->frame here because call_function_by_hand
-         gets it wrong by assuming it's always FP.  */
-      deprecated_update_frame_base_hack (fi, deprecated_read_register_dummy (get_frame_pc (fi), get_frame_base (fi),
-									     AVR_PC_REGNUM));
-    }
-  else if (!get_next_frame (fi))
-    /* this is the innermost frame? */
-    deprecated_update_frame_base_hack (fi, read_register (get_frame_extra_info (fi)->framereg));
-  else if (get_frame_extra_info (fi)->is_main != 1)
-    /* not the innermost frame, not `main' */
-    /* If we have an next frame,  the callee saved it. */
-    {
-      struct frame_info *next_fi = get_next_frame (fi);
-      if (get_frame_extra_info (fi)->framereg == AVR_SP_REGNUM)
-	deprecated_update_frame_base_hack (fi, (get_frame_base (next_fi)
-						+ 2 /* ret addr */
-						+ get_frame_extra_info (next_fi)->framesize));
-      /* FIXME: I don't analyse va_args functions  */
-      else
-	{
-	  CORE_ADDR fp = 0;
-	  CORE_ADDR fp1 = 0;
-	  unsigned int fp_low, fp_high;
-
-	  /* Scan all frames */
-	  for (; next_fi; next_fi = get_next_frame (next_fi))
-	    {
-	      /* look for saved AVR_FP_REGNUM */
-	      if (get_frame_saved_regs (next_fi)[AVR_FP_REGNUM] && !fp)
-		fp = get_frame_saved_regs (next_fi)[AVR_FP_REGNUM];
-	      /* look for saved AVR_FP_REGNUM + 1 */
-	      if (get_frame_saved_regs (next_fi)[AVR_FP_REGNUM + 1] && !fp1)
-		fp1 = get_frame_saved_regs (next_fi)[AVR_FP_REGNUM + 1];
-	    }
-	  fp_low = (fp ? read_memory_unsigned_integer (avr_make_saddr (fp), 1)
-		    : read_register (AVR_FP_REGNUM)) & 0xff;
-	  fp_high =
-	    (fp1 ? read_memory_unsigned_integer (avr_make_saddr (fp1), 1) :
-	     read_register (AVR_FP_REGNUM + 1)) & 0xff;
-	  deprecated_update_frame_base_hack (fi, fp_low | (fp_high << 8));
-	}
+      return pc + avr_scan_arg_moves (vpc, prologue);
     }
 
-  /* TRoth: Do we want to do this if we are in main? I don't think we should
-     since return_pc makes no sense when we are in main. */
+  /* If we got this far, we could not scan the prologue, so just return the pc
+     of the frame plus an adjustment for argument move insns.  */
 
-  if ((get_frame_pc (fi)) && (get_frame_extra_info (fi)->is_main == 0))
-    /* We are not in CALL_DUMMY */
-    {
-      CORE_ADDR addr;
-      int i;
-
-      addr = get_frame_base (fi) + get_frame_extra_info (fi)->framesize + 1;
-
-      /* Return address in stack in different endianness */
-
-      get_frame_extra_info (fi)->return_pc =
-	read_memory_unsigned_integer (avr_make_saddr (addr), 1) << 8;
-      get_frame_extra_info (fi)->return_pc |=
-	read_memory_unsigned_integer (avr_make_saddr (addr + 1), 1);
-
-      /* This return address in words,
-         must be converted to the bytes address */
-      get_frame_extra_info (fi)->return_pc *= 2;
-
-      /* Resolve a pushed registers addresses */
-      for (i = 0; i < NUM_REGS; i++)
-	{
-	  if (get_frame_saved_regs (fi)[i])
-	    get_frame_saved_regs (fi)[i] = addr - get_frame_saved_regs (fi)[i];
-	}
-    }
-}
-
-/* Restore the machine to the state it had before the current frame was
-   created.  Usually used either by the "RETURN" command, or by
-   call_function_by_hand after the dummy_frame is finished. */
-
-static void
-avr_pop_frame (void)
-{
-  unsigned regnum;
-  CORE_ADDR saddr;
-  struct frame_info *frame = get_current_frame ();
-
-  if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (frame),
-				   get_frame_base (frame),
-				   get_frame_base (frame)))
-    {
-      generic_pop_dummy_frame ();
-    }
-  else
-    {
-      /* TRoth: Why only loop over 8 registers? */
-
-      for (regnum = 0; regnum < 8; regnum++)
-	{
-	  /* Don't forget AVR_SP_REGNUM in a frame_saved_regs struct is the
-	     actual value we want, not the address of the value we want.  */
-	  if (get_frame_saved_regs (frame)[regnum] && regnum != AVR_SP_REGNUM)
-	    {
-	      saddr = avr_make_saddr (get_frame_saved_regs (frame)[regnum]);
-	      write_register (regnum,
-			      read_memory_unsigned_integer (saddr, 1));
-	    }
-	  else if (get_frame_saved_regs (frame)[regnum] && regnum == AVR_SP_REGNUM)
-	    write_register (regnum, get_frame_base (frame) + 2);
-	}
-
-      /* Don't forget the update the PC too!  */
-      write_pc (get_frame_extra_info (frame)->return_pc);
-    }
-  flush_cached_frames ();
-}
-
-/* Return the saved PC from this frame. */
-
-static CORE_ADDR
-avr_frame_saved_pc (struct frame_info *frame)
-{
-  if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (frame),
-				   get_frame_base (frame),
-				   get_frame_base (frame)))
-    return deprecated_read_register_dummy (get_frame_pc (frame),
-					   get_frame_base (frame),
-					   AVR_PC_REGNUM);
-  else
-    return get_frame_extra_info (frame)->return_pc;
-}
-
-static CORE_ADDR
-avr_saved_pc_after_call (struct frame_info *frame)
-{
-  unsigned char m1, m2;
-  unsigned int sp = read_register (AVR_SP_REGNUM);
-  m1 = read_memory_unsigned_integer (avr_make_saddr (sp + 1), 1);
-  m2 = read_memory_unsigned_integer (avr_make_saddr (sp + 2), 1);
-  return (m2 | (m1 << 8)) * 2;
+  return pc + avr_scan_arg_moves (vpc, prologue);;
 }
 
 /* Returns the return address for a dummy. */
@@ -894,114 +782,380 @@
   return entry_point_address ();
 }
 
-/* Setup the return address for a dummy frame, as called by
-   call_function_by_hand.  Only necessary when you are using an empty
-   CALL_DUMMY. */
-
-static CORE_ADDR
-avr_push_return_address (CORE_ADDR pc, CORE_ADDR sp)
-{
-  unsigned char buf[2];
-  int wordsize = 2;
-#if 0
-  struct minimal_symbol *msymbol;
-  CORE_ADDR mon_brk;
-#endif
-
-  buf[0] = 0;
-  buf[1] = 0;
-  sp -= wordsize;
-  write_memory (sp + 1, buf, 2);
-
-#if 0
-  /* FIXME: TRoth/2002-02-18: This should probably be removed since it's a
-     left-over from Denis' original patch which used avr-mon for the target
-     instead of the generic remote target. */
-  if ((strcmp (target_shortname, "avr-mon") == 0)
-      && (msymbol = lookup_minimal_symbol ("gdb_break", NULL, NULL)))
-    {
-      mon_brk = SYMBOL_VALUE_ADDRESS (msymbol);
-      store_unsigned_integer (buf, wordsize, mon_brk / 2);
-      sp -= wordsize;
-      write_memory (sp + 1, buf + 1, 1);
-      write_memory (sp + 2, buf, 1);
-    }
-#endif
-  return sp;
-}
-
 static CORE_ADDR
 avr_skip_prologue (CORE_ADDR pc)
 {
   CORE_ADDR func_addr, func_end;
-  struct symtab_and_line sal;
+  CORE_ADDR prologue_end = pc;
 
   /* See what the symbol table says */
 
   if (find_pc_partial_function (pc, NULL, &func_addr, &func_end))
     {
-      sal = find_pc_line (func_addr, 0);
+      struct symtab_and_line sal;
+      struct avr_unwind_cache info = {0};
+      struct trad_frame_saved_reg saved_regs[AVR_NUM_REGS];
 
-      /* troth/2002-08-05: For some very simple functions, gcc doesn't
-         generate a prologue and the sal.end ends up being the 2-byte ``ret''
-         instruction at the end of the function, but func_end ends up being
-         the address of the first instruction of the _next_ function. By
-         adjusting func_end by 2 bytes, we can catch these functions and not
-         return sal.end if it is the ``ret'' instruction. */
+      info.saved_regs = saved_regs;
 
-      if (sal.line != 0 && sal.end < (func_end-2))
-	return sal.end;
+      /* Need to run the prologue scanner to figure out if the function has a
+         prologue and possibly skip over moving arguments passed via registers
+         to other registers.  */
+
+      prologue_end = avr_scan_prologue (pc, &info);
+
+      if (info.prologue_type != AVR_PROLOGUE_NONE)
+        {
+          sal = find_pc_line (func_addr, 0);
+
+          if (sal.line != 0 && sal.end < func_end)
+            return sal.end;
+        }
     }
 
 /* Either we didn't find the start of this function (nothing we can do),
    or there's no line info, or the line after the prologue is after
    the end of the function (there probably isn't a prologue). */
 
-  return pc;
+  return prologue_end;
+}
+
+/* Not all avr devices support the BREAK insn. Those that don't should treat
+   it as a NOP. Thus, it should be ok. Since the avr is currently a remote
+   only target, this shouldn't be a problem (I hope). TRoth/2003-05-14  */
+
+static const unsigned char *
+avr_breakpoint_from_pc (CORE_ADDR * pcptr, int *lenptr)
+{
+    static unsigned char avr_break_insn [] = { 0x98, 0x95 };
+    *lenptr = sizeof (avr_break_insn);
+    return avr_break_insn;
+}
+
+/* Given a return value in `regbuf' with a type `valtype', 
+   extract and copy its value into `valbuf'.
+
+   Return values are always passed via registers r25:r24:...  */
+
+static void
+avr_extract_return_value (struct type *type, struct regcache *regcache,
+                          void *valbuf)
+{
+  ULONGEST r24, r25;
+  ULONGEST c;
+  int len;
+  if (TYPE_LENGTH (type) == 1)
+    {
+      regcache_cooked_read_unsigned (regcache, 24, &c);
+      store_unsigned_integer (valbuf, 1, c);
+    }
+  else
+    {
+      int i;
+      /* The MSB of the return value is always in r25, calculate which
+         register holds the LSB.  */
+      int lsb_reg = 25 - TYPE_LENGTH (type) + 1;
+
+      for (i=0; i< TYPE_LENGTH (type); i++)
+        {
+          regcache_cooked_read (regcache, lsb_reg + i,
+                                (bfd_byte *) valbuf + i);
+        }
+    }
+}
+
+static void
+avr_saved_regs_unwinder (struct frame_info *next_frame,
+                         struct trad_frame_saved_reg *this_saved_regs,
+                         int regnum, int *optimizedp,
+                         enum lval_type *lvalp, CORE_ADDR *addrp,
+                         int *realnump, void *bufferp)
+{
+  if (this_saved_regs[regnum].addr != 0)
+    {
+      *optimizedp = 0;
+      *lvalp = lval_memory;
+      *addrp = this_saved_regs[regnum].addr;
+      *realnump = -1;
+      if (bufferp != NULL)
+        {
+          /* Read the value in from memory.  */
+
+          if (regnum == AVR_PC_REGNUM)
+            {
+              /* Reading the return PC from the PC register is slightly
+                 abnormal.  register_size(AVR_PC_REGNUM) says it is 4 bytes,
+                 but in reality, only two bytes (3 in upcoming mega256) are
+                 stored on the stack.
+
+                 Also, note that the value on the stack is an addr to a word
+                 not a byte, so we will need to multiply it by two at some
+                 point. 
+
+                 And to confuse matters even more, the return address stored
+                 on the stack is in big endian byte order, even though most
+                 everything else about the avr is little endian. Ick!  */
+
+              /* FIXME: number of bytes read here will need updated for the
+                 mega256 when it is available.  */
+
+              ULONGEST pc;
+              unsigned char tmp;
+              unsigned char buf[2];
+
+              read_memory (this_saved_regs[regnum].addr, buf, 2);
+
+              /* Convert the PC read from memory as a big-endian to
+                 little-endian order. */
+              tmp = buf[0];
+              buf[0] = buf[1];
+              buf[1] = tmp;
+
+              pc = (extract_unsigned_integer (buf, 2) * 2);
+              store_unsigned_integer (bufferp,
+                                      register_size (current_gdbarch, regnum),
+                                      pc);
+            }
+          else
+            {
+              read_memory (this_saved_regs[regnum].addr, bufferp,
+                           register_size (current_gdbarch, regnum));
+            }
+        }
+
+      return;
+    }
+
+  /* No luck, assume this and the next frame have the same register
+     value.  If a value is needed, pass the request on down the chain;
+     otherwise just return an indication that the value is in the same
+     register as the next frame.  */
+  frame_register_unwind (next_frame, regnum, optimizedp, lvalp, addrp,
+			 realnump, bufferp);
+}
+
+/* Put here the code to store, into fi->saved_regs, the addresses of
+   the saved registers of frame described by FRAME_INFO.  This
+   includes special registers such as pc and fp saved in special ways
+   in the stack frame.  sp is even more special: the address we return
+   for it IS the sp for the next frame. */
+
+struct avr_unwind_cache *
+avr_frame_unwind_cache (struct frame_info *next_frame,
+                        void **this_prologue_cache)
+{
+  CORE_ADDR pc;
+  ULONGEST prev_sp;
+  ULONGEST this_base;
+  struct avr_unwind_cache *info;
+  int i;
+
+  if ((*this_prologue_cache))
+    return (*this_prologue_cache);
+
+  info = FRAME_OBSTACK_ZALLOC (struct avr_unwind_cache);
+  (*this_prologue_cache) = info;
+  info->saved_regs = trad_frame_alloc_saved_regs (next_frame);
+
+  info->size = 0;
+  info->prologue_type = AVR_PROLOGUE_NONE;
+
+  pc = frame_func_unwind (next_frame);
+
+  if ((pc > 0) && (pc < frame_pc_unwind (next_frame)))
+    avr_scan_prologue (pc, info);
+
+  if (info->prologue_type != AVR_PROLOGUE_NONE)
+    {
+      ULONGEST high_base;       /* High byte of FP */
+
+      /* The SP was moved to the FP.  This indicates that a new frame
+         was created.  Get THIS frame's FP value by unwinding it from
+         the next frame.  */
+      frame_unwind_unsigned_register (next_frame, AVR_FP_REGNUM, &this_base);
+      frame_unwind_unsigned_register (next_frame, AVR_FP_REGNUM+1, &high_base);
+      this_base += (high_base << 8);
+      
+      /* The FP points at the last saved register.  Adjust the FP back
+         to before the first saved register giving the SP.  */
+      prev_sp = this_base + info->size; 
+   }
+  else
+    {
+      /* Assume that the FP is this frame's SP but with that pushed
+         stack space added back.  */
+      frame_unwind_unsigned_register (next_frame, AVR_SP_REGNUM, &this_base);
+      prev_sp = this_base + info->size;
+    }
+
+  /* Add 1 here to adjust for the post-decrement nature of the push
+     instruction.*/
+  info->prev_sp = avr_make_saddr (prev_sp+1);
+
+  info->base = avr_make_saddr (this_base);
+
+  /* Adjust all the saved registers so that they contain addresses and not
+     offsets.  We need to add one to the addresses since push ops are post
+     decrement on the avr.  */
+  for (i = 0; i < NUM_REGS - 1; i++)
+    if (info->saved_regs[i].addr)
+      {
+        info->saved_regs[i].addr = (info->prev_sp - info->saved_regs[i].addr);
+      }
+
+  /* Except for the main and startup code, the return PC is always saved on
+     the stack and is at the base of the frame. */
+
+  if (info->prologue_type != AVR_PROLOGUE_MAIN)
+    {
+      info->saved_regs[AVR_PC_REGNUM].addr = info->prev_sp;
+    }  
+
+  return info;
 }
 
 static CORE_ADDR
-avr_frame_address (struct frame_info *fi)
+avr_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
 {
-  return avr_make_saddr (get_frame_base (fi));
+  ULONGEST pc;
+
+  frame_unwind_unsigned_register (next_frame, AVR_PC_REGNUM, &pc);
+
+  return avr_make_iaddr (pc);
 }
 
 /* Given a GDB frame, determine the address of the calling function's
-   frame.  This will be used to create a new GDB frame struct, and
-   then DEPRECATED_INIT_EXTRA_FRAME_INFO and DEPRECATED_INIT_FRAME_PC
-   will be called for the new frame.
-
-   For us, the frame address is its stack pointer value, so we look up
-   the function prologue to determine the caller's sp value, and return it.  */
-
-static CORE_ADDR
-avr_frame_chain (struct frame_info *frame)
-{
-  if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (frame),
-				   get_frame_base (frame),
-				   get_frame_base (frame)))
-    {
-      /* initialize the return_pc now */
-      get_frame_extra_info (frame)->return_pc
-	= deprecated_read_register_dummy (get_frame_pc (frame),
-					  get_frame_base (frame),
-					  AVR_PC_REGNUM);
-      return get_frame_base (frame);
-    }
-  return (get_frame_extra_info (frame)->is_main ? 0
-	  : get_frame_base (frame) + get_frame_extra_info (frame)->framesize + 2 /* ret addr */ );
-}
-
-/* Store the address of the place in which to copy the structure the
-   subroutine will return.  This is called from call_function. 
-
-   We store structs through a pointer passed in the first Argument
-   register. */
+   frame.  This will be used to create a new GDB frame struct.  */
 
 static void
-avr_store_struct_return (CORE_ADDR addr, CORE_ADDR sp)
+avr_frame_this_id (struct frame_info *next_frame,
+                   void **this_prologue_cache,
+                   struct frame_id *this_id)
 {
-  write_register (0, addr);
+  struct avr_unwind_cache *info
+    = avr_frame_unwind_cache (next_frame, this_prologue_cache);
+  CORE_ADDR base;
+  CORE_ADDR func;
+  struct frame_id id;
+
+  /* The FUNC is easy.  */
+  func = frame_func_unwind (next_frame);
+
+  /* This is meant to halt the backtrace at "_start".  Make sure we
+     don't halt it at a generic dummy frame. */
+  if (inside_entry_file (func))
+    return;
+
+  /* Hopefully the prologue analysis either correctly determined the
+     frame's base (which is the SP from the previous frame), or set
+     that base to "NULL".  */
+  base = info->prev_sp;
+  if (base == 0)
+    return;
+
+  id = frame_id_build (base, func);
+
+  /* Check that we're not going round in circles with the same frame
+     ID (but avoid applying the test to sentinel frames which do go
+     round in circles).  Can't use frame_id_eq() as that doesn't yet
+     compare the frame's PC value.  */
+  if (frame_relative_level (next_frame) >= 0
+      && get_frame_type (next_frame) != DUMMY_FRAME
+      && frame_id_eq (get_frame_id (next_frame), id))
+    return;
+
+  (*this_id) = id;
+}
+
+static void
+avr_frame_prev_register (struct frame_info *next_frame,
+			  void **this_prologue_cache,
+			  int regnum, int *optimizedp,
+			  enum lval_type *lvalp, CORE_ADDR *addrp,
+			  int *realnump, void *bufferp)
+{
+  struct avr_unwind_cache *info
+    = avr_frame_unwind_cache (next_frame, this_prologue_cache);
+
+  avr_saved_regs_unwinder (next_frame, info->saved_regs, regnum, optimizedp,
+                           lvalp, addrp, realnump, bufferp);
+}
+
+static const struct frame_unwind avr_frame_unwind = {
+  NORMAL_FRAME,
+  avr_frame_this_id,
+  avr_frame_prev_register
+};
+
+const struct frame_unwind *
+avr_frame_p (CORE_ADDR pc)
+{
+  return &avr_frame_unwind;
+}
+
+static CORE_ADDR
+avr_frame_base_address (struct frame_info *next_frame, void **this_cache)
+{
+  struct avr_unwind_cache *info
+    = avr_frame_unwind_cache (next_frame, this_cache);
+
+  return info->base;
+}
+
+static const struct frame_base avr_frame_base = {
+  &avr_frame_unwind,
+  avr_frame_base_address,
+  avr_frame_base_address,
+  avr_frame_base_address
+};
+
+/* Assuming NEXT_FRAME->prev is a dummy, return the frame ID of that
+   dummy frame.  The frame ID's base needs to match the TOS value
+   saved by save_dummy_frame_tos(), and the PC match the dummy frame's
+   breakpoint.  */
+
+static struct frame_id
+avr_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame)
+{
+  ULONGEST base;
+
+  frame_unwind_unsigned_register (next_frame, AVR_SP_REGNUM, &base);
+  return frame_id_build (avr_make_saddr (base), frame_pc_unwind (next_frame));
+}
+
+/* When arguments must be pushed onto the stack, they go on in reverse
+   order.  The below implements a FILO (stack) to do this. */
+
+struct stack_item
+{
+  int len;
+  struct stack_item *prev;
+  void *data;
+};
+
+static struct stack_item *push_stack_item (struct stack_item *prev,
+					   void *contents, int len);
+static struct stack_item *
+push_stack_item (struct stack_item *prev, void *contents, int len)
+{
+  struct stack_item *si;
+  si = xmalloc (sizeof (struct stack_item));
+  si->data = xmalloc (len);
+  si->len = len;
+  si->prev = prev;
+  memcpy (si->data, contents, len);
+  return si;
+}
+
+static struct stack_item *pop_stack_item (struct stack_item *si);
+static struct stack_item *
+pop_stack_item (struct stack_item *si)
+{
+  struct stack_item *dead = si;
+  si = si->prev;
+  xfree (dead->data);
+  xfree (dead);
+  return si;
 }
 
 /* Setup the function arguments for calling a function in the inferior.
@@ -1010,9 +1164,20 @@
    dedicated for passing function arguments.  Up to the first 18 arguments
    (depending on size) may go into these registers.  The rest go on the stack.
 
-   Arguments that are larger than WORDSIZE bytes will be split between two or
-   more registers as available, but will NOT be split between a register and
-   the stack.
+   All arguments are aligned to start in even-numbered registers (odd-sized
+   arguments, including char, have one free register above them). For example,
+   an int in arg1 and a char in arg2 would be passed as such:
+
+      arg1 -> r25:r24
+      arg2 -> r22
+
+   Arguments that are larger than 2 bytes will be split between two or more
+   registers as available, but will NOT be split between a register and the
+   stack. Arguments that go onto the stack are pushed last arg first (this is
+   similar to the d10v).  */
+
+/* NOTE: TRoth/2003-06-17: The rest of this comment is old looks to be
+   inaccurate.
 
    An exceptional case exists for struct arguments (and possibly other
    aggregates such as arrays) -- if the size is larger than WORDSIZE bytes but
@@ -1033,78 +1198,94 @@
    registers R0 to R2. */
 
 static CORE_ADDR
-avr_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
-		    int struct_return, CORE_ADDR struct_addr)
+avr_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
+                     struct regcache *regcache, CORE_ADDR bp_addr,
+                     int nargs, struct value **args, CORE_ADDR sp,
+                     int struct_return, CORE_ADDR struct_addr)
 {
-  int stack_alloc, stack_offset;
-  int wordsize;
-  int argreg;
-  int argnum;
-  struct type *type;
-  CORE_ADDR regval;
-  char *val;
-  char valbuf[4];
-  int len;
+  int i;
+  unsigned char buf[2];
+  CORE_ADDR return_pc = avr_convert_iaddr_to_raw (bp_addr);
+  int regnum = AVR_ARGN_REGNUM;
+  struct stack_item *si = NULL;
 
-  wordsize = 1;
 #if 0
-  /* Now make sure there's space on the stack */
-  for (argnum = 0, stack_alloc = 0; argnum < nargs; argnum++)
-    stack_alloc += TYPE_LENGTH (VALUE_TYPE (args[argnum]));
-  sp -= stack_alloc;		/* make room on stack for args */
-  /* we may over-allocate a little here, but that won't hurt anything */
+  /* FIXME: TRoth/2003-06-18: Not sure what to do when returning a struct. */
+  if (struct_return)
+    {
+      fprintf_unfiltered (gdb_stderr, "struct_return: 0x%lx\n", struct_addr);
+      write_register (argreg--, struct_addr & 0xff);
+      write_register (argreg--, (struct_addr >>8) & 0xff);
+    }
 #endif
-  argreg = 25;
-  if (struct_return)		/* "struct return" pointer takes up one argreg */
+
+  for (i = 0; i < nargs; i++)
     {
-      write_register (--argreg, struct_addr);
+      int last_regnum;
+      int j;
+      struct value *arg = args[i];
+      struct type *type = check_typedef (VALUE_TYPE (arg));
+      char *contents = VALUE_CONTENTS (arg);
+      int len = TYPE_LENGTH (type);
+
+      /* Calculate the potential last register needed. */
+      last_regnum = regnum - (len + (len & 1));
+
+      /* If there are registers available, use them. Once we start putting
+         stuff on the stack, all subsequent args go on stack. */
+      if ((si == NULL) && (last_regnum >= 8))
+        {
+          ULONGEST val;
+
+          /* Skip a register for odd length args. */
+          if (len & 1)
+            regnum--;
+
+          val = extract_unsigned_integer (contents, len);
+          for (j=0; j<len; j++)
+            {
+              regcache_cooked_write_unsigned (regcache, regnum--,
+                                              val >> (8*(len-j-1)));
+            }
+        }
+      /* No registers available, push the args onto the stack. */
+      else
+        {
+          /* From here on, we don't care about regnum. */
+          si = push_stack_item (si, contents, len);
+        }
     }
 
-  /* Now load as many as possible of the first arguments into registers, and
-     push the rest onto the stack.  There are 3N bytes in three registers
-     available.  Loop thru args from first to last.  */
-
-  for (argnum = 0, stack_offset = 0; argnum < nargs; argnum++)
+  /* Push args onto the stack. */
+  while (si)
     {
-      type = VALUE_TYPE (args[argnum]);
-      len = TYPE_LENGTH (type);
-      val = (char *) VALUE_CONTENTS (args[argnum]);
-
-      /* NOTE WELL!!!!!  This is not an "else if" clause!!!  That's because
-         some *&^%$ things get passed on the stack AND in the registers!  */
-      while (len > 0)
-	{			/* there's room in registers */
-	  len -= wordsize;
-	  regval = extract_unsigned_integer (val + len, wordsize);
-	  write_register (argreg--, regval);
-	}
+      sp -= si->len;
+      /* Add 1 to sp here to account for post decr nature of pushes. */
+      write_memory (sp+1, si->data, si->len);
+      si = pop_stack_item (si);
     }
+
+  /* Set the return address.  For the avr, the return address is the BP_ADDR.
+     Need to push the return address onto the stack noting that it needs to be
+     in big-endian order on the stack.  */
+  buf[0] = (return_pc >> 8) & 0xff;
+  buf[1] = return_pc & 0xff;
+
+  sp -= 2;
+  write_memory (sp+1, buf, 2);  /* Add one since pushes are post decr ops. */
+
+  /* Finally, update the SP register. */
+  regcache_cooked_write_unsigned (regcache, AVR_SP_REGNUM,
+				  avr_convert_saddr_to_raw (sp));
+
   return sp;
 }
 
-/* Not all avr devices support the BREAK insn. Those that don't should treat
-   it as a NOP. Thus, it should be ok. Since the avr is currently a remote
-   only target, this shouldn't be a problem (I hope). TRoth/2003-05-14  */
-
-static const unsigned char *
-avr_breakpoint_from_pc (CORE_ADDR * pcptr, int *lenptr)
-{
-    static unsigned char avr_break_insn [] = { 0x98, 0x95 };
-    *lenptr = sizeof (avr_break_insn);
-    return avr_break_insn;
-}
-
 /* Initialize the gdbarch structure for the AVR's. */
 
 static struct gdbarch *
 avr_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 {
-  /* FIXME: TRoth/2002-02-18: I have no idea if avr_call_dummy_words[] should
-     be bigger or not. Initial testing seems to show that `call my_func()`
-     works and backtrace from a breakpoint within the call looks correct.
-     Admittedly, I haven't tested with more than a very simple program. */
-  static LONGEST avr_call_dummy_words[] = { 0 };
-
   struct gdbarch *gdbarch;
   struct gdbarch_tdep *tdep;
 
@@ -1117,10 +1298,6 @@
   tdep = XMALLOC (struct gdbarch_tdep);
   gdbarch = gdbarch_alloc (&info, tdep);
 
-  /* NOTE: cagney/2002-12-06: This can be deleted when this arch is
-     ready to unwind the PC first (see frame.c:get_prev_frame()).  */
-  set_gdbarch_deprecated_init_frame_pc (gdbarch, init_frame_pc_default);
-
   /* If we ever need to differentiate the device types, do it here. */
   switch (info.bfd_arch_info->mach)
     {
@@ -1138,7 +1315,6 @@
   set_gdbarch_long_long_bit (gdbarch, 8 * TARGET_CHAR_BIT);
   set_gdbarch_ptr_bit (gdbarch, 2 * TARGET_CHAR_BIT);
   set_gdbarch_addr_bit (gdbarch, 32);
-  set_gdbarch_bfd_vma_bit (gdbarch, 32);	/* FIXME: TRoth/2002-02-18: Is this needed? */
 
   set_gdbarch_float_bit (gdbarch, 4 * TARGET_CHAR_BIT);
   set_gdbarch_double_bit (gdbarch, 4 * TARGET_CHAR_BIT);
@@ -1150,44 +1326,27 @@
 
   set_gdbarch_read_pc (gdbarch, avr_read_pc);
   set_gdbarch_write_pc (gdbarch, avr_write_pc);
-  set_gdbarch_deprecated_target_read_fp (gdbarch, avr_read_fp);
   set_gdbarch_read_sp (gdbarch, avr_read_sp);
-  set_gdbarch_deprecated_dummy_write_sp (gdbarch, avr_write_sp);
 
   set_gdbarch_num_regs (gdbarch, AVR_NUM_REGS);
 
   set_gdbarch_sp_regnum (gdbarch, AVR_SP_REGNUM);
-  set_gdbarch_deprecated_fp_regnum (gdbarch, AVR_FP_REGNUM);
   set_gdbarch_pc_regnum (gdbarch, AVR_PC_REGNUM);
 
   set_gdbarch_register_name (gdbarch, avr_register_name);
-  set_gdbarch_deprecated_register_size (gdbarch, 1);
-  set_gdbarch_deprecated_register_bytes (gdbarch, AVR_NUM_REG_BYTES);
-  set_gdbarch_deprecated_register_byte (gdbarch, avr_register_byte);
-  set_gdbarch_deprecated_register_raw_size (gdbarch, avr_register_raw_size);
-  set_gdbarch_deprecated_max_register_raw_size (gdbarch, 4);
-  set_gdbarch_deprecated_register_virtual_size (gdbarch, avr_register_virtual_size);
-  set_gdbarch_deprecated_max_register_virtual_size (gdbarch, 4);
-  set_gdbarch_deprecated_register_virtual_type (gdbarch, avr_register_virtual_type);
+  set_gdbarch_register_type (gdbarch, avr_register_type);
 
+  set_gdbarch_extract_return_value (gdbarch, avr_extract_return_value);
   set_gdbarch_print_insn (gdbarch, print_insn_avr);
 
   set_gdbarch_call_dummy_address (gdbarch, avr_call_dummy_address);
-  set_gdbarch_deprecated_call_dummy_words (gdbarch, avr_call_dummy_words);
-
-/*    set_gdbarch_believe_pcc_promotion (gdbarch, 1); // TRoth: should this be set? */
+  set_gdbarch_push_dummy_call (gdbarch, avr_push_dummy_call);
 
   set_gdbarch_address_to_pointer (gdbarch, avr_address_to_pointer);
   set_gdbarch_pointer_to_address (gdbarch, avr_pointer_to_address);
-  set_gdbarch_deprecated_push_arguments (gdbarch, avr_push_arguments);
-  set_gdbarch_deprecated_push_return_address (gdbarch, avr_push_return_address);
-  set_gdbarch_deprecated_pop_frame (gdbarch, avr_pop_frame);
 
   set_gdbarch_use_struct_convention (gdbarch, generic_use_struct_convention);
-  set_gdbarch_deprecated_store_struct_return (gdbarch, avr_store_struct_return);
 
-  set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, avr_scan_prologue);
-  set_gdbarch_deprecated_init_extra_frame_info (gdbarch, avr_init_extra_frame_info);
   set_gdbarch_skip_prologue (gdbarch, avr_skip_prologue);
   set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
 
@@ -1195,15 +1354,17 @@
   set_gdbarch_breakpoint_from_pc (gdbarch, avr_breakpoint_from_pc);
 
   set_gdbarch_function_start_offset (gdbarch, 0);
-  set_gdbarch_remote_translate_xfer_address (gdbarch,
-					     avr_remote_translate_xfer_address);
+
   set_gdbarch_frame_args_skip (gdbarch, 0);
-  set_gdbarch_frameless_function_invocation (gdbarch, frameless_look_for_prologue);	/* ??? */
-  set_gdbarch_deprecated_frame_chain (gdbarch, avr_frame_chain);
-  set_gdbarch_deprecated_frame_saved_pc (gdbarch, avr_frame_saved_pc);
-  set_gdbarch_frame_args_address (gdbarch, avr_frame_address);
-  set_gdbarch_frame_locals_address (gdbarch, avr_frame_address);
-  set_gdbarch_deprecated_saved_pc_after_call (gdbarch, avr_saved_pc_after_call);
+  set_gdbarch_frameless_function_invocation (gdbarch,
+                                             frameless_look_for_prologue);
+
+  frame_unwind_append_predicate (gdbarch, avr_frame_p);
+  frame_base_set_default (gdbarch, &avr_frame_base);
+
+  set_gdbarch_unwind_dummy_id (gdbarch, avr_unwind_dummy_id);
+
+  set_gdbarch_unwind_pc (gdbarch, avr_unwind_pc);
 
   return gdbarch;
 }
@@ -1232,13 +1393,11 @@
   unsigned int val;
   int i, j, k, step;
 
-/*    fprintf_unfiltered (gdb_stderr, "DEBUG: avr_io_reg_read_command (\"%s\", %d)\n", */
-/*             args, from_tty); */
-
   if (!current_target.to_query)
     {
       fprintf_unfiltered (gdb_stderr,
-			  "ERR: info io_registers NOT supported by current target\n");
+			  "ERR: info io_registers NOT supported by current "
+                          "target\n");
       return;
     }
 
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 0739efd..2980d4d4 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -703,6 +703,35 @@
 }
 
 
+/* A wrapper function for inserting catchpoints.  */
+int
+insert_catchpoint (struct ui_out *uo, void *args)
+{
+  struct breakpoint *b = (struct breakpoint *) args;
+  int val = -1;
+
+  switch (b->type)
+    {
+    case bp_catch_fork:
+      val = target_insert_fork_catchpoint (PIDGET (inferior_ptid));
+      break;
+    case bp_catch_vfork:
+      val = target_insert_vfork_catchpoint (PIDGET (inferior_ptid));
+      break;
+    case bp_catch_exec:
+      val = target_insert_exec_catchpoint (PIDGET (inferior_ptid));
+      break;
+    default:
+      internal_error (__FILE__, __LINE__, "unknown breakpoint type");
+      break;
+    }
+
+  if (val < 0)
+    throw_exception (RETURN_ERROR);
+
+  return 0;
+}
+
 /* insert_breakpoints is used when starting or continuing the program.
    remove_breakpoints is used when the program stops.
    Both return zero if successful,
@@ -1054,32 +1083,15 @@
 	     && !b->inserted
 	     && !b->duplicate)
       {
-	val = -1;
-	switch (b->type)
-	  {
-	  case bp_catch_fork:
-	    val = target_insert_fork_catchpoint (PIDGET (inferior_ptid));
-	    break;
-	  case bp_catch_vfork:
-	    val = target_insert_vfork_catchpoint (PIDGET (inferior_ptid));
-	    break;
-	  case bp_catch_exec:
-	    val = target_insert_exec_catchpoint (PIDGET (inferior_ptid));
-	    break;
-	  default:
-	    warning ("Internal error, %s line %d.", __FILE__, __LINE__);
-	    break;
-	  }
+	char prefix[64];
+
+	sprintf (prefix, "warning: inserting catchpoint %d: ", b->number);
+	val = catch_exceptions (uiout, insert_catchpoint, b, prefix,
+				RETURN_MASK_ERROR);
 	if (val < 0)
-	  {
-	    fprintf_unfiltered (tmp_error_stream, 
-				"Cannot insert catchpoint %d.", b->number);
-	  }
+	  b->enable_state = bp_disabled;
 	else
 	  b->inserted = 1;
-
-	if (val)
-	  return_val = val;	/* remember failure */
       }
   }
   
diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c
index 419b247..4ca48a6 100644
--- a/gdb/c-valprint.c
+++ b/gdb/c-valprint.c
@@ -592,7 +592,8 @@
       /* Otherwise, we end up at the return outside this "if" */
     }
 
-  return val_print (type, VALUE_CONTENTS_ALL (val), VALUE_EMBEDDED_OFFSET (val),
-		    VALUE_ADDRESS (val),
+  return val_print (type, VALUE_CONTENTS_ALL (val),
+		    VALUE_EMBEDDED_OFFSET (val),
+		    VALUE_ADDRESS (val) + VALUE_OFFSET (val),
 		    stream, format, 1, 0, pretty);
 }
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index 999ae72..45794f7 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -26,6 +26,7 @@
 #include "gdb_wait.h"		/* For shell escape implementation */
 #include "gdb_regex.h"		/* Used by apropos_command */
 #include "gdb_string.h"
+#include "gdb_vfork.h"
 #include "linespec.h"
 #include "expression.h"
 #include "frame.h"
@@ -498,19 +499,20 @@
 #endif
 #else /* Can fork.  */
   int rc, status, pid;
-  char *p, *user_shell;
 
-  if ((user_shell = (char *) getenv ("SHELL")) == NULL)
-    user_shell = "/bin/sh";
-
-  /* Get the name of the shell for arg0 */
-  if ((p = strrchr (user_shell, '/')) == NULL)
-    p = user_shell;
-  else
-    p++;			/* Get past '/' */
-
-  if ((pid = fork ()) == 0)
+  if ((pid = vfork ()) == 0)
     {
+      char *p, *user_shell;
+
+      if ((user_shell = (char *) getenv ("SHELL")) == NULL)
+	user_shell = "/bin/sh";
+
+      /* Get the name of the shell for arg0 */
+      if ((p = strrchr (user_shell, '/')) == NULL)
+	p = user_shell;
+      else
+	p++;			/* Get past '/' */
+
       if (!arg)
 	execl (user_shell, p, 0);
       else
diff --git a/gdb/config/alpha/alpha-linux.mh b/gdb/config/alpha/alpha-linux.mh
index 7691d07..d373179 100644
--- a/gdb/config/alpha/alpha-linux.mh
+++ b/gdb/config/alpha/alpha-linux.mh
@@ -2,7 +2,8 @@
 XM_FILE= xm-alphalinux.h
 NAT_FILE= nm-linux.h
 NATDEPFILES= infptrace.o inftarg.o corelow.o alpha-nat.o linux-proc.o \
-	fork-child.o proc-service.o thread-db.o lin-lwp.o gcore.o
+	fork-child.o proc-service.o thread-db.o lin-lwp.o gcore.o \
+	linux-nat.o
 
 LOADLIBES = -ldl -rdynamic
 
diff --git a/gdb/config/arm/linux.mh b/gdb/config/arm/linux.mh
index fa1eb63..1b0a3ba 100644
--- a/gdb/config/arm/linux.mh
+++ b/gdb/config/arm/linux.mh
@@ -5,7 +5,7 @@
 NAT_FILE= nm-linux.h
 NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o	\
 	core-regset.o arm-linux-nat.o linux-proc.o gcore.o	\
-	proc-service.o thread-db.o lin-lwp.o
+	proc-service.o thread-db.o lin-lwp.o linux-nat.o
 
 LOADLIBES= -ldl -rdynamic
 
diff --git a/gdb/config/arm/linux.mt b/gdb/config/arm/linux.mt
index e1996ab..c17b2e5 100644
--- a/gdb/config/arm/linux.mt
+++ b/gdb/config/arm/linux.mt
@@ -1,5 +1,3 @@
 # Target: ARM based machine running GNU/Linux
 TM_FILE= tm-linux.h
 TDEPFILES= arm-tdep.o arm-linux-tdep.o solib.o solib-svr4.o solib-legacy.o
-
-GDBSERVER_DEPFILES = linux-low.o linux-arm-low.o reg-arm.o
diff --git a/gdb/config/arm/nm-linux.h b/gdb/config/arm/nm-linux.h
index 7e0156d..3de00c9 100644
--- a/gdb/config/arm/nm-linux.h
+++ b/gdb/config/arm/nm-linux.h
@@ -27,11 +27,6 @@
 
 #define U_REGS_OFFSET 0
 
-#ifdef GDBSERVER
-#define REGISTER_U_ADDR(addr,blockend,regno) \
-	 (addr) = arm_register_u_addr ((blockend),(regno))
-#endif /* GDBSERVER */
-
 /* Return sizeof user struct to callers in less machine dependent routines */
 extern int kernel_u_size (void);
 #define KERNEL_U_SIZE	arm_linux_kernel_u_size()
diff --git a/gdb/config/arm/tm-linux.h b/gdb/config/arm/tm-linux.h
index 51b9d70..995ba73 100644
--- a/gdb/config/arm/tm-linux.h
+++ b/gdb/config/arm/tm-linux.h
@@ -21,10 +21,6 @@
 #ifndef TM_ARMLINUX_H
 #define TM_ARMLINUX_H
 
-#ifdef GDBSERVER
-#define	ARM_GNULINUX_TARGET
-#endif
-
 /* Include the common ARM target definitions.  */
 #include "arm/tm-arm.h"
 
diff --git a/gdb/config/djgpp/fnchange.lst b/gdb/config/djgpp/fnchange.lst
index 386fcf0..698b275 100644
--- a/gdb/config/djgpp/fnchange.lst
+++ b/gdb/config/djgpp/fnchange.lst
@@ -168,7 +168,6 @@
 @V@/gdb/regformats/reg-i386-linux.dat @V@/gdb/regformats/r-i386-lnx.dat
 @V@/gdb/regformats/reg-s390x.dat @V@/gdb/regformats/r-s390x.dat
 @V@/gdb/remote-adapt.c @V@/gdb/rmt-adapt.c
-@V@/gdb/remote-array.c @V@/gdb/rmt-array.c
 @V@/gdb/remote-e7000.c @V@/gdb/rmt-e7000.c
 @V@/gdb/remote-eb.c @V@/gdb/rmt-eb.c
 @V@/gdb/remote-est.c @V@/gdb/rmt-est.c
diff --git a/gdb/config/i386/linux.mh b/gdb/config/i386/linux.mh
index 494ccf1..2a20cdd 100644
--- a/gdb/config/i386/linux.mh
+++ b/gdb/config/i386/linux.mh
@@ -5,7 +5,8 @@
 NAT_FILE= nm-linux.h
 NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o linux-proc.o \
 	core-aout.o i386-nat.o i386-linux-nat.o \
-	proc-service.o thread-db.o lin-lwp.o linux-proc.o gcore.o
+	proc-service.o thread-db.o lin-lwp.o linux-proc.o gcore.o \
+	linux-nat.o
 
 # The dynamically loaded libthread_db needs access to symbols in the
 # gdb executable.
diff --git a/gdb/config/i386/linux.mt b/gdb/config/i386/linux.mt
index 43bc2d2..2d27a02 100644
--- a/gdb/config/i386/linux.mt
+++ b/gdb/config/i386/linux.mt
@@ -2,5 +2,3 @@
 TDEPFILES= i386-tdep.o i386-linux-tdep.o i387-tdep.o \
 	solib.o solib-svr4.o solib-legacy.o
 TM_FILE= tm-linux.h
-
-GDBSERVER_DEPFILES = linux-low.o linux-i386-low.o reg-i386.o
diff --git a/gdb/config/i386/nm-x86-64linux.h b/gdb/config/i386/nm-x86-64linux.h
index 4df2f5d..8ff8095 100644
--- a/gdb/config/i386/nm-x86-64linux.h
+++ b/gdb/config/i386/nm-x86-64linux.h
@@ -60,9 +60,5 @@
 
 /* Override copies of {fetch,store}_inferior_registers in `infptrace.c'.  */
 #define FETCH_INFERIOR_REGISTERS
-
-
-/* FIXME: kettenis/20030416: Why?  */
-#undef PREPARE_TO_PROCEED
 
 #endif /* NM_X86_64_LINUX_H */
diff --git a/gdb/config/i386/tm-i386.h b/gdb/config/i386/tm-i386.h
index e80b258..395c9b2 100644
--- a/gdb/config/i386/tm-i386.h
+++ b/gdb/config/i386/tm-i386.h
@@ -24,8 +24,4 @@
 
 #define GDB_MULTI_ARCH GDB_MULTI_ARCH_PARTIAL
 
-/* FIXME: kettenis/2000-06-12: These do not belong here.  */
-extern void print_387_control_word (unsigned int);
-extern void print_387_status_word (unsigned int);
-
 #endif /* ifndef TM_I386_H */
diff --git a/gdb/config/i386/x86-64linux.mh b/gdb/config/i386/x86-64linux.mh
index 895d1fb..0c3c855 100644
--- a/gdb/config/i386/x86-64linux.mh
+++ b/gdb/config/i386/x86-64linux.mh
@@ -5,6 +5,7 @@
 NAT_FILE= nm-x86-64linux.h
 NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o \
 	core-regset.o i386-nat.o x86-64-linux-nat.o \
+	linux-nat.o \
 	proc-service.o thread-db.o lin-lwp.o linux-proc.o gcore.o 
 
 # The dynamically loaded libthread_db needs access to symbols in the
diff --git a/gdb/config/ia64/linux.mh b/gdb/config/ia64/linux.mh
index 65f3028..2013af3 100644
--- a/gdb/config/ia64/linux.mh
+++ b/gdb/config/ia64/linux.mh
@@ -5,6 +5,6 @@
 NAT_FILE= nm-linux.h
 NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o gcore.o \
 	core-aout.o core-regset.o ia64-linux-nat.o linux-proc.o \
-	proc-service.o thread-db.o lin-lwp.o
+	proc-service.o thread-db.o lin-lwp.o linux-nat.o
 
 LOADLIBES = -ldl -rdynamic
diff --git a/gdb/config/ia64/linux.mt b/gdb/config/ia64/linux.mt
index d841f75..3a661b3 100644
--- a/gdb/config/ia64/linux.mt
+++ b/gdb/config/ia64/linux.mt
@@ -2,5 +2,3 @@
 TDEPFILES= ia64-tdep.o ia64-aix-tdep.o ia64-linux-tdep.o \
 	solib.o solib-svr4.o solib-legacy.o
 TM_FILE= tm-linux.h
-
-GDBSERVER_DEPFILES = linux-low.o linux-ia64-low.o reg-ia64.o
diff --git a/gdb/config/ia64/nm-linux.h b/gdb/config/ia64/nm-linux.h
index e00d561..0418495 100644
--- a/gdb/config/ia64/nm-linux.h
+++ b/gdb/config/ia64/nm-linux.h
@@ -34,13 +34,6 @@
 #define CANNOT_STORE_REGISTER(regno) ia64_cannot_store_register(regno)
 extern int ia64_cannot_store_register (int regno);
 
-#ifdef GDBSERVER
-#define REGISTER_U_ADDR(addr, blockend, regno) \
-	(addr) = ia64_register_u_addr ((blockend),(regno));
-
-extern int ia64_register_u_addr(int, int);
-#endif /* GDBSERVER */
-
 #define U_REGS_OFFSET 0
 
 #define PTRACE_ARG3_TYPE long
diff --git a/gdb/config/ia64/tm-ia64.h b/gdb/config/ia64/tm-ia64.h
index 2445395..1b2baac 100644
--- a/gdb/config/ia64/tm-ia64.h
+++ b/gdb/config/ia64/tm-ia64.h
@@ -21,59 +21,8 @@
 #ifndef TM_IA64_H
 #define TM_IA64_H
 
-#if !defined(GDBSERVER)
-
 #define GDB_MULTI_ARCH 1
 
-#else /* defines needed for GDBSERVER */
-
-/* Say how long (ordinary) registers are.  This is a piece of bogosity
-   used in push_word and a few other places; REGISTER_RAW_SIZE is the
-   real way to know how big a register is.  */
-
-#define DEPRECATED_REGISTER_SIZE 8
-
-#undef  NUM_REGS
-#define NUM_REGS 590
-
-/* Some pseudo register numbers */
-
-#define PC_REGNUM	IA64_IP_REGNUM
-#define SP_REGNUM	IA64_GR12_REGNUM
-#define DEPRECATED_FP_REGNUM	IA64_VFP_REGNUM
-
-/* Total amount of space needed to store our copies of the machine's
-   register state, the array `registers'.  On the ia64, all registers
-   fit in 64 bits except for the floating point registers which require
-   84 bits.  But 84 isn't a nice number, so we'll just allocate 128
-   bits for each of these.  The expression below says that we
-   need 8 bytes for each register, plus an additional 8 bytes for each
-   of the 128 floating point registers. */
-
-#define DEPRECATED_REGISTER_BYTES (NUM_REGS*8+128*8)
-
-/* Index within `registers' of the first byte of the space for
-   register N.  */
-
-#define REGISTER_BYTE(N) (((N) * 8) \
-  + ((N) <= IA64_FR0_REGNUM ? 0 : 8 * (((N) > IA64_FR127_REGNUM) ? 128 : (N) - IA64_FR0_REGNUM)))
-
-/* Number of bytes of storage in the actual machine representation
-   for register N.  */
-
-#define REGISTER_RAW_SIZE(N) \
-  ((IA64_FR0_REGNUM <= (N) && (N) <= IA64_FR127_REGNUM) ? 16 : 8)
-
-/* Largest value REGISTER_RAW_SIZE can have.  */
-
-#define DEPRECATED_MAX_REGISTER_RAW_SIZE 16
-
-
-#define GDBSERVER_RESUME_REGS { IA64_IP_REGNUM, IA64_PSR_REGNUM, SP_REGNUM, IA64_BSP_REGNUM, IA64_CFM_REGNUM }
-
-#endif /* GDBSERVER */
-
-
 /* Register numbers of various important registers */
 
 /* General registers; there are 128 of these 64 bit wide registers.  The
diff --git a/gdb/config/m68k/linux.mh b/gdb/config/m68k/linux.mh
index f94df64..7de2c3f 100644
--- a/gdb/config/m68k/linux.mh
+++ b/gdb/config/m68k/linux.mh
@@ -5,10 +5,8 @@
 NAT_FILE= nm-linux.h
 NATDEPFILES= infptrace.o inftarg.o fork-child.o \
 	corelow.o core-aout.o m68klinux-nat.o linux-proc.o gcore.o \
-	proc-service.o thread-db.o lin-lwp.o 
+	proc-service.o thread-db.o lin-lwp.o linux-nat.o
 
 # The dynamically loaded libthread_db needs access to symbols in the
 # gdb executable.
 LOADLIBES = -ldl -rdynamic
-
-GDBSERVER_DEPFILES = linux-low.o linux-m68k-low.o reg-m68k.o
diff --git a/gdb/config/mips/bigmips.mt b/gdb/config/mips/bigmips.mt
deleted file mode 100644
index 38f03f2..0000000
--- a/gdb/config/mips/bigmips.mt
+++ /dev/null
@@ -1,3 +0,0 @@
-# Target: Big-endian MIPS machine such as Sony News
-TDEPFILES= mips-tdep.o
-TM_FILE= tm-bigmips.h
diff --git a/gdb/config/mips/bigmips64.mt b/gdb/config/mips/bigmips64.mt
deleted file mode 100644
index fcb7b21..0000000
--- a/gdb/config/mips/bigmips64.mt
+++ /dev/null
@@ -1,3 +0,0 @@
-# Target: Big-endian MIPS machine such as Sony News
-TDEPFILES= mips-tdep.o
-TM_FILE= tm-bigmips64.h
diff --git a/gdb/config/mips/decstation.mt b/gdb/config/mips/decstation.mt
deleted file mode 100644
index 1984722..0000000
--- a/gdb/config/mips/decstation.mt
+++ /dev/null
@@ -1,3 +0,0 @@
-# Target: Little-endian MIPS machine such as DECstation.
-TDEPFILES= mips-tdep.o
-TM_FILE= tm-mips.h
diff --git a/gdb/config/mips/embed.mt b/gdb/config/mips/embed.mt
index 42ab4aa..e17c5c2 100644
--- a/gdb/config/mips/embed.mt
+++ b/gdb/config/mips/embed.mt
@@ -1,5 +1,5 @@
 # Target: Big-endian mips board, typically an IDT.
-TDEPFILES= mips-tdep.o remote-mips.o remote-array.o
+TDEPFILES= mips-tdep.o remote-mips.o
 TM_FILE= tm-embed.h
 SIM_OBS = remote-sim.o
 SIM = ../sim/mips/libsim.a
diff --git a/gdb/config/mips/embed64.mt b/gdb/config/mips/embed64.mt
index 5df6224..aee68ae 100644
--- a/gdb/config/mips/embed64.mt
+++ b/gdb/config/mips/embed64.mt
@@ -1,5 +1,5 @@
 # Target: Big-endian mips board, typically an IDT.
-TDEPFILES= mips-tdep.o remote-mips.o remote-array.o
+TDEPFILES= mips-tdep.o remote-mips.o
 TM_FILE= tm-mips64.h
 SIM_OBS = remote-sim.o
 SIM = ../sim/mips/libsim.a
diff --git a/gdb/config/mips/embedl.mt b/gdb/config/mips/embedl.mt
index 4d5cea8..bbc9b7d 100644
--- a/gdb/config/mips/embedl.mt
+++ b/gdb/config/mips/embedl.mt
@@ -1,5 +1,5 @@
 # Target: Big-endian mips board, typically an IDT.
-TDEPFILES= mips-tdep.o remote-mips.o remote-array.o
+TDEPFILES= mips-tdep.o remote-mips.o
 TM_FILE= tm-mips.h
 SIM_OBS = remote-sim.o
 SIM = ../sim/mips/libsim.a
diff --git a/gdb/config/mips/embedl64.mt b/gdb/config/mips/embedl64.mt
index 5df6224..aee68ae 100644
--- a/gdb/config/mips/embedl64.mt
+++ b/gdb/config/mips/embedl64.mt
@@ -1,5 +1,5 @@
 # Target: Big-endian mips board, typically an IDT.
-TDEPFILES= mips-tdep.o remote-mips.o remote-array.o
+TDEPFILES= mips-tdep.o remote-mips.o
 TM_FILE= tm-mips64.h
 SIM_OBS = remote-sim.o
 SIM = ../sim/mips/libsim.a
diff --git a/gdb/config/mips/linux.mh b/gdb/config/mips/linux.mh
index 991fd6c..38f8725 100644
--- a/gdb/config/mips/linux.mh
+++ b/gdb/config/mips/linux.mh
@@ -2,6 +2,7 @@
 XM_FILE= xm-linux.h
 NAT_FILE= nm-linux.h
 NATDEPFILES= infptrace.o inftarg.o fork-child.o mips-linux-nat.o \
-	thread-db.o lin-lwp.o proc-service.o linux-proc.o gcore.o
+	thread-db.o lin-lwp.o proc-service.o linux-proc.o gcore.o \
+	linux-nat.o
 
 LOADLIBES = -ldl -rdynamic
diff --git a/gdb/config/mips/linux.mt b/gdb/config/mips/linux.mt
index 60bbfb2..25d99b3 100644
--- a/gdb/config/mips/linux.mt
+++ b/gdb/config/mips/linux.mt
@@ -3,7 +3,5 @@
 	solib.o solib-svr4.o
 TM_FILE= tm-linux.h
 
-GDBSERVER_DEPFILES = linux-low.o linux-mips-low.o reg-mips.o
-
 SIM_OBS = remote-sim.o
 SIM = ../sim/mips/libsim.a
diff --git a/gdb/config/mips/littlemips.mt b/gdb/config/mips/littlemips.mt
deleted file mode 100644
index 1984722..0000000
--- a/gdb/config/mips/littlemips.mt
+++ /dev/null
@@ -1,3 +0,0 @@
-# Target: Little-endian MIPS machine such as DECstation.
-TDEPFILES= mips-tdep.o
-TM_FILE= tm-mips.h
diff --git a/gdb/config/mips/tm-bigmips.h b/gdb/config/mips/tm-bigmips.h
deleted file mode 100644
index 7a5a6b8..0000000
--- a/gdb/config/mips/tm-bigmips.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/* Copyright 1990, 1994, 2000 Free Software Foundation, Inc.
-
-   This file is part of GDB.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
-
-#include "mips/tm-mips.h"
diff --git a/gdb/config/mips/tm-bigmips64.h b/gdb/config/mips/tm-bigmips64.h
deleted file mode 100644
index 9f171ee..0000000
--- a/gdb/config/mips/tm-bigmips64.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/* Target machine parameters for MIPS r4000
-   Copyright 1994, 2000 Free Software Foundation, Inc.
-   Contributed by Ian Lance Taylor (ian@cygnus.com)
-
-   This file is part of GDB.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
-
-#include "mips/tm-mips64.h"
diff --git a/gdb/config/mips/tm-embed64.h b/gdb/config/mips/tm-embed64.h
deleted file mode 100644
index 630b8e0..0000000
--- a/gdb/config/mips/tm-embed64.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/* Copyright 1993, 2000 Free Software Foundation, Inc.
-
-   This file is part of GDB.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
-
-#include "mips/tm-bigmips64.h"
diff --git a/gdb/config/mips/tm-embedl.h b/gdb/config/mips/tm-embedl.h
deleted file mode 100644
index d53f5c8..0000000
--- a/gdb/config/mips/tm-embedl.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/* Copyright 1993, 2000 Free Software Foundation, Inc.
-
-   This file is part of GDB.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
-
-#include "mips/tm-mips.h"
diff --git a/gdb/config/mips/tm-embedl64.h b/gdb/config/mips/tm-embedl64.h
deleted file mode 100644
index c76c612..0000000
--- a/gdb/config/mips/tm-embedl64.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/* Copyright 1993, 2000 Free Software Foundation, Inc.
-
-   This file is part of GDB.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
-
-#include "mips/tm-mips64.h"
diff --git a/gdb/config/mips/tm-irix5.h b/gdb/config/mips/tm-irix5.h
index 3d598c9d..932852e 100644
--- a/gdb/config/mips/tm-irix5.h
+++ b/gdb/config/mips/tm-irix5.h
@@ -30,16 +30,16 @@
  * Irix 6 (n32 ABI) has 32-bit GP regs and 64-bit FP regs
  */
 
-#undef  REGISTER_BYTE
-#define REGISTER_BYTE(N) \
+#undef  MIPS_REGISTER_BYTE
+#define MIPS_REGISTER_BYTE(N) \
      (((N) < FP0_REGNUM) ? (N) * MIPS_REGSIZE : \
       ((N) < FP0_REGNUM + 32) ?     \
       FP0_REGNUM * MIPS_REGSIZE + \
       ((N) - FP0_REGNUM) * sizeof(double) : \
       32 * sizeof(double) + ((N) - 32) * MIPS_REGSIZE)
 
-#undef  REGISTER_VIRTUAL_TYPE
-#define REGISTER_VIRTUAL_TYPE(N) \
+#undef  MIPS_REGISTER_TYPE
+#define MIPS_REGISTER_TYPE(N) \
 	(((N) >= FP0_REGNUM && (N) < FP0_REGNUM+32) ? builtin_type_double \
 	 : ((N) == 32 /*SR*/) ? builtin_type_uint32 \
 	 : ((N) >= 70 && (N) <= 89) ? builtin_type_uint32 \
diff --git a/gdb/config/mips/tm-irix6.h b/gdb/config/mips/tm-irix6.h
index 14de12e..e6395ae 100644
--- a/gdb/config/mips/tm-irix6.h
+++ b/gdb/config/mips/tm-irix6.h
@@ -62,8 +62,8 @@
 #define FCRIR_REGNUM 70		/* FP implementation/revision */
 
 
-#undef  REGISTER_BYTE
-#define REGISTER_BYTE(N) \
+#undef  MIPS_REGISTER_BYTE
+#define MIPS_REGISTER_BYTE(N) \
      (((N) < FP0_REGNUM) ? (N) * MIPS_REGSIZE : \
       ((N) < FP0_REGNUM + 32) ?     \
       FP0_REGNUM * MIPS_REGSIZE + \
@@ -94,4 +94,4 @@
 #define SIGFRAME_REG_SIZE	8
 
 /* Undefine those methods which have been multiarched.  */
-#undef REGISTER_VIRTUAL_TYPE
+#undef MIPS_REGISTER_TYPE
diff --git a/gdb/config/mips/tm-mips.h b/gdb/config/mips/tm-mips.h
index 7ae05a4..51a6a7d 100644
--- a/gdb/config/mips/tm-mips.h
+++ b/gdb/config/mips/tm-mips.h
@@ -98,38 +98,19 @@
 /* Index within `registers' of the first byte of the space for
    register N.  */
 
-#define REGISTER_BYTE(N) ((N) * MIPS_REGSIZE)
+#define MIPS_REGISTER_BYTE(N) ((N) * MIPS_REGSIZE)
 
 /* Return the GDB type object for the "standard" data type of data in
    register N.  */
 
-#ifndef REGISTER_VIRTUAL_TYPE
-#define REGISTER_VIRTUAL_TYPE(N) \
+#ifndef MIPS_REGISTER_TYPE
+#define MIPS_REGISTER_TYPE(N) \
 	(((N) >= FP0_REGNUM && (N) < FP0_REGNUM+32) ? builtin_type_float \
 	 : ((N) == 32 /*SR*/) ? builtin_type_uint32 \
 	 : ((N) >= 70 && (N) <= 89) ? builtin_type_uint32 \
 	 : builtin_type_int)
 #endif
 
-/* All mips targets store doubles in a register pair with the least
-   significant register in the lower numbered register.
-   If the target is big endian, double register values need conversion
-   between memory and register formats.  */
-
-extern void mips_register_convert_to_type (int regnum, 
-					   struct type *type,
-					   char *buffer);
-extern void mips_register_convert_from_type (int regnum, 
-					     struct type *type,
-					     char *buffer);
-
-#define REGISTER_CONVERT_TO_TYPE(n, type, buffer)	\
-  mips_register_convert_to_type ((n), (type), (buffer))
-
-#define REGISTER_CONVERT_FROM_TYPE(n, type, buffer)	\
-  mips_register_convert_from_type ((n), (type), (buffer))
-
-
 /* Special symbol found in blocks associated with routines.  We can hang
    mips_extra_func_info_t's off of this.  */
 
diff --git a/gdb/config/mips/tm-mips64.h b/gdb/config/mips/tm-mips64.h
index 13e62d2..2547e86 100644
--- a/gdb/config/mips/tm-mips64.h
+++ b/gdb/config/mips/tm-mips64.h
@@ -23,7 +23,7 @@
 #define MIPS_REGSIZE 8
 
 /* define 8 byte register type */
-#define REGISTER_VIRTUAL_TYPE(N) \
+#define MIPS_REGISTER_TYPE(N) \
         (((N) >= FP0_REGNUM && (N) < FP0_REGNUM+32) ? builtin_type_double \
 	 : ((N) == 32 /*SR*/) ? builtin_type_uint32 \
 	 : ((N) >= 70 && (N) <= 89) ? builtin_type_uint32 \
diff --git a/gdb/config/mips/tm-tx39l.h b/gdb/config/mips/tm-tx39l.h
deleted file mode 100644
index 81f3b6d..0000000
--- a/gdb/config/mips/tm-tx39l.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Copyright 1993, 1997, 1999, 2000 Free Software Foundation, Inc.
-
-   This file is part of GDB.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
-
-#include "mips/tm-mips.h"
-
-#undef  MIPS_REGISTER_NAMES
-#define MIPS_REGISTER_NAMES 	\
-    {	"sr",	"lo",	"hi",	"bad",	"cause","pc", \
-	"",   	"",   	"",   	"",   	"",   	"",   	"",   	"", \
-	"",   	"",   	"",  	"",  	"",  	"",  	"",  	"", \
-	"",  	"",  	"",  	"",  	"",  	"",  	"",  	"", \
-	"",  	"",  	"",  	"",  	"",  	"",  	"",  	"", \
-	"",  	"",  	"",	"", \
-	"",	"",	"",	"",	"",	"",	"",	"", \
-	"",	"", "config", "cache", "debug", "depc", "epc",	"" \
-    }
diff --git a/gdb/config/mips/tm-vr4100.h b/gdb/config/mips/tm-vr4100.h
deleted file mode 100644
index 9c4472b..0000000
--- a/gdb/config/mips/tm-vr4100.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/* Copyright 1998, 2000 Free Software Foundation, Inc.
-
-   This file is part of GDB.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
-
-#include "mips/tm-bigmips64.h"
diff --git a/gdb/config/mips/tm-vr4300.h b/gdb/config/mips/tm-vr4300.h
deleted file mode 100644
index 728c731..0000000
--- a/gdb/config/mips/tm-vr4300.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/* Copyright 1993, 1995, 1996, 2000 Free Software Foundation, Inc.
-
-   This file is part of GDB.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
-
-#include "mips/tm-bigmips64.h"
diff --git a/gdb/config/mips/tm-vr4300el.h b/gdb/config/mips/tm-vr4300el.h
deleted file mode 100644
index e7e5680..0000000
--- a/gdb/config/mips/tm-vr4300el.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/* Copyright 1993, 1995, 1996, 2000 Free Software Foundation, Inc.
-
-   This file is part of GDB.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
-
-#include "mips/tm-mips64.h"
diff --git a/gdb/config/mips/tm-vr4xxx.h b/gdb/config/mips/tm-vr4xxx.h
deleted file mode 100644
index 9c4472b..0000000
--- a/gdb/config/mips/tm-vr4xxx.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/* Copyright 1998, 2000 Free Software Foundation, Inc.
-
-   This file is part of GDB.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
-
-#include "mips/tm-bigmips64.h"
diff --git a/gdb/config/mips/tm-vr4xxxel.h b/gdb/config/mips/tm-vr4xxxel.h
deleted file mode 100644
index 7f2e4cd..0000000
--- a/gdb/config/mips/tm-vr4xxxel.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/* Copyright 1998, 2000 Free Software Foundation, Inc.
-
-   This file is part of GDB.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
-
-#include "mips/tm-mips64.h"
diff --git a/gdb/config/mips/tm-vr5000.h b/gdb/config/mips/tm-vr5000.h
deleted file mode 100644
index 0d68345..0000000
--- a/gdb/config/mips/tm-vr5000.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/* Copyright 1996, 2000 Free Software Foundation, Inc.
-
-   This file is part of GDB.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
-
-#include "mips/tm-bigmips64.h"
diff --git a/gdb/config/mips/tm-vr5000el.h b/gdb/config/mips/tm-vr5000el.h
deleted file mode 100644
index 7fae087..0000000
--- a/gdb/config/mips/tm-vr5000el.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/* Copyright 1996, 2000 Free Software Foundation, Inc.
-
-   This file is part of GDB.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
-
-#include "mips/tm-mips64.h"
diff --git a/gdb/config/mips/vr4100.mt b/gdb/config/mips/vr4100.mt
deleted file mode 100644
index c5ae4f9..0000000
--- a/gdb/config/mips/vr4100.mt
+++ /dev/null
@@ -1,5 +0,0 @@
-# Target: Big-endian SIM monitor board.
-TDEPFILES= mips-tdep.o remote-mips.o
-TM_FILE= tm-vr4100.h
-SIM_OBS = remote-sim.o
-SIM = ../sim/mips/libsim.a
diff --git a/gdb/config/mips/vr4300.mt b/gdb/config/mips/vr4300.mt
deleted file mode 100644
index 22cb25e..0000000
--- a/gdb/config/mips/vr4300.mt
+++ /dev/null
@@ -1,5 +0,0 @@
-# Target: Big-endian SIM monitor board.
-TDEPFILES= mips-tdep.o remote-mips.o
-TM_FILE= tm-vr4300.h
-SIM_OBS = remote-sim.o
-SIM = ../sim/mips/libsim.a
diff --git a/gdb/config/mips/vr4300el.mt b/gdb/config/mips/vr4300el.mt
deleted file mode 100644
index cff7241..0000000
--- a/gdb/config/mips/vr4300el.mt
+++ /dev/null
@@ -1,5 +0,0 @@
-# Target: Little-endian SIM monitor board.
-TDEPFILES= mips-tdep.o remote-mips.o
-TM_FILE= tm-vr4300el.h
-SIM_OBS = remote-sim.o
-SIM = ../sim/mips/libsim.a
diff --git a/gdb/config/mips/vr4xxx.mt b/gdb/config/mips/vr4xxx.mt
deleted file mode 100644
index 4c79ec7..0000000
--- a/gdb/config/mips/vr4xxx.mt
+++ /dev/null
@@ -1,5 +0,0 @@
-# Target: Big-endian SIM monitor board.
-TDEPFILES= mips-tdep.o remote-mips.o
-TM_FILE= tm-vr4xxx.h
-SIM_OBS = remote-sim.o
-SIM = ../sim/mips/libsim.a
diff --git a/gdb/config/mips/vr4xxxel.mt b/gdb/config/mips/vr4xxxel.mt
deleted file mode 100644
index 5124dd7..0000000
--- a/gdb/config/mips/vr4xxxel.mt
+++ /dev/null
@@ -1,5 +0,0 @@
-# Target: Big-endian SIM monitor board.
-TDEPFILES= mips-tdep.o remote-mips.o
-TM_FILE= tm-vr4xxxel.h
-SIM_OBS = remote-sim.o
-SIM = ../sim/mips/libsim.a
diff --git a/gdb/config/mips/vr5000.mt b/gdb/config/mips/vr5000.mt
deleted file mode 100644
index 7a4a915..0000000
--- a/gdb/config/mips/vr5000.mt
+++ /dev/null
@@ -1,5 +0,0 @@
-# Target: Big-endian SIM monitor board.
-TDEPFILES= mips-tdep.o remote-mips.o
-TM_FILE= tm-vr5000.h
-SIM_OBS = remote-sim.o
-SIM = ../sim/mips/libsim.a
diff --git a/gdb/config/mips/vr5000el.mt b/gdb/config/mips/vr5000el.mt
deleted file mode 100644
index 99687ed..0000000
--- a/gdb/config/mips/vr5000el.mt
+++ /dev/null
@@ -1,5 +0,0 @@
-# Target: Little-endian SIM monitor board.
-TDEPFILES= mips-tdep.o remote-mips.o
-TM_FILE= tm-vr5000el.h
-SIM_OBS = remote-sim.o
-SIM = ../sim/mips/libsim.a
diff --git a/gdb/config/nm-linux.h b/gdb/config/nm-linux.h
index 0fb5627..9a04cf7 100644
--- a/gdb/config/nm-linux.h
+++ b/gdb/config/nm-linux.h
@@ -51,9 +51,6 @@
 extern ptid_t child_wait (ptid_t ptid, struct target_waitstatus *ourstatus);
 #define CHILD_WAIT
 
-extern int lin_lwp_prepare_to_proceed (void);
-#define PREPARE_TO_PROCEED(select_it) lin_lwp_prepare_to_proceed ()
-
 extern void lin_lwp_attach_lwp (ptid_t ptid, int verbose);
 #define ATTACH_LWP(ptid, verbose) lin_lwp_attach_lwp ((ptid), (verbose))
 
@@ -73,7 +70,6 @@
 /* Override child_pid_to_exec_file in 'inftarg.c'.  */
 #define CHILD_PID_TO_EXEC_FILE
 
-struct mem_attrib;
-extern int linux_proc_xfer_memory (CORE_ADDR addr, char *myaddr, int len,
-				   int write, struct mem_attrib *attrib,
-				   struct target_ops *target);
+#define CHILD_INSERT_FORK_CATCHPOINT
+#define CHILD_INSERT_VFORK_CATCHPOINT
+#define CHILD_INSERT_EXEC_CATCHPOINT
diff --git a/gdb/config/pa/nm-hppah.h b/gdb/config/pa/nm-hppah.h
index 74bfa20..05e7db2 100644
--- a/gdb/config/pa/nm-hppah.h
+++ b/gdb/config/pa/nm-hppah.h
@@ -53,11 +53,6 @@
 #define CHILD_XFER_MEMORY
 #define CHILD_FOLLOW_FORK
 
-/* While this is for use by threaded programs, it doesn't appear
- * to hurt non-threaded ones.  This is used in infrun.c: */
-#define PREPARE_TO_PROCEED(select_it) generic_prepare_to_proceed(select_it)
-extern int generic_prepare_to_proceed (int select_it);
-
 /* In infptrace.c or infttrace.c: */
 #define CHILD_PID_TO_EXEC_FILE
 #define CHILD_POST_STARTUP_INFERIOR
diff --git a/gdb/config/powerpc/linux.mh b/gdb/config/powerpc/linux.mh
index d0a2104..925650d 100644
--- a/gdb/config/powerpc/linux.mh
+++ b/gdb/config/powerpc/linux.mh
@@ -6,8 +6,6 @@
 NAT_FILE= nm-linux.h
 NATDEPFILES= infptrace.o inftarg.o fork-child.o linux-proc.o \
 	ppc-linux-nat.o proc-service.o thread-db.o lin-lwp.o \
-	gcore.o
+	gcore.o linux-nat.o
 
 LOADLIBES = -ldl -rdynamic
-
-GDBSERVER_DEPFILES = linux-low.o linux-ppc-low.o reg-ppc.o
diff --git a/gdb/config/s390/s390.mh b/gdb/config/s390/s390.mh
index 300a5e3..ab3350f 100644
--- a/gdb/config/s390/s390.mh
+++ b/gdb/config/s390/s390.mh
@@ -6,7 +6,7 @@
 NAT_FILE= nm-linux.h
 NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o s390-nat.o \
 	core-aout.o core-regset.o linux-proc.o gcore.o thread-db.o lin-lwp.o \
-	proc-service.o
+	proc-service.o linux-nat.o
 LOADLIBES = -ldl -rdynamic
 
 
diff --git a/gdb/config/s390/tm-linux.h b/gdb/config/s390/tm-linux.h
index c1b4a29..7b406e0 100644
--- a/gdb/config/s390/tm-linux.h
+++ b/gdb/config/s390/tm-linux.h
@@ -24,9 +24,7 @@
 
 #ifndef TM_LINUX_H
 #define TM_LINUX_H
-#ifdef GDBSERVER
-#define S390_GNULINUX_TARGET
-#endif /* GDBSERVER */
+
 #undef  TARGET_ELF64
 #define TARGET_ELF64 (gdbarch_tdep (current_gdbarch)->intreg_size==8)
 
diff --git a/gdb/config/s390/tm-s390.h b/gdb/config/s390/tm-s390.h
index c8a6e8d..d36c279 100644
--- a/gdb/config/s390/tm-s390.h
+++ b/gdb/config/s390/tm-s390.h
@@ -73,43 +73,6 @@
 #define S390X_REGISTER_BYTES ((8+8)+(8*S390_NUM_GPRS)+(4*S390_NUM_ACRS)+ \
 (8*S390_NUM_CRS)+(S390_FPC_SIZE+S390_FPC_PAD_SIZE)+(S390_FPR_SIZE*S390_NUM_FPRS))
 
-#ifdef GDBSERVER
-
-int s390_register_byte (int reg_nr);
-#define REGISTER_BYTE(reg_nr) s390_register_byte(reg_nr)
-#define PC_REGNUM S390_PC_REGNUM
-#define NUM_REGS  S390_NUM_REGS
-#define NUM_FREGS S390_NUM_FPRS
-#define DEPRECATED_FP_REGNUM S390_FP_REGNUM
-#define SP_REGNUM S390_SP_REGNUM
-/* Obviously ptrace for user program tracing cannot be allowed
-  mess with control registers (except per registers for hardware watchpoints),
-  when we add kernel debugging we may need to alter these macros. */
-int s390_cannot_fetch_register (int regno);
-#define CANNOT_FETCH_REGISTER(regno) s390_cannot_fetch_register(regno)
-#define CANNOT_STORE_REGISTER(regno) s390_cannot_fetch_register(regno)
-
-#if CONFIG_ARCH_S390X
-
-int s390x_register_raw_size (int reg_nr);
-#define REGISTER_RAW_SIZE(reg_nr) s390x_register_raw_size(reg_nr)
-#define GDB_TARGET_IS_ESAME (1)
-#define DEPRECATED_REGISTER_SIZE       (8)
-#define DEPRECATED_REGISTER_BYTES S390X_REGISTER_BYTES
-
-#else /*  CONFIG_ARCH_S390X */
-
-int s390_register_raw_size (int reg_nr);
-#define REGISTER_RAW_SIZE(reg_nr) s390_register_raw_size(reg_nr)
-#define GDB_TARGET_IS_ESAME (0)
-#define DEPRECATED_REGISTER_SIZE       (4)
-#define DEPRECATED_REGISTER_BYTES S390_REGISTER_BYTES
-
-#endif /* CONFIG_ARCH_S390X */
-
-#else /* GDBSERVER */
-
 #define GDB_TARGET_IS_ESAME (TARGET_ARCHITECTURE->mach == bfd_mach_s390_64)
 
-#endif /* GDBSERVER */
 #endif /* ifndef TM_S390_H */
diff --git a/gdb/config/sh/linux.mt b/gdb/config/sh/linux.mt
index ea8460c..8f217cc 100644
--- a/gdb/config/sh/linux.mt
+++ b/gdb/config/sh/linux.mt
@@ -4,5 +4,3 @@
 
 SIM_OBS = remote-sim.o
 SIM = ../sim/sh/libsim.a
-
-GDBSERVER_DEPFILES = linux-low.o linux-sh-low.o reg-sh.o
diff --git a/gdb/config/sparc/linux.mh b/gdb/config/sparc/linux.mh
index 4a2c41f..f36dbb1 100644
--- a/gdb/config/sparc/linux.mh
+++ b/gdb/config/sparc/linux.mh
@@ -5,7 +5,7 @@
 NAT_FILE= nm-linux.h
 NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o sparc-nat.o \
 	proc-service.o thread-db.o lin-lwp.o sparc-linux-nat.o \
-	linux-proc.o gcore.o 
+	linux-proc.o gcore.o linux-nat.o
 
 # The dynamically loaded libthread_db needs access to symbols in the
 # gdb executable.
diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c
index 60a2093..a591d18 100644
--- a/gdb/cp-valprint.c
+++ b/gdb/cp-valprint.c
@@ -554,7 +554,7 @@
 	{
 	  boffset = baseclass_offset (type, i,
 				      valaddr + offset,
-				      address + offset);
+				      address);
 	  skip = ((boffset == -1) || (boffset + offset) < 0) ? 1 : -1;
 
 	  if (BASETYPE_VIA_VIRTUAL (type, i))
@@ -569,9 +569,10 @@
 		{
 		  /* FIXME (alloca): unsafe if baseclass is really really large. */
 		  base_valaddr = (char *) alloca (TYPE_LENGTH (baseclass));
-		  if (target_read_memory (address + offset + boffset, base_valaddr,
+		  if (target_read_memory (address + boffset, base_valaddr,
 					  TYPE_LENGTH (baseclass)) != 0)
 		    skip = 1;
+		  address = address + boffset;
 		  thisoffset = 0;
 		  boffset = 0;
 		  thistype = baseclass;
@@ -600,7 +601,8 @@
 	fprintf_filtered (stream, "<invalid address>");
       else
 	cp_print_value_fields (baseclass, thistype, base_valaddr,
-			       thisoffset + boffset, address, stream, format,
+			       thisoffset + boffset, address + boffset,
+			       stream, format,
 			       recurse, pretty,
 			       ((struct type **)
 				obstack_base (&dont_print_vb_obstack)),
diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c
index 0da68c0..3c7bf60 100644
--- a/gdb/cris-tdep.c
+++ b/gdb/cris-tdep.c
@@ -4295,7 +4295,7 @@
   set_gdbarch_deprecated_saved_pc_after_call (gdbarch, cris_saved_pc_after_call);
 
   /* Helpful for backtracing and returning in a call dummy.  */
-  set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos);
+  set_gdbarch_deprecated_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos);
 
   /* Should be using push_dummy_call.  */
   set_gdbarch_deprecated_dummy_write_sp (gdbarch, deprecated_write_sp);
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index 7dcda46..b1b61a6 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,3 +1,27 @@
+2003-06-22  Daniel Jacobowitz  <drow@mvista.com>
+
+	* gdbint.texinfo (Coding): Clarify use of gdb_XXX.h headers.
+
+2003-06-22  Daniel Jacobowitz  <drow@mvista.com>
+
+	* Makefile.in (SFILES_INCLUDED): Add agentexpr.texi.
+	* agentexpr.texi: Retitle section, and change it to an appendix.
+	Comment out texinfo initialization.  Factor a @var{} into two
+	pieces to prevent makeinfo warnings.
+	* gdb.texinfo: Add Agent Expressions appendix.
+
+2003-06-19  Daniel Jacobowitz  <drow@mvista.com>
+
+	* gdbint.texinfo (Native Conditionals): Remove PREPARE_TO_PROCEED.
+
+2003-06-18  Daniel Jacobowitz  <drow@mvista.com>
+
+        * gdb.texinfo (Remote Debugging): New section "Connecting to a
+	remote target".  Document the "detach" and "disconnect" commands.
+	(Server, Netware, Debug Session): Reference "Connecting to a
+	remote target".
+	(GDB/MI Target Manipulation): Document "-target-disconnect".
+
 2003-06-13  Andrew Cagney  <cagney@redhat.com>
 
 	* gdbint.texinfo (Target Architecture Definition): Deprecate
diff --git a/gdb/doc/Makefile.in b/gdb/doc/Makefile.in
index fcdabc5..eda637c 100644
--- a/gdb/doc/Makefile.in
+++ b/gdb/doc/Makefile.in
@@ -1,4 +1,4 @@
-##Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1999, 2000, 2002
+##Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1999, 2000, 2002, 2003
 ##Free Software Foundation, Inc.
 
 # Makefile for GDB documentation.
@@ -100,6 +100,7 @@
 GDB_DOC_SOURCE_INCLUDES = \
 	$(srcdir)/fdl.texi \
 	$(srcdir)/gpl.texi \
+	$(srcdir)/agentexpr.texi \
 	$(READLINE_DIR)/rluser.texinfo \
 	$(READLINE_DIR)/inc-hist.texinfo
 GDB_DOC_BUILD_INCLUDES = \
diff --git a/gdb/doc/agentexpr.texi b/gdb/doc/agentexpr.texi
index 0135391..79985b7 100644
--- a/gdb/doc/agentexpr.texi
+++ b/gdb/doc/agentexpr.texi
@@ -1,14 +1,14 @@
-\input texinfo
+@c \input texinfo
 @c %**start of header
-@setfilename agentexpr.info
-@settitle GDB Agent Expressions
-@setchapternewpage off
+@c @setfilename agentexpr.info
+@c @settitle GDB Agent Expressions
+@c @setchapternewpage off
 @c %**end of header
 
-Revision: $Id$
+@c Revision: $Id$
 
-@node The GDB Agent Expression Mechanism
-@chapter The GDB Agent Expression Mechanism
+@node Agent Expressions
+@appendix The GDB Agent Expression Mechanism
 
 In some applications, it is not feasable for the debugger to interrupt
 the program's execution long enough for the developer to learn anything
@@ -299,7 +299,7 @@
 and @var{b} be the top value.  Shift @var{a} left by @var{b} bits, and
 push the result.
 
-@item @code{rsh_signed} (0x0a): @var{a} @var{b} @result{} @var{@code{(signed)}a>>b}
+@item @code{rsh_signed} (0x0a): @var{a} @var{b} @result{} @code{(signed)}@var{a>>b}
 Pop two integers from the stack; let @var{a} be the next-to-top value,
 and @var{b} be the top value.  Shift @var{a} right by @var{b} bits,
 inserting copies of the top bit at the high end, and push the result.
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 95fd5a0..f343eed 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -156,6 +156,7 @@
 * Installing GDB::              Installing GDB
 * Maintenance Commands::        Maintenance Commands
 * Remote Protocol::             GDB Remote Serial Protocol
+* Agent Expressions::           The GDB Agent Expression Mechanism
 * Copying::			GNU General Public License says
                                 how you can copy and share GDB
 * GNU Free Documentation License::  The license for this documentation
@@ -10513,12 +10514,112 @@
 @chapter Debugging remote programs
 
 @menu
+* Connecting::                  Connecting to a remote target
 * Server::	                Using the gdbserver program
 * NetWare::                     Using the gdbserve.nlm program
 * Remote configuration::        Remote configuration
 * remote stub::                 Implementing a remote stub
 @end menu
 
+@node Connecting
+@section Connecting to a remote target
+
+On the @value{GDBN} host machine, you will need an unstripped copy of
+your program, since @value{GDBN} needs symobl and debugging information.
+Start up @value{GDBN} as usual, using the name of the local copy of your
+program as the first argument.
+
+@cindex serial line, @code{target remote}
+If you're using a serial line, you may want to give @value{GDBN} the
+@w{@samp{--baud}} option, or use the @code{set remotebaud} command
+before the @code{target} command.
+
+After that, use @code{target remote} to establish communications with
+the target machine.  Its argument specifies how to communicate---either
+via a devicename attached to a direct serial line, or a TCP or UDP port
+(possibly to a terminal server which in turn has a serial line to the
+target).  For example, to use a serial line connected to the device
+named @file{/dev/ttyb}:
+
+@smallexample
+target remote /dev/ttyb
+@end smallexample
+
+@cindex TCP port, @code{target remote}
+To use a TCP connection, use an argument of the form
+@code{@var{host}:@var{port}} or @code{tcp:@var{host}:@var{port}}.
+For example, to connect to port 2828 on a
+terminal server named @code{manyfarms}:
+
+@smallexample
+target remote manyfarms:2828
+@end smallexample
+
+If your remote target is actually running on the same machine as
+your debugger session (e.g.@: a simulator of your target running on
+the same host), you can omit the hostname.  For example, to connect
+to port 1234 on your local machine:
+
+@smallexample
+target remote :1234
+@end smallexample
+@noindent
+
+Note that the colon is still required here.
+
+@cindex UDP port, @code{target remote}
+To use a UDP connection, use an argument of the form
+@code{udp:@var{host}:@var{port}}.  For example, to connect to UDP port 2828
+on a terminal server named @code{manyfarms}:
+
+@smallexample
+target remote udp:manyfarms:2828
+@end smallexample
+
+When using a UDP connection for remote debugging, you should keep in mind
+that the `U' stands for ``Unreliable''.  UDP can silently drop packets on
+busy or unreliable networks, which will cause havoc with your debugging
+session.
+
+Now you can use all the usual commands to examine and change data and to
+step and continue the remote program.
+
+@cindex interrupting remote programs
+@cindex remote programs, interrupting
+Whenever @value{GDBN} is waiting for the remote program, if you type the
+interrupt character (often @key{C-C}), @value{GDBN} attempts to stop the
+program.  This may or may not succeed, depending in part on the hardware
+and the serial drivers the remote system uses.  If you type the
+interrupt character once again, @value{GDBN} displays this prompt:
+
+@smallexample
+Interrupted while waiting for the program.
+Give up (and stop debugging it)?  (y or n)
+@end smallexample
+
+If you type @kbd{y}, @value{GDBN} abandons the remote debugging session.
+(If you decide you want to try again later, you can use @samp{target
+remote} again to connect once more.)  If you type @kbd{n}, @value{GDBN}
+goes back to waiting.
+
+@table @code
+@kindex detach (remote)
+@item detach
+When you have finished debugging the remote program, you can use the
+@code{detach} command to release it from @value{GDBN} control.
+Detaching from the target normally resumes its execution, but the results
+will depend on your particular remote stub.  After the @code{detach}
+command, @value{GDBN} is free to connect to another target.
+
+@kindex disconnect
+@item disconnect
+The @code{disconnect} command behaves like @code{detach}, except that
+the target is generally not resumed.  It will wait for @value{GDBN}
+(this instance or another one) to connect and continue debugging.  After
+the @code{disconnect} command, @value{GDBN} is again free to connect to
+another target.
+@end table
+
 @node Server
 @section Using the @code{gdbserver} program
 
@@ -10601,34 +10702,15 @@
 @var{pid} is the process ID of a currently running process.  It isn't necessary
 to point @code{gdbserver} at a binary for the running process.
 
-@item On the @value{GDBN} host machine,
-you need an unstripped copy of your program, since @value{GDBN} needs
-symbols and debugging information.  Start up @value{GDBN} as usual,
-using the name of the local copy of your program as the first argument.
-(You may also need the @w{@samp{--baud}} option if the serial line is
-running at anything other than 9600@dmn{bps}.)  After that, use @code{target
-remote} to establish communications with @code{gdbserver}.  Its argument
-is either a device name (usually a serial device, like
-@file{/dev/ttyb}), or a TCP port descriptor in the form
-@code{@var{host}:@var{PORT}}.  For example:
-
-@smallexample
-(@value{GDBP}) target remote /dev/ttyb
-@end smallexample
-
-@noindent
-communicates with the server via serial line @file{/dev/ttyb}, and
-
-@smallexample
-(@value{GDBP}) target remote the-target:2345
-@end smallexample
-
-@noindent
-communicates via a TCP connection to port 2345 on host @w{@file{the-target}}.
+@item On the host machine,
+connect to your target (@pxref{Connecting,,Connecting to a remote target}).
 For TCP connections, you must start up @code{gdbserver} prior to using
 the @code{target remote} command.  Otherwise you may get an error whose
 text depends on the host system, but which usually looks something like
-@samp{Connection refused}.
+@samp{Connection refused}.  You don't need to use the @code{load}
+command in @value{GDBN} when using gdbserver, since the program is
+already on the target.
+
 @end table
 
 @node NetWare
@@ -10670,22 +10752,10 @@
 load gdbserve BOARD=1 PORT=2 BAUD=19200 emacs foo.txt
 @end smallexample
 
-@item On the @value{GDBN} host machine,
-you need an unstripped copy of your program, since @value{GDBN} needs
-symbols and debugging information.  Start up @value{GDBN} as usual,
-using the name of the local copy of your program as the first argument.
-(You may also need the @w{@samp{--baud}} option if the serial line is
-running at anything other than 9600@dmn{bps}.  After that, use @code{target
-remote} to establish communications with @code{gdbserve.nlm}.  Its
-argument is a device name (usually a serial device, like
-@file{/dev/ttyb}).  For example:
+@item
+On the @value{GDBN} host machine, connect to your target (@pxref{Connecting,,
+Connecting to a remote target}).
 
-@smallexample
-(@value{GDBP}) target remote /dev/ttyb
-@end smallexample
-
-@noindent
-communications with the server via serial line @file{/dev/ttyb}.
 @end table
 
 @node Remote configuration
@@ -11007,87 +11077,11 @@
 whatever means the manufacturer provides), and start it.
 
 @item
-To start remote debugging, run @value{GDBN} on the host machine, and specify
-as an executable file the program that is running in the remote machine.
-This tells @value{GDBN} how to find your program's symbols and the contents
-of its pure text.
-
-@item
-@cindex serial line, @code{target remote}
-Establish communication using the @code{target remote} command.
-Its argument specifies how to communicate with the target
-machine---either via a devicename attached to a direct serial line, or a
-TCP or UDP port (usually to a terminal server which in turn has a serial line
-to the target).  For example, to use a serial line connected to the
-device named @file{/dev/ttyb}:
-
-@smallexample
-target remote /dev/ttyb
-@end smallexample
-
-@cindex TCP port, @code{target remote}
-To use a TCP connection, use an argument of the form
-@code{@var{host}:@var{port}} or @code{tcp:@var{host}:@var{port}}.
-For example, to connect to port 2828 on a
-terminal server named @code{manyfarms}:
-
-@smallexample
-target remote manyfarms:2828
-@end smallexample
-
-If your remote target is actually running on the same machine as
-your debugger session (e.g.@: a simulator of your target running on
-the same host), you can omit the hostname.  For example, to connect
-to port 1234 on your local machine:
-
-@smallexample
-target remote :1234
-@end smallexample
-@noindent
-
-Note that the colon is still required here.
-
-@cindex UDP port, @code{target remote}
-To use a UDP connection, use an argument of the form
-@code{udp:@var{host}:@var{port}}.  For example, to connect to UDP port 2828
-on a terminal server named @code{manyfarms}:
-
-@smallexample
-target remote udp:manyfarms:2828
-@end smallexample
-
-When using a UDP connection for remote debugging, you should keep in mind
-that the `U' stands for ``Unreliable''.  UDP can silently drop packets on
-busy or unreliable networks, which will cause havoc with your debugging
-session.
+Start @value{GDBN} on the host, and connect to the target
+(@pxref{Connecting,,Connecting to a remote target}).
 
 @end enumerate
 
-Now you can use all the usual commands to examine and change data and to
-step and continue the remote program.
-
-To resume the remote program and stop debugging it, use the @code{detach}
-command.
-
-@cindex interrupting remote programs
-@cindex remote programs, interrupting
-Whenever @value{GDBN} is waiting for the remote program, if you type the
-interrupt character (often @key{C-C}), @value{GDBN} attempts to stop the
-program.  This may or may not succeed, depending in part on the hardware
-and the serial drivers the remote system uses.  If you type the
-interrupt character once again, @value{GDBN} displays this prompt:
-
-@smallexample
-Interrupted while waiting for the program.
-Give up (and stop debugging it)?  (y or n)
-@end smallexample
-
-If you type @kbd{y}, @value{GDBN} abandons the remote debugging session.
-(If you decide you want to try again later, you can use @samp{target
-remote} again to connect once more.)  If you type @kbd{n}, @value{GDBN}
-goes back to waiting.
-
-
 @node Configurations
 @chapter Configuration-Specific Information
 
@@ -17392,6 +17386,31 @@
 @end smallexample
 
 
+@subheading The @code{-target-disconnect} Command
+@findex -target-disconnect
+
+@subsubheading Synopsis
+
+@example
+ -target-disconnect
+@end example
+
+Disconnect from the remote target.  There's no output.
+
+@subsubheading @value{GDBN} command
+
+The corresponding @value{GDBN} command is @samp{disconnect}.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+-target-disconnect
+^done
+(@value{GDBP})
+@end smallexample
+
+
 @subheading The @code{-target-download} Command
 @findex -target-download
 
@@ -19775,7 +19794,7 @@
 @cindex @code{D} packet
 
 Detach @value{GDBN} from the remote system.  Sent to the remote target
-before @value{GDBN} disconnects.
+before @value{GDBN} disconnects via the @code{detach} command.
 
 Reply:
 @table @samp
@@ -21702,6 +21721,8 @@
 <- @code{T02}
 @end smallexample
 
+@include agentexpr.texi
+
 @include gpl.texi
 
 @include fdl.texi
diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo
index 68ff5dc..4f031e0 100644
--- a/gdb/doc/gdbint.texinfo
+++ b/gdb/doc/gdbint.texinfo
@@ -4494,23 +4494,6 @@
 Define this to be able to, when a breakpoint insertion fails, warn the
 user that another process may be running with the same executable.
 
-@item PREPARE_TO_PROCEED (@var{select_it})
-@findex PREPARE_TO_PROCEED
-This (ugly) macro allows a native configuration to customize the way the
-@code{proceed} function in @file{infrun.c} deals with switching between
-threads.
-
-In a multi-threaded task we may select another thread and then continue
-or step.  But if the old thread was stopped at a breakpoint, it will
-immediately cause another breakpoint stop without any execution (i.e. it
-will report a breakpoint hit incorrectly).  So @value{GDBN} must step over it
-first.
-
-If defined, @code{PREPARE_TO_PROCEED} should check the current thread
-against the thread that reported the most recent event.  If a step-over
-is required, it returns TRUE.  If @var{select_it} is non-zero, it should
-reselect the old thread.
-
 @item PROC_NAME_FMT
 @findex PROC_NAME_FMT
 Defines the format for the name of a @file{/proc} device.  Should be
@@ -5208,7 +5191,11 @@
 
 When @value{GDBN} has a local version of a system header file (ex
 @file{string.h}) the file name based on the POSIX header prefixed with
-@file{gdb_} (@file{gdb_string.h}).
+@file{gdb_} (@file{gdb_string.h}).  These headers should be relatively
+independent: they should use only macros defined by @file{configure},
+the compiler, or the host; they should include only system headers; they
+should refer only to system types.  They may be shared between multiple
+programs, e.g.@: @value{GDBN} and @sc{gdbserver}.
 
 For other files @samp{-} is used as the separator.
 
diff --git a/gdb/dummy-frame.c b/gdb/dummy-frame.c
index c395c93..9870433 100644
--- a/gdb/dummy-frame.c
+++ b/gdb/dummy-frame.c
@@ -99,7 +99,7 @@
              FP against the saved SP and FP.  NOTE: If you're trying
              to fix a problem with GDB not correctly finding a dummy
              frame, check the comments that go with FRAME_ALIGN() and
-             SAVE_DUMMY_FRAME_TOS().  */
+             UNWIND_DUMMY_ID().  */
 	  if (fp != dummyframe->fp && fp != dummyframe->sp)
 	    continue;
 	}
diff --git a/gdb/dwarf2cfi.c b/gdb/dwarf2cfi.c
deleted file mode 100644
index 085c91c..0000000
--- a/gdb/dwarf2cfi.c
+++ /dev/null
@@ -1,1970 +0,0 @@
-/* Stack unwinding code based on dwarf2 frame info for GDB, the GNU debugger.
-
-   Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
-
-   Contributed by Jiri Smid, SuSE Labs.
-   Based on code written by Daniel Berlin (dan@dberlin.org).
-
-   This file is part of GDB.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
-
-#include "defs.h"
-#include "gdbcore.h"
-#include "symtab.h"
-#include "symfile.h"
-#include "objfiles.h"
-#include "target.h"
-#include "elf/dwarf2.h"
-#include "inferior.h"
-#include "regcache.h"
-#include "dwarf2cfi.h"
-#include "gdb_assert.h"
-
-/* Common Information Entry - holds information that is shared among many
-   Frame Descriptors.  */
-struct cie_unit
-{
-  /* Offset of this unit in .debug_frame or .eh_frame.  */
-  ULONGEST offset;
-
-  /* A null-terminated string that identifies the augmentation to this CIE or
-     to the FDEs that use it.  */
-  char *augmentation;
-
-  /* A constant that is factored out of all advance location instructions.  */
-  unsigned int code_align;
-
-  /* A constant that is factored out of all offset instructions.  */
-  int data_align;
-
-  /* A constant that indicates which regiter represents the return address
-     of a function.  */
-  unsigned char ra;
-
-  /* Indicates how addresses are encoded.  */
-  unsigned char addr_encoding;
-
-  /* Pointer and length of the cie program.  */
-  char *data;
-  unsigned int data_length;
-
-  struct objfile *objfile;
-
-  /* Next in chain.  */
-  struct cie_unit *next;
-};
-
-/* Frame Description Entry.  */
-struct fde_unit
-{
-  /* Address of the first location associated with this entry.  */
-  CORE_ADDR initial_location;
-
-  /* Length of program section described by this entry.  */
-  CORE_ADDR address_range;
-
-  /* Pointer to asociated CIE.  */
-  struct cie_unit *cie_ptr;
-
-  /* Pointer and length of the cie program.  */
-  char *data;
-  unsigned int data_length;
-};
-
-struct fde_array
-{
-  struct fde_unit **array;
-  int elems;
-  int array_size;
-};
-
-struct frame_state_reg
-{
-  union
-  {
-    unsigned int reg;
-    long offset;
-    unsigned char *exp;
-  }
-  loc;
-  enum
-  {
-    REG_UNSAVED,
-    REG_SAVED_OFFSET,
-    REG_SAVED_REG,
-    REG_SAVED_EXP,
-  }
-  how;
-};
-
-struct frame_state
-{
-  /* Each register save state can be described in terms of a CFA slot,
-     another register, or a location expression.  */
-  struct frame_state_regs
-  {
-    struct frame_state_reg *reg;
-
-    /* Used to implement DW_CFA_remember_state.  */
-    struct frame_state_regs *prev;
-  }
-  regs;
-
-  /* The CFA can be described in terms of a reg+offset or a
-     location expression.  */
-  long cfa_offset;
-  int cfa_reg;
-  unsigned char *cfa_exp;
-  enum
-  {
-    CFA_UNSET,
-    CFA_REG_OFFSET,
-    CFA_EXP,
-  }
-  cfa_how;
-
-  /* The PC described by the current frame state.  */
-  CORE_ADDR pc;
-
-  /* The information we care about from the CIE/FDE.  */
-  int data_align;
-  unsigned int code_align;
-  unsigned char retaddr_column;
-  unsigned char addr_encoding;
-
-  struct objfile *objfile;
-};
-
-enum ptr_encoding
-{
-  PE_absptr = DW_EH_PE_absptr,
-  PE_pcrel = DW_EH_PE_pcrel,
-  PE_textrel = DW_EH_PE_textrel,
-  PE_datarel = DW_EH_PE_datarel,
-  PE_funcrel = DW_EH_PE_funcrel
-};
-
-#define UNWIND_CONTEXT(fi) ((struct context *) (deprecated_get_frame_context (fi)))
-
-
-static struct cie_unit *cie_chunks;
-static struct fde_array fde_chunks;
-/* Obstack for allocating temporary storage used during unwind operations.  */
-static struct obstack unwind_tmp_obstack;
-
-extern file_ptr dwarf_frame_offset;
-extern unsigned int dwarf_frame_size;
-extern file_ptr dwarf_eh_frame_offset;
-extern unsigned int dwarf_eh_frame_size;
-extern asection *dwarf_frame_section;
-extern asection *dwarf_eh_frame_section;
-
-
-
-extern char *dwarf2_read_section (struct objfile *objfile, file_ptr offset,
-				  unsigned int size, asection *sectp);
-
-static struct fde_unit *fde_unit_alloc (void);
-static struct cie_unit *cie_unit_alloc (void);
-static void fde_chunks_need_space ();
-
-static void unwind_tmp_obstack_init ();
-static void unwind_tmp_obstack_free ();
-
-static unsigned int read_1u (bfd *abfd, char **p);
-static int read_1s (bfd *abfd, char **p);
-static unsigned int read_2u (bfd *abfd, char **p);
-static int read_2s (bfd *abfd, char **p);
-static unsigned int read_4u (bfd *abfd, char **p);
-static int read_4s (bfd *abfd, char **p);
-static ULONGEST read_8u (bfd *abfd, char **p);
-static LONGEST read_8s (bfd *abfd, char **p);
-
-static ULONGEST read_uleb128 (bfd *abfd, char **p);
-static LONGEST read_sleb128 (bfd *abfd, char **p);
-static CORE_ADDR read_pointer (bfd *abfd, char **p);
-static CORE_ADDR read_encoded_pointer (bfd *abfd, char **p,
-				       unsigned char encoding);
-static enum ptr_encoding pointer_encoding (unsigned char encoding,
-					   struct objfile *objfile);
-
-static LONGEST read_initial_length (bfd *abfd, char *buf, int *bytes_read);
-static ULONGEST read_length (bfd *abfd, char *buf, int *bytes_read,
-			     int dwarf64);
-
-static int is_cie (ULONGEST cie_id, int dwarf64);
-static int compare_fde_unit (const void *a, const void *b);
-void dwarf2_build_frame_info (struct objfile *objfile);
-
-static void execute_cfa_program (struct objfile *objfile, char *insn_ptr,
-				 char *insn_end, struct context *context,
-				 struct frame_state *fs);
-static struct fde_unit *get_fde_for_addr (CORE_ADDR pc);
-static void frame_state_for (struct context *context, struct frame_state *fs);
-static void get_reg (char *reg, struct context *context, int regnum);
-static CORE_ADDR execute_stack_op (struct objfile *objfile,
-				   char *op_ptr, char *op_end,
-				   struct context *context,
-				   CORE_ADDR initial);
-static void update_context (struct context *context, struct frame_state *fs,
-			    int chain);
-
-
-/* Memory allocation functions.  */
-static struct fde_unit *
-fde_unit_alloc (void)
-{
-  struct fde_unit *fde;
-
-  fde = (struct fde_unit *) xmalloc (sizeof (struct fde_unit));
-  memset (fde, 0, sizeof (struct fde_unit));
-  return fde;
-}
-
-static struct cie_unit *
-cie_unit_alloc (void)
-{
-  struct cie_unit *cie;
-
-  cie = (struct cie_unit *) xmalloc (sizeof (struct cie_unit));
-  memset (cie, 0, sizeof (struct cie_unit));
-  return cie;
-}
-
-static void
-fde_chunks_need_space (void)
-{
-  if (fde_chunks.elems < fde_chunks.array_size)
-    return;
-  fde_chunks.array_size =
-    fde_chunks.array_size ? 2 * fde_chunks.array_size : 1024;
-  fde_chunks.array =
-    xrealloc (fde_chunks.array,
-	      sizeof (struct fde_unit) * fde_chunks.array_size);
-}
-
-/* Alocate a new `struct context' on temporary obstack.  */
-struct context *
-context_alloc (void)
-{
-  struct context *context;
-
-  int regs_size = sizeof (struct context_reg) * NUM_REGS;
-
-  context = (struct context *) obstack_alloc (&unwind_tmp_obstack,
-					      sizeof (struct context));
-  memset (context, 0, sizeof (struct context));
-  context->reg = (struct context_reg *) obstack_alloc (&unwind_tmp_obstack,
-						       regs_size);
-  memset (context->reg, 0, regs_size);
-  return context;
-}
-
-/* Alocate a new `struct frame_state' on temporary obstack.  */
-struct frame_state *
-frame_state_alloc (void)
-{
-  struct frame_state *fs;
-
-  int regs_size = sizeof (struct frame_state_reg) * NUM_REGS;
-
-  fs = (struct frame_state *) obstack_alloc (&unwind_tmp_obstack,
-					     sizeof (struct frame_state));
-  memset (fs, 0, sizeof (struct frame_state));
-  fs->regs.reg =
-    (struct frame_state_reg *) obstack_alloc (&unwind_tmp_obstack, regs_size);
-  memset (fs->regs.reg, 0, regs_size);
-  return fs;
-}
-
-static void
-unwind_tmp_obstack_init (void)
-{
-  obstack_init (&unwind_tmp_obstack);
-}
-
-static void
-unwind_tmp_obstack_free (void)
-{
-  obstack_free (&unwind_tmp_obstack, NULL);
-  unwind_tmp_obstack_init ();
-}
-
-void
-context_cpy (struct context *dst, struct context *src)
-{
-  int regs_size = sizeof (struct context_reg) * NUM_REGS;
-  struct context_reg *dreg;
-
-  /* Since `struct context' contains a pointer to an array with
-     register values, make sure we end up with a copy of that array,
-     and not with a copy of the pointer to that array.  */
-  dreg = dst->reg;
-  *dst = *src;
-  dst->reg = dreg;
-  memcpy (dst->reg, src->reg, regs_size);
-}
-
-static unsigned int
-read_1u (bfd *abfd, char **p)
-{
-  unsigned ret;
-
-  ret = bfd_get_8 (abfd, (bfd_byte *) * p);
-  (*p)++;
-  return ret;
-}
-
-static int
-read_1s (bfd *abfd, char **p)
-{
-  int ret;
-
-  ret = bfd_get_signed_8 (abfd, (bfd_byte *) * p);
-  (*p)++;
-  return ret;
-}
-
-static unsigned int
-read_2u (bfd *abfd, char **p)
-{
-  unsigned ret;
-
-  ret = bfd_get_16 (abfd, (bfd_byte *) * p);
-  (*p) += 2;
-  return ret;
-}
-
-static int
-read_2s (bfd *abfd, char **p)
-{
-  int ret;
-
-  ret = bfd_get_signed_16 (abfd, (bfd_byte *) * p);
-  (*p) += 2;
-  return ret;
-}
-
-static unsigned int
-read_4u (bfd *abfd, char **p)
-{
-  unsigned int ret;
-
-  ret = bfd_get_32 (abfd, (bfd_byte *) * p);
-  (*p) += 4;
-  return ret;
-}
-
-static int
-read_4s (bfd *abfd, char **p)
-{
-  int ret;
-
-  ret = bfd_get_signed_32 (abfd, (bfd_byte *) * p);
-  (*p) += 4;
-  return ret;
-}
-
-static ULONGEST
-read_8u (bfd *abfd, char **p)
-{
-  ULONGEST ret;
-
-  ret = bfd_get_64 (abfd, (bfd_byte *) * p);
-  (*p) += 8;
-  return ret;
-}
-
-static LONGEST
-read_8s (bfd *abfd, char **p)
-{
-  LONGEST ret;
-
-  ret = bfd_get_signed_64 (abfd, (bfd_byte *) * p);
-  (*p) += 8;
-  return ret;
-}
-
-static ULONGEST
-read_uleb128 (bfd *abfd, char **p)
-{
-  ULONGEST ret;
-  int i, shift;
-  unsigned char byte;
-
-  ret = 0;
-  shift = 0;
-  i = 0;
-  while (1)
-    {
-      byte = bfd_get_8 (abfd, (bfd_byte *) * p);
-      (*p)++;
-      ret |= ((unsigned long) (byte & 127) << shift);
-      if ((byte & 128) == 0)
-	{
-	  break;
-	}
-      shift += 7;
-    }
-  return ret;
-}
-
-static LONGEST
-read_sleb128 (bfd *abfd, char **p)
-{
-  LONGEST ret;
-  int i, shift, size, num_read;
-  unsigned char byte;
-
-  ret = 0;
-  shift = 0;
-  size = 32;
-  num_read = 0;
-  i = 0;
-  while (1)
-    {
-      byte = bfd_get_8 (abfd, (bfd_byte *) * p);
-      (*p)++;
-      ret |= ((long) (byte & 127) << shift);
-      shift += 7;
-      if ((byte & 128) == 0)
-	{
-	  break;
-	}
-    }
-  if ((shift < size) && (byte & 0x40))
-    {
-      ret |= -(1 << shift);
-    }
-  return ret;
-}
-
-static CORE_ADDR
-read_pointer (bfd *abfd, char **p)
-{
-  switch (TARGET_ADDR_BIT / TARGET_CHAR_BIT)
-    {
-    case 4:
-      return read_4u (abfd, p);
-    case 8:
-      return read_8u (abfd, p);
-    default:
-      error
-	("dwarf cfi error: unsupported target address length [in module %s]",
-	 bfd_get_filename (abfd));
-    }
-}
-
-/* Read the appropriate amount of data from *P and return the
-   resulting value based on ENCODING, which the calling function must
-   provide.  */
-static CORE_ADDR
-read_encoded_pointer (bfd *abfd, char **p, unsigned char encoding)
-{
-  CORE_ADDR ret;
-
-  switch (encoding & 0x0f)
-    {
-    case DW_EH_PE_absptr:
-      ret = read_pointer (abfd, p);
-      break;
-
-    case DW_EH_PE_uleb128:
-      ret = read_uleb128 (abfd, p);
-      break;
-    case DW_EH_PE_sleb128:
-      ret = read_sleb128 (abfd, p);
-      break;
-
-    case DW_EH_PE_udata2:
-      ret = read_2u (abfd, p);
-      break;
-    case DW_EH_PE_udata4:
-      ret = read_4u (abfd, p);
-      break;
-    case DW_EH_PE_udata8:
-      ret = read_8u (abfd, p);
-      break;
-
-    case DW_EH_PE_sdata2:
-      ret = read_2s (abfd, p);
-      break;
-    case DW_EH_PE_sdata4:
-      ret = read_4s (abfd, p);
-      break;
-    case DW_EH_PE_sdata8:
-      ret = read_8s (abfd, p);
-      break;
-
-    default:
-      internal_error (__FILE__, __LINE__,
-		      "read_encoded_pointer: unknown pointer encoding [in module %s]",
-		      bfd_get_filename (abfd));
-    }
-
-  return ret;
-}
-
-/* The variable 'encoding' carries three different flags:
-   - encoding & 0x0f : size of the address (handled in read_encoded_pointer())
-   - encoding & 0x70 : type (absolute, relative, ...)
-   - encoding & 0x80 : indirect flag (DW_EH_PE_indirect == 0x80).  */
-enum ptr_encoding
-pointer_encoding (unsigned char encoding, struct objfile *objfile)
-{
-  int ret;
-
-  if (encoding & DW_EH_PE_indirect)
-    warning
-      ("CFI: Unsupported pointer encoding: DW_EH_PE_indirect [in module %s]",
-       objfile->name);
-
-  switch (encoding & 0x70)
-    {
-    case DW_EH_PE_absptr:
-    case DW_EH_PE_pcrel:
-    case DW_EH_PE_textrel:
-    case DW_EH_PE_datarel:
-    case DW_EH_PE_funcrel:
-      ret = encoding & 0x70;
-      break;
-    default:
-      internal_error (__FILE__, __LINE__,
-		      "CFI: unknown pointer encoding [in module %s]",
-		      objfile->name);
-    }
-  return ret;
-}
-
-static LONGEST
-read_initial_length (bfd *abfd, char *buf, int *bytes_read)
-{
-  LONGEST ret = 0;
-
-  ret = bfd_get_32 (abfd, (bfd_byte *) buf);
-
-  if (ret == 0xffffffff)
-    {
-      ret = bfd_get_64 (abfd, (bfd_byte *) buf + 4);
-      *bytes_read = 12;
-    }
-  else
-    {
-      *bytes_read = 4;
-    }
-
-  return ret;
-}
-
-static ULONGEST
-read_length (bfd *abfd, char *buf, int *bytes_read, int dwarf64)
-{
-  if (dwarf64)
-    {
-      *bytes_read = 8;
-      return read_8u (abfd, &buf);
-    }
-  else
-    {
-      *bytes_read = 4;
-      return read_4u (abfd, &buf);
-    }
-}
-
-static void
-execute_cfa_program (struct objfile *objfile, char *insn_ptr, char *insn_end,
-		     struct context *context, struct frame_state *fs)
-{
-  struct frame_state_regs *unused_rs = NULL;
-
-  /* Don't allow remember/restore between CIE and FDE programs.  */
-  fs->regs.prev = NULL;
-
-  while (insn_ptr < insn_end && fs->pc < context->ra)
-    {
-      unsigned char insn = *insn_ptr++;
-      ULONGEST reg, uoffset;
-      LONGEST offset;
-
-      if (insn & DW_CFA_advance_loc)
-	fs->pc += (insn & 0x3f) * fs->code_align;
-      else if (insn & DW_CFA_offset)
-	{
-	  reg = insn & 0x3f;
-	  uoffset = read_uleb128 (objfile->obfd, &insn_ptr);
-	  offset = (long) uoffset *fs->data_align;
-	  fs->regs.reg[reg].how = REG_SAVED_OFFSET;
-	  fs->regs.reg[reg].loc.offset = offset;
-	}
-      else if (insn & DW_CFA_restore)
-	{
-	  reg = insn & 0x3f;
-	  fs->regs.reg[reg].how = REG_UNSAVED;
-	}
-      else
-	switch (insn)
-	  {
-	  case DW_CFA_set_loc:
-	    fs->pc = read_encoded_pointer (objfile->obfd, &insn_ptr,
-					   fs->addr_encoding);
-
-	    if (pointer_encoding (fs->addr_encoding, objfile) != PE_absptr)
-	      warning
-		("CFI: DW_CFA_set_loc uses relative addressing [in module %s]",
-		 objfile->name);
-
-	    break;
-
-	  case DW_CFA_advance_loc1:
-	    fs->pc += read_1u (objfile->obfd, &insn_ptr);
-	    break;
-	  case DW_CFA_advance_loc2:
-	    fs->pc += read_2u (objfile->obfd, &insn_ptr);
-	    break;
-	  case DW_CFA_advance_loc4:
-	    fs->pc += read_4u (objfile->obfd, &insn_ptr);
-	    break;
-
-	  case DW_CFA_offset_extended:
-	    reg = read_uleb128 (objfile->obfd, &insn_ptr);
-	    uoffset = read_uleb128 (objfile->obfd, &insn_ptr);
-	    offset = (long) uoffset *fs->data_align;
-	    fs->regs.reg[reg].how = REG_SAVED_OFFSET;
-	    fs->regs.reg[reg].loc.offset = offset;
-	    break;
-
-	  case DW_CFA_restore_extended:
-	    reg = read_uleb128 (objfile->obfd, &insn_ptr);
-	    fs->regs.reg[reg].how = REG_UNSAVED;
-	    break;
-
-	  case DW_CFA_undefined:
-	  case DW_CFA_same_value:
-	  case DW_CFA_nop:
-	    break;
-
-	  case DW_CFA_register:
-	    {
-	      ULONGEST reg2;
-	      reg = read_uleb128 (objfile->obfd, &insn_ptr);
-	      reg2 = read_uleb128 (objfile->obfd, &insn_ptr);
-	      fs->regs.reg[reg].how = REG_SAVED_REG;
-	      fs->regs.reg[reg].loc.reg = reg2;
-	    }
-	    break;
-
-	  case DW_CFA_remember_state:
-	    {
-	      struct frame_state_regs *new_rs;
-	      if (unused_rs)
-		{
-		  new_rs = unused_rs;
-		  unused_rs = unused_rs->prev;
-		}
-	      else
-		new_rs = xmalloc (sizeof (struct frame_state_regs));
-
-	      *new_rs = fs->regs;
-	      fs->regs.prev = new_rs;
-	    }
-	    break;
-
-	  case DW_CFA_restore_state:
-	    {
-	      struct frame_state_regs *old_rs = fs->regs.prev;
-	      fs->regs = *old_rs;
-	      old_rs->prev = unused_rs;
-	      unused_rs = old_rs;
-	    }
-	    break;
-
-	  case DW_CFA_def_cfa:
-	    reg = read_uleb128 (objfile->obfd, &insn_ptr);
-	    uoffset = read_uleb128 (objfile->obfd, &insn_ptr);
-	    fs->cfa_reg = reg;
-	    fs->cfa_offset = uoffset;
-	    fs->cfa_how = CFA_REG_OFFSET;
-	    break;
-
-	  case DW_CFA_def_cfa_register:
-	    reg = read_uleb128 (objfile->obfd, &insn_ptr);
-	    fs->cfa_reg = reg;
-	    fs->cfa_how = CFA_REG_OFFSET;
-	    break;
-
-	  case DW_CFA_def_cfa_offset:
-	    uoffset = read_uleb128 (objfile->obfd, &insn_ptr);
-	    fs->cfa_offset = uoffset;
-	    break;
-
-	  case DW_CFA_def_cfa_expression:
-	    uoffset = read_uleb128 (objfile->obfd, &insn_ptr);
-	    fs->cfa_exp = insn_ptr;
-	    fs->cfa_how = CFA_EXP;
-	    insn_ptr += uoffset;
-	    break;
-
-	  case DW_CFA_expression:
-	    reg = read_uleb128 (objfile->obfd, &insn_ptr);
-	    uoffset = read_uleb128 (objfile->obfd, &insn_ptr);
-	    fs->regs.reg[reg].how = REG_SAVED_EXP;
-	    fs->regs.reg[reg].loc.exp = insn_ptr;
-	    insn_ptr += uoffset;
-	    break;
-
-	    /* From the 2.1 draft.  */
-	  case DW_CFA_offset_extended_sf:
-	    reg = read_uleb128 (objfile->obfd, &insn_ptr);
-	    offset = read_sleb128 (objfile->obfd, &insn_ptr);
-	    offset *= fs->data_align;
-	    fs->regs.reg[reg].how = REG_SAVED_OFFSET;
-	    fs->regs.reg[reg].loc.offset = offset;
-	    break;
-
-	  case DW_CFA_def_cfa_sf:
-	    reg = read_uleb128 (objfile->obfd, &insn_ptr);
-	    offset = read_sleb128 (objfile->obfd, &insn_ptr);
-	    fs->cfa_offset = offset;
-	    fs->cfa_reg = reg;
-	    fs->cfa_how = CFA_REG_OFFSET;
-	    break;
-
-	  case DW_CFA_def_cfa_offset_sf:
-	    uoffset = read_uleb128 (objfile->obfd, &insn_ptr);
-	    fs->cfa_offset = uoffset;
-	    /* cfa_how deliberately not set.  */
-	    break;
-
-	  case DW_CFA_GNU_window_save:
-	    /* ??? Hardcoded for SPARC register window configuration.  */
-	    for (reg = 16; reg < 32; ++reg)
-	      {
-		fs->regs.reg[reg].how = REG_SAVED_OFFSET;
-		fs->regs.reg[reg].loc.offset = (reg - 16) * sizeof (void *);
-	      }
-	    break;
-
-	  case DW_CFA_GNU_args_size:
-	    uoffset = read_uleb128 (objfile->obfd, &insn_ptr);
-	    context->args_size = uoffset;
-	    break;
-
-	  case DW_CFA_GNU_negative_offset_extended:
-	    /* Obsoleted by DW_CFA_offset_extended_sf, but used by
-	       older PowerPC code.  */
-	    reg = read_uleb128 (objfile->obfd, &insn_ptr);
-	    uoffset = read_uleb128 (objfile->obfd, &insn_ptr);
-	    offset = (long) uoffset *fs->data_align;
-	    fs->regs.reg[reg].how = REG_SAVED_OFFSET;
-	    fs->regs.reg[reg].loc.offset = -offset;
-	    break;
-
-	  default:
-	    error
-	      ("dwarf cfi error: unknown cfa instruction %d [in module %s]",
-	       insn, objfile->name);
-	  }
-    }
-}
-
-static struct fde_unit *
-get_fde_for_addr (CORE_ADDR pc)
-{
-  size_t lo, hi;
-  struct fde_unit *fde = NULL;
-  lo = 0;
-  hi = fde_chunks.elems;
-
-  while (lo < hi)
-    {
-      size_t i = (lo + hi) / 2;
-      fde = fde_chunks.array[i];
-      if (pc < fde->initial_location)
-	hi = i;
-      else if (pc >= fde->initial_location + fde->address_range)
-	lo = i + 1;
-      else
-	return fde;
-    }
-  return 0;
-}
-
-static void
-frame_state_for (struct context *context, struct frame_state *fs)
-{
-  struct fde_unit *fde;
-  struct cie_unit *cie;
-
-  context->args_size = 0;
-  context->lsda = 0;
-
-  fde = get_fde_for_addr (context->ra - 1);
-
-  if (fde == NULL)
-    return;
-
-  fs->pc = fde->initial_location;
-
-  gdb_assert (fde->cie_ptr != NULL);
-
-  cie = fde->cie_ptr;
-
-  fs->code_align = cie->code_align;
-  fs->data_align = cie->data_align;
-  fs->retaddr_column = cie->ra;
-  fs->addr_encoding = cie->addr_encoding;
-  fs->objfile = cie->objfile;
-
-  execute_cfa_program (cie->objfile, cie->data,
-		       cie->data + cie->data_length, context, fs);
-  execute_cfa_program (cie->objfile, fde->data,
-		       fde->data + fde->data_length, context, fs);
-}
-
-static void
-get_reg (char *reg, struct context *context, int regnum)
-{
-  switch (context->reg[regnum].how)
-    {
-    case REG_CTX_UNSAVED:
-      deprecated_read_register_gen (regnum, reg);
-      break;
-    case REG_CTX_SAVED_OFFSET:
-      target_read_memory (context->cfa + context->reg[regnum].loc.offset,
-			  reg, REGISTER_RAW_SIZE (regnum));
-      break;
-    case REG_CTX_SAVED_REG:
-      deprecated_read_register_gen (context->reg[regnum].loc.reg, reg);
-      break;
-    case REG_CTX_SAVED_ADDR:
-      target_read_memory (context->reg[regnum].loc.addr,
-			  reg, REGISTER_RAW_SIZE (regnum));
-      break;
-    case REG_CTX_VALUE:
-      memcpy (reg, &context->reg[regnum].loc.addr,
-	      REGISTER_RAW_SIZE (regnum));
-      break;
-    default:
-      internal_error (__FILE__, __LINE__, "get_reg: unknown register rule");
-    }
-}
-
-/* Decode a DW_OP stack program.  Return the top of stack.  Push INITIAL
-   onto the stack to start.  */
-static CORE_ADDR
-execute_stack_op (struct objfile *objfile,
-		  char *op_ptr, char *op_end, struct context *context,
-		  CORE_ADDR initial)
-{
-  CORE_ADDR stack[64];		/* ??? Assume this is enough. */
-  int stack_elt;
-
-  stack[0] = initial;
-  stack_elt = 1;
-
-  while (op_ptr < op_end)
-    {
-      enum dwarf_location_atom op = *op_ptr++;
-      CORE_ADDR result;
-      ULONGEST reg;
-      LONGEST offset;
-
-      switch (op)
-	{
-	case DW_OP_lit0:
-	case DW_OP_lit1:
-	case DW_OP_lit2:
-	case DW_OP_lit3:
-	case DW_OP_lit4:
-	case DW_OP_lit5:
-	case DW_OP_lit6:
-	case DW_OP_lit7:
-	case DW_OP_lit8:
-	case DW_OP_lit9:
-	case DW_OP_lit10:
-	case DW_OP_lit11:
-	case DW_OP_lit12:
-	case DW_OP_lit13:
-	case DW_OP_lit14:
-	case DW_OP_lit15:
-	case DW_OP_lit16:
-	case DW_OP_lit17:
-	case DW_OP_lit18:
-	case DW_OP_lit19:
-	case DW_OP_lit20:
-	case DW_OP_lit21:
-	case DW_OP_lit22:
-	case DW_OP_lit23:
-	case DW_OP_lit24:
-	case DW_OP_lit25:
-	case DW_OP_lit26:
-	case DW_OP_lit27:
-	case DW_OP_lit28:
-	case DW_OP_lit29:
-	case DW_OP_lit30:
-	case DW_OP_lit31:
-	  result = op - DW_OP_lit0;
-	  break;
-
-	case DW_OP_addr:
-	  result = read_pointer (objfile->obfd, &op_ptr);
-	  break;
-
-	case DW_OP_const1u:
-	  result = read_1u (objfile->obfd, &op_ptr);
-	  break;
-	case DW_OP_const1s:
-	  result = read_1s (objfile->obfd, &op_ptr);
-	  break;
-	case DW_OP_const2u:
-	  result = read_2u (objfile->obfd, &op_ptr);
-	  break;
-	case DW_OP_const2s:
-	  result = read_2s (objfile->obfd, &op_ptr);
-	  break;
-	case DW_OP_const4u:
-	  result = read_4u (objfile->obfd, &op_ptr);
-	  break;
-	case DW_OP_const4s:
-	  result = read_4s (objfile->obfd, &op_ptr);
-	  break;
-	case DW_OP_const8u:
-	  result = read_8u (objfile->obfd, &op_ptr);
-	  break;
-	case DW_OP_const8s:
-	  result = read_8s (objfile->obfd, &op_ptr);
-	  break;
-	case DW_OP_constu:
-	  result = read_uleb128 (objfile->obfd, &op_ptr);
-	  break;
-	case DW_OP_consts:
-	  result = read_sleb128 (objfile->obfd, &op_ptr);
-	  break;
-
-	case DW_OP_reg0:
-	case DW_OP_reg1:
-	case DW_OP_reg2:
-	case DW_OP_reg3:
-	case DW_OP_reg4:
-	case DW_OP_reg5:
-	case DW_OP_reg6:
-	case DW_OP_reg7:
-	case DW_OP_reg8:
-	case DW_OP_reg9:
-	case DW_OP_reg10:
-	case DW_OP_reg11:
-	case DW_OP_reg12:
-	case DW_OP_reg13:
-	case DW_OP_reg14:
-	case DW_OP_reg15:
-	case DW_OP_reg16:
-	case DW_OP_reg17:
-	case DW_OP_reg18:
-	case DW_OP_reg19:
-	case DW_OP_reg20:
-	case DW_OP_reg21:
-	case DW_OP_reg22:
-	case DW_OP_reg23:
-	case DW_OP_reg24:
-	case DW_OP_reg25:
-	case DW_OP_reg26:
-	case DW_OP_reg27:
-	case DW_OP_reg28:
-	case DW_OP_reg29:
-	case DW_OP_reg30:
-	case DW_OP_reg31:
-	  get_reg ((char *) &result, context, op - DW_OP_reg0);
-	  break;
-	case DW_OP_regx:
-	  reg = read_uleb128 (objfile->obfd, &op_ptr);
-	  get_reg ((char *) &result, context, reg);
-	  break;
-
-	case DW_OP_breg0:
-	case DW_OP_breg1:
-	case DW_OP_breg2:
-	case DW_OP_breg3:
-	case DW_OP_breg4:
-	case DW_OP_breg5:
-	case DW_OP_breg6:
-	case DW_OP_breg7:
-	case DW_OP_breg8:
-	case DW_OP_breg9:
-	case DW_OP_breg10:
-	case DW_OP_breg11:
-	case DW_OP_breg12:
-	case DW_OP_breg13:
-	case DW_OP_breg14:
-	case DW_OP_breg15:
-	case DW_OP_breg16:
-	case DW_OP_breg17:
-	case DW_OP_breg18:
-	case DW_OP_breg19:
-	case DW_OP_breg20:
-	case DW_OP_breg21:
-	case DW_OP_breg22:
-	case DW_OP_breg23:
-	case DW_OP_breg24:
-	case DW_OP_breg25:
-	case DW_OP_breg26:
-	case DW_OP_breg27:
-	case DW_OP_breg28:
-	case DW_OP_breg29:
-	case DW_OP_breg30:
-	case DW_OP_breg31:
-	  offset = read_sleb128 (objfile->obfd, &op_ptr);
-	  get_reg ((char *) &result, context, op - DW_OP_breg0);
-	  result += offset;
-	  break;
-	case DW_OP_bregx:
-	  reg = read_uleb128 (objfile->obfd, &op_ptr);
-	  offset = read_sleb128 (objfile->obfd, &op_ptr);
-	  get_reg ((char *) &result, context, reg);
-	  result += offset;
-	  break;
-
-	case DW_OP_dup:
-	  if (stack_elt < 1)
-	    internal_error (__FILE__, __LINE__,
-			    "execute_stack_op error [in module %s]",
-			    objfile->name);
-	  result = stack[stack_elt - 1];
-	  break;
-
-	case DW_OP_drop:
-	  if (--stack_elt < 0)
-	    internal_error (__FILE__, __LINE__,
-			    "execute_stack_op error [in module %s]",
-			    objfile->name);
-	  goto no_push;
-
-	case DW_OP_pick:
-	  offset = *op_ptr++;
-	  if (offset >= stack_elt - 1)
-	    internal_error (__FILE__, __LINE__,
-			    "execute_stack_op error [in module %s]",
-			    objfile->name);
-	  result = stack[stack_elt - 1 - offset];
-	  break;
-
-	case DW_OP_over:
-	  if (stack_elt < 2)
-	    internal_error (__FILE__, __LINE__,
-			    "execute_stack_op error [in module %s]",
-			    objfile->name);
-	  result = stack[stack_elt - 2];
-	  break;
-
-	case DW_OP_rot:
-	  {
-	    CORE_ADDR t1, t2, t3;
-
-	    if (stack_elt < 3)
-	      internal_error (__FILE__, __LINE__,
-			      "execute_stack_op error [in module %s]",
-			      objfile->name);
-	    t1 = stack[stack_elt - 1];
-	    t2 = stack[stack_elt - 2];
-	    t3 = stack[stack_elt - 3];
-	    stack[stack_elt - 1] = t2;
-	    stack[stack_elt - 2] = t3;
-	    stack[stack_elt - 3] = t1;
-	    goto no_push;
-	  }
-
-	case DW_OP_deref:
-	case DW_OP_deref_size:
-	case DW_OP_abs:
-	case DW_OP_neg:
-	case DW_OP_not:
-	case DW_OP_plus_uconst:
-	  /* Unary operations.  */
-	  if (--stack_elt < 0)
-	    internal_error (__FILE__, __LINE__,
-			    "execute_stack_op error [in module %s]",
-			    objfile->name);
-	  result = stack[stack_elt];
-
-	  switch (op)
-	    {
-	    case DW_OP_deref:
-	      {
-		int len = TARGET_ADDR_BIT / TARGET_CHAR_BIT;
-		if (len != 4 && len != 8)
-		  internal_error (__FILE__, __LINE__,
-				  "execute_stack_op error [in module %s]",
-				  objfile->name);
-		result = read_memory_unsigned_integer (result, len);
-	      }
-	      break;
-
-	    case DW_OP_deref_size:
-	      {
-		int len = *op_ptr++;
-		if (len != 1 && len != 2 && len != 4 && len != 8)
-		  internal_error (__FILE__, __LINE__,
-				  "execute_stack_op error [in module %s]",
-				  objfile->name);
-		result = read_memory_unsigned_integer (result, len);
-	      }
-	      break;
-
-	    case DW_OP_abs:
-	      if (result < 0)
-		result = -result;
-	      break;
-	    case DW_OP_neg:
-	      result = -result;
-	      break;
-	    case DW_OP_not:
-	      result = ~result;
-	      break;
-	    case DW_OP_plus_uconst:
-	      result += read_uleb128 (objfile->obfd, &op_ptr);
-	      break;
-	    default:
-	      break;
-	    }
-	  break;
-
-	case DW_OP_and:
-	case DW_OP_div:
-	case DW_OP_minus:
-	case DW_OP_mod:
-	case DW_OP_mul:
-	case DW_OP_or:
-	case DW_OP_plus:
-	case DW_OP_le:
-	case DW_OP_ge:
-	case DW_OP_eq:
-	case DW_OP_lt:
-	case DW_OP_gt:
-	case DW_OP_ne:
-	  {
-	    /* Binary operations.  */
-	    CORE_ADDR first, second;
-	    if ((stack_elt -= 2) < 0)
-	      internal_error (__FILE__, __LINE__,
-			      "execute_stack_op error [in module %s]",
-			      objfile->name);
-	    second = stack[stack_elt];
-	    first = stack[stack_elt + 1];
-
-	    switch (op)
-	      {
-	      case DW_OP_and:
-		result = second & first;
-		break;
-	      case DW_OP_div:
-		result = (LONGEST) second / (LONGEST) first;
-		break;
-	      case DW_OP_minus:
-		result = second - first;
-		break;
-	      case DW_OP_mod:
-		result = (LONGEST) second % (LONGEST) first;
-		break;
-	      case DW_OP_mul:
-		result = second * first;
-		break;
-	      case DW_OP_or:
-		result = second | first;
-		break;
-	      case DW_OP_plus:
-		result = second + first;
-		break;
-	      case DW_OP_shl:
-		result = second << first;
-		break;
-	      case DW_OP_shr:
-		result = second >> first;
-		break;
-	      case DW_OP_shra:
-		result = (LONGEST) second >> first;
-		break;
-	      case DW_OP_xor:
-		result = second ^ first;
-		break;
-	      case DW_OP_le:
-		result = (LONGEST) first <= (LONGEST) second;
-		break;
-	      case DW_OP_ge:
-		result = (LONGEST) first >= (LONGEST) second;
-		break;
-	      case DW_OP_eq:
-		result = (LONGEST) first == (LONGEST) second;
-		break;
-	      case DW_OP_lt:
-		result = (LONGEST) first < (LONGEST) second;
-		break;
-	      case DW_OP_gt:
-		result = (LONGEST) first > (LONGEST) second;
-		break;
-	      case DW_OP_ne:
-		result = (LONGEST) first != (LONGEST) second;
-		break;
-	      default:
-		error
-		  ("execute_stack_op: Unknown DW_OP_ value [in module %s]",
-		   objfile->name);
-		break;
-	      }
-	  }
-	  break;
-
-	case DW_OP_skip:
-	  offset = read_2s (objfile->obfd, &op_ptr);
-	  op_ptr += offset;
-	  goto no_push;
-
-	case DW_OP_bra:
-	  if (--stack_elt < 0)
-	    internal_error (__FILE__, __LINE__,
-			    "execute_stack_op error [in module %s]",
-			    objfile->name);
-	  offset = read_2s (objfile->obfd, &op_ptr);
-	  if (stack[stack_elt] != 0)
-	    op_ptr += offset;
-	  goto no_push;
-
-	case DW_OP_nop:
-	  goto no_push;
-
-	default:
-	  internal_error (__FILE__, __LINE__,
-			  "execute_stack_op error [in module %s]",
-			  objfile->name);
-	}
-
-      /* Most things push a result value.  */
-      if ((size_t) stack_elt >= sizeof (stack) / sizeof (*stack))
-	internal_error (__FILE__, __LINE__,
-			"execute_stack_op error [in module %s]",
-			objfile->name);
-      stack[++stack_elt] = result;
-    no_push:;
-    }
-
-  /* We were executing this program to get a value.  It should be
-     at top of stack.  */
-  if (--stack_elt < 0)
-    internal_error (__FILE__, __LINE__,
-		    "execute_stack_op error [in module %s]", objfile->name);
-  return stack[stack_elt];
-}
-
-static void
-update_context (struct context *context, struct frame_state *fs, int chain)
-{
-  struct context *orig_context;
-  CORE_ADDR cfa = 0;
-  long i;
-
-  unwind_tmp_obstack_init ();
-
-  orig_context = context_alloc ();
-  context_cpy (orig_context, context);
-
-  /* Compute this frame's CFA.  */
-  switch (fs->cfa_how)
-    {
-    case CFA_REG_OFFSET:
-      get_reg ((char *) &cfa, context, fs->cfa_reg);
-      cfa += fs->cfa_offset;
-      break;
-
-    case CFA_EXP:
-      /* ??? No way of knowing what register number is the stack pointer
-         to do the same sort of handling as above.  Assume that if the
-         CFA calculation is so complicated as to require a stack program
-         that this will not be a problem.  */
-      {
-	char *exp = fs->cfa_exp;
-	ULONGEST len;
-
-	len = read_uleb128 (fs->objfile->obfd, &exp);
-	cfa = (CORE_ADDR) execute_stack_op (fs->objfile, exp,
-					    exp + len, context, 0);
-	break;
-      }
-    default:
-      break;
-    }
-  context->cfa = cfa;
-
-  if (!chain)
-    orig_context->cfa = cfa;
-
-  /* Compute the addresses of all registers saved in this frame.  */
-  for (i = 0; i < NUM_REGS; ++i)
-    switch (fs->regs.reg[i].how)
-      {
-      case REG_UNSAVED:
-	if (i == SP_REGNUM)
-	  {
-	    context->reg[i].how = REG_CTX_VALUE;
-	    context->reg[i].loc.addr = cfa;
-	  }
-	else
-	  context->reg[i].how = REG_CTX_UNSAVED;
-	break;
-      case REG_SAVED_OFFSET:
-	context->reg[i].how = REG_CTX_SAVED_OFFSET;
-	context->reg[i].loc.offset = fs->regs.reg[i].loc.offset;
-	break;
-      case REG_SAVED_REG:
-	switch (orig_context->reg[fs->regs.reg[i].loc.reg].how)
-	  {
-	  case REG_CTX_UNSAVED:
-	    context->reg[i].how = REG_CTX_UNSAVED;
-	    break;
-	  case REG_CTX_SAVED_OFFSET:
-	    context->reg[i].how = REG_CTX_SAVED_OFFSET;
-	    context->reg[i].loc.offset = orig_context->cfa - context->cfa +
-	      orig_context->reg[fs->regs.reg[i].loc.reg].loc.offset;
-	    break;
-	  case REG_CTX_SAVED_REG:
-	    context->reg[i].how = REG_CTX_SAVED_REG;
-	    context->reg[i].loc.reg =
-	      orig_context->reg[fs->regs.reg[i].loc.reg].loc.reg;
-	    break;
-	  case REG_CTX_SAVED_ADDR:
-	    context->reg[i].how = REG_CTX_SAVED_ADDR;
-	    context->reg[i].loc.addr =
-	      orig_context->reg[fs->regs.reg[i].loc.reg].loc.addr;
-	    break;
-	  default:
-	    internal_error (__FILE__, __LINE__, "bad switch 0x%02X",
-			    orig_context->reg[fs->regs.reg[i].loc.reg].how);
-	  }
-	break;
-      case REG_SAVED_EXP:
-	{
-	  char *exp = fs->regs.reg[i].loc.exp;
-	  ULONGEST len;
-	  CORE_ADDR val;
-
-	  len = read_uleb128 (fs->objfile->obfd, &exp);
-	  val = execute_stack_op (fs->objfile, exp, exp + len,
-				  orig_context, cfa);
-	  context->reg[i].how = REG_CTX_SAVED_ADDR;
-	  context->reg[i].loc.addr = val;
-	}
-	break;
-      default:
-	internal_error (__FILE__, __LINE__, "bad switch 0x%02X",
-			fs->regs.reg[i].how);
-      }
-  get_reg ((char *) &context->ra, context, fs->retaddr_column);
-  unwind_tmp_obstack_free ();
-}
-
-static int
-is_cie (ULONGEST cie_id, int dwarf64)
-{
-  return dwarf64 ? (cie_id == 0xffffffffffffffff) : (cie_id == 0xffffffff);
-}
-
-static int
-compare_fde_unit (const void *a, const void *b)
-{
-  struct fde_unit **first, **second;
-  first = (struct fde_unit **) a;
-  second = (struct fde_unit **) b;
-  if ((*first)->initial_location > (*second)->initial_location)
-    return 1;
-  else if ((*first)->initial_location < (*second)->initial_location)
-    return -1;
-  else
-    return 0;
-}
-
-/*  Build the cie_chunks and fde_chunks tables from informations
-    found in .debug_frame and .eh_frame sections.  */
-/* We can handle both of these sections almost in the same way, however there
-   are some exceptions:
-   - CIE ID is -1 in debug_frame, but 0 in eh_frame
-   - eh_frame may contain some more information that are used only by gcc 
-     (eg. personality pointer, LSDA pointer, ...). Most of them we can ignore.
-   - In debug_frame FDE's item cie_id contains offset of it's parent CIE.
-     In eh_frame FDE's item cie_id is a relative pointer to the parent CIE.
-     Anyway we don't need to bother with this, because we are smart enough 
-     to keep the pointer to the parent CIE of oncomming FDEs in 'last_cie'.
-   - Although debug_frame items can contain Augmentation as well as 
-     eh_frame ones, I have never seen them non-empty. Thus only in eh_frame 
-     we can encounter for example non-absolute pointers (Aug. 'R').  
-                                                              -- mludvig  */
-static void
-parse_frame_info (struct objfile *objfile, file_ptr frame_offset,
-		  unsigned int frame_size, asection *frame_section,
-		  int eh_frame)
-{
-  bfd *abfd = objfile->obfd;
-  asection *curr_section_ptr;
-  char *start = NULL;
-  char *end = NULL;
-  char *frame_buffer = NULL;
-  char *curr_section_name, *aug_data;
-  struct cie_unit *last_cie = NULL;
-  int last_dup_fde = 0;
-  int aug_len, i;
-  CORE_ADDR curr_section_vma = 0;
-
-  unwind_tmp_obstack_init ();
-
-  frame_buffer = dwarf2_read_section (objfile, frame_offset, frame_size,
-				      frame_section);
-
-  start = frame_buffer;
-  end = frame_buffer + frame_size;
-
-  curr_section_name = eh_frame ? ".eh_frame" : ".debug_frame";
-  curr_section_ptr = bfd_get_section_by_name (abfd, curr_section_name);
-  if (curr_section_ptr)
-    curr_section_vma = curr_section_ptr->vma;
-
-  if (start)
-    {
-      while (start < end)
-	{
-	  unsigned long length;
-	  ULONGEST cie_id;
-	  ULONGEST unit_offset = start - frame_buffer;
-	  int bytes_read, dwarf64;
-	  char *block_end;
-
-	  length = read_initial_length (abfd, start, &bytes_read);
-	  start += bytes_read;
-	  dwarf64 = (bytes_read == 12);
-	  block_end = start + length;
-
-	  if (length == 0)
-	    {
-	      start = block_end;
-	      continue;
-	    }
-
-	  cie_id = read_length (abfd, start, &bytes_read, dwarf64);
-	  start += bytes_read;
-
-	  if ((eh_frame && cie_id == 0) || is_cie (cie_id, dwarf64))
-	    {
-	      struct cie_unit *cie = cie_unit_alloc ();
-	      char *aug;
-
-	      cie->objfile = objfile;
-	      cie->next = cie_chunks;
-	      cie_chunks = cie;
-
-	      cie->objfile = objfile;
-
-	      cie->offset = unit_offset;
-
-	      start++;		/* version */
-
-	      cie->augmentation = aug = start;
-	      while (*start++);	/* Skips last NULL as well */
-
-	      cie->code_align = read_uleb128 (abfd, &start);
-	      cie->data_align = read_sleb128 (abfd, &start);
-	      cie->ra = read_1u (abfd, &start);
-
-	      /* Augmentation:
-	         z      Indicates that a uleb128 is present to size the
-	         augmentation section.
-	         L      Indicates the encoding (and thus presence) of
-	         an LSDA pointer in the FDE augmentation.
-	         R      Indicates a non-default pointer encoding for
-	         FDE code pointers.
-	         P      Indicates the presence of an encoding + language
-	         personality routine in the CIE augmentation.
-
-	         [This info comes from GCC's dwarf2out.c]
-	       */
-	      if (*aug == 'z')
-		{
-		  aug_len = read_uleb128 (abfd, &start);
-		  aug_data = start;
-		  start += aug_len;
-		  ++aug;
-		}
-
-	      cie->data = start;
-	      cie->data_length = block_end - cie->data;
-
-	      while (*aug != '\0')
-		{
-		  if (aug[0] == 'e' && aug[1] == 'h')
-		    {
-		      aug_data += sizeof (void *);
-		      aug++;
-		    }
-		  else if (aug[0] == 'R')
-		    cie->addr_encoding = *aug_data++;
-		  else if (aug[0] == 'P')
-		    {
-		      CORE_ADDR pers_addr;
-		      int pers_addr_enc;
-
-		      pers_addr_enc = *aug_data++;
-		      /* We don't need pers_addr value and so we 
-		         don't care about it's encoding.  */
-		      pers_addr = read_encoded_pointer (abfd, &aug_data,
-							pers_addr_enc);
-		    }
-		  else if (aug[0] == 'L' && eh_frame)
-		    {
-		      int lsda_addr_enc;
-
-		      /* Perhaps we should save this to CIE for later use?
-		         Do we need it for something in GDB?  */
-		      lsda_addr_enc = *aug_data++;
-		    }
-		  else
-		    warning ("CFI warning: unknown augmentation \"%c\""
-			     " in \"%s\" of\n"
-			     "\t%s", aug[0], curr_section_name,
-			     objfile->name);
-		  aug++;
-		}
-
-	      last_cie = cie;
-	    }
-	  else
-	    {
-	      struct fde_unit *fde;
-	      struct cie_unit *cie;
-	      int dup = 0;
-	      CORE_ADDR init_loc;
-
-	      /* We assume that debug_frame is in order 
-	         CIE,FDE,CIE,FDE,FDE,...  and thus the CIE for this FDE
-	         should be stored in last_cie pointer. If not, we'll 
-	         try to find it by the older way.  */
-	      if (last_cie)
-		cie = last_cie;
-	      else
-		{
-		  warning ("CFI: last_cie == NULL. "
-			   "Perhaps a malformed %s section in '%s'...?\n",
-			   curr_section_name, objfile->name);
-
-		  cie = cie_chunks;
-		  while (cie)
-		    {
-		      if (cie->objfile == objfile)
-			{
-			  if (eh_frame &&
-			      (cie->offset ==
-			       (unit_offset + bytes_read - cie_id)))
-			    break;
-			  if (!eh_frame && (cie->offset == cie_id))
-			    break;
-			}
-
-		      cie = cie->next;
-		    }
-		  if (!cie)
-		    error ("CFI: can't find CIE pointer [in module %s]",
-			   bfd_get_filename (abfd));
-		}
-
-	      init_loc = read_encoded_pointer (abfd, &start,
-					       cie->addr_encoding);
-
-	      switch (pointer_encoding (cie->addr_encoding, objfile))
-		{
-		case PE_absptr:
-		  break;
-		case PE_pcrel:
-		  /* start-frame_buffer gives offset from 
-		     the beginning of actual section.  */
-		  init_loc += curr_section_vma + start - frame_buffer;
-		  break;
-		default:
-		  warning ("CFI: Unsupported pointer encoding [in module %s]",
-			   bfd_get_filename (abfd));
-		}
-
-	      /* For relocatable objects we must add an offset telling
-	         where the section is actually mapped in the memory.  */
-	      init_loc += ANOFFSET (objfile->section_offsets,
-				    SECT_OFF_TEXT (objfile));
-
-	      /* If we have both .debug_frame and .eh_frame present in 
-	         a file, we must eliminate duplicate FDEs. For now we'll 
-	         run through all entries in fde_chunks and check it one 
-	         by one. Perhaps in the future we can implement a faster 
-	         searching algorithm.  */
-	      /* eh_frame==2 indicates, that this file has an already 
-	         parsed .debug_frame too. When eh_frame==1 it means, that no
-	         .debug_frame is present and thus we don't need to check for
-	         duplicities. eh_frame==0 means, that we parse .debug_frame
-	         and don't need to care about duplicate FDEs, because
-	         .debug_frame is parsed first.  */
-	      if (eh_frame == 2)
-		for (i = 0; eh_frame == 2 && i < fde_chunks.elems; i++)
-		  {
-		    /* We assume that FDEs in .debug_frame and .eh_frame 
-		       have the same order (if they are present, of course).
-		       If we find a duplicate entry for one FDE and save
-		       it's index to last_dup_fde it's very likely, that 
-		       we'll find an entry for the following FDE right after 
-		       the previous one. Thus in many cases we'll run this 
-		       loop only once.  */
-		    last_dup_fde = (last_dup_fde + i) % fde_chunks.elems;
-		    if (fde_chunks.array[last_dup_fde]->initial_location
-			== init_loc)
-		      {
-			dup = 1;
-			break;
-		      }
-		  }
-
-	      /* Allocate a new entry only if this FDE isn't a duplicate of
-	         something we have already seen.   */
-	      if (!dup)
-		{
-		  fde_chunks_need_space ();
-		  fde = fde_unit_alloc ();
-
-		  fde_chunks.array[fde_chunks.elems++] = fde;
-
-		  fde->initial_location = init_loc;
-		  fde->address_range = read_encoded_pointer (abfd, &start,
-							     cie->
-							     addr_encoding);
-
-		  fde->cie_ptr = cie;
-
-		  /* Here we intentionally ignore augmentation data
-		     from FDE, because we don't need them.  */
-		  if (cie->augmentation[0] == 'z')
-		    start += read_uleb128 (abfd, &start);
-
-		  fde->data = start;
-		  fde->data_length = block_end - start;
-		}
-	    }
-	  start = block_end;
-	}
-      qsort (fde_chunks.array, fde_chunks.elems,
-	     sizeof (struct fde_unit *), compare_fde_unit);
-    }
-}
-
-/* We must parse both .debug_frame section and .eh_frame because 
- * not all frames must be present in both of these sections. */
-void
-dwarf2_build_frame_info (struct objfile *objfile)
-{
-  int after_debug_frame = 0;
-
-  /* If we have .debug_frame then the parser is called with 
-     eh_frame==0 for .debug_frame and eh_frame==2 for .eh_frame, 
-     otherwise it's only called once for .eh_frame with argument 
-     eh_frame==1.  */
-
-  if (dwarf_frame_offset)
-    {
-      parse_frame_info (objfile, dwarf_frame_offset,
-			dwarf_frame_size, dwarf_frame_section,
-			0 /* = debug_frame */ );
-      after_debug_frame = 1;
-    }
-
-  if (dwarf_eh_frame_offset)
-    parse_frame_info (objfile, dwarf_eh_frame_offset, dwarf_eh_frame_size,
-		      dwarf_eh_frame_section,
-		      1 /* = eh_frame */  + after_debug_frame);
-}
-
-/* Return the frame address.  */
-CORE_ADDR
-cfi_read_fp (void)
-{
-  struct context *context;
-  struct frame_state *fs;
-  CORE_ADDR cfa;
-
-  unwind_tmp_obstack_init ();
-
-  context = context_alloc ();
-  fs = frame_state_alloc ();
-
-  context->ra = read_pc () + 1;
-
-  frame_state_for (context, fs);
-  update_context (context, fs, 0);
-
-  cfa = context->cfa;
-
-  unwind_tmp_obstack_free ();
-
-  return cfa;
-}
-
-/* Store the frame address.  This function is not used.  */
-
-void
-cfi_write_fp (CORE_ADDR val)
-{
-  struct context *context;
-  struct frame_state *fs;
-
-  unwind_tmp_obstack_init ();
-
-  context = context_alloc ();
-  fs = frame_state_alloc ();
-
-  context->ra = read_pc () + 1;
-
-  frame_state_for (context, fs);
-
-  if (fs->cfa_how == CFA_REG_OFFSET)
-    {
-      val -= fs->cfa_offset;
-      deprecated_write_register_gen (fs->cfa_reg, (char *) &val);
-    }
-  else
-    warning ("Can't write fp.");
-
-  unwind_tmp_obstack_free ();
-}
-
-/* Restore the machine to the state it had before the current frame
-   was created.  */
-void
-cfi_pop_frame (struct frame_info *fi)
-{
-  char regbuf[MAX_REGISTER_SIZE];
-  int regnum;
-
-  for (regnum = 0; regnum < NUM_REGS; regnum++)
-    {
-      get_reg (regbuf, UNWIND_CONTEXT (fi), regnum);
-      deprecated_write_register_bytes (REGISTER_BYTE (regnum), regbuf,
-				       REGISTER_RAW_SIZE (regnum));
-    }
-  write_register (PC_REGNUM, UNWIND_CONTEXT (fi)->ra);
-
-  flush_cached_frames ();
-}
-
-/* Determine the address of the calling function's frame.  */
-CORE_ADDR
-cfi_frame_chain (struct frame_info *fi)
-{
-  struct context *context;
-  struct frame_state *fs;
-  CORE_ADDR cfa;
-
-  unwind_tmp_obstack_init ();
-
-  context = context_alloc ();
-  fs = frame_state_alloc ();
-  context_cpy (context, UNWIND_CONTEXT (fi));
-
-  /* outermost frame */
-  if (context->ra == 0)
-    {
-      unwind_tmp_obstack_free ();
-      return 0;
-    }
-
-  frame_state_for (context, fs);
-  update_context (context, fs, 1);
-
-  cfa = context->cfa;
-  unwind_tmp_obstack_free ();
-
-  return cfa;
-}
-
-/* Sets the pc of the frame.  */
-CORE_ADDR
-cfi_init_frame_pc (int fromleaf, struct frame_info *fi)
-{
-  if (get_next_frame (fi))
-    {
-      CORE_ADDR pc;
-      /* FIXME: cagney/2002-12-04: This is straight wrong.  It's
-         assuming that the PC is CORE_ADDR (a host quantity) in size.  */
-      get_reg ((void *) &pc, UNWIND_CONTEXT (get_next_frame (fi)), PC_REGNUM);
-      return pc;
-    }
-  else
-    return read_pc ();
-}
-
-/* Initialize unwind context informations of the frame.  */
-void
-cfi_init_extra_frame_info (int fromleaf, struct frame_info *fi)
-{
-  struct frame_state *fs;
-
-  unwind_tmp_obstack_init ();
-
-  fs = frame_state_alloc ();
-  deprecated_set_frame_context (fi,
-				frame_obstack_zalloc (sizeof
-						      (struct context)));
-  UNWIND_CONTEXT (fi)->reg =
-    frame_obstack_zalloc (sizeof (struct context_reg) * NUM_REGS);
-  memset (UNWIND_CONTEXT (fi)->reg, 0,
-	  sizeof (struct context_reg) * NUM_REGS);
-
-  if (get_next_frame (fi))
-    {
-      context_cpy (UNWIND_CONTEXT (fi), UNWIND_CONTEXT (get_next_frame (fi)));
-      frame_state_for (UNWIND_CONTEXT (fi), fs);
-      update_context (UNWIND_CONTEXT (fi), fs, 1);
-    }
-  else
-    {
-      UNWIND_CONTEXT (fi)->ra = get_frame_pc (fi) + 1;
-      frame_state_for (UNWIND_CONTEXT (fi), fs);
-      update_context (UNWIND_CONTEXT (fi), fs, 0);
-    }
-
-  unwind_tmp_obstack_free ();
-}
-
-/* Obtain return address of the frame.  */
-CORE_ADDR
-cfi_get_ra (struct frame_info *fi)
-{
-  return UNWIND_CONTEXT (fi)->ra;
-}
-
-/* Find register number REGNUM relative to FRAME and put its
-   (raw) contents in *RAW_BUFFER.  Set *OPTIMIZED if the variable
-   was optimized out (and thus can't be fetched).  If the variable
-   was fetched from memory, set *ADDRP to where it was fetched from,
-   otherwise it was fetched from a register.
-
-   The argument RAW_BUFFER must point to aligned memory.  */
-void
-cfi_get_saved_register (char *raw_buffer,
-			int *optimized,
-			CORE_ADDR *addrp,
-			struct frame_info *frame,
-			int regnum, enum lval_type *lval)
-{
-  if (!target_has_registers)
-    error ("No registers.");
-
-  /* Normal systems don't optimize out things with register numbers.  */
-  if (optimized != NULL)
-    *optimized = 0;
-
-  if (addrp)			/* default assumption: not found in memory */
-    *addrp = 0;
-
-  if (!get_next_frame (frame))
-    {
-      deprecated_read_register_gen (regnum, raw_buffer);
-      if (lval != NULL)
-	*lval = lval_register;
-      if (addrp != NULL)
-	*addrp = REGISTER_BYTE (regnum);
-    }
-  else
-    {
-      frame = get_next_frame (frame);
-      switch (UNWIND_CONTEXT (frame)->reg[regnum].how)
-	{
-	case REG_CTX_UNSAVED:
-	  deprecated_read_register_gen (regnum, raw_buffer);
-	  if (lval != NULL)
-	    *lval = not_lval;
-	  if (optimized != NULL)
-	    *optimized = 1;
-	  break;
-	case REG_CTX_SAVED_OFFSET:
-	  target_read_memory (UNWIND_CONTEXT (frame)->cfa +
-			      UNWIND_CONTEXT (frame)->reg[regnum].loc.offset,
-			      raw_buffer, REGISTER_RAW_SIZE (regnum));
-	  if (lval != NULL)
-	    *lval = lval_memory;
-	  if (addrp != NULL)
-	    *addrp =
-	      UNWIND_CONTEXT (frame)->cfa +
-	      UNWIND_CONTEXT (frame)->reg[regnum].loc.offset;
-	  break;
-	case REG_CTX_SAVED_REG:
-	  deprecated_read_register_gen (UNWIND_CONTEXT (frame)->reg[regnum].
-					loc.reg, raw_buffer);
-	  if (lval != NULL)
-	    *lval = lval_register;
-	  if (addrp != NULL)
-	    *addrp =
-	      REGISTER_BYTE (UNWIND_CONTEXT (frame)->reg[regnum].loc.reg);
-	  break;
-	case REG_CTX_SAVED_ADDR:
-	  target_read_memory (UNWIND_CONTEXT (frame)->reg[regnum].loc.addr,
-			      raw_buffer, REGISTER_RAW_SIZE (regnum));
-	  if (lval != NULL)
-	    *lval = lval_memory;
-	  if (addrp != NULL)
-	    *addrp = UNWIND_CONTEXT (frame)->reg[regnum].loc.addr;
-	  break;
-	case REG_CTX_VALUE:
-	  memcpy (raw_buffer, &UNWIND_CONTEXT (frame)->reg[regnum].loc.addr,
-		  REGISTER_RAW_SIZE (regnum));
-	  if (lval != NULL)
-	    *lval = not_lval;
-	  if (optimized != NULL)
-	    *optimized = 0;
-	  break;
-	default:
-	  internal_error (__FILE__, __LINE__,
-			  "cfi_get_saved_register: unknown register rule 0x%02X",
-			  UNWIND_CONTEXT (frame)->reg[regnum].how);
-	}
-    }
-}
-
-/*  Return the register that the function uses for a frame pointer,
-    plus any necessary offset to be applied to the register before
-    any frame pointer offsets.  */
-void
-cfi_virtual_frame_pointer (CORE_ADDR pc, int *frame_reg,
-			   LONGEST * frame_offset)
-{
-  struct context *context;
-  struct frame_state *fs;
-
-  unwind_tmp_obstack_init ();
-
-  context = context_alloc ();
-  fs = frame_state_alloc ();
-
-  context->ra = read_pc () + 1;
-
-  frame_state_for (context, fs);
-
-  if (fs->cfa_how == CFA_REG_OFFSET)
-    {
-      *frame_reg = fs->cfa_reg;
-      *frame_offset = fs->cfa_offset;
-    }
-  else
-    error ("dwarf cfi error: CFA is not defined as CFA_REG_OFFSET");
-
-  unwind_tmp_obstack_free ();
-}
diff --git a/gdb/dwarf2cfi.h b/gdb/dwarf2cfi.h
deleted file mode 100644
index 28a329d..0000000
--- a/gdb/dwarf2cfi.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/* Stack unwinding code based on dwarf2 frame info for GDB, the GNU debugger.
-   Copyright 2001
-   Free Software Foundation, Inc.
-
-   This file is part of GDB.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
-
-#ifndef DWARF2CFI_H
-#define DWARF2CFI_H
-
-struct frame_info;
-
-struct context_reg
-{
-  union
-  {
-    unsigned int reg;
-    long offset;
-    CORE_ADDR addr;
-  }
-  loc;
-  enum
-  {
-    REG_CTX_UNSAVED,
-    REG_CTX_SAVED_OFFSET,
-    REG_CTX_SAVED_REG,
-    REG_CTX_SAVED_ADDR,
-    REG_CTX_VALUE,
-  }
-  how;
-};
-
-/* This is the register and unwind state for a particular frame.  */
-struct context
-{
-  struct context_reg *reg;
-
-  CORE_ADDR cfa;
-  CORE_ADDR ra;
-  void *lsda;
-  int args_size;
-};
-
-/* Return the frame address.  */
-CORE_ADDR cfi_read_fp ();
-
-/* Store the frame address.  */
-void cfi_write_fp (CORE_ADDR val);
-
-/* Restore the machine to the state it had before the current frame
-   was created.  */
-void cfi_pop_frame (struct frame_info *);
-
-/* Determine the address of the calling function's frame.  */
-CORE_ADDR cfi_frame_chain (struct frame_info *fi);
-
-/* Sets the pc of the frame.  */
-CORE_ADDR cfi_init_frame_pc (int fromleaf, struct frame_info *fi);
-
-/* Initialize unwind context informations of the frame.  */
-void cfi_init_extra_frame_info (int fromleaf, struct frame_info *fi);
-
-/* Obtain return address of the frame.  */
-CORE_ADDR cfi_get_ra (struct frame_info *fi);
-
-/* Find register number REGNUM relative to FRAME and put its
-   (raw) contents in *RAW_BUFFER.  Set *OPTIMIZED if the variable
-   was optimized out (and thus can't be fetched).  If the variable
-   was fetched from memory, set *ADDRP to where it was fetched from,
-   otherwise it was fetched from a register.
-
-   The argument RAW_BUFFER must point to aligned memory.  */
-void cfi_get_saved_register (char *raw_buffer,
-			     int *optimized,
-			     CORE_ADDR *addrp,
-			     struct frame_info *frame,
-			     int regnum, enum lval_type *lval);
-
-/*  Return the register that the function uses for a frame pointer,
-    plus any necessary offset to be applied to the register before
-    any frame pointer offsets.  */
-void cfi_virtual_frame_pointer (CORE_ADDR pc, int *frame_regnum,
-				LONGEST * frame_offset);
-
-struct context *context_alloc ();
-void context_cpy (struct context *dst, struct context *src);
-struct frame_state *frame_state_alloc ();
-#endif
diff --git a/gdb/findvar.c b/gdb/findvar.c
index 3155697c..933146a 100644
--- a/gdb/findvar.c
+++ b/gdb/findvar.c
@@ -624,145 +624,75 @@
 struct value *
 value_from_register (struct type *type, int regnum, struct frame_info *frame)
 {
-  char raw_buffer[MAX_REGISTER_SIZE];
-  CORE_ADDR addr;
-  int optim;
+  struct gdbarch *gdbarch = get_frame_arch (frame);
   struct value *v = allocate_value (type);
-  char *value_bytes = 0;
-  int value_bytes_copied = 0;
-  int num_storage_locs;
-  enum lval_type lval;
-  int len;
-
   CHECK_TYPEDEF (type);
-  len = TYPE_LENGTH (type);
 
-  VALUE_REGNO (v) = regnum;
-
-  num_storage_locs = (len > REGISTER_VIRTUAL_SIZE (regnum) ?
-		      ((len - 1) / REGISTER_RAW_SIZE (regnum)) + 1 :
-		      1);
-
-  if (num_storage_locs > 1
-#if 0
-      // OBSOLETE #ifdef GDB_TARGET_IS_H8500
-      // OBSOLETE       || TYPE_CODE (type) == TYPE_CODE_PTR
-      // OBSOLETE #endif
-#endif
-    )
+  if (CONVERT_REGISTER_P (regnum, type))
     {
-      /* Value spread across multiple storage locations.  */
-
+      /* The ISA/ABI need to something weird when obtaining the
+         specified value from this register.  It might need to
+         re-order non-adjacent, starting with REGNUM (see MIPS and
+         i386).  It might need to convert the [float] register into
+         the corresponding [integer] type (see Alpha).  The assumption
+         is that REGISTER_TO_VALUE populates the entire value
+         including the location.  */
+      REGISTER_TO_VALUE (frame, regnum, type, VALUE_CONTENTS_RAW (v));
+      VALUE_LVAL (v) = lval_reg_frame_relative;
+      VALUE_FRAME_ID (v) = get_frame_id (frame);
+      VALUE_FRAME_REGNUM (v) = regnum;
+    }
+  else
+    {
       int local_regnum;
       int mem_stor = 0, reg_stor = 0;
       int mem_tracking = 1;
       CORE_ADDR last_addr = 0;
       CORE_ADDR first_addr = 0;
-
-      value_bytes = (char *) alloca (len + MAX_REGISTER_SIZE);
+      int first_realnum = regnum;
+      int len = TYPE_LENGTH (type);
+      int value_bytes_copied;
+      int optimized = 0;
+      char *value_bytes = (char *) alloca (len + MAX_REGISTER_SIZE);
 
       /* Copy all of the data out, whereever it may be.  */
-
-#if 0
-      // OBSOLETE #ifdef GDB_TARGET_IS_H8500
-      // OBSOLETE /* This piece of hideosity is required because the H8500 treats registers
-      // OBSOLETE    differently depending upon whether they are used as pointers or not.  As a
-      // OBSOLETE    pointer, a register needs to have a page register tacked onto the front.
-      // OBSOLETE    An alternate way to do this would be to have gcc output different register
-      // OBSOLETE    numbers for the pointer & non-pointer form of the register.  But, it
-      // OBSOLETE    doesn't, so we're stuck with this.  */
-      // OBSOLETE 
-      // OBSOLETE       if (TYPE_CODE (type) == TYPE_CODE_PTR
-      // OBSOLETE 	  && len > 2)
-      // OBSOLETE 	{
-      // OBSOLETE 	  int page_regnum;
-      // OBSOLETE 
-      // OBSOLETE 	  switch (regnum)
-      // OBSOLETE 	    {
-      // OBSOLETE 	    case R0_REGNUM:
-      // OBSOLETE 	    case R1_REGNUM:
-      // OBSOLETE 	    case R2_REGNUM:
-      // OBSOLETE 	    case R3_REGNUM:
-      // OBSOLETE 	      page_regnum = SEG_D_REGNUM;
-      // OBSOLETE 	      break;
-      // OBSOLETE 	    case R4_REGNUM:
-      // OBSOLETE 	    case R5_REGNUM:
-      // OBSOLETE 	      page_regnum = SEG_E_REGNUM;
-      // OBSOLETE 	      break;
-      // OBSOLETE 	    case R6_REGNUM:
-      // OBSOLETE 	    case R7_REGNUM:
-      // OBSOLETE 	      page_regnum = SEG_T_REGNUM;
-      // OBSOLETE 	      break;
-      // OBSOLETE 	    }
-      // OBSOLETE 
-      // OBSOLETE 	  value_bytes[0] = 0;
-      // OBSOLETE 	  get_saved_register (value_bytes + 1,
-      // OBSOLETE 			      &optim,
-      // OBSOLETE 			      &addr,
-      // OBSOLETE 			      frame,
-      // OBSOLETE 			      page_regnum,
-      // OBSOLETE 			      &lval);
-      // OBSOLETE 
-      // OBSOLETE 	  if (register_cached (page_regnum) == -1)
-      // OBSOLETE 	    return NULL;	/* register value not available */
-      // OBSOLETE 
-      // OBSOLETE 	  if (lval == lval_register)
-      // OBSOLETE 	    reg_stor++;
-      // OBSOLETE 	  else
-      // OBSOLETE 	    mem_stor++;
-      // OBSOLETE 	  first_addr = addr;
-      // OBSOLETE 	  last_addr = addr;
-      // OBSOLETE 
-      // OBSOLETE 	  get_saved_register (value_bytes + 2,
-      // OBSOLETE 			      &optim,
-      // OBSOLETE 			      &addr,
-      // OBSOLETE 			      frame,
-      // OBSOLETE 			      regnum,
-      // OBSOLETE 			      &lval);
-      // OBSOLETE 
-      // OBSOLETE 	  if (register_cached (regnum) == -1)
-      // OBSOLETE 	    return NULL;	/* register value not available */
-      // OBSOLETE 
-      // OBSOLETE 	  if (lval == lval_register)
-      // OBSOLETE 	    reg_stor++;
-      // OBSOLETE 	  else
-      // OBSOLETE 	    {
-      // OBSOLETE 	      mem_stor++;
-      // OBSOLETE 	      mem_tracking = mem_tracking && (addr == last_addr);
-      // OBSOLETE 	    }
-      // OBSOLETE 	  last_addr = addr;
-      // OBSOLETE 	}
-      // OBSOLETE       else
-      // OBSOLETE #endif /* GDB_TARGET_IS_H8500 */
-#endif
-	for (local_regnum = regnum;
-	     value_bytes_copied < len;
-	     (value_bytes_copied += REGISTER_RAW_SIZE (local_regnum),
-	      ++local_regnum))
-	  {
-	    int realnum;
-	    frame_register (frame, local_regnum, &optim, &lval, &addr,
-			    &realnum, value_bytes + value_bytes_copied);
-
-	    if (register_cached (local_regnum) == -1)
-	      return NULL;	/* register value not available */
-
-	    if (regnum == local_regnum)
+      for (local_regnum = regnum, value_bytes_copied = 0;
+	   value_bytes_copied < len;
+	   (value_bytes_copied += REGISTER_RAW_SIZE (local_regnum),
+	    ++local_regnum))
+	{
+	  int realnum;
+	  int optim;
+	  enum lval_type lval;
+	  CORE_ADDR addr;
+	  frame_register (frame, local_regnum, &optim, &lval, &addr,
+			  &realnum, value_bytes + value_bytes_copied);
+	  optimized += optim;
+	  if (register_cached (local_regnum) == -1)
+	    return NULL;	/* register value not available */
+	  
+	  if (regnum == local_regnum)
+	    {
 	      first_addr = addr;
-	    if (lval == lval_register)
-	      reg_stor++;
-	    else
-	      {
-		mem_stor++;
-
-		mem_tracking =
-		  (mem_tracking
-		   && (regnum == local_regnum
-		       || addr == last_addr));
-	      }
-	    last_addr = addr;
-	  }
-
+	      first_realnum = realnum;
+	    }
+	  if (lval == lval_register)
+	    reg_stor++;
+	  else
+	    {
+	      mem_stor++;
+	      
+	      mem_tracking = (mem_tracking
+			      && (regnum == local_regnum
+				  || addr == last_addr));
+	    }
+	  last_addr = addr;
+	}
+      
+      /* FIXME: cagney/2003-06-04: Shouldn't this always use
+         lval_reg_frame_relative?  If it doesn't and the register's
+         location changes (say after a resume) then this value is
+         going to have wrong information.  */
       if ((reg_stor && mem_stor)
 	  || (mem_stor && !mem_tracking))
 	/* Mixed storage; all of the hassle we just went through was
@@ -781,67 +711,29 @@
 	{
 	  VALUE_LVAL (v) = lval_register;
 	  VALUE_ADDRESS (v) = first_addr;
+	  VALUE_REGNO (v) = first_realnum;
 	}
       else
 	internal_error (__FILE__, __LINE__,
 			"value_from_register: Value not stored anywhere!");
-
-      VALUE_OPTIMIZED_OUT (v) = optim;
-
+      
+      VALUE_OPTIMIZED_OUT (v) = optimized;
+      
       /* Any structure stored in more than one register will always be
-         an integral number of registers.  Otherwise, you'd need to do
+         an integral number of registers.  Otherwise, you need to do
          some fiddling with the last register copied here for little
          endian machines.  */
-
-      /* Copy into the contents section of the value.  */
-      memcpy (VALUE_CONTENTS_RAW (v), value_bytes, len);
-
-      /* Finally do any conversion necessary when extracting this
-         type from more than one register.  */
-#ifdef REGISTER_CONVERT_TO_TYPE
-      REGISTER_CONVERT_TO_TYPE (regnum, type, VALUE_CONTENTS_RAW (v));
-#endif
-      return v;
+      if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG
+	  && len < REGISTER_RAW_SIZE (regnum))
+	/* Big-endian, and we want less than full size.  */
+	VALUE_OFFSET (v) = REGISTER_RAW_SIZE (regnum) - len;
+      else
+	VALUE_OFFSET (v) = 0;
+      memcpy (VALUE_CONTENTS_RAW (v), value_bytes + VALUE_OFFSET (v), len);
     }
-
-  /* Data is completely contained within a single register.  Locate the
-     register's contents in a real register or in core;
-     read the data in raw format.  */
-
-  {
-    int realnum;
-    frame_register (frame, regnum, &optim, &lval, &addr, &realnum, raw_buffer);
-  }
-
-  if (register_cached (regnum) == -1)
-    return NULL;		/* register value not available */
-
-  VALUE_OPTIMIZED_OUT (v) = optim;
-  VALUE_LVAL (v) = lval;
-  VALUE_ADDRESS (v) = addr;
-
-  /* Convert the raw register to the corresponding data value's memory
-     format, if necessary.  */
-
-  if (CONVERT_REGISTER_P (regnum))
-    {
-      REGISTER_TO_VALUE (regnum, type, raw_buffer, VALUE_CONTENTS_RAW (v));
-    }
-  else
-    {
-      /* Raw and virtual formats are the same for this register.  */
-
-      if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG && len < REGISTER_RAW_SIZE (regnum))
-	{
-	  /* Big-endian, and we want less than full size.  */
-	  VALUE_OFFSET (v) = REGISTER_RAW_SIZE (regnum) - len;
-	}
-
-      memcpy (VALUE_CONTENTS_RAW (v), raw_buffer + VALUE_OFFSET (v), len);
-    }
-
   return v;
 }
+
 
 /* Given a struct symbol for a variable or function,
    and a stack frame id, 
diff --git a/gdb/frame.c b/gdb/frame.c
index 18f9561..eadb77d 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -615,6 +615,41 @@
 }
 
 void
+get_frame_register (struct frame_info *frame,
+		    int regnum, void *buf)
+{
+  frame_unwind_register (frame->next, regnum, buf);
+}
+
+LONGEST
+frame_unwind_register_signed (struct frame_info *frame, int regnum)
+{
+  char buf[MAX_REGISTER_SIZE];
+  frame_unwind_register (frame, regnum, buf);
+  return extract_signed_integer (buf, REGISTER_VIRTUAL_SIZE (regnum));
+}
+
+LONGEST
+get_frame_register_signed (struct frame_info *frame, int regnum)
+{
+  return frame_unwind_register_signed (frame->next, regnum);
+}
+
+ULONGEST
+frame_unwind_register_unsigned (struct frame_info *frame, int regnum)
+{
+  char buf[MAX_REGISTER_SIZE];
+  frame_unwind_register (frame, regnum, buf);
+  return extract_unsigned_integer (buf, REGISTER_VIRTUAL_SIZE (regnum));
+}
+
+ULONGEST
+get_frame_register_unsigned (struct frame_info *frame, int regnum)
+{
+  return frame_unwind_register_unsigned (frame->next, regnum);
+}
+
+void
 frame_unwind_signed_register (struct frame_info *frame, int regnum,
 			      LONGEST *val)
 {
@@ -674,33 +709,33 @@
 }
 
 void
-deprecated_unwind_get_saved_register (char *raw_buffer,
-				      int *optimizedp,
-				      CORE_ADDR *addrp,
-				      struct frame_info *frame,
-				      int regnum,
-				      enum lval_type *lvalp)
+put_frame_register (struct frame_info *frame, int regnum, const void *buf)
 {
-  int optimizedx;
-  CORE_ADDR addrx;
-  int realnumx;
-  enum lval_type lvalx;
-
-  if (!target_has_registers)
-    error ("No registers.");
-
-  /* Keep things simple, ensure that all the pointers (except valuep)
-     are non NULL.  */
-  if (optimizedp == NULL)
-    optimizedp = &optimizedx;
-  if (lvalp == NULL)
-    lvalp = &lvalx;
-  if (addrp == NULL)
-    addrp = &addrx;
-
-  gdb_assert (frame != NULL && frame->next != NULL);
-  frame_register_unwind (frame->next, regnum, optimizedp, lvalp, addrp,
-			 &realnumx, raw_buffer);
+  struct gdbarch *gdbarch = get_frame_arch (frame);
+  int realnum;
+  int optim;
+  enum lval_type lval;
+  CORE_ADDR addr;
+  frame_register (frame, regnum, &optim, &lval, &addr, &realnum, NULL);
+  if (optim)
+    error ("Attempt to assign to a value that was optimized out.");
+  switch (lval)
+    {
+    case lval_memory:
+      {
+	/* FIXME: write_memory doesn't yet take constant buffers.
+           Arrrg!  */
+	char tmp[MAX_REGISTER_SIZE];
+	memcpy (tmp, buf, register_size (gdbarch, regnum));
+	write_memory (addr, tmp, register_size (gdbarch, regnum));
+	break;
+      }
+    case lval_register:
+      regcache_cooked_write (current_regcache, realnum, buf);
+      break;
+    default:
+      error ("Attempt to assign to an unmodifiable value.");
+    }
 }
 
 /* frame_register_read ()
@@ -963,14 +998,13 @@
   struct frame_info *frame = next_frame->prev;
   gdb_assert (frame != NULL);
 
-  /* Only (older) architectures that implement the
-     DEPRECATED_FRAME_INIT_SAVED_REGS method should be using this
-     function.  */
-  gdb_assert (DEPRECATED_FRAME_INIT_SAVED_REGS_P ());
-
-  /* Load the saved_regs register cache.  */
   if (get_frame_saved_regs (frame) == NULL)
-    DEPRECATED_FRAME_INIT_SAVED_REGS (frame);
+    {
+      /* If nothing's initialized the saved regs, do it now.  */
+      gdb_assert (DEPRECATED_FRAME_INIT_SAVED_REGS_P ());
+      DEPRECATED_FRAME_INIT_SAVED_REGS (frame);
+      gdb_assert (get_frame_saved_regs (frame) != NULL);
+    }
 
   if (get_frame_saved_regs (frame) != NULL
       && get_frame_saved_regs (frame)[regnum] != 0)
@@ -1082,8 +1116,6 @@
   if (!target_has_registers)
     error ("No registers.");
 
-  gdb_assert (DEPRECATED_FRAME_INIT_SAVED_REGS_P ());
-
   /* Normal systems don't optimize out things with register numbers.  */
   if (optimized != NULL)
     *optimized = 0;
@@ -1237,6 +1269,12 @@
     return NULL;
 }
 
+struct frame_info *
+deprecated_get_next_frame_hack (struct frame_info *this_frame)
+{
+  return this_frame->next;
+}
+
 /* Flush the entire frame cache.  */
 
 void
@@ -1373,10 +1411,6 @@
 	     or some random address on the stack.  Trying to use that
 	     PC to apply standard frame ID unwind techniques is just
 	     asking for trouble.  */
-	  /* Assume call_function_by_hand(), via SAVE_DUMMY_FRAME_TOS,
-	     previously saved the dummy frame's ID.  Things only work
-	     if the two return the same value.  */
-	  gdb_assert (SAVE_DUMMY_FRAME_TOS_P ());
 	  /* Use an architecture specific method to extract the prev's
 	     dummy ID from the next frame.  Note that this method uses
 	     frame_register_unwind to obtain the register values
@@ -1475,6 +1509,12 @@
     /* FIXME: 2002-11-09: There isn't any reason to special case this
        edge condition.  Instead the per-architecture code should hande
        it locally.  */
+    /* FIXME: cagney/2003-06-16: This returns the inner most stack
+       address for the previous frame, that, however, is wrong.  It
+       should be the inner most stack address for the previous to
+       previous frame.  This is because it is the previous to previous
+       frame's innermost stack address that is constant through out
+       the lifetime of the previous frame (trust me :-).  */
     address = get_frame_base (this_frame);
   else
     {
@@ -1493,8 +1533,29 @@
          this to after the ffi test; I'd rather have backtraces from
          start go curfluy than have an abort called from main not show
          main.  */
-      gdb_assert (DEPRECATED_FRAME_CHAIN_P ());
-      address = DEPRECATED_FRAME_CHAIN (this_frame);
+      if (DEPRECATED_FRAME_CHAIN_P ())
+	address = DEPRECATED_FRAME_CHAIN (this_frame);
+      else
+	{
+	  /* Someone is part way through coverting an old architecture
+             to the new frame code.  Implement FRAME_CHAIN the way the
+             new frame will.  */
+	  /* Find PREV frame's unwinder.  */
+	  prev->unwind = frame_unwind_find_by_pc (current_gdbarch,
+						  frame_pc_unwind (this_frame));
+	  /* FIXME: cagney/2003-04-02: Rather than storing the frame's
+	     type in the frame, the unwinder's type should be returned
+	     directly.  Unfortunatly, legacy code, called by
+	     legacy_get_prev_frame, explicitly set the frames type
+	     using the method deprecated_set_frame_type().  */
+	  prev->type = prev->unwind->type;
+	  /* Find PREV frame's ID.  */
+	  prev->unwind->this_id (this_frame,
+				 &prev->prologue_cache,
+				 &prev->this_id.value);
+	  prev->this_id.p = 1;
+	  address = prev->this_id.value.stack_addr;
+	}
 
       if (!legacy_frame_chain_valid (address, this_frame))
 	{
@@ -1637,9 +1698,13 @@
   /* Initialize the code used to unwind the frame PREV based on the PC
      (and probably other architectural information).  The PC lets you
      check things like the debug info at that point (dwarf2cfi?) and
-     use that to decide how the frame should be unwound.  */
-  prev->unwind = frame_unwind_find_by_pc (current_gdbarch,
-					  get_frame_pc (prev));
+     use that to decide how the frame should be unwound.
+
+     If there isn't a FRAME_CHAIN, the code above will have already
+     done this.  */
+  if (prev->unwind == NULL)
+    prev->unwind = frame_unwind_find_by_pc (current_gdbarch,
+					    get_frame_pc (prev));
 
   /* If the unwinder provides a frame type, use it.  Otherwize
      continue on to that heuristic mess.  */
@@ -1647,6 +1712,7 @@
     {
       prev->type = prev->unwind->type;
       if (prev->type == NORMAL_FRAME)
+	/* FIXME: cagney/2003-06-16: would get_frame_pc() be better?  */
 	prev->this_id.value.code_addr
 	  = get_pc_function_start (prev->this_id.value.code_addr);
       if (frame_debug)
diff --git a/gdb/frame.h b/gdb/frame.h
index 4dc7560..87c2057 100644
--- a/gdb/frame.h
+++ b/gdb/frame.h
@@ -23,6 +23,47 @@
 #if !defined (FRAME_H)
 #define FRAME_H 1
 
+/* The following is the intended naming schema for frame functions.
+   It isn't 100% consistent, but it is aproaching that.  Frame naming
+   schema:
+
+   Prefixes:
+
+   get_frame_WHAT...(): Get WHAT from the THIS frame (functionaly
+   equivalent to THIS->next->unwind->what)
+
+   frame_unwind_WHAT...(): Unwind THIS frame's WHAT from the NEXT
+   frame.
+
+   put_frame_WHAT...(): Put a value into this frame (unsafe, need to
+   invalidate the frame / regcache afterwards) (better name more
+   strongly hinting at its unsafeness)
+
+   safe_....(): Safer version of various functions, doesn't throw an
+   error (leave this for later?).  Returns non-zero if the fetch
+   succeeds.   Return a freshly allocated error message?
+
+   Suffixes:
+
+   void /frame/_WHAT(): Read WHAT's value into the buffer parameter.
+
+   ULONGEST /frame/_WHAT_unsigned(): Return an unsigned value (the
+   alternative is *frame_unsigned_WHAT).
+
+   LONGEST /frame/_WHAT_signed(): Return WHAT signed value.
+
+   What:
+
+   /frame/_memory* (frame, coreaddr, len [, buf]): Extract/return
+   *memory.
+
+   /frame/_register* (frame, regnum [, buf]): extract/return register.
+
+   CORE_ADDR /frame/_{pc,sp,...} (frame): Resume address, innner most
+   stack *address, ...
+
+   */
+
 struct symtab_and_line;
 struct frame_unwind;
 struct frame_base;
@@ -154,6 +195,13 @@
 extern struct frame_info *get_prev_frame (struct frame_info *);
 extern struct frame_info *get_next_frame (struct frame_info *);
 
+/* Given a FRAME, return the true next (more inner, younger) frame.
+   This one exposes the sentinel frame and, hence, never returns NULL.
+   It is here strictly to help old targets in their migration path to
+   the new frame code - the new code requires the NEXT, and not THIS
+   frame.  */
+extern struct frame_info *deprecated_get_next_frame_hack (struct frame_info *);
+
 /* Given a frame's ID, relocate the frame.  Returns NULL if the frame
    is not found.  */
 extern struct frame_info *frame_find_by_id (struct frame_id id);
@@ -296,16 +344,31 @@
 				   CORE_ADDR *addrp, int *realnump,
 				   void *valuep);
 
-/* More convenient interface to frame_register_unwind().  */
-/* NOTE: cagney/2002-09-13: Return void as one day these functions may
-   be changed to return an indication that the read succeeded.  */
+/* Fetch a register from this, or unwind a register from the next
+   frame.  Note that the get_frame methods are wrappers to
+   frame->next->unwind.  They all [potentially] throw an error if the
+   fetch fails.  */
 
 extern void frame_unwind_register (struct frame_info *frame,
 				   int regnum, void *buf);
+extern void get_frame_register (struct frame_info *frame,
+				int regnum, void *buf);
 
+extern LONGEST frame_unwind_register_signed (struct frame_info *frame,
+					     int regnum);
+extern LONGEST get_frame_register_signed (struct frame_info *frame,
+					  int regnum);
+extern ULONGEST frame_unwind_register_unsigned (struct frame_info *frame,
+					       int regnum);
+extern ULONGEST get_frame_register_unsigned (struct frame_info *frame,
+					     int regnum);
+
+
+/* Use frame_unwind_register_signed.  */
 extern void frame_unwind_signed_register (struct frame_info *frame,
 					  int regnum, LONGEST *val);
 
+/* Use frame_unwind_register_signed.  */
 extern void frame_unwind_unsigned_register (struct frame_info *frame,
 					    int regnum, ULONGEST *val);
 
@@ -323,15 +386,24 @@
 /* NOTE: cagney/2002-09-13: Return void as one day these functions may
    be changed to return an indication that the read succeeded.  */
 
+/* Use get_frame_register.  */
 extern void frame_read_register (struct frame_info *frame, int regnum,
 				 void *buf);
 
+/* Use get_frame_register_signed.  */
 extern void frame_read_signed_register (struct frame_info *frame,
 					int regnum, LONGEST *val);
 
+/* Use get_frame_register_unsigned.  */
 extern void frame_read_unsigned_register (struct frame_info *frame,
 					  int regnum, ULONGEST *val);
 
+/* The reverse.  Store a register value relative to the specified
+   frame.  Note: this call makes the frame's state undefined.  The
+   register and frame caches must be flushed.  */
+extern void put_frame_register (struct frame_info *frame, int regnum,
+				const void *buf);
+
 /* Map between a frame register number and its name.  A frame register
    space is a superset of the cooked register space --- it also
    includes builtin registers.  If NAMELEN is negative, use the NAME's
@@ -496,12 +568,6 @@
 /* The DEPRECATED_GET_SAVED_REGISTER architecture interface is
    entirely redundant.  New architectures should implement per-frame
    unwinders (ref "frame-unwind.h").  */
-extern void deprecated_unwind_get_saved_register (char *raw_buffer,
-						  int *optimizedp,
-						  CORE_ADDR *addrp,
-						  struct frame_info *frame,
-						  int regnum,
-						  enum lval_type *lvalp);
 extern void deprecated_generic_get_saved_register (char *, int *, CORE_ADDR *,
 						   struct frame_info *, int,
 						   enum lval_type *);
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index 03d6b99..7918b0c 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -147,16 +147,13 @@
   int char_signed;
   gdbarch_read_pc_ftype *read_pc;
   gdbarch_write_pc_ftype *write_pc;
-  gdbarch_deprecated_target_read_fp_ftype *deprecated_target_read_fp;
   gdbarch_read_sp_ftype *read_sp;
-  gdbarch_deprecated_dummy_write_sp_ftype *deprecated_dummy_write_sp;
   gdbarch_virtual_frame_pointer_ftype *virtual_frame_pointer;
   gdbarch_pseudo_register_read_ftype *pseudo_register_read;
   gdbarch_pseudo_register_write_ftype *pseudo_register_write;
   int num_regs;
   int num_pseudo_regs;
   int sp_regnum;
-  int deprecated_fp_regnum;
   int pc_regnum;
   int ps_regnum;
   int fp0_regnum;
@@ -167,7 +164,6 @@
   gdbarch_sdb_reg_to_regnum_ftype *sdb_reg_to_regnum;
   gdbarch_dwarf2_reg_to_regnum_ftype *dwarf2_reg_to_regnum;
   gdbarch_register_name_ftype *register_name;
-  int deprecated_register_size;
   gdbarch_register_type_ftype *register_type;
   gdbarch_deprecated_register_virtual_type_ftype *deprecated_register_virtual_type;
   int deprecated_register_bytes;
@@ -176,6 +172,28 @@
   gdbarch_deprecated_register_virtual_size_ftype *deprecated_register_virtual_size;
   int deprecated_max_register_raw_size;
   int deprecated_max_register_virtual_size;
+  gdbarch_unwind_dummy_id_ftype *unwind_dummy_id;
+  gdbarch_deprecated_save_dummy_frame_tos_ftype *deprecated_save_dummy_frame_tos;
+  int deprecated_fp_regnum;
+  gdbarch_deprecated_target_read_fp_ftype *deprecated_target_read_fp;
+  gdbarch_push_dummy_call_ftype *push_dummy_call;
+  gdbarch_deprecated_push_arguments_ftype *deprecated_push_arguments;
+  int deprecated_use_generic_dummy_frames;
+  gdbarch_deprecated_push_return_address_ftype *deprecated_push_return_address;
+  gdbarch_deprecated_dummy_write_sp_ftype *deprecated_dummy_write_sp;
+  int deprecated_register_size;
+  int call_dummy_location;
+  gdbarch_call_dummy_address_ftype *call_dummy_address;
+  CORE_ADDR deprecated_call_dummy_start_offset;
+  CORE_ADDR deprecated_call_dummy_breakpoint_offset;
+  int deprecated_call_dummy_length;
+  LONGEST * deprecated_call_dummy_words;
+  int deprecated_sizeof_call_dummy_words;
+  int deprecated_call_dummy_stack_adjust;
+  gdbarch_deprecated_fix_call_dummy_ftype *deprecated_fix_call_dummy;
+  gdbarch_push_dummy_code_ftype *push_dummy_code;
+  gdbarch_deprecated_push_dummy_frame_ftype *deprecated_push_dummy_frame;
+  int deprecated_extra_stack_alignment_needed;
   gdbarch_deprecated_do_registers_info_ftype *deprecated_do_registers_info;
   gdbarch_print_registers_info_ftype *print_registers_info;
   gdbarch_print_float_info_ftype *print_float_info;
@@ -185,18 +203,7 @@
   gdbarch_cannot_fetch_register_ftype *cannot_fetch_register;
   gdbarch_cannot_store_register_ftype *cannot_store_register;
   gdbarch_get_longjmp_target_ftype *get_longjmp_target;
-  int deprecated_use_generic_dummy_frames;
-  int call_dummy_location;
-  gdbarch_call_dummy_address_ftype *call_dummy_address;
-  CORE_ADDR deprecated_call_dummy_start_offset;
-  CORE_ADDR deprecated_call_dummy_breakpoint_offset;
-  int deprecated_call_dummy_length;
   gdbarch_deprecated_pc_in_call_dummy_ftype *deprecated_pc_in_call_dummy;
-  LONGEST * deprecated_call_dummy_words;
-  int deprecated_sizeof_call_dummy_words;
-  int deprecated_call_dummy_stack_adjust;
-  gdbarch_deprecated_fix_call_dummy_ftype *deprecated_fix_call_dummy;
-  gdbarch_push_dummy_code_ftype *push_dummy_code;
   gdbarch_deprecated_init_frame_pc_first_ftype *deprecated_init_frame_pc_first;
   gdbarch_deprecated_init_frame_pc_ftype *deprecated_init_frame_pc;
   int believe_pcc_promotion;
@@ -212,10 +219,6 @@
   gdbarch_address_to_pointer_ftype *address_to_pointer;
   gdbarch_integer_to_address_ftype *integer_to_address;
   gdbarch_return_value_on_stack_ftype *return_value_on_stack;
-  gdbarch_deprecated_push_arguments_ftype *deprecated_push_arguments;
-  gdbarch_push_dummy_call_ftype *push_dummy_call;
-  gdbarch_deprecated_push_dummy_frame_ftype *deprecated_push_dummy_frame;
-  gdbarch_deprecated_push_return_address_ftype *deprecated_push_return_address;
   gdbarch_deprecated_pop_frame_ftype *deprecated_pop_frame;
   gdbarch_deprecated_store_struct_return_ftype *deprecated_store_struct_return;
   gdbarch_extract_return_value_ftype *extract_return_value;
@@ -234,7 +237,6 @@
   gdbarch_memory_insert_breakpoint_ftype *memory_insert_breakpoint;
   gdbarch_memory_remove_breakpoint_ftype *memory_remove_breakpoint;
   CORE_ADDR decr_pc_after_break;
-  gdbarch_prepare_to_proceed_ftype *prepare_to_proceed;
   CORE_ADDR function_start_offset;
   gdbarch_remote_translate_xfer_address_ftype *remote_translate_xfer_address;
   CORE_ADDR frame_args_skip;
@@ -250,10 +252,7 @@
   gdbarch_frame_num_args_ftype *frame_num_args;
   gdbarch_stack_align_ftype *stack_align;
   gdbarch_frame_align_ftype *frame_align;
-  int deprecated_extra_stack_alignment_needed;
   gdbarch_reg_struct_has_addr_ftype *reg_struct_has_addr;
-  gdbarch_save_dummy_frame_tos_ftype *save_dummy_frame_tos;
-  gdbarch_unwind_dummy_id_ftype *unwind_dummy_id;
   int parm_boundary;
   const struct floatformat * float_format;
   const struct floatformat * double_format;
@@ -315,16 +314,13 @@
   1,  /* char_signed */
   0,  /* read_pc */
   0,  /* write_pc */
-  0,  /* deprecated_target_read_fp */
   0,  /* read_sp */
-  0,  /* deprecated_dummy_write_sp */
   0,  /* virtual_frame_pointer */
   0,  /* pseudo_register_read */
   0,  /* pseudo_register_write */
   0,  /* num_regs */
   0,  /* num_pseudo_regs */
   -1,  /* sp_regnum */
-  -1,  /* deprecated_fp_regnum */
   -1,  /* pc_regnum */
   -1,  /* ps_regnum */
   0,  /* fp0_regnum */
@@ -335,7 +331,6 @@
   0,  /* sdb_reg_to_regnum */
   0,  /* dwarf2_reg_to_regnum */
   0,  /* register_name */
-  0,  /* deprecated_register_size */
   0,  /* register_type */
   0,  /* deprecated_register_virtual_type */
   0,  /* deprecated_register_bytes */
@@ -344,6 +339,28 @@
   generic_register_size,  /* deprecated_register_virtual_size */
   0,  /* deprecated_max_register_raw_size */
   0,  /* deprecated_max_register_virtual_size */
+  0,  /* unwind_dummy_id */
+  0,  /* deprecated_save_dummy_frame_tos */
+  -1,  /* deprecated_fp_regnum */
+  0,  /* deprecated_target_read_fp */
+  0,  /* push_dummy_call */
+  0,  /* deprecated_push_arguments */
+  0,  /* deprecated_use_generic_dummy_frames */
+  0,  /* deprecated_push_return_address */
+  0,  /* deprecated_dummy_write_sp */
+  0,  /* deprecated_register_size */
+  0,  /* call_dummy_location */
+  0,  /* call_dummy_address */
+  0,  /* deprecated_call_dummy_start_offset */
+  0,  /* deprecated_call_dummy_breakpoint_offset */
+  0,  /* deprecated_call_dummy_length */
+  0,  /* deprecated_call_dummy_words */
+  0,  /* deprecated_sizeof_call_dummy_words */
+  0,  /* deprecated_call_dummy_stack_adjust */
+  0,  /* deprecated_fix_call_dummy */
+  0,  /* push_dummy_code */
+  0,  /* deprecated_push_dummy_frame */
+  0,  /* deprecated_extra_stack_alignment_needed */
   0,  /* deprecated_do_registers_info */
   default_print_registers_info,  /* print_registers_info */
   0,  /* print_float_info */
@@ -353,18 +370,7 @@
   0,  /* cannot_fetch_register */
   0,  /* cannot_store_register */
   0,  /* get_longjmp_target */
-  0,  /* deprecated_use_generic_dummy_frames */
-  0,  /* call_dummy_location */
-  0,  /* call_dummy_address */
-  0,  /* deprecated_call_dummy_start_offset */
-  0,  /* deprecated_call_dummy_breakpoint_offset */
-  0,  /* deprecated_call_dummy_length */
   generic_pc_in_call_dummy,  /* deprecated_pc_in_call_dummy */
-  0,  /* deprecated_call_dummy_words */
-  0,  /* deprecated_sizeof_call_dummy_words */
-  0,  /* deprecated_call_dummy_stack_adjust */
-  0,  /* deprecated_fix_call_dummy */
-  0,  /* push_dummy_code */
   0,  /* deprecated_init_frame_pc_first */
   0,  /* deprecated_init_frame_pc */
   0,  /* believe_pcc_promotion */
@@ -380,10 +386,6 @@
   0,  /* address_to_pointer */
   0,  /* integer_to_address */
   0,  /* return_value_on_stack */
-  0,  /* deprecated_push_arguments */
-  0,  /* push_dummy_call */
-  0,  /* deprecated_push_dummy_frame */
-  0,  /* deprecated_push_return_address */
   0,  /* deprecated_pop_frame */
   0,  /* deprecated_store_struct_return */
   0,  /* extract_return_value */
@@ -402,7 +404,6 @@
   0,  /* memory_insert_breakpoint */
   0,  /* memory_remove_breakpoint */
   0,  /* decr_pc_after_break */
-  0,  /* prepare_to_proceed */
   0,  /* function_start_offset */
   generic_remote_translate_xfer_address,  /* remote_translate_xfer_address */
   0,  /* frame_args_skip */
@@ -418,10 +419,7 @@
   0,  /* frame_num_args */
   0,  /* stack_align */
   0,  /* frame_align */
-  0,  /* deprecated_extra_stack_alignment_needed */
   0,  /* reg_struct_has_addr */
-  0,  /* save_dummy_frame_tos */
-  0,  /* unwind_dummy_id */
   0,  /* parm_boundary */
   0,  /* float_format */
   0,  /* double_format */
@@ -507,7 +505,6 @@
   current_gdbarch->virtual_frame_pointer = legacy_virtual_frame_pointer;
   current_gdbarch->num_regs = -1;
   current_gdbarch->sp_regnum = -1;
-  current_gdbarch->deprecated_fp_regnum = -1;
   current_gdbarch->pc_regnum = -1;
   current_gdbarch->ps_regnum = -1;
   current_gdbarch->fp0_regnum = -1;
@@ -521,16 +518,17 @@
   current_gdbarch->deprecated_register_byte = generic_register_byte;
   current_gdbarch->deprecated_register_raw_size = generic_register_size;
   current_gdbarch->deprecated_register_virtual_size = generic_register_size;
+  current_gdbarch->deprecated_fp_regnum = -1;
+  current_gdbarch->deprecated_use_generic_dummy_frames = 1;
+  current_gdbarch->call_dummy_location = AT_ENTRY_POINT;
+  current_gdbarch->call_dummy_address = entry_point_address;
+  current_gdbarch->deprecated_call_dummy_words = legacy_call_dummy_words;
+  current_gdbarch->deprecated_sizeof_call_dummy_words = legacy_sizeof_call_dummy_words;
   current_gdbarch->print_registers_info = default_print_registers_info;
   current_gdbarch->register_sim_regno = legacy_register_sim_regno;
   current_gdbarch->cannot_fetch_register = cannot_register_not;
   current_gdbarch->cannot_store_register = cannot_register_not;
-  current_gdbarch->deprecated_use_generic_dummy_frames = 1;
-  current_gdbarch->call_dummy_location = AT_ENTRY_POINT;
-  current_gdbarch->call_dummy_address = entry_point_address;
   current_gdbarch->deprecated_pc_in_call_dummy = generic_pc_in_call_dummy;
-  current_gdbarch->deprecated_call_dummy_words = legacy_call_dummy_words;
-  current_gdbarch->deprecated_sizeof_call_dummy_words = legacy_sizeof_call_dummy_words;
   current_gdbarch->deprecated_register_convertible = deprecated_register_convertible_not;
   current_gdbarch->convert_register_p = legacy_convert_register_p;
   current_gdbarch->register_to_value = legacy_register_to_value;
@@ -545,7 +543,6 @@
   current_gdbarch->memory_insert_breakpoint = default_memory_insert_breakpoint;
   current_gdbarch->memory_remove_breakpoint = default_memory_remove_breakpoint;
   current_gdbarch->decr_pc_after_break = -1;
-  current_gdbarch->prepare_to_proceed = default_prepare_to_proceed;
   current_gdbarch->function_start_offset = -1;
   current_gdbarch->remote_translate_xfer_address = generic_remote_translate_xfer_address;
   current_gdbarch->frame_args_skip = -1;
@@ -622,9 +619,7 @@
     gdbarch->char_signed = 1;
   /* Skip verify of read_pc, has predicate */
   /* Skip verify of write_pc, invalid_p == 0 */
-  /* Skip verify of deprecated_target_read_fp, has predicate */
   /* Skip verify of read_sp, has predicate */
-  /* Skip verify of deprecated_dummy_write_sp, has predicate */
   /* Skip verify of virtual_frame_pointer, invalid_p == 0 */
   /* Skip verify of pseudo_register_read, has predicate */
   /* Skip verify of pseudo_register_write, has predicate */
@@ -633,7 +628,6 @@
     fprintf_unfiltered (log, "\n\tnum_regs");
   /* Skip verify of num_pseudo_regs, invalid_p == 0 */
   /* Skip verify of sp_regnum, invalid_p == 0 */
-  /* Skip verify of deprecated_fp_regnum, invalid_p == 0 */
   /* Skip verify of pc_regnum, invalid_p == 0 */
   /* Skip verify of ps_regnum, invalid_p == 0 */
   /* Skip verify of fp0_regnum, invalid_p == 0 */
@@ -651,6 +645,24 @@
   /* Skip verify of deprecated_register_virtual_size, invalid_p == 0 */
   /* Skip verify of deprecated_max_register_raw_size, has predicate */
   /* Skip verify of deprecated_max_register_virtual_size, has predicate */
+  /* Skip verify of unwind_dummy_id, has predicate */
+  /* Skip verify of deprecated_save_dummy_frame_tos, has predicate */
+  /* Skip verify of deprecated_fp_regnum, invalid_p == 0 */
+  /* Skip verify of deprecated_target_read_fp, has predicate */
+  /* Skip verify of push_dummy_call, has predicate */
+  /* Skip verify of deprecated_push_arguments, has predicate */
+  /* Skip verify of deprecated_use_generic_dummy_frames, invalid_p == 0 */
+  /* Skip verify of deprecated_push_return_address, has predicate */
+  /* Skip verify of deprecated_dummy_write_sp, has predicate */
+  /* Skip verify of call_dummy_location, invalid_p == 0 */
+  /* Skip verify of call_dummy_address, invalid_p == 0 */
+  /* Skip verify of deprecated_call_dummy_words, invalid_p == 0 */
+  /* Skip verify of deprecated_sizeof_call_dummy_words, invalid_p == 0 */
+  /* Skip verify of deprecated_call_dummy_stack_adjust, has predicate */
+  /* Skip verify of deprecated_fix_call_dummy, has predicate */
+  /* Skip verify of push_dummy_code, has predicate */
+  /* Skip verify of deprecated_push_dummy_frame, has predicate */
+  /* Skip verify of deprecated_extra_stack_alignment_needed, invalid_p == 0 */
   /* Skip verify of deprecated_do_registers_info, has predicate */
   /* Skip verify of print_registers_info, invalid_p == 0 */
   /* Skip verify of print_float_info, has predicate */
@@ -660,15 +672,7 @@
   /* Skip verify of cannot_fetch_register, invalid_p == 0 */
   /* Skip verify of cannot_store_register, invalid_p == 0 */
   /* Skip verify of get_longjmp_target, has predicate */
-  /* Skip verify of deprecated_use_generic_dummy_frames, invalid_p == 0 */
-  /* Skip verify of call_dummy_location, invalid_p == 0 */
-  /* Skip verify of call_dummy_address, invalid_p == 0 */
   /* Skip verify of deprecated_pc_in_call_dummy, has predicate */
-  /* Skip verify of deprecated_call_dummy_words, invalid_p == 0 */
-  /* Skip verify of deprecated_sizeof_call_dummy_words, invalid_p == 0 */
-  /* Skip verify of deprecated_call_dummy_stack_adjust, has predicate */
-  /* Skip verify of deprecated_fix_call_dummy, has predicate */
-  /* Skip verify of push_dummy_code, has predicate */
   /* Skip verify of deprecated_init_frame_pc_first, has predicate */
   /* Skip verify of deprecated_init_frame_pc, has predicate */
   /* Skip verify of deprecated_get_saved_register, has predicate */
@@ -682,10 +686,6 @@
   /* Skip verify of address_to_pointer, invalid_p == 0 */
   /* Skip verify of integer_to_address, has predicate */
   /* Skip verify of return_value_on_stack, invalid_p == 0 */
-  /* Skip verify of deprecated_push_arguments, has predicate */
-  /* Skip verify of push_dummy_call, has predicate */
-  /* Skip verify of deprecated_push_dummy_frame, has predicate */
-  /* Skip verify of deprecated_push_return_address, has predicate */
   /* Skip verify of deprecated_pop_frame, has predicate */
   /* Skip verify of deprecated_store_struct_return, has predicate */
   /* Skip verify of extract_return_value, invalid_p == 0 */
@@ -710,7 +710,6 @@
   if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
       && (gdbarch->decr_pc_after_break == -1))
     fprintf_unfiltered (log, "\n\tdecr_pc_after_break");
-  /* Skip verify of prepare_to_proceed, invalid_p == 0 */
   if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
       && (gdbarch->function_start_offset == -1))
     fprintf_unfiltered (log, "\n\tfunction_start_offset");
@@ -730,10 +729,7 @@
   /* Skip verify of frame_num_args, has predicate */
   /* Skip verify of stack_align, has predicate */
   /* Skip verify of frame_align, has predicate */
-  /* Skip verify of deprecated_extra_stack_alignment_needed, invalid_p == 0 */
   /* Skip verify of reg_struct_has_addr, has predicate */
-  /* Skip verify of save_dummy_frame_tos, has predicate */
-  /* Skip verify of unwind_dummy_id, has predicate */
   if (gdbarch->float_format == 0)
     gdbarch->float_format = default_float_format (gdbarch);
   if (gdbarch->double_format == 0)
@@ -989,8 +985,8 @@
 #ifdef CONVERT_REGISTER_P
   fprintf_unfiltered (file,
                       "gdbarch_dump: %s # %s\n",
-                      "CONVERT_REGISTER_P(regnum)",
-                      XSTRING (CONVERT_REGISTER_P (regnum)));
+                      "CONVERT_REGISTER_P(regnum, type)",
+                      XSTRING (CONVERT_REGISTER_P (regnum, type)));
   if (GDB_MULTI_ARCH)
     fprintf_unfiltered (file,
                         "gdbarch_dump: CONVERT_REGISTER_P = <0x%08lx>\n",
@@ -1557,6 +1553,29 @@
                         (long) current_gdbarch->deprecated_saved_pc_after_call
                         /*DEPRECATED_SAVED_PC_AFTER_CALL ()*/);
 #endif
+#ifdef DEPRECATED_SAVE_DUMMY_FRAME_TOS_P
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "DEPRECATED_SAVE_DUMMY_FRAME_TOS_P()",
+                      XSTRING (DEPRECATED_SAVE_DUMMY_FRAME_TOS_P ()));
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: DEPRECATED_SAVE_DUMMY_FRAME_TOS_P() = %d\n",
+                      DEPRECATED_SAVE_DUMMY_FRAME_TOS_P ());
+#endif
+#ifdef DEPRECATED_SAVE_DUMMY_FRAME_TOS
+#if GDB_MULTI_ARCH
+  /* Macro might contain `[{}]' when not multi-arch */
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "DEPRECATED_SAVE_DUMMY_FRAME_TOS(sp)",
+                      XSTRING (DEPRECATED_SAVE_DUMMY_FRAME_TOS (sp)));
+#endif
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: DEPRECATED_SAVE_DUMMY_FRAME_TOS = <0x%08lx>\n",
+                        (long) current_gdbarch->deprecated_save_dummy_frame_tos
+                        /*DEPRECATED_SAVE_DUMMY_FRAME_TOS ()*/);
+#endif
 #ifdef DEPRECATED_SIZEOF_CALL_DUMMY_WORDS
   fprintf_unfiltered (file,
                       "gdbarch_dump: DEPRECATED_SIZEOF_CALL_DUMMY_WORDS # %s\n",
@@ -2004,17 +2023,6 @@
                         (long) current_gdbarch->pointer_to_address
                         /*POINTER_TO_ADDRESS ()*/);
 #endif
-#ifdef PREPARE_TO_PROCEED
-  fprintf_unfiltered (file,
-                      "gdbarch_dump: %s # %s\n",
-                      "PREPARE_TO_PROCEED(select_it)",
-                      XSTRING (PREPARE_TO_PROCEED (select_it)));
-  if (GDB_MULTI_ARCH)
-    fprintf_unfiltered (file,
-                        "gdbarch_dump: PREPARE_TO_PROCEED = <0x%08lx>\n",
-                        (long) current_gdbarch->prepare_to_proceed
-                        /*PREPARE_TO_PROCEED ()*/);
-#endif
   if (GDB_MULTI_ARCH)
     fprintf_unfiltered (file,
                         "gdbarch_dump: gdbarch_print_float_info_p() = %d\n",
@@ -2148,8 +2156,8 @@
   /* Macro might contain `[{}]' when not multi-arch */
   fprintf_unfiltered (file,
                       "gdbarch_dump: %s # %s\n",
-                      "REGISTER_TO_VALUE(regnum, type, from, to)",
-                      XSTRING (REGISTER_TO_VALUE (regnum, type, from, to)));
+                      "REGISTER_TO_VALUE(frame, regnum, type, buf)",
+                      XSTRING (REGISTER_TO_VALUE (frame, regnum, type, buf)));
 #endif
   if (GDB_MULTI_ARCH)
     fprintf_unfiltered (file,
@@ -2231,29 +2239,6 @@
                         (long) current_gdbarch->return_value_on_stack
                         /*RETURN_VALUE_ON_STACK ()*/);
 #endif
-#ifdef SAVE_DUMMY_FRAME_TOS_P
-  fprintf_unfiltered (file,
-                      "gdbarch_dump: %s # %s\n",
-                      "SAVE_DUMMY_FRAME_TOS_P()",
-                      XSTRING (SAVE_DUMMY_FRAME_TOS_P ()));
-  fprintf_unfiltered (file,
-                      "gdbarch_dump: SAVE_DUMMY_FRAME_TOS_P() = %d\n",
-                      SAVE_DUMMY_FRAME_TOS_P ());
-#endif
-#ifdef SAVE_DUMMY_FRAME_TOS
-#if GDB_MULTI_ARCH
-  /* Macro might contain `[{}]' when not multi-arch */
-  fprintf_unfiltered (file,
-                      "gdbarch_dump: %s # %s\n",
-                      "SAVE_DUMMY_FRAME_TOS(sp)",
-                      XSTRING (SAVE_DUMMY_FRAME_TOS (sp)));
-#endif
-  if (GDB_MULTI_ARCH)
-    fprintf_unfiltered (file,
-                        "gdbarch_dump: SAVE_DUMMY_FRAME_TOS = <0x%08lx>\n",
-                        (long) current_gdbarch->save_dummy_frame_tos
-                        /*SAVE_DUMMY_FRAME_TOS ()*/);
-#endif
 #ifdef SDB_REG_TO_REGNUM
   fprintf_unfiltered (file,
                       "gdbarch_dump: %s # %s\n",
@@ -2670,8 +2655,8 @@
   /* Macro might contain `[{}]' when not multi-arch */
   fprintf_unfiltered (file,
                       "gdbarch_dump: %s # %s\n",
-                      "VALUE_TO_REGISTER(type, regnum, from, to)",
-                      XSTRING (VALUE_TO_REGISTER (type, regnum, from, to)));
+                      "VALUE_TO_REGISTER(frame, regnum, type, buf)",
+                      XSTRING (VALUE_TO_REGISTER (frame, regnum, type, buf)));
 #endif
   if (GDB_MULTI_ARCH)
     fprintf_unfiltered (file,
@@ -2956,32 +2941,6 @@
 }
 
 int
-gdbarch_deprecated_target_read_fp_p (struct gdbarch *gdbarch)
-{
-  gdb_assert (gdbarch != NULL);
-  return gdbarch->deprecated_target_read_fp != 0;
-}
-
-CORE_ADDR
-gdbarch_deprecated_target_read_fp (struct gdbarch *gdbarch)
-{
-  gdb_assert (gdbarch != NULL);
-  if (gdbarch->deprecated_target_read_fp == 0)
-    internal_error (__FILE__, __LINE__,
-                    "gdbarch: gdbarch_deprecated_target_read_fp invalid");
-  if (gdbarch_debug >= 2)
-    fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_target_read_fp called\n");
-  return gdbarch->deprecated_target_read_fp ();
-}
-
-void
-set_gdbarch_deprecated_target_read_fp (struct gdbarch *gdbarch,
-                                       gdbarch_deprecated_target_read_fp_ftype deprecated_target_read_fp)
-{
-  gdbarch->deprecated_target_read_fp = deprecated_target_read_fp;
-}
-
-int
 gdbarch_read_sp_p (struct gdbarch *gdbarch)
 {
   gdb_assert (gdbarch != NULL);
@@ -3007,32 +2966,6 @@
   gdbarch->read_sp = read_sp;
 }
 
-int
-gdbarch_deprecated_dummy_write_sp_p (struct gdbarch *gdbarch)
-{
-  gdb_assert (gdbarch != NULL);
-  return gdbarch->deprecated_dummy_write_sp != 0;
-}
-
-void
-gdbarch_deprecated_dummy_write_sp (struct gdbarch *gdbarch, CORE_ADDR val)
-{
-  gdb_assert (gdbarch != NULL);
-  if (gdbarch->deprecated_dummy_write_sp == 0)
-    internal_error (__FILE__, __LINE__,
-                    "gdbarch: gdbarch_deprecated_dummy_write_sp invalid");
-  if (gdbarch_debug >= 2)
-    fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_dummy_write_sp called\n");
-  gdbarch->deprecated_dummy_write_sp (val);
-}
-
-void
-set_gdbarch_deprecated_dummy_write_sp (struct gdbarch *gdbarch,
-                                       gdbarch_deprecated_dummy_write_sp_ftype deprecated_dummy_write_sp)
-{
-  gdbarch->deprecated_dummy_write_sp = deprecated_dummy_write_sp;
-}
-
 void
 gdbarch_virtual_frame_pointer (struct gdbarch *gdbarch, CORE_ADDR pc, int *frame_regnum, LONGEST *frame_offset)
 {
@@ -3158,23 +3091,6 @@
 }
 
 int
-gdbarch_deprecated_fp_regnum (struct gdbarch *gdbarch)
-{
-  gdb_assert (gdbarch != NULL);
-  /* Skip verify of deprecated_fp_regnum, invalid_p == 0 */
-  if (gdbarch_debug >= 2)
-    fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_fp_regnum called\n");
-  return gdbarch->deprecated_fp_regnum;
-}
-
-void
-set_gdbarch_deprecated_fp_regnum (struct gdbarch *gdbarch,
-                                  int deprecated_fp_regnum)
-{
-  gdbarch->deprecated_fp_regnum = deprecated_fp_regnum;
-}
-
-int
 gdbarch_pc_regnum (struct gdbarch *gdbarch)
 {
   gdb_assert (gdbarch != NULL);
@@ -3357,22 +3273,6 @@
 }
 
 int
-gdbarch_deprecated_register_size (struct gdbarch *gdbarch)
-{
-  gdb_assert (gdbarch != NULL);
-  if (gdbarch_debug >= 2)
-    fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_register_size called\n");
-  return gdbarch->deprecated_register_size;
-}
-
-void
-set_gdbarch_deprecated_register_size (struct gdbarch *gdbarch,
-                                      int deprecated_register_size)
-{
-  gdbarch->deprecated_register_size = deprecated_register_size;
-}
-
-int
 gdbarch_register_type_p (struct gdbarch *gdbarch)
 {
   gdb_assert (gdbarch != NULL);
@@ -3552,6 +3452,474 @@
 }
 
 int
+gdbarch_unwind_dummy_id_p (struct gdbarch *gdbarch)
+{
+  gdb_assert (gdbarch != NULL);
+  return gdbarch->unwind_dummy_id != 0;
+}
+
+struct frame_id
+gdbarch_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *info)
+{
+  gdb_assert (gdbarch != NULL);
+  if (gdbarch->unwind_dummy_id == 0)
+    internal_error (__FILE__, __LINE__,
+                    "gdbarch: gdbarch_unwind_dummy_id invalid");
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_unwind_dummy_id called\n");
+  return gdbarch->unwind_dummy_id (gdbarch, info);
+}
+
+void
+set_gdbarch_unwind_dummy_id (struct gdbarch *gdbarch,
+                             gdbarch_unwind_dummy_id_ftype unwind_dummy_id)
+{
+  gdbarch->unwind_dummy_id = unwind_dummy_id;
+}
+
+int
+gdbarch_deprecated_save_dummy_frame_tos_p (struct gdbarch *gdbarch)
+{
+  gdb_assert (gdbarch != NULL);
+  return gdbarch->deprecated_save_dummy_frame_tos != 0;
+}
+
+void
+gdbarch_deprecated_save_dummy_frame_tos (struct gdbarch *gdbarch, CORE_ADDR sp)
+{
+  gdb_assert (gdbarch != NULL);
+  if (gdbarch->deprecated_save_dummy_frame_tos == 0)
+    internal_error (__FILE__, __LINE__,
+                    "gdbarch: gdbarch_deprecated_save_dummy_frame_tos invalid");
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_save_dummy_frame_tos called\n");
+  gdbarch->deprecated_save_dummy_frame_tos (sp);
+}
+
+void
+set_gdbarch_deprecated_save_dummy_frame_tos (struct gdbarch *gdbarch,
+                                             gdbarch_deprecated_save_dummy_frame_tos_ftype deprecated_save_dummy_frame_tos)
+{
+  gdbarch->deprecated_save_dummy_frame_tos = deprecated_save_dummy_frame_tos;
+}
+
+int
+gdbarch_deprecated_fp_regnum (struct gdbarch *gdbarch)
+{
+  gdb_assert (gdbarch != NULL);
+  /* Skip verify of deprecated_fp_regnum, invalid_p == 0 */
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_fp_regnum called\n");
+  return gdbarch->deprecated_fp_regnum;
+}
+
+void
+set_gdbarch_deprecated_fp_regnum (struct gdbarch *gdbarch,
+                                  int deprecated_fp_regnum)
+{
+  gdbarch->deprecated_fp_regnum = deprecated_fp_regnum;
+}
+
+int
+gdbarch_deprecated_target_read_fp_p (struct gdbarch *gdbarch)
+{
+  gdb_assert (gdbarch != NULL);
+  return gdbarch->deprecated_target_read_fp != 0;
+}
+
+CORE_ADDR
+gdbarch_deprecated_target_read_fp (struct gdbarch *gdbarch)
+{
+  gdb_assert (gdbarch != NULL);
+  if (gdbarch->deprecated_target_read_fp == 0)
+    internal_error (__FILE__, __LINE__,
+                    "gdbarch: gdbarch_deprecated_target_read_fp invalid");
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_target_read_fp called\n");
+  return gdbarch->deprecated_target_read_fp ();
+}
+
+void
+set_gdbarch_deprecated_target_read_fp (struct gdbarch *gdbarch,
+                                       gdbarch_deprecated_target_read_fp_ftype deprecated_target_read_fp)
+{
+  gdbarch->deprecated_target_read_fp = deprecated_target_read_fp;
+}
+
+int
+gdbarch_push_dummy_call_p (struct gdbarch *gdbarch)
+{
+  gdb_assert (gdbarch != NULL);
+  return gdbarch->push_dummy_call != 0;
+}
+
+CORE_ADDR
+gdbarch_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, struct regcache *regcache, CORE_ADDR bp_addr, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr)
+{
+  gdb_assert (gdbarch != NULL);
+  if (gdbarch->push_dummy_call == 0)
+    internal_error (__FILE__, __LINE__,
+                    "gdbarch: gdbarch_push_dummy_call invalid");
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_push_dummy_call called\n");
+  return gdbarch->push_dummy_call (gdbarch, func_addr, regcache, bp_addr, nargs, args, sp, struct_return, struct_addr);
+}
+
+void
+set_gdbarch_push_dummy_call (struct gdbarch *gdbarch,
+                             gdbarch_push_dummy_call_ftype push_dummy_call)
+{
+  gdbarch->push_dummy_call = push_dummy_call;
+}
+
+int
+gdbarch_deprecated_push_arguments_p (struct gdbarch *gdbarch)
+{
+  gdb_assert (gdbarch != NULL);
+  return gdbarch->deprecated_push_arguments != 0;
+}
+
+CORE_ADDR
+gdbarch_deprecated_push_arguments (struct gdbarch *gdbarch, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr)
+{
+  gdb_assert (gdbarch != NULL);
+  if (gdbarch->deprecated_push_arguments == 0)
+    internal_error (__FILE__, __LINE__,
+                    "gdbarch: gdbarch_deprecated_push_arguments invalid");
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_push_arguments called\n");
+  return gdbarch->deprecated_push_arguments (nargs, args, sp, struct_return, struct_addr);
+}
+
+void
+set_gdbarch_deprecated_push_arguments (struct gdbarch *gdbarch,
+                                       gdbarch_deprecated_push_arguments_ftype deprecated_push_arguments)
+{
+  gdbarch->deprecated_push_arguments = deprecated_push_arguments;
+}
+
+int
+gdbarch_deprecated_use_generic_dummy_frames (struct gdbarch *gdbarch)
+{
+  gdb_assert (gdbarch != NULL);
+  /* Skip verify of deprecated_use_generic_dummy_frames, invalid_p == 0 */
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_use_generic_dummy_frames called\n");
+  return gdbarch->deprecated_use_generic_dummy_frames;
+}
+
+void
+set_gdbarch_deprecated_use_generic_dummy_frames (struct gdbarch *gdbarch,
+                                                 int deprecated_use_generic_dummy_frames)
+{
+  gdbarch->deprecated_use_generic_dummy_frames = deprecated_use_generic_dummy_frames;
+}
+
+int
+gdbarch_deprecated_push_return_address_p (struct gdbarch *gdbarch)
+{
+  gdb_assert (gdbarch != NULL);
+  return gdbarch->deprecated_push_return_address != 0;
+}
+
+CORE_ADDR
+gdbarch_deprecated_push_return_address (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR sp)
+{
+  gdb_assert (gdbarch != NULL);
+  if (gdbarch->deprecated_push_return_address == 0)
+    internal_error (__FILE__, __LINE__,
+                    "gdbarch: gdbarch_deprecated_push_return_address invalid");
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_push_return_address called\n");
+  return gdbarch->deprecated_push_return_address (pc, sp);
+}
+
+void
+set_gdbarch_deprecated_push_return_address (struct gdbarch *gdbarch,
+                                            gdbarch_deprecated_push_return_address_ftype deprecated_push_return_address)
+{
+  gdbarch->deprecated_push_return_address = deprecated_push_return_address;
+}
+
+int
+gdbarch_deprecated_dummy_write_sp_p (struct gdbarch *gdbarch)
+{
+  gdb_assert (gdbarch != NULL);
+  return gdbarch->deprecated_dummy_write_sp != 0;
+}
+
+void
+gdbarch_deprecated_dummy_write_sp (struct gdbarch *gdbarch, CORE_ADDR val)
+{
+  gdb_assert (gdbarch != NULL);
+  if (gdbarch->deprecated_dummy_write_sp == 0)
+    internal_error (__FILE__, __LINE__,
+                    "gdbarch: gdbarch_deprecated_dummy_write_sp invalid");
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_dummy_write_sp called\n");
+  gdbarch->deprecated_dummy_write_sp (val);
+}
+
+void
+set_gdbarch_deprecated_dummy_write_sp (struct gdbarch *gdbarch,
+                                       gdbarch_deprecated_dummy_write_sp_ftype deprecated_dummy_write_sp)
+{
+  gdbarch->deprecated_dummy_write_sp = deprecated_dummy_write_sp;
+}
+
+int
+gdbarch_deprecated_register_size (struct gdbarch *gdbarch)
+{
+  gdb_assert (gdbarch != NULL);
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_register_size called\n");
+  return gdbarch->deprecated_register_size;
+}
+
+void
+set_gdbarch_deprecated_register_size (struct gdbarch *gdbarch,
+                                      int deprecated_register_size)
+{
+  gdbarch->deprecated_register_size = deprecated_register_size;
+}
+
+int
+gdbarch_call_dummy_location (struct gdbarch *gdbarch)
+{
+  gdb_assert (gdbarch != NULL);
+  /* Skip verify of call_dummy_location, invalid_p == 0 */
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_call_dummy_location called\n");
+  return gdbarch->call_dummy_location;
+}
+
+void
+set_gdbarch_call_dummy_location (struct gdbarch *gdbarch,
+                                 int call_dummy_location)
+{
+  gdbarch->call_dummy_location = call_dummy_location;
+}
+
+CORE_ADDR
+gdbarch_call_dummy_address (struct gdbarch *gdbarch)
+{
+  gdb_assert (gdbarch != NULL);
+  if (gdbarch->call_dummy_address == 0)
+    internal_error (__FILE__, __LINE__,
+                    "gdbarch: gdbarch_call_dummy_address invalid");
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_call_dummy_address called\n");
+  return gdbarch->call_dummy_address ();
+}
+
+void
+set_gdbarch_call_dummy_address (struct gdbarch *gdbarch,
+                                gdbarch_call_dummy_address_ftype call_dummy_address)
+{
+  gdbarch->call_dummy_address = call_dummy_address;
+}
+
+CORE_ADDR
+gdbarch_deprecated_call_dummy_start_offset (struct gdbarch *gdbarch)
+{
+  gdb_assert (gdbarch != NULL);
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_call_dummy_start_offset called\n");
+  return gdbarch->deprecated_call_dummy_start_offset;
+}
+
+void
+set_gdbarch_deprecated_call_dummy_start_offset (struct gdbarch *gdbarch,
+                                                CORE_ADDR deprecated_call_dummy_start_offset)
+{
+  gdbarch->deprecated_call_dummy_start_offset = deprecated_call_dummy_start_offset;
+}
+
+CORE_ADDR
+gdbarch_deprecated_call_dummy_breakpoint_offset (struct gdbarch *gdbarch)
+{
+  gdb_assert (gdbarch != NULL);
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_call_dummy_breakpoint_offset called\n");
+  return gdbarch->deprecated_call_dummy_breakpoint_offset;
+}
+
+void
+set_gdbarch_deprecated_call_dummy_breakpoint_offset (struct gdbarch *gdbarch,
+                                                     CORE_ADDR deprecated_call_dummy_breakpoint_offset)
+{
+  gdbarch->deprecated_call_dummy_breakpoint_offset = deprecated_call_dummy_breakpoint_offset;
+}
+
+int
+gdbarch_deprecated_call_dummy_length (struct gdbarch *gdbarch)
+{
+  gdb_assert (gdbarch != NULL);
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_call_dummy_length called\n");
+  return gdbarch->deprecated_call_dummy_length;
+}
+
+void
+set_gdbarch_deprecated_call_dummy_length (struct gdbarch *gdbarch,
+                                          int deprecated_call_dummy_length)
+{
+  gdbarch->deprecated_call_dummy_length = deprecated_call_dummy_length;
+}
+
+LONGEST *
+gdbarch_deprecated_call_dummy_words (struct gdbarch *gdbarch)
+{
+  gdb_assert (gdbarch != NULL);
+  /* Skip verify of deprecated_call_dummy_words, invalid_p == 0 */
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_call_dummy_words called\n");
+  return gdbarch->deprecated_call_dummy_words;
+}
+
+void
+set_gdbarch_deprecated_call_dummy_words (struct gdbarch *gdbarch,
+                                         LONGEST * deprecated_call_dummy_words)
+{
+  gdbarch->deprecated_call_dummy_words = deprecated_call_dummy_words;
+}
+
+int
+gdbarch_deprecated_sizeof_call_dummy_words (struct gdbarch *gdbarch)
+{
+  gdb_assert (gdbarch != NULL);
+  /* Skip verify of deprecated_sizeof_call_dummy_words, invalid_p == 0 */
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_sizeof_call_dummy_words called\n");
+  return gdbarch->deprecated_sizeof_call_dummy_words;
+}
+
+void
+set_gdbarch_deprecated_sizeof_call_dummy_words (struct gdbarch *gdbarch,
+                                                int deprecated_sizeof_call_dummy_words)
+{
+  gdbarch->deprecated_sizeof_call_dummy_words = deprecated_sizeof_call_dummy_words;
+}
+
+int
+gdbarch_deprecated_call_dummy_stack_adjust_p (struct gdbarch *gdbarch)
+{
+  gdb_assert (gdbarch != NULL);
+  return gdbarch->deprecated_call_dummy_stack_adjust != 0;
+}
+
+int
+gdbarch_deprecated_call_dummy_stack_adjust (struct gdbarch *gdbarch)
+{
+  gdb_assert (gdbarch != NULL);
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_call_dummy_stack_adjust called\n");
+  return gdbarch->deprecated_call_dummy_stack_adjust;
+}
+
+void
+set_gdbarch_deprecated_call_dummy_stack_adjust (struct gdbarch *gdbarch,
+                                                int deprecated_call_dummy_stack_adjust)
+{
+  gdbarch->deprecated_call_dummy_stack_adjust = deprecated_call_dummy_stack_adjust;
+}
+
+int
+gdbarch_deprecated_fix_call_dummy_p (struct gdbarch *gdbarch)
+{
+  gdb_assert (gdbarch != NULL);
+  return gdbarch->deprecated_fix_call_dummy != 0;
+}
+
+void
+gdbarch_deprecated_fix_call_dummy (struct gdbarch *gdbarch, char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs, struct value **args, struct type *type, int gcc_p)
+{
+  gdb_assert (gdbarch != NULL);
+  if (gdbarch->deprecated_fix_call_dummy == 0)
+    internal_error (__FILE__, __LINE__,
+                    "gdbarch: gdbarch_deprecated_fix_call_dummy invalid");
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_fix_call_dummy called\n");
+  gdbarch->deprecated_fix_call_dummy (dummy, pc, fun, nargs, args, type, gcc_p);
+}
+
+void
+set_gdbarch_deprecated_fix_call_dummy (struct gdbarch *gdbarch,
+                                       gdbarch_deprecated_fix_call_dummy_ftype deprecated_fix_call_dummy)
+{
+  gdbarch->deprecated_fix_call_dummy = deprecated_fix_call_dummy;
+}
+
+int
+gdbarch_push_dummy_code_p (struct gdbarch *gdbarch)
+{
+  gdb_assert (gdbarch != NULL);
+  return gdbarch->push_dummy_code != 0;
+}
+
+CORE_ADDR
+gdbarch_push_dummy_code (struct gdbarch *gdbarch, CORE_ADDR sp, CORE_ADDR funaddr, int using_gcc, struct value **args, int nargs, struct type *value_type, CORE_ADDR *real_pc, CORE_ADDR *bp_addr)
+{
+  gdb_assert (gdbarch != NULL);
+  if (gdbarch->push_dummy_code == 0)
+    internal_error (__FILE__, __LINE__,
+                    "gdbarch: gdbarch_push_dummy_code invalid");
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_push_dummy_code called\n");
+  return gdbarch->push_dummy_code (gdbarch, sp, funaddr, using_gcc, args, nargs, value_type, real_pc, bp_addr);
+}
+
+void
+set_gdbarch_push_dummy_code (struct gdbarch *gdbarch,
+                             gdbarch_push_dummy_code_ftype push_dummy_code)
+{
+  gdbarch->push_dummy_code = push_dummy_code;
+}
+
+int
+gdbarch_deprecated_push_dummy_frame_p (struct gdbarch *gdbarch)
+{
+  gdb_assert (gdbarch != NULL);
+  return gdbarch->deprecated_push_dummy_frame != 0;
+}
+
+void
+gdbarch_deprecated_push_dummy_frame (struct gdbarch *gdbarch)
+{
+  gdb_assert (gdbarch != NULL);
+  if (gdbarch->deprecated_push_dummy_frame == 0)
+    internal_error (__FILE__, __LINE__,
+                    "gdbarch: gdbarch_deprecated_push_dummy_frame invalid");
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_push_dummy_frame called\n");
+  gdbarch->deprecated_push_dummy_frame ();
+}
+
+void
+set_gdbarch_deprecated_push_dummy_frame (struct gdbarch *gdbarch,
+                                         gdbarch_deprecated_push_dummy_frame_ftype deprecated_push_dummy_frame)
+{
+  gdbarch->deprecated_push_dummy_frame = deprecated_push_dummy_frame;
+}
+
+int
+gdbarch_deprecated_extra_stack_alignment_needed (struct gdbarch *gdbarch)
+{
+  gdb_assert (gdbarch != NULL);
+  /* Skip verify of deprecated_extra_stack_alignment_needed, invalid_p == 0 */
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_extra_stack_alignment_needed called\n");
+  return gdbarch->deprecated_extra_stack_alignment_needed;
+}
+
+void
+set_gdbarch_deprecated_extra_stack_alignment_needed (struct gdbarch *gdbarch,
+                                                     int deprecated_extra_stack_alignment_needed)
+{
+  gdbarch->deprecated_extra_stack_alignment_needed = deprecated_extra_stack_alignment_needed;
+}
+
+int
 gdbarch_deprecated_do_registers_info_p (struct gdbarch *gdbarch)
 {
   gdb_assert (gdbarch != NULL);
@@ -3758,107 +4126,6 @@
 }
 
 int
-gdbarch_deprecated_use_generic_dummy_frames (struct gdbarch *gdbarch)
-{
-  gdb_assert (gdbarch != NULL);
-  /* Skip verify of deprecated_use_generic_dummy_frames, invalid_p == 0 */
-  if (gdbarch_debug >= 2)
-    fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_use_generic_dummy_frames called\n");
-  return gdbarch->deprecated_use_generic_dummy_frames;
-}
-
-void
-set_gdbarch_deprecated_use_generic_dummy_frames (struct gdbarch *gdbarch,
-                                                 int deprecated_use_generic_dummy_frames)
-{
-  gdbarch->deprecated_use_generic_dummy_frames = deprecated_use_generic_dummy_frames;
-}
-
-int
-gdbarch_call_dummy_location (struct gdbarch *gdbarch)
-{
-  gdb_assert (gdbarch != NULL);
-  /* Skip verify of call_dummy_location, invalid_p == 0 */
-  if (gdbarch_debug >= 2)
-    fprintf_unfiltered (gdb_stdlog, "gdbarch_call_dummy_location called\n");
-  return gdbarch->call_dummy_location;
-}
-
-void
-set_gdbarch_call_dummy_location (struct gdbarch *gdbarch,
-                                 int call_dummy_location)
-{
-  gdbarch->call_dummy_location = call_dummy_location;
-}
-
-CORE_ADDR
-gdbarch_call_dummy_address (struct gdbarch *gdbarch)
-{
-  gdb_assert (gdbarch != NULL);
-  if (gdbarch->call_dummy_address == 0)
-    internal_error (__FILE__, __LINE__,
-                    "gdbarch: gdbarch_call_dummy_address invalid");
-  if (gdbarch_debug >= 2)
-    fprintf_unfiltered (gdb_stdlog, "gdbarch_call_dummy_address called\n");
-  return gdbarch->call_dummy_address ();
-}
-
-void
-set_gdbarch_call_dummy_address (struct gdbarch *gdbarch,
-                                gdbarch_call_dummy_address_ftype call_dummy_address)
-{
-  gdbarch->call_dummy_address = call_dummy_address;
-}
-
-CORE_ADDR
-gdbarch_deprecated_call_dummy_start_offset (struct gdbarch *gdbarch)
-{
-  gdb_assert (gdbarch != NULL);
-  if (gdbarch_debug >= 2)
-    fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_call_dummy_start_offset called\n");
-  return gdbarch->deprecated_call_dummy_start_offset;
-}
-
-void
-set_gdbarch_deprecated_call_dummy_start_offset (struct gdbarch *gdbarch,
-                                                CORE_ADDR deprecated_call_dummy_start_offset)
-{
-  gdbarch->deprecated_call_dummy_start_offset = deprecated_call_dummy_start_offset;
-}
-
-CORE_ADDR
-gdbarch_deprecated_call_dummy_breakpoint_offset (struct gdbarch *gdbarch)
-{
-  gdb_assert (gdbarch != NULL);
-  if (gdbarch_debug >= 2)
-    fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_call_dummy_breakpoint_offset called\n");
-  return gdbarch->deprecated_call_dummy_breakpoint_offset;
-}
-
-void
-set_gdbarch_deprecated_call_dummy_breakpoint_offset (struct gdbarch *gdbarch,
-                                                     CORE_ADDR deprecated_call_dummy_breakpoint_offset)
-{
-  gdbarch->deprecated_call_dummy_breakpoint_offset = deprecated_call_dummy_breakpoint_offset;
-}
-
-int
-gdbarch_deprecated_call_dummy_length (struct gdbarch *gdbarch)
-{
-  gdb_assert (gdbarch != NULL);
-  if (gdbarch_debug >= 2)
-    fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_call_dummy_length called\n");
-  return gdbarch->deprecated_call_dummy_length;
-}
-
-void
-set_gdbarch_deprecated_call_dummy_length (struct gdbarch *gdbarch,
-                                          int deprecated_call_dummy_length)
-{
-  gdbarch->deprecated_call_dummy_length = deprecated_call_dummy_length;
-}
-
-int
 gdbarch_deprecated_pc_in_call_dummy_p (struct gdbarch *gdbarch)
 {
   gdb_assert (gdbarch != NULL);
@@ -3885,115 +4152,6 @@
   gdbarch->deprecated_pc_in_call_dummy = deprecated_pc_in_call_dummy;
 }
 
-LONGEST *
-gdbarch_deprecated_call_dummy_words (struct gdbarch *gdbarch)
-{
-  gdb_assert (gdbarch != NULL);
-  /* Skip verify of deprecated_call_dummy_words, invalid_p == 0 */
-  if (gdbarch_debug >= 2)
-    fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_call_dummy_words called\n");
-  return gdbarch->deprecated_call_dummy_words;
-}
-
-void
-set_gdbarch_deprecated_call_dummy_words (struct gdbarch *gdbarch,
-                                         LONGEST * deprecated_call_dummy_words)
-{
-  gdbarch->deprecated_call_dummy_words = deprecated_call_dummy_words;
-}
-
-int
-gdbarch_deprecated_sizeof_call_dummy_words (struct gdbarch *gdbarch)
-{
-  gdb_assert (gdbarch != NULL);
-  /* Skip verify of deprecated_sizeof_call_dummy_words, invalid_p == 0 */
-  if (gdbarch_debug >= 2)
-    fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_sizeof_call_dummy_words called\n");
-  return gdbarch->deprecated_sizeof_call_dummy_words;
-}
-
-void
-set_gdbarch_deprecated_sizeof_call_dummy_words (struct gdbarch *gdbarch,
-                                                int deprecated_sizeof_call_dummy_words)
-{
-  gdbarch->deprecated_sizeof_call_dummy_words = deprecated_sizeof_call_dummy_words;
-}
-
-int
-gdbarch_deprecated_call_dummy_stack_adjust_p (struct gdbarch *gdbarch)
-{
-  gdb_assert (gdbarch != NULL);
-  return gdbarch->deprecated_call_dummy_stack_adjust != 0;
-}
-
-int
-gdbarch_deprecated_call_dummy_stack_adjust (struct gdbarch *gdbarch)
-{
-  gdb_assert (gdbarch != NULL);
-  if (gdbarch_debug >= 2)
-    fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_call_dummy_stack_adjust called\n");
-  return gdbarch->deprecated_call_dummy_stack_adjust;
-}
-
-void
-set_gdbarch_deprecated_call_dummy_stack_adjust (struct gdbarch *gdbarch,
-                                                int deprecated_call_dummy_stack_adjust)
-{
-  gdbarch->deprecated_call_dummy_stack_adjust = deprecated_call_dummy_stack_adjust;
-}
-
-int
-gdbarch_deprecated_fix_call_dummy_p (struct gdbarch *gdbarch)
-{
-  gdb_assert (gdbarch != NULL);
-  return gdbarch->deprecated_fix_call_dummy != 0;
-}
-
-void
-gdbarch_deprecated_fix_call_dummy (struct gdbarch *gdbarch, char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs, struct value **args, struct type *type, int gcc_p)
-{
-  gdb_assert (gdbarch != NULL);
-  if (gdbarch->deprecated_fix_call_dummy == 0)
-    internal_error (__FILE__, __LINE__,
-                    "gdbarch: gdbarch_deprecated_fix_call_dummy invalid");
-  if (gdbarch_debug >= 2)
-    fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_fix_call_dummy called\n");
-  gdbarch->deprecated_fix_call_dummy (dummy, pc, fun, nargs, args, type, gcc_p);
-}
-
-void
-set_gdbarch_deprecated_fix_call_dummy (struct gdbarch *gdbarch,
-                                       gdbarch_deprecated_fix_call_dummy_ftype deprecated_fix_call_dummy)
-{
-  gdbarch->deprecated_fix_call_dummy = deprecated_fix_call_dummy;
-}
-
-int
-gdbarch_push_dummy_code_p (struct gdbarch *gdbarch)
-{
-  gdb_assert (gdbarch != NULL);
-  return gdbarch->push_dummy_code != 0;
-}
-
-CORE_ADDR
-gdbarch_push_dummy_code (struct gdbarch *gdbarch, CORE_ADDR sp, CORE_ADDR funaddr, int using_gcc, struct value **args, int nargs, struct type *value_type, CORE_ADDR *real_pc, CORE_ADDR *bp_addr)
-{
-  gdb_assert (gdbarch != NULL);
-  if (gdbarch->push_dummy_code == 0)
-    internal_error (__FILE__, __LINE__,
-                    "gdbarch: gdbarch_push_dummy_code invalid");
-  if (gdbarch_debug >= 2)
-    fprintf_unfiltered (gdb_stdlog, "gdbarch_push_dummy_code called\n");
-  return gdbarch->push_dummy_code (gdbarch, sp, funaddr, using_gcc, args, nargs, value_type, real_pc, bp_addr);
-}
-
-void
-set_gdbarch_push_dummy_code (struct gdbarch *gdbarch,
-                             gdbarch_push_dummy_code_ftype push_dummy_code)
-{
-  gdbarch->push_dummy_code = push_dummy_code;
-}
-
 int
 gdbarch_deprecated_init_frame_pc_first_p (struct gdbarch *gdbarch)
 {
@@ -4162,7 +4320,7 @@
 }
 
 int
-gdbarch_convert_register_p (struct gdbarch *gdbarch, int regnum)
+gdbarch_convert_register_p (struct gdbarch *gdbarch, int regnum, struct type *type)
 {
   gdb_assert (gdbarch != NULL);
   if (gdbarch->convert_register_p == 0)
@@ -4170,7 +4328,7 @@
                     "gdbarch: gdbarch_convert_register_p invalid");
   if (gdbarch_debug >= 2)
     fprintf_unfiltered (gdb_stdlog, "gdbarch_convert_register_p called\n");
-  return gdbarch->convert_register_p (regnum);
+  return gdbarch->convert_register_p (regnum, type);
 }
 
 void
@@ -4181,7 +4339,7 @@
 }
 
 void
-gdbarch_register_to_value (struct gdbarch *gdbarch, int regnum, struct type *type, char *from, char *to)
+gdbarch_register_to_value (struct gdbarch *gdbarch, struct frame_info *frame, int regnum, struct type *type, void *buf)
 {
   gdb_assert (gdbarch != NULL);
   if (gdbarch->register_to_value == 0)
@@ -4189,7 +4347,7 @@
                     "gdbarch: gdbarch_register_to_value invalid");
   if (gdbarch_debug >= 2)
     fprintf_unfiltered (gdb_stdlog, "gdbarch_register_to_value called\n");
-  gdbarch->register_to_value (regnum, type, from, to);
+  gdbarch->register_to_value (frame, regnum, type, buf);
 }
 
 void
@@ -4200,7 +4358,7 @@
 }
 
 void
-gdbarch_value_to_register (struct gdbarch *gdbarch, struct type *type, int regnum, char *from, char *to)
+gdbarch_value_to_register (struct gdbarch *gdbarch, struct frame_info *frame, int regnum, struct type *type, const void *buf)
 {
   gdb_assert (gdbarch != NULL);
   if (gdbarch->value_to_register == 0)
@@ -4208,7 +4366,7 @@
                     "gdbarch: gdbarch_value_to_register invalid");
   if (gdbarch_debug >= 2)
     fprintf_unfiltered (gdb_stdlog, "gdbarch_value_to_register called\n");
-  gdbarch->value_to_register (type, regnum, from, to);
+  gdbarch->value_to_register (frame, regnum, type, buf);
 }
 
 void
@@ -4302,110 +4460,6 @@
 }
 
 int
-gdbarch_deprecated_push_arguments_p (struct gdbarch *gdbarch)
-{
-  gdb_assert (gdbarch != NULL);
-  return gdbarch->deprecated_push_arguments != 0;
-}
-
-CORE_ADDR
-gdbarch_deprecated_push_arguments (struct gdbarch *gdbarch, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr)
-{
-  gdb_assert (gdbarch != NULL);
-  if (gdbarch->deprecated_push_arguments == 0)
-    internal_error (__FILE__, __LINE__,
-                    "gdbarch: gdbarch_deprecated_push_arguments invalid");
-  if (gdbarch_debug >= 2)
-    fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_push_arguments called\n");
-  return gdbarch->deprecated_push_arguments (nargs, args, sp, struct_return, struct_addr);
-}
-
-void
-set_gdbarch_deprecated_push_arguments (struct gdbarch *gdbarch,
-                                       gdbarch_deprecated_push_arguments_ftype deprecated_push_arguments)
-{
-  gdbarch->deprecated_push_arguments = deprecated_push_arguments;
-}
-
-int
-gdbarch_push_dummy_call_p (struct gdbarch *gdbarch)
-{
-  gdb_assert (gdbarch != NULL);
-  return gdbarch->push_dummy_call != 0;
-}
-
-CORE_ADDR
-gdbarch_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, struct regcache *regcache, CORE_ADDR bp_addr, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr)
-{
-  gdb_assert (gdbarch != NULL);
-  if (gdbarch->push_dummy_call == 0)
-    internal_error (__FILE__, __LINE__,
-                    "gdbarch: gdbarch_push_dummy_call invalid");
-  if (gdbarch_debug >= 2)
-    fprintf_unfiltered (gdb_stdlog, "gdbarch_push_dummy_call called\n");
-  return gdbarch->push_dummy_call (gdbarch, func_addr, regcache, bp_addr, nargs, args, sp, struct_return, struct_addr);
-}
-
-void
-set_gdbarch_push_dummy_call (struct gdbarch *gdbarch,
-                             gdbarch_push_dummy_call_ftype push_dummy_call)
-{
-  gdbarch->push_dummy_call = push_dummy_call;
-}
-
-int
-gdbarch_deprecated_push_dummy_frame_p (struct gdbarch *gdbarch)
-{
-  gdb_assert (gdbarch != NULL);
-  return gdbarch->deprecated_push_dummy_frame != 0;
-}
-
-void
-gdbarch_deprecated_push_dummy_frame (struct gdbarch *gdbarch)
-{
-  gdb_assert (gdbarch != NULL);
-  if (gdbarch->deprecated_push_dummy_frame == 0)
-    internal_error (__FILE__, __LINE__,
-                    "gdbarch: gdbarch_deprecated_push_dummy_frame invalid");
-  if (gdbarch_debug >= 2)
-    fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_push_dummy_frame called\n");
-  gdbarch->deprecated_push_dummy_frame ();
-}
-
-void
-set_gdbarch_deprecated_push_dummy_frame (struct gdbarch *gdbarch,
-                                         gdbarch_deprecated_push_dummy_frame_ftype deprecated_push_dummy_frame)
-{
-  gdbarch->deprecated_push_dummy_frame = deprecated_push_dummy_frame;
-}
-
-int
-gdbarch_deprecated_push_return_address_p (struct gdbarch *gdbarch)
-{
-  gdb_assert (gdbarch != NULL);
-  return gdbarch->deprecated_push_return_address != 0;
-}
-
-CORE_ADDR
-gdbarch_deprecated_push_return_address (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR sp)
-{
-  gdb_assert (gdbarch != NULL);
-  if (gdbarch->deprecated_push_return_address == 0)
-    internal_error (__FILE__, __LINE__,
-                    "gdbarch: gdbarch_deprecated_push_return_address invalid");
-  if (gdbarch_debug >= 2)
-    fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_push_return_address called\n");
-  return gdbarch->deprecated_push_return_address (pc, sp);
-}
-
-void
-set_gdbarch_deprecated_push_return_address (struct gdbarch *gdbarch,
-                                            gdbarch_deprecated_push_return_address_ftype deprecated_push_return_address)
-{
-  gdbarch->deprecated_push_return_address = deprecated_push_return_address;
-}
-
-int
 gdbarch_deprecated_pop_frame_p (struct gdbarch *gdbarch)
 {
   gdb_assert (gdbarch != NULL);
@@ -4789,25 +4843,6 @@
   gdbarch->decr_pc_after_break = decr_pc_after_break;
 }
 
-int
-gdbarch_prepare_to_proceed (struct gdbarch *gdbarch, int select_it)
-{
-  gdb_assert (gdbarch != NULL);
-  if (gdbarch->prepare_to_proceed == 0)
-    internal_error (__FILE__, __LINE__,
-                    "gdbarch: gdbarch_prepare_to_proceed invalid");
-  if (gdbarch_debug >= 2)
-    fprintf_unfiltered (gdb_stdlog, "gdbarch_prepare_to_proceed called\n");
-  return gdbarch->prepare_to_proceed (select_it);
-}
-
-void
-set_gdbarch_prepare_to_proceed (struct gdbarch *gdbarch,
-                                gdbarch_prepare_to_proceed_ftype prepare_to_proceed)
-{
-  gdbarch->prepare_to_proceed = prepare_to_proceed;
-}
-
 CORE_ADDR
 gdbarch_function_start_offset (struct gdbarch *gdbarch)
 {
@@ -5157,23 +5192,6 @@
 }
 
 int
-gdbarch_deprecated_extra_stack_alignment_needed (struct gdbarch *gdbarch)
-{
-  gdb_assert (gdbarch != NULL);
-  /* Skip verify of deprecated_extra_stack_alignment_needed, invalid_p == 0 */
-  if (gdbarch_debug >= 2)
-    fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_extra_stack_alignment_needed called\n");
-  return gdbarch->deprecated_extra_stack_alignment_needed;
-}
-
-void
-set_gdbarch_deprecated_extra_stack_alignment_needed (struct gdbarch *gdbarch,
-                                                     int deprecated_extra_stack_alignment_needed)
-{
-  gdbarch->deprecated_extra_stack_alignment_needed = deprecated_extra_stack_alignment_needed;
-}
-
-int
 gdbarch_reg_struct_has_addr_p (struct gdbarch *gdbarch)
 {
   gdb_assert (gdbarch != NULL);
@@ -5200,58 +5218,6 @@
 }
 
 int
-gdbarch_save_dummy_frame_tos_p (struct gdbarch *gdbarch)
-{
-  gdb_assert (gdbarch != NULL);
-  return gdbarch->save_dummy_frame_tos != 0;
-}
-
-void
-gdbarch_save_dummy_frame_tos (struct gdbarch *gdbarch, CORE_ADDR sp)
-{
-  gdb_assert (gdbarch != NULL);
-  if (gdbarch->save_dummy_frame_tos == 0)
-    internal_error (__FILE__, __LINE__,
-                    "gdbarch: gdbarch_save_dummy_frame_tos invalid");
-  if (gdbarch_debug >= 2)
-    fprintf_unfiltered (gdb_stdlog, "gdbarch_save_dummy_frame_tos called\n");
-  gdbarch->save_dummy_frame_tos (sp);
-}
-
-void
-set_gdbarch_save_dummy_frame_tos (struct gdbarch *gdbarch,
-                                  gdbarch_save_dummy_frame_tos_ftype save_dummy_frame_tos)
-{
-  gdbarch->save_dummy_frame_tos = save_dummy_frame_tos;
-}
-
-int
-gdbarch_unwind_dummy_id_p (struct gdbarch *gdbarch)
-{
-  gdb_assert (gdbarch != NULL);
-  return gdbarch->unwind_dummy_id != 0;
-}
-
-struct frame_id
-gdbarch_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *info)
-{
-  gdb_assert (gdbarch != NULL);
-  if (gdbarch->unwind_dummy_id == 0)
-    internal_error (__FILE__, __LINE__,
-                    "gdbarch: gdbarch_unwind_dummy_id invalid");
-  if (gdbarch_debug >= 2)
-    fprintf_unfiltered (gdb_stdlog, "gdbarch_unwind_dummy_id called\n");
-  return gdbarch->unwind_dummy_id (gdbarch, info);
-}
-
-void
-set_gdbarch_unwind_dummy_id (struct gdbarch *gdbarch,
-                             gdbarch_unwind_dummy_id_ftype unwind_dummy_id)
-{
-  gdbarch->unwind_dummy_id = unwind_dummy_id;
-}
-
-int
 gdbarch_parm_boundary (struct gdbarch *gdbarch)
 {
   gdb_assert (gdbarch != NULL);
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index 6c0eb3e..a0e09b2 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -333,44 +333,6 @@
 #define TARGET_WRITE_PC(val, ptid) (gdbarch_write_pc (current_gdbarch, val, ptid))
 #endif
 
-/* This is simply not needed.  See value_of_builtin_frame_fp_reg and
-   call_function_by_hand. */
-
-#if defined (DEPRECATED_TARGET_READ_FP)
-/* Legacy for systems yet to multi-arch DEPRECATED_TARGET_READ_FP */
-#if !defined (DEPRECATED_TARGET_READ_FP_P)
-#define DEPRECATED_TARGET_READ_FP_P() (1)
-#endif
-#endif
-
-/* Default predicate for non- multi-arch targets. */
-#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_TARGET_READ_FP_P)
-#define DEPRECATED_TARGET_READ_FP_P() (0)
-#endif
-
-extern int gdbarch_deprecated_target_read_fp_p (struct gdbarch *gdbarch);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_TARGET_READ_FP_P)
-#error "Non multi-arch definition of DEPRECATED_TARGET_READ_FP"
-#endif
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_TARGET_READ_FP_P)
-#define DEPRECATED_TARGET_READ_FP_P() (gdbarch_deprecated_target_read_fp_p (current_gdbarch))
-#endif
-
-/* Default (function) for non- multi-arch platforms. */
-#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_TARGET_READ_FP)
-#define DEPRECATED_TARGET_READ_FP() (internal_error (__FILE__, __LINE__, "DEPRECATED_TARGET_READ_FP"), 0)
-#endif
-
-typedef CORE_ADDR (gdbarch_deprecated_target_read_fp_ftype) (void);
-extern CORE_ADDR gdbarch_deprecated_target_read_fp (struct gdbarch *gdbarch);
-extern void set_gdbarch_deprecated_target_read_fp (struct gdbarch *gdbarch, gdbarch_deprecated_target_read_fp_ftype *deprecated_target_read_fp);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_TARGET_READ_FP)
-#error "Non multi-arch definition of DEPRECATED_TARGET_READ_FP"
-#endif
-#if !defined (DEPRECATED_TARGET_READ_FP)
-#define DEPRECATED_TARGET_READ_FP() (gdbarch_deprecated_target_read_fp (current_gdbarch))
-#endif
-
 /* UNWIND_SP is a direct replacement for TARGET_READ_SP. */
 
 #if defined (TARGET_READ_SP)
@@ -408,43 +370,6 @@
 #define TARGET_READ_SP() (gdbarch_read_sp (current_gdbarch))
 #endif
 
-/* The dummy call frame SP should be set by push_dummy_call. */
-
-#if defined (DEPRECATED_DUMMY_WRITE_SP)
-/* Legacy for systems yet to multi-arch DEPRECATED_DUMMY_WRITE_SP */
-#if !defined (DEPRECATED_DUMMY_WRITE_SP_P)
-#define DEPRECATED_DUMMY_WRITE_SP_P() (1)
-#endif
-#endif
-
-/* Default predicate for non- multi-arch targets. */
-#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_DUMMY_WRITE_SP_P)
-#define DEPRECATED_DUMMY_WRITE_SP_P() (0)
-#endif
-
-extern int gdbarch_deprecated_dummy_write_sp_p (struct gdbarch *gdbarch);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_DUMMY_WRITE_SP_P)
-#error "Non multi-arch definition of DEPRECATED_DUMMY_WRITE_SP"
-#endif
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_DUMMY_WRITE_SP_P)
-#define DEPRECATED_DUMMY_WRITE_SP_P() (gdbarch_deprecated_dummy_write_sp_p (current_gdbarch))
-#endif
-
-/* Default (function) for non- multi-arch platforms. */
-#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_DUMMY_WRITE_SP)
-#define DEPRECATED_DUMMY_WRITE_SP(val) (internal_error (__FILE__, __LINE__, "DEPRECATED_DUMMY_WRITE_SP"), 0)
-#endif
-
-typedef void (gdbarch_deprecated_dummy_write_sp_ftype) (CORE_ADDR val);
-extern void gdbarch_deprecated_dummy_write_sp (struct gdbarch *gdbarch, CORE_ADDR val);
-extern void set_gdbarch_deprecated_dummy_write_sp (struct gdbarch *gdbarch, gdbarch_deprecated_dummy_write_sp_ftype *deprecated_dummy_write_sp);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_DUMMY_WRITE_SP)
-#error "Non multi-arch definition of DEPRECATED_DUMMY_WRITE_SP"
-#endif
-#if !defined (DEPRECATED_DUMMY_WRITE_SP)
-#define DEPRECATED_DUMMY_WRITE_SP(val) (gdbarch_deprecated_dummy_write_sp (current_gdbarch, val))
-#endif
-
 /* Function for getting target's idea of a frame pointer.  FIXME: GDB's
    whole scheme for dealing with "frames" and "frame pointers" needs a
    serious shakedown. */
@@ -523,23 +448,6 @@
 #define SP_REGNUM (gdbarch_sp_regnum (current_gdbarch))
 #endif
 
-/* This is simply not needed.  See value_of_builtin_frame_fp_reg and
-   call_function_by_hand. */
-
-/* Default (value) for non- multi-arch platforms. */
-#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_FP_REGNUM)
-#define DEPRECATED_FP_REGNUM (-1)
-#endif
-
-extern int gdbarch_deprecated_fp_regnum (struct gdbarch *gdbarch);
-extern void set_gdbarch_deprecated_fp_regnum (struct gdbarch *gdbarch, int deprecated_fp_regnum);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_FP_REGNUM)
-#error "Non multi-arch definition of DEPRECATED_FP_REGNUM"
-#endif
-#if !defined (DEPRECATED_FP_REGNUM)
-#define DEPRECATED_FP_REGNUM (gdbarch_deprecated_fp_regnum (current_gdbarch))
-#endif
-
 /* Default (value) for non- multi-arch platforms. */
 #if (!GDB_MULTI_ARCH) && !defined (PC_REGNUM)
 #define PC_REGNUM (-1)
@@ -696,17 +604,6 @@
 #define REGISTER_NAME(regnr) (gdbarch_register_name (current_gdbarch, regnr))
 #endif
 
-/* See the dummy frame code. */
-
-extern int gdbarch_deprecated_register_size (struct gdbarch *gdbarch);
-extern void set_gdbarch_deprecated_register_size (struct gdbarch *gdbarch, int deprecated_register_size);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_REGISTER_SIZE)
-#error "Non multi-arch definition of DEPRECATED_REGISTER_SIZE"
-#endif
-#if !defined (DEPRECATED_REGISTER_SIZE)
-#define DEPRECATED_REGISTER_SIZE (gdbarch_deprecated_register_size (current_gdbarch))
-#endif
-
 /* REGISTER_TYPE is a direct replacement for REGISTER_VIRTUAL_TYPE. */
 
 extern int gdbarch_register_type_p (struct gdbarch *gdbarch);
@@ -764,12 +661,13 @@
 #define DEPRECATED_REGISTER_BYTES (gdbarch_deprecated_register_bytes (current_gdbarch))
 #endif
 
-/* DEPRECATED_REGISTER_BYTE can be deleted.  The value is computed from
-   REGISTER_TYPE.  NOTE: cagney/2002-05-02: This function with
-   predicate has a valid (callable) initial value.  As a consequence,
-   even when the predicate is false, the corresponding function works.
-   This simplifies the migration process - old code, calling
-   DEPRECATED_REGISTER_BYTE, doesn't need to be modified. */
+/* If the value returned by DEPRECATED_REGISTER_BYTE agrees with the
+   register offsets computed using just REGISTER_TYPE, this can be
+   deleted.  See: maint print registers.  NOTE: cagney/2002-05-02: This
+   function with predicate has a valid (callable) initial value.  As a
+   consequence, even when the predicate is false, the corresponding
+   function works.  This simplifies the migration process - old code,
+   calling DEPRECATED_REGISTER_BYTE, doesn't need to be modified. */
 
 #if defined (REGISTER_BYTE)
 /* Legacy for systems yet to multi-arch REGISTER_BYTE */
@@ -806,8 +704,10 @@
 #define REGISTER_BYTE(reg_nr) (gdbarch_deprecated_register_byte (current_gdbarch, reg_nr))
 #endif
 
-/* DEPRECATED_REGISTER_RAW_SIZE can be deleted.  The value is computed
-   from REGISTER_TYPE. */
+/* If all registers have identical raw and virtual sizes and those
+   sizes agree with the value computed from REGISTER_TYPE,
+   DEPRECATED_REGISTER_RAW_SIZE can be deleted.  See: maint print
+   registers. */
 
 /* Default (function) for non- multi-arch platforms. */
 #if (!GDB_MULTI_ARCH) && !defined (REGISTER_RAW_SIZE)
@@ -824,8 +724,10 @@
 #define REGISTER_RAW_SIZE(reg_nr) (gdbarch_deprecated_register_raw_size (current_gdbarch, reg_nr))
 #endif
 
-/* DEPRECATED_REGISTER_VIRTUAL_SIZE can be deleted.  The value is
-   computed from REGISTER_TYPE. */
+/* If all registers have identical raw and virtual sizes and those
+   sizes agree with the value computed from REGISTER_TYPE,
+   DEPRECATED_REGISTER_VIRTUAL_SIZE can be deleted.  See: maint print
+   registers. */
 
 /* Default (function) for non- multi-arch platforms. */
 #if (!GDB_MULTI_ARCH) && !defined (REGISTER_VIRTUAL_SIZE)
@@ -916,6 +818,485 @@
 #define DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE (gdbarch_deprecated_max_register_virtual_size (current_gdbarch))
 #endif
 
+/* See gdbint.texinfo, and PUSH_DUMMY_CALL. */
+
+extern int gdbarch_unwind_dummy_id_p (struct gdbarch *gdbarch);
+
+typedef struct frame_id (gdbarch_unwind_dummy_id_ftype) (struct gdbarch *gdbarch, struct frame_info *info);
+extern struct frame_id gdbarch_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *info);
+extern void set_gdbarch_unwind_dummy_id (struct gdbarch *gdbarch, gdbarch_unwind_dummy_id_ftype *unwind_dummy_id);
+
+/* Implement UNWIND_DUMMY_ID and PUSH_DUMMY_CALL, then delete
+   SAVE_DUMMY_FRAME_TOS. */
+
+#if defined (DEPRECATED_SAVE_DUMMY_FRAME_TOS)
+/* Legacy for systems yet to multi-arch DEPRECATED_SAVE_DUMMY_FRAME_TOS */
+#if !defined (DEPRECATED_SAVE_DUMMY_FRAME_TOS_P)
+#define DEPRECATED_SAVE_DUMMY_FRAME_TOS_P() (1)
+#endif
+#endif
+
+/* Default predicate for non- multi-arch targets. */
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_SAVE_DUMMY_FRAME_TOS_P)
+#define DEPRECATED_SAVE_DUMMY_FRAME_TOS_P() (0)
+#endif
+
+extern int gdbarch_deprecated_save_dummy_frame_tos_p (struct gdbarch *gdbarch);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_SAVE_DUMMY_FRAME_TOS_P)
+#error "Non multi-arch definition of DEPRECATED_SAVE_DUMMY_FRAME_TOS"
+#endif
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_SAVE_DUMMY_FRAME_TOS_P)
+#define DEPRECATED_SAVE_DUMMY_FRAME_TOS_P() (gdbarch_deprecated_save_dummy_frame_tos_p (current_gdbarch))
+#endif
+
+/* Default (function) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_SAVE_DUMMY_FRAME_TOS)
+#define DEPRECATED_SAVE_DUMMY_FRAME_TOS(sp) (internal_error (__FILE__, __LINE__, "DEPRECATED_SAVE_DUMMY_FRAME_TOS"), 0)
+#endif
+
+typedef void (gdbarch_deprecated_save_dummy_frame_tos_ftype) (CORE_ADDR sp);
+extern void gdbarch_deprecated_save_dummy_frame_tos (struct gdbarch *gdbarch, CORE_ADDR sp);
+extern void set_gdbarch_deprecated_save_dummy_frame_tos (struct gdbarch *gdbarch, gdbarch_deprecated_save_dummy_frame_tos_ftype *deprecated_save_dummy_frame_tos);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_SAVE_DUMMY_FRAME_TOS)
+#error "Non multi-arch definition of DEPRECATED_SAVE_DUMMY_FRAME_TOS"
+#endif
+#if !defined (DEPRECATED_SAVE_DUMMY_FRAME_TOS)
+#define DEPRECATED_SAVE_DUMMY_FRAME_TOS(sp) (gdbarch_deprecated_save_dummy_frame_tos (current_gdbarch, sp))
+#endif
+
+/* Implement UNWIND_DUMMY_ID and PUSH_DUMMY_CALL, then delete
+   DEPRECATED_FP_REGNUM. */
+
+/* Default (value) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_FP_REGNUM)
+#define DEPRECATED_FP_REGNUM (-1)
+#endif
+
+extern int gdbarch_deprecated_fp_regnum (struct gdbarch *gdbarch);
+extern void set_gdbarch_deprecated_fp_regnum (struct gdbarch *gdbarch, int deprecated_fp_regnum);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_FP_REGNUM)
+#error "Non multi-arch definition of DEPRECATED_FP_REGNUM"
+#endif
+#if !defined (DEPRECATED_FP_REGNUM)
+#define DEPRECATED_FP_REGNUM (gdbarch_deprecated_fp_regnum (current_gdbarch))
+#endif
+
+/* Implement UNWIND_DUMMY_ID and PUSH_DUMMY_CALL, then delete
+   DEPRECATED_TARGET_READ_FP. */
+
+#if defined (DEPRECATED_TARGET_READ_FP)
+/* Legacy for systems yet to multi-arch DEPRECATED_TARGET_READ_FP */
+#if !defined (DEPRECATED_TARGET_READ_FP_P)
+#define DEPRECATED_TARGET_READ_FP_P() (1)
+#endif
+#endif
+
+/* Default predicate for non- multi-arch targets. */
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_TARGET_READ_FP_P)
+#define DEPRECATED_TARGET_READ_FP_P() (0)
+#endif
+
+extern int gdbarch_deprecated_target_read_fp_p (struct gdbarch *gdbarch);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_TARGET_READ_FP_P)
+#error "Non multi-arch definition of DEPRECATED_TARGET_READ_FP"
+#endif
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_TARGET_READ_FP_P)
+#define DEPRECATED_TARGET_READ_FP_P() (gdbarch_deprecated_target_read_fp_p (current_gdbarch))
+#endif
+
+/* Default (function) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_TARGET_READ_FP)
+#define DEPRECATED_TARGET_READ_FP() (internal_error (__FILE__, __LINE__, "DEPRECATED_TARGET_READ_FP"), 0)
+#endif
+
+typedef CORE_ADDR (gdbarch_deprecated_target_read_fp_ftype) (void);
+extern CORE_ADDR gdbarch_deprecated_target_read_fp (struct gdbarch *gdbarch);
+extern void set_gdbarch_deprecated_target_read_fp (struct gdbarch *gdbarch, gdbarch_deprecated_target_read_fp_ftype *deprecated_target_read_fp);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_TARGET_READ_FP)
+#error "Non multi-arch definition of DEPRECATED_TARGET_READ_FP"
+#endif
+#if !defined (DEPRECATED_TARGET_READ_FP)
+#define DEPRECATED_TARGET_READ_FP() (gdbarch_deprecated_target_read_fp (current_gdbarch))
+#endif
+
+/* See gdbint.texinfo.  See infcall.c.  New, all singing all dancing,
+   replacement for DEPRECATED_PUSH_ARGUMENTS. */
+
+extern int gdbarch_push_dummy_call_p (struct gdbarch *gdbarch);
+
+typedef CORE_ADDR (gdbarch_push_dummy_call_ftype) (struct gdbarch *gdbarch, CORE_ADDR func_addr, struct regcache *regcache, CORE_ADDR bp_addr, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr);
+extern CORE_ADDR gdbarch_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, struct regcache *regcache, CORE_ADDR bp_addr, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr);
+extern void set_gdbarch_push_dummy_call (struct gdbarch *gdbarch, gdbarch_push_dummy_call_ftype *push_dummy_call);
+
+/* PUSH_DUMMY_CALL is a direct replacement for DEPRECATED_PUSH_ARGUMENTS. */
+
+#if defined (DEPRECATED_PUSH_ARGUMENTS)
+/* Legacy for systems yet to multi-arch DEPRECATED_PUSH_ARGUMENTS */
+#if !defined (DEPRECATED_PUSH_ARGUMENTS_P)
+#define DEPRECATED_PUSH_ARGUMENTS_P() (1)
+#endif
+#endif
+
+/* Default predicate for non- multi-arch targets. */
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_PUSH_ARGUMENTS_P)
+#define DEPRECATED_PUSH_ARGUMENTS_P() (0)
+#endif
+
+extern int gdbarch_deprecated_push_arguments_p (struct gdbarch *gdbarch);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_PUSH_ARGUMENTS_P)
+#error "Non multi-arch definition of DEPRECATED_PUSH_ARGUMENTS"
+#endif
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_PUSH_ARGUMENTS_P)
+#define DEPRECATED_PUSH_ARGUMENTS_P() (gdbarch_deprecated_push_arguments_p (current_gdbarch))
+#endif
+
+/* Default (function) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_PUSH_ARGUMENTS)
+#define DEPRECATED_PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) (internal_error (__FILE__, __LINE__, "DEPRECATED_PUSH_ARGUMENTS"), 0)
+#endif
+
+typedef CORE_ADDR (gdbarch_deprecated_push_arguments_ftype) (int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr);
+extern CORE_ADDR gdbarch_deprecated_push_arguments (struct gdbarch *gdbarch, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr);
+extern void set_gdbarch_deprecated_push_arguments (struct gdbarch *gdbarch, gdbarch_deprecated_push_arguments_ftype *deprecated_push_arguments);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_PUSH_ARGUMENTS)
+#error "Non multi-arch definition of DEPRECATED_PUSH_ARGUMENTS"
+#endif
+#if !defined (DEPRECATED_PUSH_ARGUMENTS)
+#define DEPRECATED_PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) (gdbarch_deprecated_push_arguments (current_gdbarch, nargs, args, sp, struct_return, struct_addr))
+#endif
+
+/* DEPRECATED_USE_GENERIC_DUMMY_FRAMES can be deleted.  Always true. */
+
+/* Default (value) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_USE_GENERIC_DUMMY_FRAMES)
+#define DEPRECATED_USE_GENERIC_DUMMY_FRAMES (1)
+#endif
+
+extern int gdbarch_deprecated_use_generic_dummy_frames (struct gdbarch *gdbarch);
+extern void set_gdbarch_deprecated_use_generic_dummy_frames (struct gdbarch *gdbarch, int deprecated_use_generic_dummy_frames);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_USE_GENERIC_DUMMY_FRAMES)
+#error "Non multi-arch definition of DEPRECATED_USE_GENERIC_DUMMY_FRAMES"
+#endif
+#if !defined (DEPRECATED_USE_GENERIC_DUMMY_FRAMES)
+#define DEPRECATED_USE_GENERIC_DUMMY_FRAMES (gdbarch_deprecated_use_generic_dummy_frames (current_gdbarch))
+#endif
+
+/* Implement PUSH_RETURN_ADDRESS, and then merge in
+   DEPRECATED_PUSH_RETURN_ADDRESS. */
+
+#if defined (DEPRECATED_PUSH_RETURN_ADDRESS)
+/* Legacy for systems yet to multi-arch DEPRECATED_PUSH_RETURN_ADDRESS */
+#if !defined (DEPRECATED_PUSH_RETURN_ADDRESS_P)
+#define DEPRECATED_PUSH_RETURN_ADDRESS_P() (1)
+#endif
+#endif
+
+/* Default predicate for non- multi-arch targets. */
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_PUSH_RETURN_ADDRESS_P)
+#define DEPRECATED_PUSH_RETURN_ADDRESS_P() (0)
+#endif
+
+extern int gdbarch_deprecated_push_return_address_p (struct gdbarch *gdbarch);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_PUSH_RETURN_ADDRESS_P)
+#error "Non multi-arch definition of DEPRECATED_PUSH_RETURN_ADDRESS"
+#endif
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_PUSH_RETURN_ADDRESS_P)
+#define DEPRECATED_PUSH_RETURN_ADDRESS_P() (gdbarch_deprecated_push_return_address_p (current_gdbarch))
+#endif
+
+/* Default (function) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_PUSH_RETURN_ADDRESS)
+#define DEPRECATED_PUSH_RETURN_ADDRESS(pc, sp) (internal_error (__FILE__, __LINE__, "DEPRECATED_PUSH_RETURN_ADDRESS"), 0)
+#endif
+
+typedef CORE_ADDR (gdbarch_deprecated_push_return_address_ftype) (CORE_ADDR pc, CORE_ADDR sp);
+extern CORE_ADDR gdbarch_deprecated_push_return_address (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR sp);
+extern void set_gdbarch_deprecated_push_return_address (struct gdbarch *gdbarch, gdbarch_deprecated_push_return_address_ftype *deprecated_push_return_address);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_PUSH_RETURN_ADDRESS)
+#error "Non multi-arch definition of DEPRECATED_PUSH_RETURN_ADDRESS"
+#endif
+#if !defined (DEPRECATED_PUSH_RETURN_ADDRESS)
+#define DEPRECATED_PUSH_RETURN_ADDRESS(pc, sp) (gdbarch_deprecated_push_return_address (current_gdbarch, pc, sp))
+#endif
+
+/* Implement PUSH_DUMMY_CALL, then merge in DEPRECATED_DUMMY_WRITE_SP. */
+
+#if defined (DEPRECATED_DUMMY_WRITE_SP)
+/* Legacy for systems yet to multi-arch DEPRECATED_DUMMY_WRITE_SP */
+#if !defined (DEPRECATED_DUMMY_WRITE_SP_P)
+#define DEPRECATED_DUMMY_WRITE_SP_P() (1)
+#endif
+#endif
+
+/* Default predicate for non- multi-arch targets. */
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_DUMMY_WRITE_SP_P)
+#define DEPRECATED_DUMMY_WRITE_SP_P() (0)
+#endif
+
+extern int gdbarch_deprecated_dummy_write_sp_p (struct gdbarch *gdbarch);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_DUMMY_WRITE_SP_P)
+#error "Non multi-arch definition of DEPRECATED_DUMMY_WRITE_SP"
+#endif
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_DUMMY_WRITE_SP_P)
+#define DEPRECATED_DUMMY_WRITE_SP_P() (gdbarch_deprecated_dummy_write_sp_p (current_gdbarch))
+#endif
+
+/* Default (function) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_DUMMY_WRITE_SP)
+#define DEPRECATED_DUMMY_WRITE_SP(val) (internal_error (__FILE__, __LINE__, "DEPRECATED_DUMMY_WRITE_SP"), 0)
+#endif
+
+typedef void (gdbarch_deprecated_dummy_write_sp_ftype) (CORE_ADDR val);
+extern void gdbarch_deprecated_dummy_write_sp (struct gdbarch *gdbarch, CORE_ADDR val);
+extern void set_gdbarch_deprecated_dummy_write_sp (struct gdbarch *gdbarch, gdbarch_deprecated_dummy_write_sp_ftype *deprecated_dummy_write_sp);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_DUMMY_WRITE_SP)
+#error "Non multi-arch definition of DEPRECATED_DUMMY_WRITE_SP"
+#endif
+#if !defined (DEPRECATED_DUMMY_WRITE_SP)
+#define DEPRECATED_DUMMY_WRITE_SP(val) (gdbarch_deprecated_dummy_write_sp (current_gdbarch, val))
+#endif
+
+/* DEPRECATED_REGISTER_SIZE can be deleted. */
+
+extern int gdbarch_deprecated_register_size (struct gdbarch *gdbarch);
+extern void set_gdbarch_deprecated_register_size (struct gdbarch *gdbarch, int deprecated_register_size);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_REGISTER_SIZE)
+#error "Non multi-arch definition of DEPRECATED_REGISTER_SIZE"
+#endif
+#if !defined (DEPRECATED_REGISTER_SIZE)
+#define DEPRECATED_REGISTER_SIZE (gdbarch_deprecated_register_size (current_gdbarch))
+#endif
+
+/* Default (value) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (CALL_DUMMY_LOCATION)
+#define CALL_DUMMY_LOCATION (AT_ENTRY_POINT)
+#endif
+
+extern int gdbarch_call_dummy_location (struct gdbarch *gdbarch);
+extern void set_gdbarch_call_dummy_location (struct gdbarch *gdbarch, int call_dummy_location);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (CALL_DUMMY_LOCATION)
+#error "Non multi-arch definition of CALL_DUMMY_LOCATION"
+#endif
+#if !defined (CALL_DUMMY_LOCATION)
+#define CALL_DUMMY_LOCATION (gdbarch_call_dummy_location (current_gdbarch))
+#endif
+
+/* Default (function) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (CALL_DUMMY_ADDRESS)
+#define CALL_DUMMY_ADDRESS() (entry_point_address ())
+#endif
+
+typedef CORE_ADDR (gdbarch_call_dummy_address_ftype) (void);
+extern CORE_ADDR gdbarch_call_dummy_address (struct gdbarch *gdbarch);
+extern void set_gdbarch_call_dummy_address (struct gdbarch *gdbarch, gdbarch_call_dummy_address_ftype *call_dummy_address);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (CALL_DUMMY_ADDRESS)
+#error "Non multi-arch definition of CALL_DUMMY_ADDRESS"
+#endif
+#if !defined (CALL_DUMMY_ADDRESS)
+#define CALL_DUMMY_ADDRESS() (gdbarch_call_dummy_address (current_gdbarch))
+#endif
+
+/* DEPRECATED_CALL_DUMMY_START_OFFSET can be deleted. */
+
+extern CORE_ADDR gdbarch_deprecated_call_dummy_start_offset (struct gdbarch *gdbarch);
+extern void set_gdbarch_deprecated_call_dummy_start_offset (struct gdbarch *gdbarch, CORE_ADDR deprecated_call_dummy_start_offset);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_CALL_DUMMY_START_OFFSET)
+#error "Non multi-arch definition of DEPRECATED_CALL_DUMMY_START_OFFSET"
+#endif
+#if !defined (DEPRECATED_CALL_DUMMY_START_OFFSET)
+#define DEPRECATED_CALL_DUMMY_START_OFFSET (gdbarch_deprecated_call_dummy_start_offset (current_gdbarch))
+#endif
+
+/* DEPRECATED_CALL_DUMMY_BREAKPOINT_OFFSET can be deleted. */
+
+extern CORE_ADDR gdbarch_deprecated_call_dummy_breakpoint_offset (struct gdbarch *gdbarch);
+extern void set_gdbarch_deprecated_call_dummy_breakpoint_offset (struct gdbarch *gdbarch, CORE_ADDR deprecated_call_dummy_breakpoint_offset);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_CALL_DUMMY_BREAKPOINT_OFFSET)
+#error "Non multi-arch definition of DEPRECATED_CALL_DUMMY_BREAKPOINT_OFFSET"
+#endif
+#if !defined (DEPRECATED_CALL_DUMMY_BREAKPOINT_OFFSET)
+#define DEPRECATED_CALL_DUMMY_BREAKPOINT_OFFSET (gdbarch_deprecated_call_dummy_breakpoint_offset (current_gdbarch))
+#endif
+
+/* DEPRECATED_CALL_DUMMY_LENGTH can be deleted. */
+
+extern int gdbarch_deprecated_call_dummy_length (struct gdbarch *gdbarch);
+extern void set_gdbarch_deprecated_call_dummy_length (struct gdbarch *gdbarch, int deprecated_call_dummy_length);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_CALL_DUMMY_LENGTH)
+#error "Non multi-arch definition of DEPRECATED_CALL_DUMMY_LENGTH"
+#endif
+#if !defined (DEPRECATED_CALL_DUMMY_LENGTH)
+#define DEPRECATED_CALL_DUMMY_LENGTH (gdbarch_deprecated_call_dummy_length (current_gdbarch))
+#endif
+
+/* DEPRECATED_CALL_DUMMY_WORDS can be deleted. */
+
+/* Default (value) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_CALL_DUMMY_WORDS)
+#define DEPRECATED_CALL_DUMMY_WORDS (legacy_call_dummy_words)
+#endif
+
+extern LONGEST * gdbarch_deprecated_call_dummy_words (struct gdbarch *gdbarch);
+extern void set_gdbarch_deprecated_call_dummy_words (struct gdbarch *gdbarch, LONGEST * deprecated_call_dummy_words);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_CALL_DUMMY_WORDS)
+#error "Non multi-arch definition of DEPRECATED_CALL_DUMMY_WORDS"
+#endif
+#if !defined (DEPRECATED_CALL_DUMMY_WORDS)
+#define DEPRECATED_CALL_DUMMY_WORDS (gdbarch_deprecated_call_dummy_words (current_gdbarch))
+#endif
+
+/* Implement PUSH_DUMMY_CALL, then delete DEPRECATED_SIZEOF_CALL_DUMMY_WORDS. */
+
+/* Default (value) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_SIZEOF_CALL_DUMMY_WORDS)
+#define DEPRECATED_SIZEOF_CALL_DUMMY_WORDS (legacy_sizeof_call_dummy_words)
+#endif
+
+extern int gdbarch_deprecated_sizeof_call_dummy_words (struct gdbarch *gdbarch);
+extern void set_gdbarch_deprecated_sizeof_call_dummy_words (struct gdbarch *gdbarch, int deprecated_sizeof_call_dummy_words);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_SIZEOF_CALL_DUMMY_WORDS)
+#error "Non multi-arch definition of DEPRECATED_SIZEOF_CALL_DUMMY_WORDS"
+#endif
+#if !defined (DEPRECATED_SIZEOF_CALL_DUMMY_WORDS)
+#define DEPRECATED_SIZEOF_CALL_DUMMY_WORDS (gdbarch_deprecated_sizeof_call_dummy_words (current_gdbarch))
+#endif
+
+/* Implement PUSH_DUMMY_CALL, then delete DEPRECATED_CALL_DUMMY_STACK_ADJUST. */
+
+#if defined (DEPRECATED_CALL_DUMMY_STACK_ADJUST)
+/* Legacy for systems yet to multi-arch DEPRECATED_CALL_DUMMY_STACK_ADJUST */
+#if !defined (DEPRECATED_CALL_DUMMY_STACK_ADJUST_P)
+#define DEPRECATED_CALL_DUMMY_STACK_ADJUST_P() (1)
+#endif
+#endif
+
+/* Default predicate for non- multi-arch targets. */
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_CALL_DUMMY_STACK_ADJUST_P)
+#define DEPRECATED_CALL_DUMMY_STACK_ADJUST_P() (0)
+#endif
+
+extern int gdbarch_deprecated_call_dummy_stack_adjust_p (struct gdbarch *gdbarch);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_CALL_DUMMY_STACK_ADJUST_P)
+#error "Non multi-arch definition of DEPRECATED_CALL_DUMMY_STACK_ADJUST"
+#endif
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_CALL_DUMMY_STACK_ADJUST_P)
+#define DEPRECATED_CALL_DUMMY_STACK_ADJUST_P() (gdbarch_deprecated_call_dummy_stack_adjust_p (current_gdbarch))
+#endif
+
+/* Default (value) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_CALL_DUMMY_STACK_ADJUST)
+#define DEPRECATED_CALL_DUMMY_STACK_ADJUST (0)
+#endif
+
+extern int gdbarch_deprecated_call_dummy_stack_adjust (struct gdbarch *gdbarch);
+extern void set_gdbarch_deprecated_call_dummy_stack_adjust (struct gdbarch *gdbarch, int deprecated_call_dummy_stack_adjust);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_CALL_DUMMY_STACK_ADJUST)
+#error "Non multi-arch definition of DEPRECATED_CALL_DUMMY_STACK_ADJUST"
+#endif
+#if !defined (DEPRECATED_CALL_DUMMY_STACK_ADJUST)
+#define DEPRECATED_CALL_DUMMY_STACK_ADJUST (gdbarch_deprecated_call_dummy_stack_adjust (current_gdbarch))
+#endif
+
+/* DEPRECATED_FIX_CALL_DUMMY can be deleted.  For the SPARC, implement
+   PUSH_DUMMY_CODE and set CALL_DUMMY_LOCATION to ON_STACK. */
+
+#if defined (DEPRECATED_FIX_CALL_DUMMY)
+/* Legacy for systems yet to multi-arch DEPRECATED_FIX_CALL_DUMMY */
+#if !defined (DEPRECATED_FIX_CALL_DUMMY_P)
+#define DEPRECATED_FIX_CALL_DUMMY_P() (1)
+#endif
+#endif
+
+/* Default predicate for non- multi-arch targets. */
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_FIX_CALL_DUMMY_P)
+#define DEPRECATED_FIX_CALL_DUMMY_P() (0)
+#endif
+
+extern int gdbarch_deprecated_fix_call_dummy_p (struct gdbarch *gdbarch);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_FIX_CALL_DUMMY_P)
+#error "Non multi-arch definition of DEPRECATED_FIX_CALL_DUMMY"
+#endif
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_FIX_CALL_DUMMY_P)
+#define DEPRECATED_FIX_CALL_DUMMY_P() (gdbarch_deprecated_fix_call_dummy_p (current_gdbarch))
+#endif
+
+/* Default (function) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_FIX_CALL_DUMMY)
+#define DEPRECATED_FIX_CALL_DUMMY(dummy, pc, fun, nargs, args, type, gcc_p) (internal_error (__FILE__, __LINE__, "DEPRECATED_FIX_CALL_DUMMY"), 0)
+#endif
+
+typedef void (gdbarch_deprecated_fix_call_dummy_ftype) (char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs, struct value **args, struct type *type, int gcc_p);
+extern void gdbarch_deprecated_fix_call_dummy (struct gdbarch *gdbarch, char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs, struct value **args, struct type *type, int gcc_p);
+extern void set_gdbarch_deprecated_fix_call_dummy (struct gdbarch *gdbarch, gdbarch_deprecated_fix_call_dummy_ftype *deprecated_fix_call_dummy);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_FIX_CALL_DUMMY)
+#error "Non multi-arch definition of DEPRECATED_FIX_CALL_DUMMY"
+#endif
+#if !defined (DEPRECATED_FIX_CALL_DUMMY)
+#define DEPRECATED_FIX_CALL_DUMMY(dummy, pc, fun, nargs, args, type, gcc_p) (gdbarch_deprecated_fix_call_dummy (current_gdbarch, dummy, pc, fun, nargs, args, type, gcc_p))
+#endif
+
+/* This is a replacement for DEPRECATED_FIX_CALL_DUMMY et.al. */
+
+extern int gdbarch_push_dummy_code_p (struct gdbarch *gdbarch);
+
+typedef CORE_ADDR (gdbarch_push_dummy_code_ftype) (struct gdbarch *gdbarch, CORE_ADDR sp, CORE_ADDR funaddr, int using_gcc, struct value **args, int nargs, struct type *value_type, CORE_ADDR *real_pc, CORE_ADDR *bp_addr);
+extern CORE_ADDR gdbarch_push_dummy_code (struct gdbarch *gdbarch, CORE_ADDR sp, CORE_ADDR funaddr, int using_gcc, struct value **args, int nargs, struct type *value_type, CORE_ADDR *real_pc, CORE_ADDR *bp_addr);
+extern void set_gdbarch_push_dummy_code (struct gdbarch *gdbarch, gdbarch_push_dummy_code_ftype *push_dummy_code);
+
+/* Implement PUSH_DUMMY_CALL, then delete DEPRECATED_PUSH_DUMMY_FRAME. */
+
+#if defined (DEPRECATED_PUSH_DUMMY_FRAME)
+/* Legacy for systems yet to multi-arch DEPRECATED_PUSH_DUMMY_FRAME */
+#if !defined (DEPRECATED_PUSH_DUMMY_FRAME_P)
+#define DEPRECATED_PUSH_DUMMY_FRAME_P() (1)
+#endif
+#endif
+
+/* Default predicate for non- multi-arch targets. */
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_PUSH_DUMMY_FRAME_P)
+#define DEPRECATED_PUSH_DUMMY_FRAME_P() (0)
+#endif
+
+extern int gdbarch_deprecated_push_dummy_frame_p (struct gdbarch *gdbarch);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_PUSH_DUMMY_FRAME_P)
+#error "Non multi-arch definition of DEPRECATED_PUSH_DUMMY_FRAME"
+#endif
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_PUSH_DUMMY_FRAME_P)
+#define DEPRECATED_PUSH_DUMMY_FRAME_P() (gdbarch_deprecated_push_dummy_frame_p (current_gdbarch))
+#endif
+
+/* Default (function) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_PUSH_DUMMY_FRAME)
+#define DEPRECATED_PUSH_DUMMY_FRAME (internal_error (__FILE__, __LINE__, "DEPRECATED_PUSH_DUMMY_FRAME"), 0)
+#endif
+
+typedef void (gdbarch_deprecated_push_dummy_frame_ftype) (void);
+extern void gdbarch_deprecated_push_dummy_frame (struct gdbarch *gdbarch);
+extern void set_gdbarch_deprecated_push_dummy_frame (struct gdbarch *gdbarch, gdbarch_deprecated_push_dummy_frame_ftype *deprecated_push_dummy_frame);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_PUSH_DUMMY_FRAME)
+#error "Non multi-arch definition of DEPRECATED_PUSH_DUMMY_FRAME"
+#endif
+#if !defined (DEPRECATED_PUSH_DUMMY_FRAME)
+#define DEPRECATED_PUSH_DUMMY_FRAME (gdbarch_deprecated_push_dummy_frame (current_gdbarch))
+#endif
+
+/* Implement PUSH_DUMMY_CALL, then delete
+   DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED. */
+
+/* Default (value) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED)
+#define DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED (0)
+#endif
+
+extern int gdbarch_deprecated_extra_stack_alignment_needed (struct gdbarch *gdbarch);
+extern void set_gdbarch_deprecated_extra_stack_alignment_needed (struct gdbarch *gdbarch, int deprecated_extra_stack_alignment_needed);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED)
+#error "Non multi-arch definition of DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED"
+#endif
+#if !defined (DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED)
+#define DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED (gdbarch_deprecated_extra_stack_alignment_needed (current_gdbarch))
+#endif
+
 #if defined (DEPRECATED_DO_REGISTERS_INFO)
 /* Legacy for systems yet to multi-arch DEPRECATED_DO_REGISTERS_INFO */
 #if !defined (DEPRECATED_DO_REGISTERS_INFO_P)
@@ -1087,94 +1468,6 @@
 #define GET_LONGJMP_TARGET(pc) (gdbarch_get_longjmp_target (current_gdbarch, pc))
 #endif
 
-/* Non multi-arch DUMMY_FRAMES are a mess (multi-arch ones are not that
-   much better but at least they are vaguely consistent).  The headers
-   and body contain convoluted #if/#else sequences for determine how
-   things should be compiled.  Instead of trying to mimic that
-   behaviour here (and hence entrench it further) gdbarch simply
-   reqires that these methods be set up from the word go.  This also
-   avoids any potential problems with moving beyond multi-arch partial. */
-
-/* Default (value) for non- multi-arch platforms. */
-#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_USE_GENERIC_DUMMY_FRAMES)
-#define DEPRECATED_USE_GENERIC_DUMMY_FRAMES (1)
-#endif
-
-extern int gdbarch_deprecated_use_generic_dummy_frames (struct gdbarch *gdbarch);
-extern void set_gdbarch_deprecated_use_generic_dummy_frames (struct gdbarch *gdbarch, int deprecated_use_generic_dummy_frames);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_USE_GENERIC_DUMMY_FRAMES)
-#error "Non multi-arch definition of DEPRECATED_USE_GENERIC_DUMMY_FRAMES"
-#endif
-#if !defined (DEPRECATED_USE_GENERIC_DUMMY_FRAMES)
-#define DEPRECATED_USE_GENERIC_DUMMY_FRAMES (gdbarch_deprecated_use_generic_dummy_frames (current_gdbarch))
-#endif
-
-/* Replaced by push_dummy_code. */
-
-/* Default (value) for non- multi-arch platforms. */
-#if (!GDB_MULTI_ARCH) && !defined (CALL_DUMMY_LOCATION)
-#define CALL_DUMMY_LOCATION (AT_ENTRY_POINT)
-#endif
-
-extern int gdbarch_call_dummy_location (struct gdbarch *gdbarch);
-extern void set_gdbarch_call_dummy_location (struct gdbarch *gdbarch, int call_dummy_location);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (CALL_DUMMY_LOCATION)
-#error "Non multi-arch definition of CALL_DUMMY_LOCATION"
-#endif
-#if !defined (CALL_DUMMY_LOCATION)
-#define CALL_DUMMY_LOCATION (gdbarch_call_dummy_location (current_gdbarch))
-#endif
-
-/* Replaced by push_dummy_code. */
-
-/* Default (function) for non- multi-arch platforms. */
-#if (!GDB_MULTI_ARCH) && !defined (CALL_DUMMY_ADDRESS)
-#define CALL_DUMMY_ADDRESS() (entry_point_address ())
-#endif
-
-typedef CORE_ADDR (gdbarch_call_dummy_address_ftype) (void);
-extern CORE_ADDR gdbarch_call_dummy_address (struct gdbarch *gdbarch);
-extern void set_gdbarch_call_dummy_address (struct gdbarch *gdbarch, gdbarch_call_dummy_address_ftype *call_dummy_address);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (CALL_DUMMY_ADDRESS)
-#error "Non multi-arch definition of CALL_DUMMY_ADDRESS"
-#endif
-#if !defined (CALL_DUMMY_ADDRESS)
-#define CALL_DUMMY_ADDRESS() (gdbarch_call_dummy_address (current_gdbarch))
-#endif
-
-/* Replaced by push_dummy_code. */
-
-extern CORE_ADDR gdbarch_deprecated_call_dummy_start_offset (struct gdbarch *gdbarch);
-extern void set_gdbarch_deprecated_call_dummy_start_offset (struct gdbarch *gdbarch, CORE_ADDR deprecated_call_dummy_start_offset);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_CALL_DUMMY_START_OFFSET)
-#error "Non multi-arch definition of DEPRECATED_CALL_DUMMY_START_OFFSET"
-#endif
-#if !defined (DEPRECATED_CALL_DUMMY_START_OFFSET)
-#define DEPRECATED_CALL_DUMMY_START_OFFSET (gdbarch_deprecated_call_dummy_start_offset (current_gdbarch))
-#endif
-
-/* Replaced by push_dummy_code. */
-
-extern CORE_ADDR gdbarch_deprecated_call_dummy_breakpoint_offset (struct gdbarch *gdbarch);
-extern void set_gdbarch_deprecated_call_dummy_breakpoint_offset (struct gdbarch *gdbarch, CORE_ADDR deprecated_call_dummy_breakpoint_offset);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_CALL_DUMMY_BREAKPOINT_OFFSET)
-#error "Non multi-arch definition of DEPRECATED_CALL_DUMMY_BREAKPOINT_OFFSET"
-#endif
-#if !defined (DEPRECATED_CALL_DUMMY_BREAKPOINT_OFFSET)
-#define DEPRECATED_CALL_DUMMY_BREAKPOINT_OFFSET (gdbarch_deprecated_call_dummy_breakpoint_offset (current_gdbarch))
-#endif
-
-/* Replaced by push_dummy_code. */
-
-extern int gdbarch_deprecated_call_dummy_length (struct gdbarch *gdbarch);
-extern void set_gdbarch_deprecated_call_dummy_length (struct gdbarch *gdbarch, int deprecated_call_dummy_length);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_CALL_DUMMY_LENGTH)
-#error "Non multi-arch definition of DEPRECATED_CALL_DUMMY_LENGTH"
-#endif
-#if !defined (DEPRECATED_CALL_DUMMY_LENGTH)
-#define DEPRECATED_CALL_DUMMY_LENGTH (gdbarch_deprecated_call_dummy_length (current_gdbarch))
-#endif
-
 /* NOTE: cagney/2002-11-24: This function with predicate has a valid
    (callable) initial value.  As a consequence, even when the predicate
    is false, the corresponding function works.  This simplifies the
@@ -1216,119 +1509,6 @@
 #define DEPRECATED_PC_IN_CALL_DUMMY(pc, sp, frame_address) (gdbarch_deprecated_pc_in_call_dummy (current_gdbarch, pc, sp, frame_address))
 #endif
 
-/* Replaced by push_dummy_code. */
-
-/* Default (value) for non- multi-arch platforms. */
-#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_CALL_DUMMY_WORDS)
-#define DEPRECATED_CALL_DUMMY_WORDS (legacy_call_dummy_words)
-#endif
-
-extern LONGEST * gdbarch_deprecated_call_dummy_words (struct gdbarch *gdbarch);
-extern void set_gdbarch_deprecated_call_dummy_words (struct gdbarch *gdbarch, LONGEST * deprecated_call_dummy_words);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_CALL_DUMMY_WORDS)
-#error "Non multi-arch definition of DEPRECATED_CALL_DUMMY_WORDS"
-#endif
-#if !defined (DEPRECATED_CALL_DUMMY_WORDS)
-#define DEPRECATED_CALL_DUMMY_WORDS (gdbarch_deprecated_call_dummy_words (current_gdbarch))
-#endif
-
-/* Replaced by push_dummy_code. */
-
-/* Default (value) for non- multi-arch platforms. */
-#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_SIZEOF_CALL_DUMMY_WORDS)
-#define DEPRECATED_SIZEOF_CALL_DUMMY_WORDS (legacy_sizeof_call_dummy_words)
-#endif
-
-extern int gdbarch_deprecated_sizeof_call_dummy_words (struct gdbarch *gdbarch);
-extern void set_gdbarch_deprecated_sizeof_call_dummy_words (struct gdbarch *gdbarch, int deprecated_sizeof_call_dummy_words);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_SIZEOF_CALL_DUMMY_WORDS)
-#error "Non multi-arch definition of DEPRECATED_SIZEOF_CALL_DUMMY_WORDS"
-#endif
-#if !defined (DEPRECATED_SIZEOF_CALL_DUMMY_WORDS)
-#define DEPRECATED_SIZEOF_CALL_DUMMY_WORDS (gdbarch_deprecated_sizeof_call_dummy_words (current_gdbarch))
-#endif
-
-/* Replaced by push_dummy_code. */
-
-#if defined (DEPRECATED_CALL_DUMMY_STACK_ADJUST)
-/* Legacy for systems yet to multi-arch DEPRECATED_CALL_DUMMY_STACK_ADJUST */
-#if !defined (DEPRECATED_CALL_DUMMY_STACK_ADJUST_P)
-#define DEPRECATED_CALL_DUMMY_STACK_ADJUST_P() (1)
-#endif
-#endif
-
-/* Default predicate for non- multi-arch targets. */
-#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_CALL_DUMMY_STACK_ADJUST_P)
-#define DEPRECATED_CALL_DUMMY_STACK_ADJUST_P() (0)
-#endif
-
-extern int gdbarch_deprecated_call_dummy_stack_adjust_p (struct gdbarch *gdbarch);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_CALL_DUMMY_STACK_ADJUST_P)
-#error "Non multi-arch definition of DEPRECATED_CALL_DUMMY_STACK_ADJUST"
-#endif
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_CALL_DUMMY_STACK_ADJUST_P)
-#define DEPRECATED_CALL_DUMMY_STACK_ADJUST_P() (gdbarch_deprecated_call_dummy_stack_adjust_p (current_gdbarch))
-#endif
-
-/* Default (value) for non- multi-arch platforms. */
-#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_CALL_DUMMY_STACK_ADJUST)
-#define DEPRECATED_CALL_DUMMY_STACK_ADJUST (0)
-#endif
-
-extern int gdbarch_deprecated_call_dummy_stack_adjust (struct gdbarch *gdbarch);
-extern void set_gdbarch_deprecated_call_dummy_stack_adjust (struct gdbarch *gdbarch, int deprecated_call_dummy_stack_adjust);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_CALL_DUMMY_STACK_ADJUST)
-#error "Non multi-arch definition of DEPRECATED_CALL_DUMMY_STACK_ADJUST"
-#endif
-#if !defined (DEPRECATED_CALL_DUMMY_STACK_ADJUST)
-#define DEPRECATED_CALL_DUMMY_STACK_ADJUST (gdbarch_deprecated_call_dummy_stack_adjust (current_gdbarch))
-#endif
-
-/* Replaced by push_dummy_code. */
-
-#if defined (DEPRECATED_FIX_CALL_DUMMY)
-/* Legacy for systems yet to multi-arch DEPRECATED_FIX_CALL_DUMMY */
-#if !defined (DEPRECATED_FIX_CALL_DUMMY_P)
-#define DEPRECATED_FIX_CALL_DUMMY_P() (1)
-#endif
-#endif
-
-/* Default predicate for non- multi-arch targets. */
-#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_FIX_CALL_DUMMY_P)
-#define DEPRECATED_FIX_CALL_DUMMY_P() (0)
-#endif
-
-extern int gdbarch_deprecated_fix_call_dummy_p (struct gdbarch *gdbarch);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_FIX_CALL_DUMMY_P)
-#error "Non multi-arch definition of DEPRECATED_FIX_CALL_DUMMY"
-#endif
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_FIX_CALL_DUMMY_P)
-#define DEPRECATED_FIX_CALL_DUMMY_P() (gdbarch_deprecated_fix_call_dummy_p (current_gdbarch))
-#endif
-
-/* Default (function) for non- multi-arch platforms. */
-#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_FIX_CALL_DUMMY)
-#define DEPRECATED_FIX_CALL_DUMMY(dummy, pc, fun, nargs, args, type, gcc_p) (internal_error (__FILE__, __LINE__, "DEPRECATED_FIX_CALL_DUMMY"), 0)
-#endif
-
-typedef void (gdbarch_deprecated_fix_call_dummy_ftype) (char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs, struct value **args, struct type *type, int gcc_p);
-extern void gdbarch_deprecated_fix_call_dummy (struct gdbarch *gdbarch, char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs, struct value **args, struct type *type, int gcc_p);
-extern void set_gdbarch_deprecated_fix_call_dummy (struct gdbarch *gdbarch, gdbarch_deprecated_fix_call_dummy_ftype *deprecated_fix_call_dummy);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_FIX_CALL_DUMMY)
-#error "Non multi-arch definition of DEPRECATED_FIX_CALL_DUMMY"
-#endif
-#if !defined (DEPRECATED_FIX_CALL_DUMMY)
-#define DEPRECATED_FIX_CALL_DUMMY(dummy, pc, fun, nargs, args, type, gcc_p) (gdbarch_deprecated_fix_call_dummy (current_gdbarch, dummy, pc, fun, nargs, args, type, gcc_p))
-#endif
-
-/* This is a replacement for DEPRECATED_FIX_CALL_DUMMY et.al. */
-
-extern int gdbarch_push_dummy_code_p (struct gdbarch *gdbarch);
-
-typedef CORE_ADDR (gdbarch_push_dummy_code_ftype) (struct gdbarch *gdbarch, CORE_ADDR sp, CORE_ADDR funaddr, int using_gcc, struct value **args, int nargs, struct type *value_type, CORE_ADDR *real_pc, CORE_ADDR *bp_addr);
-extern CORE_ADDR gdbarch_push_dummy_code (struct gdbarch *gdbarch, CORE_ADDR sp, CORE_ADDR funaddr, int using_gcc, struct value **args, int nargs, struct type *value_type, CORE_ADDR *real_pc, CORE_ADDR *bp_addr);
-extern void set_gdbarch_push_dummy_code (struct gdbarch *gdbarch, gdbarch_push_dummy_code_ftype *push_dummy_code);
-
 #if defined (DEPRECATED_INIT_FRAME_PC_FIRST)
 /* Legacy for systems yet to multi-arch DEPRECATED_INIT_FRAME_PC_FIRST */
 #if !defined (DEPRECATED_INIT_FRAME_PC_FIRST_P)
@@ -1508,47 +1688,47 @@
 
 /* Default (function) for non- multi-arch platforms. */
 #if (!GDB_MULTI_ARCH) && !defined (CONVERT_REGISTER_P)
-#define CONVERT_REGISTER_P(regnum) (legacy_convert_register_p (regnum))
+#define CONVERT_REGISTER_P(regnum, type) (legacy_convert_register_p (regnum, type))
 #endif
 
-typedef int (gdbarch_convert_register_p_ftype) (int regnum);
-extern int gdbarch_convert_register_p (struct gdbarch *gdbarch, int regnum);
+typedef int (gdbarch_convert_register_p_ftype) (int regnum, struct type *type);
+extern int gdbarch_convert_register_p (struct gdbarch *gdbarch, int regnum, struct type *type);
 extern void set_gdbarch_convert_register_p (struct gdbarch *gdbarch, gdbarch_convert_register_p_ftype *convert_register_p);
 #if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) && defined (CONVERT_REGISTER_P)
 #error "Non multi-arch definition of CONVERT_REGISTER_P"
 #endif
 #if !defined (CONVERT_REGISTER_P)
-#define CONVERT_REGISTER_P(regnum) (gdbarch_convert_register_p (current_gdbarch, regnum))
+#define CONVERT_REGISTER_P(regnum, type) (gdbarch_convert_register_p (current_gdbarch, regnum, type))
 #endif
 
 /* Default (function) for non- multi-arch platforms. */
 #if (!GDB_MULTI_ARCH) && !defined (REGISTER_TO_VALUE)
-#define REGISTER_TO_VALUE(regnum, type, from, to) (legacy_register_to_value (regnum, type, from, to))
+#define REGISTER_TO_VALUE(frame, regnum, type, buf) (legacy_register_to_value (frame, regnum, type, buf))
 #endif
 
-typedef void (gdbarch_register_to_value_ftype) (int regnum, struct type *type, char *from, char *to);
-extern void gdbarch_register_to_value (struct gdbarch *gdbarch, int regnum, struct type *type, char *from, char *to);
+typedef void (gdbarch_register_to_value_ftype) (struct frame_info *frame, int regnum, struct type *type, void *buf);
+extern void gdbarch_register_to_value (struct gdbarch *gdbarch, struct frame_info *frame, int regnum, struct type *type, void *buf);
 extern void set_gdbarch_register_to_value (struct gdbarch *gdbarch, gdbarch_register_to_value_ftype *register_to_value);
 #if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) && defined (REGISTER_TO_VALUE)
 #error "Non multi-arch definition of REGISTER_TO_VALUE"
 #endif
 #if !defined (REGISTER_TO_VALUE)
-#define REGISTER_TO_VALUE(regnum, type, from, to) (gdbarch_register_to_value (current_gdbarch, regnum, type, from, to))
+#define REGISTER_TO_VALUE(frame, regnum, type, buf) (gdbarch_register_to_value (current_gdbarch, frame, regnum, type, buf))
 #endif
 
 /* Default (function) for non- multi-arch platforms. */
 #if (!GDB_MULTI_ARCH) && !defined (VALUE_TO_REGISTER)
-#define VALUE_TO_REGISTER(type, regnum, from, to) (legacy_value_to_register (type, regnum, from, to))
+#define VALUE_TO_REGISTER(frame, regnum, type, buf) (legacy_value_to_register (frame, regnum, type, buf))
 #endif
 
-typedef void (gdbarch_value_to_register_ftype) (struct type *type, int regnum, char *from, char *to);
-extern void gdbarch_value_to_register (struct gdbarch *gdbarch, struct type *type, int regnum, char *from, char *to);
+typedef void (gdbarch_value_to_register_ftype) (struct frame_info *frame, int regnum, struct type *type, const void *buf);
+extern void gdbarch_value_to_register (struct gdbarch *gdbarch, struct frame_info *frame, int regnum, struct type *type, const void *buf);
 extern void set_gdbarch_value_to_register (struct gdbarch *gdbarch, gdbarch_value_to_register_ftype *value_to_register);
 #if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) && defined (VALUE_TO_REGISTER)
 #error "Non multi-arch definition of VALUE_TO_REGISTER"
 #endif
 #if !defined (VALUE_TO_REGISTER)
-#define VALUE_TO_REGISTER(type, regnum, from, to) (gdbarch_value_to_register (current_gdbarch, type, regnum, from, to))
+#define VALUE_TO_REGISTER(frame, regnum, type, buf) (gdbarch_value_to_register (current_gdbarch, frame, regnum, type, buf))
 #endif
 
 /* Default (function) for non- multi-arch platforms. */
@@ -1631,121 +1811,6 @@
 #define RETURN_VALUE_ON_STACK(type) (gdbarch_return_value_on_stack (current_gdbarch, type))
 #endif
 
-/* Replaced by PUSH_DUMMY_CALL */
-
-#if defined (DEPRECATED_PUSH_ARGUMENTS)
-/* Legacy for systems yet to multi-arch DEPRECATED_PUSH_ARGUMENTS */
-#if !defined (DEPRECATED_PUSH_ARGUMENTS_P)
-#define DEPRECATED_PUSH_ARGUMENTS_P() (1)
-#endif
-#endif
-
-/* Default predicate for non- multi-arch targets. */
-#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_PUSH_ARGUMENTS_P)
-#define DEPRECATED_PUSH_ARGUMENTS_P() (0)
-#endif
-
-extern int gdbarch_deprecated_push_arguments_p (struct gdbarch *gdbarch);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_PUSH_ARGUMENTS_P)
-#error "Non multi-arch definition of DEPRECATED_PUSH_ARGUMENTS"
-#endif
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_PUSH_ARGUMENTS_P)
-#define DEPRECATED_PUSH_ARGUMENTS_P() (gdbarch_deprecated_push_arguments_p (current_gdbarch))
-#endif
-
-/* Default (function) for non- multi-arch platforms. */
-#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_PUSH_ARGUMENTS)
-#define DEPRECATED_PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) (internal_error (__FILE__, __LINE__, "DEPRECATED_PUSH_ARGUMENTS"), 0)
-#endif
-
-typedef CORE_ADDR (gdbarch_deprecated_push_arguments_ftype) (int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr);
-extern CORE_ADDR gdbarch_deprecated_push_arguments (struct gdbarch *gdbarch, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr);
-extern void set_gdbarch_deprecated_push_arguments (struct gdbarch *gdbarch, gdbarch_deprecated_push_arguments_ftype *deprecated_push_arguments);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_PUSH_ARGUMENTS)
-#error "Non multi-arch definition of DEPRECATED_PUSH_ARGUMENTS"
-#endif
-#if !defined (DEPRECATED_PUSH_ARGUMENTS)
-#define DEPRECATED_PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) (gdbarch_deprecated_push_arguments (current_gdbarch, nargs, args, sp, struct_return, struct_addr))
-#endif
-
-extern int gdbarch_push_dummy_call_p (struct gdbarch *gdbarch);
-
-typedef CORE_ADDR (gdbarch_push_dummy_call_ftype) (struct gdbarch *gdbarch, CORE_ADDR func_addr, struct regcache *regcache, CORE_ADDR bp_addr, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr);
-extern CORE_ADDR gdbarch_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, struct regcache *regcache, CORE_ADDR bp_addr, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr);
-extern void set_gdbarch_push_dummy_call (struct gdbarch *gdbarch, gdbarch_push_dummy_call_ftype *push_dummy_call);
-
-#if defined (DEPRECATED_PUSH_DUMMY_FRAME)
-/* Legacy for systems yet to multi-arch DEPRECATED_PUSH_DUMMY_FRAME */
-#if !defined (DEPRECATED_PUSH_DUMMY_FRAME_P)
-#define DEPRECATED_PUSH_DUMMY_FRAME_P() (1)
-#endif
-#endif
-
-/* Default predicate for non- multi-arch targets. */
-#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_PUSH_DUMMY_FRAME_P)
-#define DEPRECATED_PUSH_DUMMY_FRAME_P() (0)
-#endif
-
-extern int gdbarch_deprecated_push_dummy_frame_p (struct gdbarch *gdbarch);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_PUSH_DUMMY_FRAME_P)
-#error "Non multi-arch definition of DEPRECATED_PUSH_DUMMY_FRAME"
-#endif
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_PUSH_DUMMY_FRAME_P)
-#define DEPRECATED_PUSH_DUMMY_FRAME_P() (gdbarch_deprecated_push_dummy_frame_p (current_gdbarch))
-#endif
-
-/* Default (function) for non- multi-arch platforms. */
-#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_PUSH_DUMMY_FRAME)
-#define DEPRECATED_PUSH_DUMMY_FRAME (internal_error (__FILE__, __LINE__, "DEPRECATED_PUSH_DUMMY_FRAME"), 0)
-#endif
-
-typedef void (gdbarch_deprecated_push_dummy_frame_ftype) (void);
-extern void gdbarch_deprecated_push_dummy_frame (struct gdbarch *gdbarch);
-extern void set_gdbarch_deprecated_push_dummy_frame (struct gdbarch *gdbarch, gdbarch_deprecated_push_dummy_frame_ftype *deprecated_push_dummy_frame);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_PUSH_DUMMY_FRAME)
-#error "Non multi-arch definition of DEPRECATED_PUSH_DUMMY_FRAME"
-#endif
-#if !defined (DEPRECATED_PUSH_DUMMY_FRAME)
-#define DEPRECATED_PUSH_DUMMY_FRAME (gdbarch_deprecated_push_dummy_frame (current_gdbarch))
-#endif
-
-/* NOTE: This can be handled directly in push_dummy_call. */
-
-#if defined (DEPRECATED_PUSH_RETURN_ADDRESS)
-/* Legacy for systems yet to multi-arch DEPRECATED_PUSH_RETURN_ADDRESS */
-#if !defined (DEPRECATED_PUSH_RETURN_ADDRESS_P)
-#define DEPRECATED_PUSH_RETURN_ADDRESS_P() (1)
-#endif
-#endif
-
-/* Default predicate for non- multi-arch targets. */
-#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_PUSH_RETURN_ADDRESS_P)
-#define DEPRECATED_PUSH_RETURN_ADDRESS_P() (0)
-#endif
-
-extern int gdbarch_deprecated_push_return_address_p (struct gdbarch *gdbarch);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_PUSH_RETURN_ADDRESS_P)
-#error "Non multi-arch definition of DEPRECATED_PUSH_RETURN_ADDRESS"
-#endif
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_PUSH_RETURN_ADDRESS_P)
-#define DEPRECATED_PUSH_RETURN_ADDRESS_P() (gdbarch_deprecated_push_return_address_p (current_gdbarch))
-#endif
-
-/* Default (function) for non- multi-arch platforms. */
-#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_PUSH_RETURN_ADDRESS)
-#define DEPRECATED_PUSH_RETURN_ADDRESS(pc, sp) (internal_error (__FILE__, __LINE__, "DEPRECATED_PUSH_RETURN_ADDRESS"), 0)
-#endif
-
-typedef CORE_ADDR (gdbarch_deprecated_push_return_address_ftype) (CORE_ADDR pc, CORE_ADDR sp);
-extern CORE_ADDR gdbarch_deprecated_push_return_address (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR sp);
-extern void set_gdbarch_deprecated_push_return_address (struct gdbarch *gdbarch, gdbarch_deprecated_push_return_address_ftype *deprecated_push_return_address);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_PUSH_RETURN_ADDRESS)
-#error "Non multi-arch definition of DEPRECATED_PUSH_RETURN_ADDRESS"
-#endif
-#if !defined (DEPRECATED_PUSH_RETURN_ADDRESS)
-#define DEPRECATED_PUSH_RETURN_ADDRESS(pc, sp) (gdbarch_deprecated_push_return_address (current_gdbarch, pc, sp))
-#endif
-
 #if defined (DEPRECATED_POP_FRAME)
 /* Legacy for systems yet to multi-arch DEPRECATED_POP_FRAME */
 #if !defined (DEPRECATED_POP_FRAME_P)
@@ -2107,21 +2172,6 @@
 #define DECR_PC_AFTER_BREAK (gdbarch_decr_pc_after_break (current_gdbarch))
 #endif
 
-/* Default (function) for non- multi-arch platforms. */
-#if (!GDB_MULTI_ARCH) && !defined (PREPARE_TO_PROCEED)
-#define PREPARE_TO_PROCEED(select_it) (default_prepare_to_proceed (select_it))
-#endif
-
-typedef int (gdbarch_prepare_to_proceed_ftype) (int select_it);
-extern int gdbarch_prepare_to_proceed (struct gdbarch *gdbarch, int select_it);
-extern void set_gdbarch_prepare_to_proceed (struct gdbarch *gdbarch, gdbarch_prepare_to_proceed_ftype *prepare_to_proceed);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (PREPARE_TO_PROCEED)
-#error "Non multi-arch definition of PREPARE_TO_PROCEED"
-#endif
-#if !defined (PREPARE_TO_PROCEED)
-#define PREPARE_TO_PROCEED(select_it) (gdbarch_prepare_to_proceed (current_gdbarch, select_it))
-#endif
-
 extern CORE_ADDR gdbarch_function_start_offset (struct gdbarch *gdbarch);
 extern void set_gdbarch_function_start_offset (struct gdbarch *gdbarch, CORE_ADDR function_start_offset);
 #if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (FUNCTION_START_OFFSET)
@@ -2421,22 +2471,6 @@
 extern CORE_ADDR gdbarch_frame_align (struct gdbarch *gdbarch, CORE_ADDR address);
 extern void set_gdbarch_frame_align (struct gdbarch *gdbarch, gdbarch_frame_align_ftype *frame_align);
 
-/* NOTE: cagney/2003-03-24: This is better handled by PUSH_ARGUMENTS. */
-
-/* Default (value) for non- multi-arch platforms. */
-#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED)
-#define DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED (0)
-#endif
-
-extern int gdbarch_deprecated_extra_stack_alignment_needed (struct gdbarch *gdbarch);
-extern void set_gdbarch_deprecated_extra_stack_alignment_needed (struct gdbarch *gdbarch, int deprecated_extra_stack_alignment_needed);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED)
-#error "Non multi-arch definition of DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED"
-#endif
-#if !defined (DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED)
-#define DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED (gdbarch_deprecated_extra_stack_alignment_needed (current_gdbarch))
-#endif
-
 #if defined (REG_STRUCT_HAS_ADDR)
 /* Legacy for systems yet to multi-arch REG_STRUCT_HAS_ADDR */
 #if !defined (REG_STRUCT_HAS_ADDR_P)
@@ -2472,50 +2506,6 @@
 #define REG_STRUCT_HAS_ADDR(gcc_p, type) (gdbarch_reg_struct_has_addr (current_gdbarch, gcc_p, type))
 #endif
 
-/* FIXME: kettenis/2003-03-08: This should be replaced by a function
-   parametrized with (at least) the regcache. */
-
-#if defined (SAVE_DUMMY_FRAME_TOS)
-/* Legacy for systems yet to multi-arch SAVE_DUMMY_FRAME_TOS */
-#if !defined (SAVE_DUMMY_FRAME_TOS_P)
-#define SAVE_DUMMY_FRAME_TOS_P() (1)
-#endif
-#endif
-
-/* Default predicate for non- multi-arch targets. */
-#if (!GDB_MULTI_ARCH) && !defined (SAVE_DUMMY_FRAME_TOS_P)
-#define SAVE_DUMMY_FRAME_TOS_P() (0)
-#endif
-
-extern int gdbarch_save_dummy_frame_tos_p (struct gdbarch *gdbarch);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (SAVE_DUMMY_FRAME_TOS_P)
-#error "Non multi-arch definition of SAVE_DUMMY_FRAME_TOS"
-#endif
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (SAVE_DUMMY_FRAME_TOS_P)
-#define SAVE_DUMMY_FRAME_TOS_P() (gdbarch_save_dummy_frame_tos_p (current_gdbarch))
-#endif
-
-/* Default (function) for non- multi-arch platforms. */
-#if (!GDB_MULTI_ARCH) && !defined (SAVE_DUMMY_FRAME_TOS)
-#define SAVE_DUMMY_FRAME_TOS(sp) (internal_error (__FILE__, __LINE__, "SAVE_DUMMY_FRAME_TOS"), 0)
-#endif
-
-typedef void (gdbarch_save_dummy_frame_tos_ftype) (CORE_ADDR sp);
-extern void gdbarch_save_dummy_frame_tos (struct gdbarch *gdbarch, CORE_ADDR sp);
-extern void set_gdbarch_save_dummy_frame_tos (struct gdbarch *gdbarch, gdbarch_save_dummy_frame_tos_ftype *save_dummy_frame_tos);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (SAVE_DUMMY_FRAME_TOS)
-#error "Non multi-arch definition of SAVE_DUMMY_FRAME_TOS"
-#endif
-#if !defined (SAVE_DUMMY_FRAME_TOS)
-#define SAVE_DUMMY_FRAME_TOS(sp) (gdbarch_save_dummy_frame_tos (current_gdbarch, sp))
-#endif
-
-extern int gdbarch_unwind_dummy_id_p (struct gdbarch *gdbarch);
-
-typedef struct frame_id (gdbarch_unwind_dummy_id_ftype) (struct gdbarch *gdbarch, struct frame_info *info);
-extern struct frame_id gdbarch_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *info);
-extern void set_gdbarch_unwind_dummy_id (struct gdbarch *gdbarch, gdbarch_unwind_dummy_id_ftype *unwind_dummy_id);
-
 extern int gdbarch_parm_boundary (struct gdbarch *gdbarch);
 extern void set_gdbarch_parm_boundary (struct gdbarch *gdbarch, int parm_boundary);
 #if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (PARM_BOUNDARY)
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index 9911ec8..a5b2bf9 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -428,13 +428,8 @@
 #
 F:2:TARGET_READ_PC:CORE_ADDR:read_pc:ptid_t ptid:ptid
 f:2:TARGET_WRITE_PC:void:write_pc:CORE_ADDR val, ptid_t ptid:val, ptid::0:generic_target_write_pc::0
-# This is simply not needed.  See value_of_builtin_frame_fp_reg and
-# call_function_by_hand.
-F::DEPRECATED_TARGET_READ_FP:CORE_ADDR:deprecated_target_read_fp:void
 # UNWIND_SP is a direct replacement for TARGET_READ_SP.
 F:2:TARGET_READ_SP:CORE_ADDR:read_sp:void
-# The dummy call frame SP should be set by push_dummy_call.
-F:2:DEPRECATED_DUMMY_WRITE_SP:void:deprecated_dummy_write_sp:CORE_ADDR val:val
 # Function for getting target's idea of a frame pointer.  FIXME: GDB's
 # whole scheme for dealing with "frames" and "frame pointers" needs a
 # serious shakedown.
@@ -455,9 +450,6 @@
 # all (-1).
 # SP_REGNUM will hopefully be replaced by UNWIND_SP.
 v:2:SP_REGNUM:int:sp_regnum::::-1:-1::0
-# This is simply not needed.  See value_of_builtin_frame_fp_reg and
-# call_function_by_hand.
-v:2:DEPRECATED_FP_REGNUM:int:deprecated_fp_regnum::::-1:-1::0
 v:2:PC_REGNUM:int:pc_regnum::::-1:-1::0
 v:2:PS_REGNUM:int:ps_regnum::::-1:-1::0
 v:2:FP0_REGNUM:int:fp0_regnum::::0:-1::0
@@ -474,8 +466,6 @@
 f:2:SDB_REG_TO_REGNUM:int:sdb_reg_to_regnum:int sdb_regnr:sdb_regnr:::no_op_reg_to_regnum::0
 f:2:DWARF2_REG_TO_REGNUM:int:dwarf2_reg_to_regnum:int dwarf2_regnr:dwarf2_regnr:::no_op_reg_to_regnum::0
 f:2:REGISTER_NAME:const char *:register_name:int regnr:regnr:::legacy_register_name::0
-# See the dummy frame code.
-v::DEPRECATED_REGISTER_SIZE:int:deprecated_register_size
 
 # REGISTER_TYPE is a direct replacement for REGISTER_VIRTUAL_TYPE.
 M:2:REGISTER_TYPE:struct type *:register_type:int reg_nr:reg_nr::0:
@@ -484,18 +474,23 @@
 # DEPRECATED_REGISTER_BYTES can be deleted.  The value is computed
 # from REGISTER_TYPE.
 v::DEPRECATED_REGISTER_BYTES:int:deprecated_register_bytes
-# DEPRECATED_REGISTER_BYTE can be deleted.  The value is computed from
-# REGISTER_TYPE.  NOTE: cagney/2002-05-02: This function with
-# predicate has a valid (callable) initial value.  As a consequence,
-# even when the predicate is false, the corresponding function works.
-# This simplifies the migration process - old code, calling
-# DEPRECATED_REGISTER_BYTE, doesn't need to be modified.
+# If the value returned by DEPRECATED_REGISTER_BYTE agrees with the
+# register offsets computed using just REGISTER_TYPE, this can be
+# deleted.  See: maint print registers.  NOTE: cagney/2002-05-02: This
+# function with predicate has a valid (callable) initial value.  As a
+# consequence, even when the predicate is false, the corresponding
+# function works.  This simplifies the migration process - old code,
+# calling DEPRECATED_REGISTER_BYTE, doesn't need to be modified.
 F::REGISTER_BYTE:int:deprecated_register_byte:int reg_nr:reg_nr::generic_register_byte:generic_register_byte
-# DEPRECATED_REGISTER_RAW_SIZE can be deleted.  The value is computed
-# from REGISTER_TYPE.
+# If all registers have identical raw and virtual sizes and those
+# sizes agree with the value computed from REGISTER_TYPE,
+# DEPRECATED_REGISTER_RAW_SIZE can be deleted.  See: maint print
+# registers.
 f:2:REGISTER_RAW_SIZE:int:deprecated_register_raw_size:int reg_nr:reg_nr::generic_register_size:generic_register_size::0
-# DEPRECATED_REGISTER_VIRTUAL_SIZE can be deleted.  The value is
-# computed from REGISTER_TYPE.
+# If all registers have identical raw and virtual sizes and those
+# sizes agree with the value computed from REGISTER_TYPE,
+# DEPRECATED_REGISTER_VIRTUAL_SIZE can be deleted.  See: maint print
+# registers.
 f:2:REGISTER_VIRTUAL_SIZE:int:deprecated_register_virtual_size:int reg_nr:reg_nr::generic_register_size:generic_register_size::0
 # DEPRECATED_MAX_REGISTER_RAW_SIZE can be deleted.  It has been
 # replaced by the constant MAX_REGISTER_SIZE.
@@ -504,6 +499,57 @@
 # replaced by the constant MAX_REGISTER_SIZE.
 V:2:DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE:int:deprecated_max_register_virtual_size
 
+# See gdbint.texinfo, and PUSH_DUMMY_CALL.
+M::UNWIND_DUMMY_ID:struct frame_id:unwind_dummy_id:struct frame_info *info:info::0:0
+# Implement UNWIND_DUMMY_ID and PUSH_DUMMY_CALL, then delete
+# SAVE_DUMMY_FRAME_TOS.
+F:2:DEPRECATED_SAVE_DUMMY_FRAME_TOS:void:deprecated_save_dummy_frame_tos:CORE_ADDR sp:sp
+# Implement UNWIND_DUMMY_ID and PUSH_DUMMY_CALL, then delete
+# DEPRECATED_FP_REGNUM.
+v:2:DEPRECATED_FP_REGNUM:int:deprecated_fp_regnum::::-1:-1::0
+# Implement UNWIND_DUMMY_ID and PUSH_DUMMY_CALL, then delete
+# DEPRECATED_TARGET_READ_FP.
+F::DEPRECATED_TARGET_READ_FP:CORE_ADDR:deprecated_target_read_fp:void
+
+# See gdbint.texinfo.  See infcall.c.  New, all singing all dancing,
+# replacement for DEPRECATED_PUSH_ARGUMENTS.
+M::PUSH_DUMMY_CALL:CORE_ADDR:push_dummy_call:CORE_ADDR func_addr, struct regcache *regcache, CORE_ADDR bp_addr, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr:func_addr, regcache, bp_addr, nargs, args, sp, struct_return, struct_addr
+# PUSH_DUMMY_CALL is a direct replacement for DEPRECATED_PUSH_ARGUMENTS.
+F:2:DEPRECATED_PUSH_ARGUMENTS:CORE_ADDR:deprecated_push_arguments:int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr:nargs, args, sp, struct_return, struct_addr
+# DEPRECATED_USE_GENERIC_DUMMY_FRAMES can be deleted.  Always true.
+v::DEPRECATED_USE_GENERIC_DUMMY_FRAMES:int:deprecated_use_generic_dummy_frames:::::1::0
+# Implement PUSH_RETURN_ADDRESS, and then merge in
+# DEPRECATED_PUSH_RETURN_ADDRESS.
+F:2:DEPRECATED_PUSH_RETURN_ADDRESS:CORE_ADDR:deprecated_push_return_address:CORE_ADDR pc, CORE_ADDR sp:pc, sp:::0
+# Implement PUSH_DUMMY_CALL, then merge in DEPRECATED_DUMMY_WRITE_SP.
+F:2:DEPRECATED_DUMMY_WRITE_SP:void:deprecated_dummy_write_sp:CORE_ADDR val:val
+# DEPRECATED_REGISTER_SIZE can be deleted.
+v::DEPRECATED_REGISTER_SIZE:int:deprecated_register_size
+v::CALL_DUMMY_LOCATION:int:call_dummy_location:::::AT_ENTRY_POINT::0
+f::CALL_DUMMY_ADDRESS:CORE_ADDR:call_dummy_address:void::::entry_point_address::0
+# DEPRECATED_CALL_DUMMY_START_OFFSET can be deleted.
+v::DEPRECATED_CALL_DUMMY_START_OFFSET:CORE_ADDR:deprecated_call_dummy_start_offset
+# DEPRECATED_CALL_DUMMY_BREAKPOINT_OFFSET can be deleted.
+v::DEPRECATED_CALL_DUMMY_BREAKPOINT_OFFSET:CORE_ADDR:deprecated_call_dummy_breakpoint_offset
+# DEPRECATED_CALL_DUMMY_LENGTH can be deleted.
+v::DEPRECATED_CALL_DUMMY_LENGTH:int:deprecated_call_dummy_length
+# DEPRECATED_CALL_DUMMY_WORDS can be deleted.
+v::DEPRECATED_CALL_DUMMY_WORDS:LONGEST *:deprecated_call_dummy_words::::0:legacy_call_dummy_words::0:0x%08lx
+# Implement PUSH_DUMMY_CALL, then delete DEPRECATED_SIZEOF_CALL_DUMMY_WORDS.
+v::DEPRECATED_SIZEOF_CALL_DUMMY_WORDS:int:deprecated_sizeof_call_dummy_words::::0:legacy_sizeof_call_dummy_words::0
+# Implement PUSH_DUMMY_CALL, then delete DEPRECATED_CALL_DUMMY_STACK_ADJUST.
+V:2:DEPRECATED_CALL_DUMMY_STACK_ADJUST:int:deprecated_call_dummy_stack_adjust::::0
+# DEPRECATED_FIX_CALL_DUMMY can be deleted.  For the SPARC, implement
+# PUSH_DUMMY_CODE and set CALL_DUMMY_LOCATION to ON_STACK.
+F::DEPRECATED_FIX_CALL_DUMMY:void:deprecated_fix_call_dummy:char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs, struct value **args, struct type *type, int gcc_p:dummy, pc, fun, nargs, args, type, gcc_p
+# This is a replacement for DEPRECATED_FIX_CALL_DUMMY et.al.
+M::PUSH_DUMMY_CODE:CORE_ADDR:push_dummy_code:CORE_ADDR sp, CORE_ADDR funaddr, int using_gcc, struct value **args, int nargs, struct type *value_type, CORE_ADDR *real_pc, CORE_ADDR *bp_addr:sp, funaddr, using_gcc, args, nargs, value_type, real_pc, bp_addr:
+# Implement PUSH_DUMMY_CALL, then delete DEPRECATED_PUSH_DUMMY_FRAME.
+F:2:DEPRECATED_PUSH_DUMMY_FRAME:void:deprecated_push_dummy_frame:void:-:::0
+# Implement PUSH_DUMMY_CALL, then delete
+# DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED.
+v:2:DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED:int:deprecated_extra_stack_alignment_needed::::0:0::0:::
+
 F:2:DEPRECATED_DO_REGISTERS_INFO:void:deprecated_do_registers_info:int reg_nr, int fpregs:reg_nr, fpregs
 m:2:PRINT_REGISTERS_INFO:void:print_registers_info:struct ui_file *file, struct frame_info *frame, int regnum, int all:file, frame, regnum, all:::default_print_registers_info::0
 M:2:PRINT_FLOAT_INFO:void:print_float_info:struct ui_file *file, struct frame_info *frame, const char *args:file, frame, args
@@ -516,41 +562,12 @@
 f:2:CANNOT_STORE_REGISTER:int:cannot_store_register:int regnum:regnum:::cannot_register_not::0
 # setjmp/longjmp support.
 F:2:GET_LONGJMP_TARGET:int:get_longjmp_target:CORE_ADDR *pc:pc::0:0
-#
-# Non multi-arch DUMMY_FRAMES are a mess (multi-arch ones are not that
-# much better but at least they are vaguely consistent).  The headers
-# and body contain convoluted #if/#else sequences for determine how
-# things should be compiled.  Instead of trying to mimic that
-# behaviour here (and hence entrench it further) gdbarch simply
-# reqires that these methods be set up from the word go.  This also
-# avoids any potential problems with moving beyond multi-arch partial.
-v::DEPRECATED_USE_GENERIC_DUMMY_FRAMES:int:deprecated_use_generic_dummy_frames:::::1::0
-# Replaced by push_dummy_code.
-v::CALL_DUMMY_LOCATION:int:call_dummy_location:::::AT_ENTRY_POINT::0
-# Replaced by push_dummy_code.
-f::CALL_DUMMY_ADDRESS:CORE_ADDR:call_dummy_address:void::::entry_point_address::0
-# Replaced by push_dummy_code.
-v::DEPRECATED_CALL_DUMMY_START_OFFSET:CORE_ADDR:deprecated_call_dummy_start_offset
-# Replaced by push_dummy_code.
-v::DEPRECATED_CALL_DUMMY_BREAKPOINT_OFFSET:CORE_ADDR:deprecated_call_dummy_breakpoint_offset
-# Replaced by push_dummy_code.
-v::DEPRECATED_CALL_DUMMY_LENGTH:int:deprecated_call_dummy_length
 # NOTE: cagney/2002-11-24: This function with predicate has a valid
 # (callable) initial value.  As a consequence, even when the predicate
 # is false, the corresponding function works.  This simplifies the
 # migration process - old code, calling DEPRECATED_PC_IN_CALL_DUMMY(),
 # doesn't need to be modified.
 F::DEPRECATED_PC_IN_CALL_DUMMY:int:deprecated_pc_in_call_dummy:CORE_ADDR pc, CORE_ADDR sp, CORE_ADDR frame_address:pc, sp, frame_address::generic_pc_in_call_dummy:generic_pc_in_call_dummy
-# Replaced by push_dummy_code.
-v::DEPRECATED_CALL_DUMMY_WORDS:LONGEST *:deprecated_call_dummy_words::::0:legacy_call_dummy_words::0:0x%08lx
-# Replaced by push_dummy_code.
-v::DEPRECATED_SIZEOF_CALL_DUMMY_WORDS:int:deprecated_sizeof_call_dummy_words::::0:legacy_sizeof_call_dummy_words::0
-# Replaced by push_dummy_code.
-V:2:DEPRECATED_CALL_DUMMY_STACK_ADJUST:int:deprecated_call_dummy_stack_adjust::::0
-# Replaced by push_dummy_code.
-F::DEPRECATED_FIX_CALL_DUMMY:void:deprecated_fix_call_dummy:char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs, struct value **args, struct type *type, int gcc_p:dummy, pc, fun, nargs, args, type, gcc_p
-# This is a replacement for DEPRECATED_FIX_CALL_DUMMY et.al.
-M::PUSH_DUMMY_CODE:CORE_ADDR:push_dummy_code:CORE_ADDR sp, CORE_ADDR funaddr, int using_gcc, struct value **args, int nargs, struct type *value_type, CORE_ADDR *real_pc, CORE_ADDR *bp_addr:sp, funaddr, using_gcc, args, nargs, value_type, real_pc, bp_addr:
 F:2:DEPRECATED_INIT_FRAME_PC_FIRST:CORE_ADDR:deprecated_init_frame_pc_first:int fromleaf, struct frame_info *prev:fromleaf, prev
 F:2:DEPRECATED_INIT_FRAME_PC:CORE_ADDR:deprecated_init_frame_pc:int fromleaf, struct frame_info *prev:fromleaf, prev
 #
@@ -568,21 +585,15 @@
 # For raw <-> cooked register conversions, replaced by pseudo registers.
 f:2:DEPRECATED_REGISTER_CONVERT_TO_RAW:void:deprecated_register_convert_to_raw:struct type *type, int regnum, const char *from, char *to:type, regnum, from, to:::0::0
 #
-f:1:CONVERT_REGISTER_P:int:convert_register_p:int regnum:regnum::0:legacy_convert_register_p::0
-f:1:REGISTER_TO_VALUE:void:register_to_value:int regnum, struct type *type, char *from, char *to:regnum, type, from, to::0:legacy_register_to_value::0
-f:1:VALUE_TO_REGISTER:void:value_to_register:struct type *type, int regnum, char *from, char *to:type, regnum, from, to::0:legacy_value_to_register::0
+f:1:CONVERT_REGISTER_P:int:convert_register_p:int regnum, struct type *type:regnum, type::0:legacy_convert_register_p::0
+f:1:REGISTER_TO_VALUE:void:register_to_value:struct frame_info *frame, int regnum, struct type *type, void *buf:frame, regnum, type, buf::0:legacy_register_to_value::0
+f:1:VALUE_TO_REGISTER:void:value_to_register:struct frame_info *frame, int regnum, struct type *type, const void *buf:frame, regnum, type, buf::0:legacy_value_to_register::0
 #
 f:2:POINTER_TO_ADDRESS:CORE_ADDR:pointer_to_address:struct type *type, const void *buf:type, buf:::unsigned_pointer_to_address::0
 f:2:ADDRESS_TO_POINTER:void:address_to_pointer:struct type *type, void *buf, CORE_ADDR addr:type, buf, addr:::unsigned_address_to_pointer::0
 F:2:INTEGER_TO_ADDRESS:CORE_ADDR:integer_to_address:struct type *type, void *buf:type, buf
 #
 f:2:RETURN_VALUE_ON_STACK:int:return_value_on_stack:struct type *type:type:::generic_return_value_on_stack_not::0
-# Replaced by PUSH_DUMMY_CALL
-F:2:DEPRECATED_PUSH_ARGUMENTS:CORE_ADDR:deprecated_push_arguments:int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr:nargs, args, sp, struct_return, struct_addr
-M::PUSH_DUMMY_CALL:CORE_ADDR:push_dummy_call:CORE_ADDR func_addr, struct regcache *regcache, CORE_ADDR bp_addr, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr:func_addr, regcache, bp_addr, nargs, args, sp, struct_return, struct_addr
-F:2:DEPRECATED_PUSH_DUMMY_FRAME:void:deprecated_push_dummy_frame:void:-:::0
-# NOTE: This can be handled directly in push_dummy_call.
-F:2:DEPRECATED_PUSH_RETURN_ADDRESS:CORE_ADDR:deprecated_push_return_address:CORE_ADDR pc, CORE_ADDR sp:pc, sp:::0
 F:2:DEPRECATED_POP_FRAME:void:deprecated_pop_frame:void:-:::0
 # NOTE: cagney/2003-03-24: Replaced by PUSH_ARGUMENTS.
 F:2:DEPRECATED_STORE_STRUCT_RETURN:void:deprecated_store_struct_return:CORE_ADDR addr, CORE_ADDR sp:addr, sp:::0
@@ -606,7 +617,6 @@
 f:2:MEMORY_INSERT_BREAKPOINT:int:memory_insert_breakpoint:CORE_ADDR addr, char *contents_cache:addr, contents_cache::0:default_memory_insert_breakpoint::0
 f:2:MEMORY_REMOVE_BREAKPOINT:int:memory_remove_breakpoint:CORE_ADDR addr, char *contents_cache:addr, contents_cache::0:default_memory_remove_breakpoint::0
 v:2:DECR_PC_AFTER_BREAK:CORE_ADDR:decr_pc_after_break::::0:-1
-f:2:PREPARE_TO_PROCEED:int:prepare_to_proceed:int select_it:select_it::0:default_prepare_to_proceed::0
 v:2:FUNCTION_START_OFFSET:CORE_ADDR:function_start_offset::::0:-1
 #
 m::REMOTE_TRANSLATE_XFER_ADDRESS:void:remote_translate_xfer_address:struct regcache *regcache, CORE_ADDR gdb_addr, int gdb_len, CORE_ADDR *rem_addr, int *rem_len:regcache, gdb_addr, gdb_len, rem_addr, rem_len:::generic_remote_translate_xfer_address::0
@@ -628,13 +638,7 @@
 #
 F:2:STACK_ALIGN:CORE_ADDR:stack_align:CORE_ADDR sp:sp::0:0
 M:::CORE_ADDR:frame_align:CORE_ADDR address:address
-# NOTE: cagney/2003-03-24: This is better handled by PUSH_ARGUMENTS.
-v:2:DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED:int:deprecated_extra_stack_alignment_needed::::0:0::0:::
 F:2:REG_STRUCT_HAS_ADDR:int:reg_struct_has_addr:int gcc_p, struct type *type:gcc_p, type::0:0
-# FIXME: kettenis/2003-03-08: This should be replaced by a function
-# parametrized with (at least) the regcache.
-F:2:SAVE_DUMMY_FRAME_TOS:void:save_dummy_frame_tos:CORE_ADDR sp:sp::0:0
-M::UNWIND_DUMMY_ID:struct frame_id:unwind_dummy_id:struct frame_info *info:info::0:0
 v:2:PARM_BOUNDARY:int:parm_boundary
 #
 v:2:TARGET_FLOAT_FORMAT:const struct floatformat *:float_format::::::default_float_format (gdbarch)::%s:(TARGET_FLOAT_FORMAT)->name
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 8e95517..8886ace 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,18 @@
+2003-06-20  Daniel Jacobowitz  <drow@mvista.com>
+
+	* Makefile.in (SFILES): Update.
+	* low-hppabsd.c, low-lynx.c, low-nbsd.c, low-sim.c, low-sparc.c,
+	low-sun3.c: Remove files.
+
+2003-06-17  Daniel Jacobowitz  <drow@mvista.com>
+
+	* linux-low.c: Move comment to linux_thread_alive where it belonged.
+	(linux_detach_one_process, linux_detach): New functions.
+	(linux_target_ops): Add linux_detach.
+	* server.c (main): Handle 'D' packet.
+	* target.h (struct target_ops): Add "detach" member.
+	(detach_inferior): Define.
+
 2003-06-13  Mark Kettenis  <kettenis@gnu.org>
 
 	From Kelley Cook  <kelleycook@wideopenwest.com>:
diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
index 763c21e..80667f9 100644
--- a/gdb/gdbserver/Makefile.in
+++ b/gdb/gdbserver/Makefile.in
@@ -113,10 +113,16 @@
 
 # All source files that go into linking GDB remote server.
 
-SFILES = $(srcdir)/low-hppabsd.c $(srcdir)/low-linux.c $(srcdir)/low-lynx.c \
-	 $(srcdir)/low-nbsd.c $(srcdir)/low-sim.c $(srcdir)/low-sparc.c \
-	 $(srcdir)/low-sun3.c $(srcdir)/utils.c $(srcdir)/server.c \
-	 $(srcdir)/remote-utils.c
+SFILES=	$(srcdir)/gdbreplay.c $(srcdir)/inferiors.c \
+	$(srcdir)/mem-break.c $(srcdir)/proc-service.c $(srcdir)/regcache.c \
+	$(srcdir)/remote-utils.c $(srcdir)/server.c $(srcdir)/target.c \
+	$(srcdir)/thread-db.c $(srcdir)/utils.c \
+	$(srcdir)/linux-arm-low.c $(srcdir)/linux-i386-low.c \
+	$(srcdir)/i387-fp.c \
+	$(srcdir)/linux-ia64-low.c $(srcdir)/linux-low.c \
+	$(srcdir)/linux-m68k-low.c $(srcdir)/linux-mips-low.c \
+	$(srcdir)/linux-ppc-low.c $(srcdir)/linux-s390-low.c \
+	$(srcdir)/linux-sh-low.c $(srcdir)/linux-x86-64-low.c
 
 DEPFILES = @GDBSERVER_DEPFILES@
 
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index 4ad204e..c700d40 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -234,13 +234,28 @@
     } while (WIFSTOPPED (wstat));
 }
 
-/* Return nonzero if the given thread is still alive.  */
 static void
 linux_kill (void)
 {
   for_each_inferior (&all_threads, linux_kill_one_process);
 }
 
+static void
+linux_detach_one_process (struct inferior_list_entry *entry)
+{
+  struct thread_info *thread = (struct thread_info *) entry;
+  struct process_info *process = get_thread_process (thread);
+
+  ptrace (PTRACE_DETACH, pid_of (process), 0, 0);
+}
+
+static void
+linux_detach (void)
+{
+  for_each_inferior (&all_threads, linux_detach_one_process);
+}
+
+/* Return nonzero if the given thread is still alive.  */
 static int
 linux_thread_alive (int tid)
 {
@@ -1249,6 +1264,7 @@
   linux_create_inferior,
   linux_attach,
   linux_kill,
+  linux_detach,
   linux_thread_alive,
   linux_resume,
   linux_wait,
diff --git a/gdb/gdbserver/linux-ppc64-low.c b/gdb/gdbserver/linux-ppc64-low.c
deleted file mode 100644
index f88db35..0000000
--- a/gdb/gdbserver/linux-ppc64-low.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/* gdbserver low-level interface for GNU/Linux running on 64-bit PowerPC.
-   Copyright 2003 Free Software Foundation, Inc.
-
-   This file is part of GDB.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
-
-#include "server.h"
-#include "linux-low.h"
-
-#include <asm/ptrace.h>
-
-#define ppc64_num_regs (sizeof (ppc64_regmap) / sizeof (ppc64_regmap[0]))
-
-#define FPR(n) ((PT_FPR0 + (n)) * 8)
-
-/* Currently, don't check/send MQ.  */
-static int ppc64_regmap[] =
-  {
-    PT_R0  * 8,    PT_R1  * 8,    PT_R2  * 8,    PT_R3  * 8,
-    PT_R4  * 8,    PT_R5  * 8,    PT_R6  * 8,    PT_R7  * 8,
-    PT_R8  * 8,    PT_R9  * 8,    PT_R10 * 8,    PT_R11 * 8,
-    PT_R12 * 8,    PT_R13 * 8,    PT_R14 * 8,    PT_R15 * 8,
-    PT_R16 * 8,    PT_R17 * 8,    PT_R18 * 8,    PT_R19 * 8,
-    PT_R20 * 8,    PT_R21 * 8,    PT_R22 * 8,    PT_R23 * 8,
-    PT_R24 * 8,    PT_R25 * 8,    PT_R26 * 8,    PT_R27 * 8,
-    PT_R28 * 8,    PT_R29 * 8,    PT_R30 * 8,    PT_R31 * 8,
-    FPR (0),       FPR (1),       FPR (2),       FPR (3),
-    FPR (4),       FPR (5),       FPR (6),       FPR (7),
-    FPR (8),       FPR (9),       FPR (10),      FPR (11),
-    FPR (12),      FPR (13),      FPR (14),      FPR (15),
-    FPR (16),      FPR (17),      FPR (18),      FPR (19),
-    FPR (20),      FPR (21),      FPR (22),      FPR (23),
-    FPR (24),      FPR (25),      FPR (26),      FPR (27),
-    FPR (28),      FPR (29),      FPR (30),      FPR (31),
-    PT_NIP * 8,    PT_MSR * 8,    PT_CCR * 8,    PT_LNK * 8,
-    PT_CTR * 8,    PT_XER * 8,    PT_FPSCR * 8,
-  };
-
-static int
-ppc64_cannot_store_register (int regno)
-{
-  return 0;
-}
-
-static int
-ppc64_cannot_fetch_register (int regno)
-{
-  return 0;
-}
-
-static CORE_ADDR
-ppc64_get_pc (void)
-{
-  unsigned long pc;
-
-  collect_register_by_name ("pc", &pc);
-  return (CORE_ADDR) pc;
-}
-
-static void
-ppc64_set_pc (CORE_ADDR pc)
-{
-  unsigned long newpc = pc;
-
-  supply_register_by_name ("pc", &newpc);
-}
-
-/* Correct in either endianness.  
-   This instruction is "twge r2, r2", which GDB uses as a software
-   breakpoint.  */
-static const unsigned int ppc64_breakpoint = 0x7d821008;
-#define ppc64_breakpoint_len 4
-
-static int
-ppc64_breakpoint_at (CORE_ADDR where)
-{
-  unsigned int insn;
-
-  (*the_target->read_memory) (where, (char *) &insn, 4);
-  if (insn == ppc64_breakpoint)
-    return 1;
-  /* If necessary, recognize more trap instructions here.  GDB only uses the
-     one.  */
-  return 0;
-}
-
-struct linux_target_ops the_low_target = {
-  ppc64_num_regs,
-  ppc64_regmap,
-  ppc64_cannot_fetch_register,
-  ppc64_cannot_store_register,
-  ppc64_get_pc,
-  ppc64_set_pc,
-  (const char *) &ppc64_breakpoint,
-  ppc64_breakpoint_len,
-  NULL,
-  0,
-  ppc64_breakpoint_at,
-};
diff --git a/gdb/gdbserver/low-hppabsd.c b/gdb/gdbserver/low-hppabsd.c
deleted file mode 100644
index 3287923..0000000
--- a/gdb/gdbserver/low-hppabsd.c
+++ /dev/null
@@ -1,355 +0,0 @@
-/* Low level interface to ptrace, for the remote server for GDB.
-   Copyright 1995, 1996, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
-
-   This file is part of GDB.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
-
-#include "server.h"
-#include <sys/wait.h>
-#include "frame.h"
-#include "inferior.h"
-
-#include <stdio.h>
-#include <sys/param.h>
-#include <sys/dir.h>
-#include <sys/user.h>
-#include <signal.h>
-#include <sys/ioctl.h>
-#include <sgtty.h>
-#include <fcntl.h>
-
-/***************Begin MY defs*********************/
-static char my_registers[REGISTER_BYTES];
-char *registers = my_registers;
-/***************End MY defs*********************/
-
-#include <sys/ptrace.h>
-#include <machine/reg.h>
-
-extern int errno;
-
-/* Start an inferior process and returns its pid.
-   ALLARGS is a vector of program-name and args. */
-
-int
-create_inferior (char *program, char **allargs)
-{
-  int pid;
-
-  pid = fork ();
-  if (pid < 0)
-    perror_with_name ("fork");
-
-  if (pid == 0)
-    {
-      ptrace (PT_TRACE_ME, 0, 0, 0, 0);
-
-      execv (program, allargs);
-
-      fprintf (stderr, "Cannot exec %s: %s.\n", program,
-	       errno < sys_nerr ? sys_errlist[errno] : "unknown error");
-      fflush (stderr);
-      _exit (0177);
-    }
-
-  return pid;
-}
-
-/* Kill the inferior process.  Make us have no inferior.  */
-
-void
-kill_inferior (void)
-{
-  if (inferior_pid == 0)
-    return;
-  ptrace (8, inferior_pid, 0, 0, 0);
-  wait (0);
-/*************inferior_died ();****VK**************/
-}
-
-/* Attaching is not supported.  */
-int
-myattach (int pid)
-{
-  return -1;
-}
-
-/* Return nonzero if the given thread is still alive.  */
-int
-mythread_alive (int pid)
-{
-  return 1;
-}
-
-/* Wait for process, returns status */
-
-unsigned char
-mywait (char *status)
-{
-  int pid;
-  union wait w;
-
-  enable_async_io ();
-  pid = waitpid (inferior_pid, &w, 0);
-  disable_async_io ();
-  if (pid != inferior_pid)
-    perror_with_name ("wait");
-
-  if (WIFEXITED (w))
-    {
-      fprintf (stderr, "\nChild exited with retcode = %x \n", WEXITSTATUS (w));
-      *status = 'W';
-      return ((unsigned char) WEXITSTATUS (w));
-    }
-  else if (!WIFSTOPPED (w))
-    {
-      fprintf (stderr, "\nChild terminated with signal = %x \n", WTERMSIG (w));
-      *status = 'X';
-      return ((unsigned char) WTERMSIG (w));
-    }
-
-  fetch_inferior_registers (0);
-
-  *status = 'T';
-  return ((unsigned char) WSTOPSIG (w));
-}
-
-/* Resume execution of the inferior process.
-   If STEP is nonzero, single-step it.
-   If SIGNAL is nonzero, give it that signal.  */
-
-void
-myresume (int step, int signal)
-{
-  errno = 0;
-  ptrace (step ? PT_STEP : PT_CONTINUE, inferior_pid, 1, signal, 0);
-  if (errno)
-    perror_with_name ("ptrace");
-}
-
-
-#if !defined (offsetof)
-#define offsetof(TYPE, MEMBER) ((unsigned long) &((TYPE *)0)->MEMBER)
-#endif
-
-/* U_REGS_OFFSET is the offset of the registers within the u area.  */
-#if !defined (U_REGS_OFFSET)
-#define U_REGS_OFFSET \
-  ptrace (PT_READ_U, inferior_pid, \
-          (PTRACE_ARG3_TYPE) (offsetof (struct user, u_ar0)), 0) \
-    - KERNEL_U_ADDR
-#endif
-
-CORE_ADDR
-register_addr (int regno, CORE_ADDR blockend)
-{
-  CORE_ADDR addr;
-
-  if (regno < 0 || regno >= NUM_REGS)
-    error ("Invalid register number %d.", regno);
-
-  REGISTER_U_ADDR (addr, blockend, regno);
-
-  return addr;
-}
-
-/* Fetch one register.  */
-
-static void
-fetch_register (int regno)
-{
-  register unsigned int regaddr;
-  char buf[MAX_REGISTER_RAW_SIZE];
-  register int i;
-
-  /* Offset of registers within the u area.  */
-  unsigned int offset;
-
-  offset = U_REGS_OFFSET;
-
-  regaddr = register_addr (regno, offset);
-  for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int))
-    {
-      errno = 0;
-      *(int *) &registers[regno * 4 + i] = ptrace (PT_RUREGS, inferior_pid,
-					  (PTRACE_ARG3_TYPE) regaddr, 0, 0);
-      regaddr += sizeof (int);
-      if (errno != 0)
-	{
-	  /* Warning, not error, in case we are attached; sometimes the
-	     kernel doesn't let us at the registers.  */
-	  char *err = strerror (errno);
-	  char *msg = alloca (strlen (err) + 128);
-	  sprintf (msg, "reading register %d: %s", regno, err);
-	  error (msg);
-	  goto error_exit;
-	}
-    }
-error_exit:;
-}
-
-/* Fetch all registers, or just one, from the child process.  */
-
-void
-fetch_inferior_registers (int regno)
-{
-  if (regno == -1 || regno == 0)
-    for (regno = 0; regno < NUM_REGS; regno++)
-      fetch_register (regno);
-  else
-    fetch_register (regno);
-}
-
-/* Store our register values back into the inferior.
-   If REGNO is -1, do this for all registers.
-   Otherwise, REGNO specifies which register (so we can save time).  */
-
-void
-store_inferior_registers (int regno)
-{
-  register unsigned int regaddr;
-  char buf[80];
-  extern char registers[];
-  register int i;
-  unsigned int offset = U_REGS_OFFSET;
-  int scratch;
-
-  if (regno >= 0)
-    {
-      if (CANNOT_STORE_REGISTER (regno))
-	return;
-      regaddr = register_addr (regno, offset);
-      errno = 0;
-      if (regno == PCOQ_HEAD_REGNUM || regno == PCOQ_TAIL_REGNUM)
-	{
-	  scratch = *(int *) &registers[REGISTER_BYTE (regno)] | 0x3;
-	  ptrace (PT_WUREGS, inferior_pid, (PTRACE_ARG3_TYPE) regaddr,
-		  scratch, 0);
-	  if (errno != 0)
-	    {
-	      /* Error, even if attached.  Failing to write these two
-	         registers is pretty serious.  */
-	      sprintf (buf, "writing register number %d", regno);
-	      perror_with_name (buf);
-	    }
-	}
-      else
-	for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int))
-	  {
-	    errno = 0;
-	    ptrace (PT_WUREGS, inferior_pid, (PTRACE_ARG3_TYPE) regaddr,
-		    *(int *) &registers[REGISTER_BYTE (regno) + i], 0);
-	    if (errno != 0)
-	      {
-		/* Warning, not error, in case we are attached; sometimes the
-		   kernel doesn't let us at the registers.  */
-		char *err = strerror (errno);
-		char *msg = alloca (strlen (err) + 128);
-		sprintf (msg, "writing register %d: %s",
-			 regno, err);
-		error (msg);
-		return;
-	      }
-	    regaddr += sizeof (int);
-	  }
-    }
-  else
-    for (regno = 0; regno < NUM_REGS; regno++)
-      store_inferior_registers (regno);
-}
-
-/* NOTE! I tried using PTRACE_READDATA, etc., to read and write memory
-   in the NEW_SUN_PTRACE case.
-   It ought to be straightforward.  But it appears that writing did
-   not write the data that I specified.  I cannot understand where
-   it got the data that it actually did write.  */
-
-/* Copy LEN bytes from inferior's memory starting at MEMADDR
-   to debugger memory starting at MYADDR.  */
-
-void
-read_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
-{
-  register int i;
-  /* Round starting address down to longword boundary.  */
-  register CORE_ADDR addr = memaddr & -(CORE_ADDR) sizeof (int);
-  /* Round ending address up; get number of longwords that makes.  */
-  register int count
-  = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int);
-  /* Allocate buffer of that many longwords.  */
-  register int *buffer = (int *) alloca (count * sizeof (int));
-
-  /* Read all the longwords */
-  for (i = 0; i < count; i++, addr += sizeof (int))
-    {
-      buffer[i] = ptrace (1, inferior_pid, addr, 0, 0);
-    }
-
-  /* Copy appropriate bytes out of the buffer.  */
-  memcpy (myaddr, (char *) buffer + (memaddr & (sizeof (int) - 1)), len);
-}
-
-/* Copy LEN bytes of data from debugger memory at MYADDR
-   to inferior's memory at MEMADDR.
-   On failure (cannot write the inferior)
-   returns the value of errno.  */
-
-int
-write_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
-{
-  register int i;
-  /* Round starting address down to longword boundary.  */
-  register CORE_ADDR addr = memaddr & -(CORE_ADDR) sizeof (int);
-  /* Round ending address up; get number of longwords that makes.  */
-  register int count
-  = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int);
-  /* Allocate buffer of that many longwords.  */
-  register int *buffer = (int *) alloca (count * sizeof (int));
-  extern int errno;
-
-  /* Fill start and end extra bytes of buffer with existing memory data.  */
-
-  buffer[0] = ptrace (1, inferior_pid, addr, 0, 0);
-
-  if (count > 1)
-    {
-      buffer[count - 1]
-	= ptrace (1, inferior_pid,
-		  addr + (count - 1) * sizeof (int), 0, 0);
-    }
-
-  /* Copy data to be written over corresponding part of buffer */
-
-  memcpy ((char *) buffer + (memaddr & (sizeof (int) - 1)), myaddr, len);
-
-  /* Write the entire buffer.  */
-
-  for (i = 0; i < count; i++, addr += sizeof (int))
-    {
-      errno = 0;
-      ptrace (4, inferior_pid, addr, buffer[i], 0);
-      if (errno)
-	return errno;
-    }
-
-  return 0;
-}
-
-void
-initialize_low (void)
-{
-}
diff --git a/gdb/gdbserver/low-lynx.c b/gdb/gdbserver/low-lynx.c
deleted file mode 100644
index 90e18db..0000000
--- a/gdb/gdbserver/low-lynx.c
+++ /dev/null
@@ -1,745 +0,0 @@
-/* Low level interface to ptrace, for the remote server for GDB.
-   Copyright 1986, 1987, 1993, 1994, 1995, 1999, 2000, 2001, 2002
-   Free Software Foundation, Inc.
-
-   This file is part of GDB.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
-
-#include "server.h"
-#include "frame.h"
-#include "inferior.h"
-
-#include <stdio.h>
-#include <sys/param.h>
-#include <sys/dir.h>
-#define LYNXOS
-#include <sys/mem.h>
-#include <sys/signal.h>
-#include <sys/file.h>
-#include <sys/kernel.h>
-#ifndef __LYNXOS
-#define __LYNXOS
-#endif
-#include <sys/itimer.h>
-#include <sys/time.h>
-#include <sys/resource.h>
-#include <sys/proc.h>
-#include <signal.h>
-#include <sys/ioctl.h>
-#include <sgtty.h>
-#include <fcntl.h>
-#include <sys/wait.h>
-#include <sys/fpp.h>
-
-static char my_registers[REGISTER_BYTES];
-char *registers = my_registers;
-
-#include <sys/ptrace.h>
-
-/* Start an inferior process and returns its pid.
-   ALLARGS is a vector of program-name and args. */
-
-int
-create_inferior (char *program, char **allargs)
-{
-  int pid;
-
-  pid = fork ();
-  if (pid < 0)
-    perror_with_name ("fork");
-
-  if (pid == 0)
-    {
-      int pgrp;
-
-      /* Switch child to it's own process group so that signals won't
-         directly affect gdbserver. */
-
-      pgrp = getpid ();
-      setpgrp (0, pgrp);
-      ioctl (0, TIOCSPGRP, &pgrp);
-
-      ptrace (PTRACE_TRACEME, 0, (PTRACE_ARG3_TYPE) 0, 0);
-
-      execv (program, allargs);
-
-      fprintf (stderr, "GDBserver (process %d):  Cannot exec %s: %s.\n",
-	       getpid (), program,
-	       errno < sys_nerr ? sys_errlist[errno] : "unknown error");
-      fflush (stderr);
-      _exit (0177);
-    }
-
-  return pid;
-}
-
-/* Attaching is not supported.  */
-int
-myattach (int pid)
-{
-  return -1;
-}
-
-/* Kill the inferior process.  Make us have no inferior.  */
-
-void
-kill_inferior (void)
-{
-  if (inferior_pid == 0)
-    return;
-  ptrace (PTRACE_KILL, inferior_pid, 0, 0);
-  wait (0);
-
-  inferior_pid = 0;
-}
-
-/* Return nonzero if the given thread is still alive.  */
-int
-mythread_alive (int pid)
-{
-  /* Arggh.  Apparently pthread_kill only works for threads within
-     the process that calls pthread_kill.
-
-     We want to avoid the lynx signal extensions as they simply don't
-     map well to the generic gdb interface we want to keep.
-
-     All we want to do is determine if a particular thread is alive;
-     it appears as if we can just make a harmless thread specific
-     ptrace call to do that.  */
-  return (ptrace (PTRACE_THREADUSER,
-		  BUILDPID (PIDGET (inferior_pid), pid), 0, 0) != -1);
-}
-
-/* Wait for process, returns status */
-
-unsigned char
-mywait (char *status)
-{
-  int pid;
-  union wait w;
-
-  while (1)
-    {
-      enable_async_io ();
-
-      pid = wait (&w);
-
-      disable_async_io ();
-
-      if (pid != PIDGET (inferior_pid))
-	perror_with_name ("wait");
-
-      thread_from_wait = w.w_tid;
-      inferior_pid = BUILDPID (inferior_pid, w.w_tid);
-
-      if (WIFSTOPPED (w)
-	  && WSTOPSIG (w) == SIGTRAP)
-	{
-	  int realsig;
-
-	  realsig = ptrace (PTRACE_GETTRACESIG, inferior_pid,
-			    (PTRACE_ARG3_TYPE) 0, 0);
-
-	  if (realsig == SIGNEWTHREAD)
-	    {
-	      /* It's a new thread notification.  Nothing to do here since
-	         the machine independent code in wait_for_inferior will
-	         add the thread to the thread list and restart the thread
-	         when pid != inferior_pid and pid is not in the thread list.
-	         We don't even want to muck with realsig -- the code in
-	         wait_for_inferior expects SIGTRAP.  */
-	      ;
-	    }
-	}
-      break;
-    }
-
-  if (WIFEXITED (w))
-    {
-      *status = 'W';
-      return ((unsigned char) WEXITSTATUS (w));
-    }
-  else if (!WIFSTOPPED (w))
-    {
-      *status = 'X';
-      return ((unsigned char) WTERMSIG (w));
-    }
-
-  fetch_inferior_registers (0);
-
-  *status = 'T';
-  return ((unsigned char) WSTOPSIG (w));
-}
-
-/* Resume execution of the inferior process.
-   If STEP is nonzero, single-step it.
-   If SIGNAL is nonzero, give it that signal.  */
-
-void
-myresume (int step, int signal)
-{
-  errno = 0;
-  ptrace (step ? PTRACE_SINGLESTEP_ONE : PTRACE_CONT,
-	  BUILDPID (inferior_pid, cont_thread == -1 ? 0 : cont_thread),
-	  1, signal);
-  if (errno)
-    perror_with_name ("ptrace");
-}
-
-#undef offsetof
-#define offsetof(TYPE, MEMBER) ((unsigned long) &((TYPE *)0)->MEMBER)
-
-/* Mapping between GDB register #s and offsets into econtext.  Must be
-   consistent with REGISTER_NAMES macro in various tmXXX.h files. */
-
-#define X(ENTRY)(offsetof(struct econtext, ENTRY))
-
-#ifdef I386
-/* Mappings from tm-i386v.h */
-
-static int regmap[] =
-{
-  X (eax),
-  X (ecx),
-  X (edx),
-  X (ebx),
-  X (esp),			/* sp */
-  X (ebp),			/* fp */
-  X (esi),
-  X (edi),
-  X (eip),			/* pc */
-  X (flags),			/* ps */
-  X (cs),
-  X (ss),
-  X (ds),
-  X (es),
-  X (ecode),			/* Lynx doesn't give us either fs or gs, so */
-  X (fault),			/* we just substitute these two in the hopes
-				   that they are useful. */
-};
-#endif
-
-#ifdef M68K
-/* Mappings from tm-m68k.h */
-
-static int regmap[] =
-{
-  X (regs[0]),			/* d0 */
-  X (regs[1]),			/* d1 */
-  X (regs[2]),			/* d2 */
-  X (regs[3]),			/* d3 */
-  X (regs[4]),			/* d4 */
-  X (regs[5]),			/* d5 */
-  X (regs[6]),			/* d6 */
-  X (regs[7]),			/* d7 */
-  X (regs[8]),			/* a0 */
-  X (regs[9]),			/* a1 */
-  X (regs[10]),			/* a2 */
-  X (regs[11]),			/* a3 */
-  X (regs[12]),			/* a4 */
-  X (regs[13]),			/* a5 */
-  X (regs[14]),			/* fp */
-  0,				/* sp */
-  X (status),			/* ps */
-  X (pc),
-
-  X (fregs[0 * 3]),		/* fp0 */
-  X (fregs[1 * 3]),		/* fp1 */
-  X (fregs[2 * 3]),		/* fp2 */
-  X (fregs[3 * 3]),		/* fp3 */
-  X (fregs[4 * 3]),		/* fp4 */
-  X (fregs[5 * 3]),		/* fp5 */
-  X (fregs[6 * 3]),		/* fp6 */
-  X (fregs[7 * 3]),		/* fp7 */
-
-  X (fcregs[0]),		/* fpcontrol */
-  X (fcregs[1]),		/* fpstatus */
-  X (fcregs[2]),		/* fpiaddr */
-  X (ssw),			/* fpcode */
-  X (fault),			/* fpflags */
-};
-#endif
-
-#ifdef SPARC
-/* Mappings from tm-sparc.h */
-
-#define FX(ENTRY)(offsetof(struct fcontext, ENTRY))
-
-static int regmap[] =
-{
-  -1,				/* g0 */
-  X (g1),
-  X (g2),
-  X (g3),
-  X (g4),
-  -1,				/* g5->g7 aren't saved by Lynx */
-  -1,
-  -1,
-
-  X (o[0]),
-  X (o[1]),
-  X (o[2]),
-  X (o[3]),
-  X (o[4]),
-  X (o[5]),
-  X (o[6]),			/* sp */
-  X (o[7]),			/* ra */
-
-  -1, -1, -1, -1, -1, -1, -1, -1,	/* l0 -> l7 */
-
-  -1, -1, -1, -1, -1, -1, -1, -1,	/* i0 -> i7 */
-
-  FX (f.fregs[0]),		/* f0 */
-  FX (f.fregs[1]),
-  FX (f.fregs[2]),
-  FX (f.fregs[3]),
-  FX (f.fregs[4]),
-  FX (f.fregs[5]),
-  FX (f.fregs[6]),
-  FX (f.fregs[7]),
-  FX (f.fregs[8]),
-  FX (f.fregs[9]),
-  FX (f.fregs[10]),
-  FX (f.fregs[11]),
-  FX (f.fregs[12]),
-  FX (f.fregs[13]),
-  FX (f.fregs[14]),
-  FX (f.fregs[15]),
-  FX (f.fregs[16]),
-  FX (f.fregs[17]),
-  FX (f.fregs[18]),
-  FX (f.fregs[19]),
-  FX (f.fregs[20]),
-  FX (f.fregs[21]),
-  FX (f.fregs[22]),
-  FX (f.fregs[23]),
-  FX (f.fregs[24]),
-  FX (f.fregs[25]),
-  FX (f.fregs[26]),
-  FX (f.fregs[27]),
-  FX (f.fregs[28]),
-  FX (f.fregs[29]),
-  FX (f.fregs[30]),
-  FX (f.fregs[31]),
-
-  X (y),
-  X (psr),
-  X (wim),
-  X (tbr),
-  X (pc),
-  X (npc),
-  FX (fsr),			/* fpsr */
-  -1,				/* cpsr */
-};
-#endif
-
-#ifdef SPARC
-
-/* This routine handles some oddball cases for Sparc registers and LynxOS.
-   In partucular, it causes refs to G0, g5->7, and all fp regs to return zero.
-   It also handles knows where to find the I & L regs on the stack.  */
-
-void
-fetch_inferior_registers (int regno)
-{
-#if 0
-  int whatregs = 0;
-
-#define WHATREGS_FLOAT 1
-#define WHATREGS_GEN 2
-#define WHATREGS_STACK 4
-
-  if (regno == -1)
-    whatregs = WHATREGS_FLOAT | WHATREGS_GEN | WHATREGS_STACK;
-  else if (regno >= L0_REGNUM && regno <= I7_REGNUM)
-    whatregs = WHATREGS_STACK;
-  else if (regno >= FP0_REGNUM && regno < FP0_REGNUM + 32)
-    whatregs = WHATREGS_FLOAT;
-  else
-    whatregs = WHATREGS_GEN;
-
-  if (whatregs & WHATREGS_GEN)
-    {
-      struct econtext ec;	/* general regs */
-      char buf[MAX_REGISTER_RAW_SIZE];
-      int retval;
-      int i;
-
-      errno = 0;
-      retval = ptrace (PTRACE_GETREGS,
-		       BUILDPID (inferior_pid, general_thread),
-		       (PTRACE_ARG3_TYPE) & ec,
-		       0);
-      if (errno)
-	perror_with_name ("Sparc fetch_inferior_registers(ptrace)");
-
-      memset (buf, 0, REGISTER_RAW_SIZE (G0_REGNUM));
-      supply_register (G0_REGNUM, buf);
-      supply_register (TBR_REGNUM, (char *) &ec.tbr);
-
-      memcpy (&registers[REGISTER_BYTE (G1_REGNUM)], &ec.g1,
-	      4 * REGISTER_RAW_SIZE (G1_REGNUM));
-      for (i = G1_REGNUM; i <= G1_REGNUM + 3; i++)
-	register_valid[i] = 1;
-
-      supply_register (PS_REGNUM, (char *) &ec.psr);
-      supply_register (Y_REGNUM, (char *) &ec.y);
-      supply_register (PC_REGNUM, (char *) &ec.pc);
-      supply_register (NPC_REGNUM, (char *) &ec.npc);
-      supply_register (WIM_REGNUM, (char *) &ec.wim);
-
-      memcpy (&registers[REGISTER_BYTE (O0_REGNUM)], ec.o,
-	      8 * REGISTER_RAW_SIZE (O0_REGNUM));
-      for (i = O0_REGNUM; i <= O0_REGNUM + 7; i++)
-	register_valid[i] = 1;
-    }
-
-  if (whatregs & WHATREGS_STACK)
-    {
-      CORE_ADDR sp;
-      int i;
-
-      sp = read_register (SP_REGNUM);
-
-      target_xfer_memory (sp + FRAME_SAVED_I0,
-			  &registers[REGISTER_BYTE (I0_REGNUM)],
-			  8 * REGISTER_RAW_SIZE (I0_REGNUM), 0);
-      for (i = I0_REGNUM; i <= I7_REGNUM; i++)
-	register_valid[i] = 1;
-
-      target_xfer_memory (sp + FRAME_SAVED_L0,
-			  &registers[REGISTER_BYTE (L0_REGNUM)],
-			  8 * REGISTER_RAW_SIZE (L0_REGNUM), 0);
-      for (i = L0_REGNUM; i <= L0_REGNUM + 7; i++)
-	register_valid[i] = 1;
-    }
-
-  if (whatregs & WHATREGS_FLOAT)
-    {
-      struct fcontext fc;	/* fp regs */
-      int retval;
-      int i;
-
-      errno = 0;
-      retval = ptrace (PTRACE_GETFPREGS, BUILDPID (inferior_pid, general_thread), (PTRACE_ARG3_TYPE) & fc,
-		       0);
-      if (errno)
-	perror_with_name ("Sparc fetch_inferior_registers(ptrace)");
-
-      memcpy (&registers[REGISTER_BYTE (FP0_REGNUM)], fc.f.fregs,
-	      32 * REGISTER_RAW_SIZE (FP0_REGNUM));
-      for (i = FP0_REGNUM; i <= FP0_REGNUM + 31; i++)
-	register_valid[i] = 1;
-
-      supply_register (FPS_REGNUM, (char *) &fc.fsr);
-    }
-#endif
-}
-
-/* This routine handles storing of the I & L regs for the Sparc.  The trick
-   here is that they actually live on the stack.  The really tricky part is
-   that when changing the stack pointer, the I & L regs must be written to
-   where the new SP points, otherwise the regs will be incorrect when the
-   process is started up again.   We assume that the I & L regs are valid at
-   this point.  */
-
-void
-store_inferior_registers (int regno)
-{
-#if 0
-  int whatregs = 0;
-
-  if (regno == -1)
-    whatregs = WHATREGS_FLOAT | WHATREGS_GEN | WHATREGS_STACK;
-  else if (regno >= L0_REGNUM && regno <= I7_REGNUM)
-    whatregs = WHATREGS_STACK;
-  else if (regno >= FP0_REGNUM && regno < FP0_REGNUM + 32)
-    whatregs = WHATREGS_FLOAT;
-  else if (regno == SP_REGNUM)
-    whatregs = WHATREGS_STACK | WHATREGS_GEN;
-  else
-    whatregs = WHATREGS_GEN;
-
-  if (whatregs & WHATREGS_GEN)
-    {
-      struct econtext ec;	/* general regs */
-      int retval;
-
-      ec.tbr = read_register (TBR_REGNUM);
-      memcpy (&ec.g1, &registers[REGISTER_BYTE (G1_REGNUM)],
-	      4 * REGISTER_RAW_SIZE (G1_REGNUM));
-
-      ec.psr = read_register (PS_REGNUM);
-      ec.y = read_register (Y_REGNUM);
-      ec.pc = read_register (PC_REGNUM);
-      ec.npc = read_register (NPC_REGNUM);
-      ec.wim = read_register (WIM_REGNUM);
-
-      memcpy (ec.o, &registers[REGISTER_BYTE (O0_REGNUM)],
-	      8 * REGISTER_RAW_SIZE (O0_REGNUM));
-
-      errno = 0;
-      retval = ptrace (PTRACE_SETREGS, BUILDPID (inferior_pid, general_thread), (PTRACE_ARG3_TYPE) & ec,
-		       0);
-      if (errno)
-	perror_with_name ("Sparc fetch_inferior_registers(ptrace)");
-    }
-
-  if (whatregs & WHATREGS_STACK)
-    {
-      int regoffset;
-      CORE_ADDR sp;
-
-      sp = read_register (SP_REGNUM);
-
-      if (regno == -1 || regno == SP_REGNUM)
-	{
-	  if (!register_valid[L0_REGNUM + 5])
-	    abort ();
-	  target_xfer_memory (sp + FRAME_SAVED_I0,
-			      &registers[REGISTER_BYTE (I0_REGNUM)],
-			      8 * REGISTER_RAW_SIZE (I0_REGNUM), 1);
-
-	  target_xfer_memory (sp + FRAME_SAVED_L0,
-			      &registers[REGISTER_BYTE (L0_REGNUM)],
-			      8 * REGISTER_RAW_SIZE (L0_REGNUM), 1);
-	}
-      else if (regno >= L0_REGNUM && regno <= I7_REGNUM)
-	{
-	  if (!register_valid[regno])
-	    abort ();
-	  if (regno >= L0_REGNUM && regno <= L0_REGNUM + 7)
-	    regoffset = REGISTER_BYTE (regno) - REGISTER_BYTE (L0_REGNUM)
-	      + FRAME_SAVED_L0;
-	  else
-	    regoffset = REGISTER_BYTE (regno) - REGISTER_BYTE (I0_REGNUM)
-	      + FRAME_SAVED_I0;
-	  target_xfer_memory (sp + regoffset, &registers[REGISTER_BYTE (regno)],
-			      REGISTER_RAW_SIZE (regno), 1);
-	}
-    }
-
-  if (whatregs & WHATREGS_FLOAT)
-    {
-      struct fcontext fc;	/* fp regs */
-      int retval;
-
-/* We read fcontext first so that we can get good values for fq_t... */
-      errno = 0;
-      retval = ptrace (PTRACE_GETFPREGS, BUILDPID (inferior_pid, general_thread), (PTRACE_ARG3_TYPE) & fc,
-		       0);
-      if (errno)
-	perror_with_name ("Sparc fetch_inferior_registers(ptrace)");
-
-      memcpy (fc.f.fregs, &registers[REGISTER_BYTE (FP0_REGNUM)],
-	      32 * REGISTER_RAW_SIZE (FP0_REGNUM));
-
-      fc.fsr = read_register (FPS_REGNUM);
-
-      errno = 0;
-      retval = ptrace (PTRACE_SETFPREGS, BUILDPID (inferior_pid, general_thread), (PTRACE_ARG3_TYPE) & fc,
-		       0);
-      if (errno)
-	perror_with_name ("Sparc fetch_inferior_registers(ptrace)");
-    }
-#endif
-}
-#endif /* SPARC */
-
-#ifndef SPARC
-
-/* Return the offset relative to the start of the per-thread data to the
-   saved context block.  */
-
-static unsigned long
-lynx_registers_addr (void)
-{
-  CORE_ADDR stblock;
-  int ecpoff = offsetof (st_t, ecp);
-  CORE_ADDR ecp;
-
-  errno = 0;
-  stblock = (CORE_ADDR) ptrace (PTRACE_THREADUSER, BUILDPID (inferior_pid, general_thread),
-				(PTRACE_ARG3_TYPE) 0, 0);
-  if (errno)
-    perror_with_name ("PTRACE_THREADUSER");
-
-  ecp = (CORE_ADDR) ptrace (PTRACE_PEEKTHREAD, BUILDPID (inferior_pid, general_thread),
-			    (PTRACE_ARG3_TYPE) ecpoff, 0);
-  if (errno)
-    perror_with_name ("lynx_registers_addr(PTRACE_PEEKTHREAD)");
-
-  return ecp - stblock;
-}
-
-/* Fetch one or more registers from the inferior.  REGNO == -1 to get
-   them all.  We actually fetch more than requested, when convenient,
-   marking them as valid so we won't fetch them again.  */
-
-void
-fetch_inferior_registers (int ignored)
-{
-  int regno;
-  unsigned long reg;
-  unsigned long ecp;
-
-  ecp = lynx_registers_addr ();
-
-  for (regno = 0; regno < NUM_REGS; regno++)
-    {
-      int ptrace_fun = PTRACE_PEEKTHREAD;
-
-#ifdef PTRACE_PEEKUSP
-      ptrace_fun = regno == SP_REGNUM ? PTRACE_PEEKUSP : PTRACE_PEEKTHREAD;
-#endif
-
-      errno = 0;
-      reg = ptrace (ptrace_fun, BUILDPID (inferior_pid, general_thread),
-		    (PTRACE_ARG3_TYPE) (ecp + regmap[regno]), 0);
-      if (errno)
-	perror_with_name ("fetch_inferior_registers(PTRACE_PEEKTHREAD)");
-
-      *(unsigned long *) &registers[REGISTER_BYTE (regno)] = reg;
-    }
-}
-
-/* Store our register values back into the inferior.
-   If REGNO is -1, do this for all registers.
-   Otherwise, REGNO specifies which register (so we can save time).  */
-
-void
-store_inferior_registers (int ignored)
-{
-  int regno;
-  unsigned long reg;
-  unsigned long ecp;
-
-  ecp = lynx_registers_addr ();
-
-  for (regno = 0; regno < NUM_REGS; regno++)
-    {
-      int ptrace_fun = PTRACE_POKEUSER;
-
-#ifdef PTRACE_POKEUSP
-      ptrace_fun = regno == SP_REGNUM ? PTRACE_POKEUSP : PTRACE_POKEUSER;
-#endif
-
-      reg = *(unsigned long *) &registers[REGISTER_BYTE (regno)];
-
-      errno = 0;
-      ptrace (ptrace_fun, BUILDPID (inferior_pid, general_thread),
-	      (PTRACE_ARG3_TYPE) (ecp + regmap[regno]), reg);
-      if (errno)
-	perror_with_name ("PTRACE_POKEUSER");
-    }
-}
-
-#endif /* ! SPARC */
-
-/* NOTE! I tried using PTRACE_READDATA, etc., to read and write memory
-   in the NEW_SUN_PTRACE case.
-   It ought to be straightforward.  But it appears that writing did
-   not write the data that I specified.  I cannot understand where
-   it got the data that it actually did write.  */
-
-/* Copy LEN bytes from inferior's memory starting at MEMADDR
-   to debugger memory starting at MYADDR.  */
-
-void
-read_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
-{
-  register int i;
-  /* Round starting address down to longword boundary.  */
-  register CORE_ADDR addr = memaddr & -(CORE_ADDR) sizeof (int);
-  /* Round ending address up; get number of longwords that makes.  */
-  register int count
-  = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int);
-  /* Allocate buffer of that many longwords.  */
-  register int *buffer = (int *) alloca (count * sizeof (int));
-
-  /* Read all the longwords */
-  for (i = 0; i < count; i++, addr += sizeof (int))
-    {
-      buffer[i] = ptrace (PTRACE_PEEKTEXT, BUILDPID (inferior_pid, general_thread), addr, 0);
-    }
-
-  /* Copy appropriate bytes out of the buffer.  */
-  memcpy (myaddr, (char *) buffer + (memaddr & (sizeof (int) - 1)), len);
-}
-
-/* Copy LEN bytes of data from debugger memory at MYADDR
-   to inferior's memory at MEMADDR.
-   On failure (cannot write the inferior)
-   returns the value of errno.  */
-
-int
-write_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
-{
-  register int i;
-  /* Round starting address down to longword boundary.  */
-  register CORE_ADDR addr = memaddr & -(CORE_ADDR) sizeof (int);
-  /* Round ending address up; get number of longwords that makes.  */
-  register int count
-  = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int);
-  /* Allocate buffer of that many longwords.  */
-  register int *buffer = (int *) alloca (count * sizeof (int));
-  extern int errno;
-
-  /* Fill start and end extra bytes of buffer with existing memory data.  */
-
-  buffer[0] = ptrace (PTRACE_PEEKTEXT, BUILDPID (inferior_pid, general_thread), addr, 0);
-
-  if (count > 1)
-    {
-      buffer[count - 1]
-	= ptrace (PTRACE_PEEKTEXT, BUILDPID (inferior_pid, general_thread),
-		  addr + (count - 1) * sizeof (int), 0);
-    }
-
-  /* Copy data to be written over corresponding part of buffer */
-
-  memcpy ((char *) buffer + (memaddr & (sizeof (int) - 1)), myaddr, len);
-
-  /* Write the entire buffer.  */
-
-  for (i = 0; i < count; i++, addr += sizeof (int))
-    {
-      while (1)
-	{
-	  errno = 0;
-	  ptrace (PTRACE_POKETEXT, BUILDPID (inferior_pid, general_thread), addr, buffer[i]);
-	  if (errno)
-	    {
-	      fprintf (stderr, "\
-ptrace (PTRACE_POKETEXT): errno=%d, pid=0x%x, addr=0x%x, buffer[i] = 0x%x\n",
-		       errno, BUILDPID (inferior_pid, general_thread),
-		       addr, buffer[i]);
-	      fprintf (stderr, "Sleeping for 1 second\n");
-	      sleep (1);
-	    }
-	  else
-	    break;
-	}
-    }
-
-  return 0;
-}
-
-void
-initialize_low (void)
-{
-}
diff --git a/gdb/gdbserver/low-nbsd.c b/gdb/gdbserver/low-nbsd.c
deleted file mode 100644
index 8bec0d9..0000000
--- a/gdb/gdbserver/low-nbsd.c
+++ /dev/null
@@ -1,599 +0,0 @@
-/* Low level interface to ptrace, for the remote server for GDB.
-   Copyright 1986, 1987, 1993, 2000, 2001, 2002 Free Software Foundation, Inc.
-
-This file is part of GDB.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
-
-#include "server.h"
-#include <sys/types.h>
-#include <sys/wait.h>
-#include "frame.h"
-#include "inferior.h"
-
-#include <stdio.h>
-#include <errno.h>
-
-/***************Begin MY defs*********************/
-static char my_registers[REGISTER_BYTES];
-char *registers = my_registers;
-/***************End MY defs*********************/
-
-#include <sys/ptrace.h>
-#include <machine/reg.h>
-
-#define RF(dst, src) \
-	memcpy(&registers[REGISTER_BYTE(dst)], &src, sizeof(src))
-
-#define RS(src, dst) \
-	memcpy(&dst, &registers[REGISTER_BYTE(src)], sizeof(dst))
-
-#ifdef __i386__
-struct env387
-  {
-    unsigned short control;
-    unsigned short r0;
-    unsigned short status;
-    unsigned short r1;
-    unsigned short tag;  
-    unsigned short r2;
-    unsigned long eip;
-    unsigned short code_seg;
-    unsigned short opcode;
-    unsigned long operand; 
-    unsigned short operand_seg;
-    unsigned short r3;
-    unsigned char regs[8][10];
-  };
-
-/* i386_register_raw_size[i] is the number of bytes of storage in the
-   actual machine representation for register i.  */
-int i386_register_raw_size[MAX_NUM_REGS] = {
-   4,  4,  4,  4,
-   4,  4,  4,  4,
-   4,  4,  4,  4,  
-   4,  4,  4,  4,
-  10, 10, 10, 10, 
-  10, 10, 10, 10,
-   4,  4,  4,  4,
-   4,  4,  4,  4, 
-  16, 16, 16, 16,
-  16, 16, 16, 16, 
-  4
-}; 
-   
-int i386_register_byte[MAX_NUM_REGS];
-
-static void       
-initialize_arch (void)
-{
-  /* Initialize the table saying where each register starts in the
-     register file.  */
-  {
-    int i, offset;
-
-    offset = 0;
-    for (i = 0; i < MAX_NUM_REGS; i++)
-      {
-        i386_register_byte[i] = offset;
-        offset += i386_register_raw_size[i];
-      }
-  }   
-}       
-#endif	/* !__i386__ */
-
-#ifdef __m68k__
-static void
-initialize_arch (void)
-{
-}
-#endif	/* !__m68k__ */
-
-#ifdef __ns32k__
-static void
-initialize_arch (void)
-{
-}
-#endif	/* !__ns32k__ */
-
-#ifdef __powerpc__
-#include "ppc-tdep.h"
-
-static void
-initialize_arch (void)
-{
-}
-#endif	/* !__powerpc__ */
-
-
-/* Start an inferior process and returns its pid.
-   ALLARGS is a vector of program-name and args. */
-
-int
-create_inferior (char *program, char **allargs)
-{
-  int pid;
-
-  pid = fork ();
-  if (pid < 0)
-    perror_with_name ("fork");
-
-  if (pid == 0)
-    {
-      ptrace (PT_TRACE_ME, 0, 0, 0);
-
-      execv (program, allargs);
-
-      fprintf (stderr, "Cannot exec %s: %s.\n", program,
-	       errno < sys_nerr ? sys_errlist[errno] : "unknown error");
-      fflush (stderr);
-      _exit (0177);
-    }
-
-  return pid;
-}
-
-/* Attaching is not supported.  */
-int
-myattach (int pid)
-{
-  return -1;
-}
-
-/* Kill the inferior process.  Make us have no inferior.  */
-
-void
-kill_inferior (void)
-{
-  if (inferior_pid == 0)
-    return;
-  ptrace (PT_KILL, inferior_pid, 0, 0);
-  wait (0);
-  /*************inferior_died ();****VK**************/
-}
-
-/* Return nonzero if the given thread is still alive.  */
-int
-mythread_alive (int pid)
-{
-  return 1;
-}
-
-/* Wait for process, returns status */
-
-unsigned char
-mywait (char *status)
-{
-  int pid;
-  int w;
-
-  enable_async_io ();
-  pid = waitpid (inferior_pid, &w, 0);
-  disable_async_io ();
-  if (pid != inferior_pid)
-    perror_with_name ("wait");
-
-  if (WIFEXITED (w))
-    {
-      fprintf (stderr, "\nChild exited with retcode = %x \n", WEXITSTATUS (w));
-      *status = 'W';
-      return ((unsigned char) WEXITSTATUS (w));
-    }
-  else if (!WIFSTOPPED (w))
-    {
-      fprintf (stderr, "\nChild terminated with signal = %x \n", WTERMSIG (w));
-      *status = 'X';
-      return ((unsigned char) WTERMSIG (w));
-    }
-
-  fetch_inferior_registers (0);
-
-  *status = 'T';
-  return ((unsigned char) WSTOPSIG (w));
-}
-
-/* Resume execution of the inferior process.
-   If STEP is nonzero, single-step it.
-   If SIGNAL is nonzero, give it that signal.  */
-
-void
-myresume (int step, int signal)
-{
-  errno = 0;
-  ptrace (step ? PT_STEP : PT_CONTINUE, inferior_pid, 
-	  (PTRACE_ARG3_TYPE) 1, signal);
-  if (errno)
-    perror_with_name ("ptrace");
-}
-
-
-#ifdef __i386__
-/* Fetch one or more registers from the inferior.  REGNO == -1 to get
-   them all.  We actually fetch more than requested, when convenient,
-   marking them as valid so we won't fetch them again.  */
-
-void
-fetch_inferior_registers (int ignored)
-{
-  struct reg inferior_registers;
-  struct env387 inferior_fp_registers;
-
-  ptrace (PT_GETREGS, inferior_pid,
-	  (PTRACE_ARG3_TYPE) &inferior_registers, 0);
-  ptrace (PT_GETFPREGS, inferior_pid,
-	  (PTRACE_ARG3_TYPE) &inferior_fp_registers, 0);
-
-  RF ( 0, inferior_registers.r_eax); 
-  RF ( 1, inferior_registers.r_ecx);
-  RF ( 2, inferior_registers.r_edx);
-  RF ( 3, inferior_registers.r_ebx);
-  RF ( 4, inferior_registers.r_esp);
-  RF ( 5, inferior_registers.r_ebp);
-  RF ( 6, inferior_registers.r_esi);
-  RF ( 7, inferior_registers.r_edi);
-  RF ( 8, inferior_registers.r_eip);
-  RF ( 9, inferior_registers.r_eflags);
-  RF (10, inferior_registers.r_cs);
-  RF (11, inferior_registers.r_ss);
-  RF (12, inferior_registers.r_ds);
-  RF (13, inferior_registers.r_es);
-  RF (14, inferior_registers.r_fs);
-  RF (15, inferior_registers.r_gs);
-
-  RF (FP0_REGNUM,     inferior_fp_registers.regs[0]);
-  RF (FP0_REGNUM + 1, inferior_fp_registers.regs[1]);
-  RF (FP0_REGNUM + 2, inferior_fp_registers.regs[2]);
-  RF (FP0_REGNUM + 3, inferior_fp_registers.regs[3]);
-  RF (FP0_REGNUM + 4, inferior_fp_registers.regs[4]);
-  RF (FP0_REGNUM + 5, inferior_fp_registers.regs[5]);
-  RF (FP0_REGNUM + 6, inferior_fp_registers.regs[6]);
-  RF (FP0_REGNUM + 7, inferior_fp_registers.regs[7]);
-  
-  RF (FCTRL_REGNUM,   inferior_fp_registers.control);
-  RF (FSTAT_REGNUM,   inferior_fp_registers.status);
-  RF (FTAG_REGNUM,    inferior_fp_registers.tag);
-  RF (FCS_REGNUM,     inferior_fp_registers.code_seg);
-  RF (FCOFF_REGNUM,   inferior_fp_registers.eip);
-  RF (FDS_REGNUM,     inferior_fp_registers.operand_seg);
-  RF (FDOFF_REGNUM,   inferior_fp_registers.operand);
-  RF (FOP_REGNUM,     inferior_fp_registers.opcode);
-}
-
-/* Store our register values back into the inferior.
-   If REGNO is -1, do this for all registers.
-   Otherwise, REGNO specifies which register (so we can save time).  */
-
-void
-store_inferior_registers (int ignored)
-{
-  struct reg inferior_registers;
-  struct env387 inferior_fp_registers;
-
-  RS ( 0, inferior_registers.r_eax); 
-  RS ( 1, inferior_registers.r_ecx);
-  RS ( 2, inferior_registers.r_edx);
-  RS ( 3, inferior_registers.r_ebx);
-  RS ( 4, inferior_registers.r_esp);
-  RS ( 5, inferior_registers.r_ebp);
-  RS ( 6, inferior_registers.r_esi);
-  RS ( 7, inferior_registers.r_edi);
-  RS ( 8, inferior_registers.r_eip);
-  RS ( 9, inferior_registers.r_eflags);
-  RS (10, inferior_registers.r_cs);
-  RS (11, inferior_registers.r_ss);
-  RS (12, inferior_registers.r_ds);
-  RS (13, inferior_registers.r_es);
-  RS (14, inferior_registers.r_fs);
-  RS (15, inferior_registers.r_gs);
-
-  RS (FP0_REGNUM,     inferior_fp_registers.regs[0]);
-  RS (FP0_REGNUM + 1, inferior_fp_registers.regs[1]);
-  RS (FP0_REGNUM + 2, inferior_fp_registers.regs[2]);
-  RS (FP0_REGNUM + 3, inferior_fp_registers.regs[3]);
-  RS (FP0_REGNUM + 4, inferior_fp_registers.regs[4]);
-  RS (FP0_REGNUM + 5, inferior_fp_registers.regs[5]);
-  RS (FP0_REGNUM + 6, inferior_fp_registers.regs[6]);
-  RS (FP0_REGNUM + 7, inferior_fp_registers.regs[7]);
-  
-  RS (FCTRL_REGNUM,   inferior_fp_registers.control);
-  RS (FSTAT_REGNUM,   inferior_fp_registers.status);
-  RS (FTAG_REGNUM,    inferior_fp_registers.tag);
-  RS (FCS_REGNUM,     inferior_fp_registers.code_seg);
-  RS (FCOFF_REGNUM,   inferior_fp_registers.eip);
-  RS (FDS_REGNUM,     inferior_fp_registers.operand_seg);
-  RS (FDOFF_REGNUM,   inferior_fp_registers.operand);
-  RS (FOP_REGNUM,     inferior_fp_registers.opcode);
-
-  ptrace (PT_SETREGS, inferior_pid,
-	  (PTRACE_ARG3_TYPE) &inferior_registers, 0);
-  ptrace (PT_SETFPREGS, inferior_pid,
-	  (PTRACE_ARG3_TYPE) &inferior_fp_registers, 0);
-}
-#endif	/* !__i386__ */
-
-#ifdef __m68k__
-/* Fetch one or more registers from the inferior.  REGNO == -1 to get
-   them all.  We actually fetch more than requested, when convenient,
-   marking them as valid so we won't fetch them again.  */
-
-void
-fetch_inferior_registers (int regno)
-{
-  struct reg inferior_registers;
-  struct fpreg inferior_fp_registers;
-
-  ptrace (PT_GETREGS, inferior_pid,
-          (PTRACE_ARG3_TYPE) & inferior_registers, 0);
-  memcpy (&registers[REGISTER_BYTE (0)], &inferior_registers,
-          sizeof (inferior_registers));
-
-  ptrace (PT_GETFPREGS, inferior_pid,
-          (PTRACE_ARG3_TYPE) & inferior_fp_registers, 0);
-  memcpy (&registers[REGISTER_BYTE (FP0_REGNUM)], &inferior_fp_registers,
-          sizeof (inferior_fp_registers));
-}
-
-/* Store our register values back into the inferior.
-   If REGNO is -1, do this for all registers.
-   Otherwise, REGNO specifies which register (so we can save time).  */
-
-void
-store_inferior_registers (int regno)
-{
-  struct reg inferior_registers;
-  struct fpreg inferior_fp_registers;
-
-  memcpy (&inferior_registers, &registers[REGISTER_BYTE (0)],
-          sizeof (inferior_registers));
-  ptrace (PT_SETREGS, inferior_pid,
-          (PTRACE_ARG3_TYPE) & inferior_registers, 0);
-
-  memcpy (&inferior_fp_registers, &registers[REGISTER_BYTE (FP0_REGNUM)],
-          sizeof (inferior_fp_registers));
-  ptrace (PT_SETFPREGS, inferior_pid,
-          (PTRACE_ARG3_TYPE) & inferior_fp_registers, 0);
-}
-#endif	/* !__m68k__ */
-
-
-#ifdef __ns32k__
-/* Fetch one or more registers from the inferior.  REGNO == -1 to get
-   them all.  We actually fetch more than requested, when convenient,
-   marking them as valid so we won't fetch them again.  */
-
-void
-fetch_inferior_registers (int regno)
-{
-  struct reg inferior_registers;
-  struct fpreg inferior_fpregisters;
-
-  ptrace (PT_GETREGS, inferior_pid,
-          (PTRACE_ARG3_TYPE) & inferior_registers, 0);
-  ptrace (PT_GETFPREGS, inferior_pid,
-          (PTRACE_ARG3_TYPE) & inferior_fpregisters, 0);
-
-  RF (R0_REGNUM + 0, inferior_registers.r_r0);
-  RF (R0_REGNUM + 1, inferior_registers.r_r1);
-  RF (R0_REGNUM + 2, inferior_registers.r_r2);
-  RF (R0_REGNUM + 3, inferior_registers.r_r3);
-  RF (R0_REGNUM + 4, inferior_registers.r_r4);
-  RF (R0_REGNUM + 5, inferior_registers.r_r5);
-  RF (R0_REGNUM + 6, inferior_registers.r_r6);
-  RF (R0_REGNUM + 7, inferior_registers.r_r7);
-
-  RF (SP_REGNUM, inferior_registers.r_sp);
-  RF (DEPRECATED_FP_REGNUM, inferior_registers.r_fp);
-  RF (PC_REGNUM, inferior_registers.r_pc);
-  RF (PS_REGNUM, inferior_registers.r_psr);
-
-  RF (FPS_REGNUM, inferior_fpregisters.r_fsr);
-  RF (FP0_REGNUM + 0, inferior_fpregisters.r_freg[0]);
-  RF (FP0_REGNUM + 2, inferior_fpregisters.r_freg[2]);
-  RF (FP0_REGNUM + 4, inferior_fpregisters.r_freg[4]);
-  RF (FP0_REGNUM + 6, inferior_fpregisters.r_freg[6]);
-  RF (LP0_REGNUM + 1, inferior_fpregisters.r_freg[1]);
-  RF (LP0_REGNUM + 3, inferior_fpregisters.r_freg[3]);
-  RF (LP0_REGNUM + 5, inferior_fpregisters.r_freg[5]);
-  RF (LP0_REGNUM + 7, inferior_fpregisters.r_freg[7]);
-}
-
-/* Store our register values back into the inferior.
-   If REGNO is -1, do this for all registers.
-   Otherwise, REGNO specifies which register (so we can save time).  */
-
-void
-store_inferior_registers (int regno)
-{
-  struct reg inferior_registers;
-  struct fpreg inferior_fpregisters;
-
-  RS (R0_REGNUM + 0, inferior_registers.r_r0);
-  RS (R0_REGNUM + 1, inferior_registers.r_r1);
-  RS (R0_REGNUM + 2, inferior_registers.r_r2);
-  RS (R0_REGNUM + 3, inferior_registers.r_r3);
-  RS (R0_REGNUM + 4, inferior_registers.r_r4);
-  RS (R0_REGNUM + 5, inferior_registers.r_r5);
-  RS (R0_REGNUM + 6, inferior_registers.r_r6);
-  RS (R0_REGNUM + 7, inferior_registers.r_r7);
-  
-  RS (SP_REGNUM, inferior_registers.r_sp);
-  RS (DEPRECATED_FP_REGNUM, inferior_registers.r_fp);
-  RS (PC_REGNUM, inferior_registers.r_pc);
-  RS (PS_REGNUM, inferior_registers.r_psr);
-  
-  RS (FPS_REGNUM, inferior_fpregisters.r_fsr);
-  RS (FP0_REGNUM + 0, inferior_fpregisters.r_freg[0]);
-  RS (FP0_REGNUM + 2, inferior_fpregisters.r_freg[2]);
-  RS (FP0_REGNUM + 4, inferior_fpregisters.r_freg[4]);
-  RS (FP0_REGNUM + 6, inferior_fpregisters.r_freg[6]);
-  RS (LP0_REGNUM + 1, inferior_fpregisters.r_freg[1]);
-  RS (LP0_REGNUM + 3, inferior_fpregisters.r_freg[3]);
-  RS (LP0_REGNUM + 5, inferior_fpregisters.r_freg[5]);
-  RS (LP0_REGNUM + 7, inferior_fpregisters.r_freg[7]);
-  
-  ptrace (PT_SETREGS, inferior_pid,
-          (PTRACE_ARG3_TYPE) & inferior_registers, 0);
-  ptrace (PT_SETFPREGS, inferior_pid,
-          (PTRACE_ARG3_TYPE) & inferior_fpregisters, 0);
-
-}
-#endif	/* !__ns32k__ */
-
-#ifdef __powerpc__
-/* Fetch one or more registers from the inferior.  REGNO == -1 to get
-   them all.  We actually fetch more than requested, when convenient,
-   marking them as valid so we won't fetch them again.  */
-
-void
-fetch_inferior_registers (int regno)
-{
-  struct reg inferior_registers;
-#ifdef PT_GETFPREGS
-  struct fpreg inferior_fp_registers;
-#endif
-  int i;
-
-  ptrace (PT_GETREGS, inferior_pid,
-	  (PTRACE_ARG3_TYPE) & inferior_registers, 0);
-  for (i = 0; i < 32; i++)
-    RF (i, inferior_registers.fixreg[i]);
-  RF (PPC_LR_REGNUM, inferior_registers.lr);
-  RF (PPC_CR_REGNUM, inferior_registers.cr);
-  RF (PPC_XER_REGNUM, inferior_registers.xer);
-  RF (PPC_CTR_REGNUM, inferior_registers.ctr);
-  RF (PC_REGNUM, inferior_registers.pc);
-
-#ifdef PT_GETFPREGS
-  ptrace (PT_GETFPREGS, inferior_pid,
-	  (PTRACE_ARG3_TYPE) & inferior_fp_registers, 0);
-  for (i = 0; i < 32; i++)
-    RF (FP0_REGNUM + i, inferior_fp_registers.r_regs[i]);
-#endif
-}
-
-/* Store our register values back into the inferior.
-   If REGNO is -1, do this for all registers.
-   Otherwise, REGNO specifies which register (so we can save time).  */
-
-void
-store_inferior_registers (int regno)
-{
-  struct reg inferior_registers;
-#ifdef PT_SETFPREGS
-  struct fpreg inferior_fp_registers;
-#endif
-  int i;
-
-  for (i = 0; i < 32; i++)
-    RS (i, inferior_registers.fixreg[i]);
-  RS (PPC_LR_REGNUM, inferior_registers.lr);
-  RS (PPC_CR_REGNUM, inferior_registers.cr);
-  RS (PPC_XER_REGNUM, inferior_registers.xer);
-  RS (PPC_CTR_REGNUM, inferior_registers.ctr);
-  RS (PC_REGNUM, inferior_registers.pc);
-  ptrace (PT_SETREGS, inferior_pid,
-	  (PTRACE_ARG3_TYPE) & inferior_registers, 0);
-
-#ifdef PT_SETFPREGS
-  for (i = 0; i < 32; i++)
-    RS (FP0_REGNUM + i, inferior_fp_registers.r_regs[i]);
-  ptrace (PT_SETFPREGS, inferior_pid,
-	  (PTRACE_ARG3_TYPE) & inferior_fp_registers, 0);
-#endif
-}
-#endif	/* !__powerpc__ */
-
-/* NOTE! I tried using PTRACE_READDATA, etc., to read and write memory
-   in the NEW_SUN_PTRACE case.
-   It ought to be straightforward.  But it appears that writing did
-   not write the data that I specified.  I cannot understand where
-   it got the data that it actually did write.  */
-
-/* Copy LEN bytes from inferior's memory starting at MEMADDR
-   to debugger memory starting at MYADDR.  */
-
-void
-read_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
-{
-  register int i;
-  /* Round starting address down to longword boundary.  */
-  register CORE_ADDR addr = memaddr & -(CORE_ADDR) sizeof (int);
-  /* Round ending address up; get number of longwords that makes.  */
-  register int count
-  = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int);
-  /* Allocate buffer of that many longwords.  */
-  register int *buffer = (int *) alloca (count * sizeof (int));
-
-  /* Read all the longwords */
-  for (i = 0; i < count; i++, addr += sizeof (int))
-    {
-      buffer[i] = ptrace (PT_READ_D, inferior_pid, (PTRACE_ARG3_TYPE) addr, 0);
-    }
-
-  /* Copy appropriate bytes out of the buffer.  */
-  memcpy (myaddr, (char *) buffer + (memaddr & (sizeof (int) - 1)), len);
-}
-
-/* Copy LEN bytes of data from debugger memory at MYADDR
-   to inferior's memory at MEMADDR.
-   On failure (cannot write the inferior)
-   returns the value of errno.  */
-
-int
-write_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
-{
-  register int i;
-  /* Round starting address down to longword boundary.  */
-  register CORE_ADDR addr = memaddr & -(CORE_ADDR) sizeof (int);
-  /* Round ending address up; get number of longwords that makes.  */
-  register int count
-  = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int);
-  /* Allocate buffer of that many longwords.  */
-  register int *buffer = (int *) alloca (count * sizeof (int));
-  extern int errno;
-
-  /* Fill start and end extra bytes of buffer with existing memory data.  */
-
-  buffer[0] = ptrace (PT_READ_D, inferior_pid, (PTRACE_ARG3_TYPE) addr, 0);
-
-  if (count > 1)
-    {
-      buffer[count - 1]
-	= ptrace (PT_READ_D, inferior_pid,
-		  (PTRACE_ARG3_TYPE) addr + (count - 1) * sizeof (int), 0);
-    }
-
-  /* Copy data to be written over corresponding part of buffer */
-
-  memcpy ((char *) buffer + (memaddr & (sizeof (int) - 1)), myaddr, len);
-
-  /* Write the entire buffer.  */
-
-  for (i = 0; i < count; i++, addr += sizeof (int))
-    {
-      errno = 0;
-      ptrace (PT_WRITE_D, inferior_pid, (PTRACE_ARG3_TYPE) addr, buffer[i]);
-      if (errno)
-	return errno;
-    }
-
-  return 0;
-}
-
-void 
-initialize_low (void)
-{
-  initialize_arch ();
-}
diff --git a/gdb/gdbserver/low-sim.c b/gdb/gdbserver/low-sim.c
deleted file mode 100644
index 86a0406..0000000
--- a/gdb/gdbserver/low-sim.c
+++ /dev/null
@@ -1,269 +0,0 @@
-/* Low level interface to simulators, for the remote server for GDB.
-   Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
-   Free Software Foundation, Inc.
-
-   This file is part of GDB.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
-
-#include "server.h"
-#include "bfd.h"
-#include "callback.h"		/* GDB simulator callback interface */
-#include "remote-sim.h"		/* GDB simulator interface */
-
-extern int remote_debug;
-
-extern host_callback default_callback;	/* in sim/common/callback.c */
-
-static char my_registers[REGISTER_BYTES] __attribute__ ((aligned));
-char * registers = my_registers;
-
-int target_byte_order;		/* used by simulator */
-
-/* We record the result of sim_open so we can pass it
-   back to the other sim_foo routines.  */
-static SIM_DESC gdbsim_desc = 0;
-
-/* This version of "load" should be usable for any simulator that
-   does not support loading itself.  */
-
-static void
-mygeneric_load (bfd *loadfile_bfd)
-{
-  asection *s;
-
-  for (s = loadfile_bfd->sections; s; s = s->next)
-    {
-      if (s->flags & SEC_LOAD)
-	{
-	  bfd_size_type size;
-
-	  size = bfd_get_section_size_before_reloc (s);
-	  if (size > 0)
-	    {
-	      char *buffer;
-	      bfd_vma lma;	/* use load address, not virtual address */
-
-	      buffer = xmalloc (size);
-	      lma = s->lma;
-
-	      /* Is this really necessary?  I guess it gives the user something
-	         to look at during a long download.  */
-	      printf ("Loading section %s, size 0x%lx lma 0x%lx\n",
-		      bfd_get_section_name (loadfile_bfd, s),
-		      (unsigned long) size,
-		      (unsigned long) lma);	/* chops high 32 bits.  FIXME!! */
-
-	      bfd_get_section_contents (loadfile_bfd, s, buffer, 0, size);
-
-	      write_inferior_memory (lma, buffer, size);
-	      free (buffer);
-	    }
-	}
-    }
-
-  printf ("Start address 0x%lx\n",
-	  (unsigned long) loadfile_bfd->start_address);
-
-  /* We were doing this in remote-mips.c, I suspect it is right
-     for other targets too.  */
-  /* write_pc (loadfile_bfd->start_address); *//* FIXME!! */
-}
-
-int
-create_inferior (char *program, char **argv)
-{
-  bfd *abfd;
-  int pid = 0;
-  char **new_argv;
-  int nargs;
-
-  abfd = bfd_openr (program, 0);
-  if (!abfd)
-    {
-      fprintf (stderr, "gdbserver: can't open %s: %s\n",
-	       program, bfd_errmsg (bfd_get_error ()));
-      exit (1);
-    }
-
-  if (!bfd_check_format (abfd, bfd_object))
-    {
-      fprintf (stderr, "gdbserver: unknown load format for %s: %s\n",
-	       program, bfd_errmsg (bfd_get_error ()));
-      exit (1);
-    }
-
-  /* Add "-E big" or "-E little" to the argument list depending on the
-     endianness of the program to be loaded.  */
-  for (nargs = 0; argv[nargs] != NULL; nargs++)		/* count the args */
-    ;
-  new_argv = alloca (sizeof (char *) * (nargs + 3));	/* allocate new args */
-  for (nargs = 0; argv[nargs] != NULL; nargs++)		/* copy old to new */
-    new_argv[nargs] = argv[nargs];
-  new_argv[nargs] = "-E";
-  new_argv[nargs + 1] = bfd_big_endian (abfd) ? "big" : "little";
-  new_argv[nargs + 2] = NULL;
-  argv = new_argv;
-
-  /* Create an instance of the simulator.  */
-  default_callback.init (&default_callback);
-  gdbsim_desc = sim_open (SIM_OPEN_STANDALONE, &default_callback, abfd, argv);
-  if (gdbsim_desc == 0)
-    exit (1);
-
-  /* Load the program into the simulator.  */
-  if (abfd)
-    if (sim_load (gdbsim_desc, program, NULL, 0) == SIM_RC_FAIL)
-      mygeneric_load (abfd);
-
-  /* Create an inferior process in the simulator.  This initializes SP.  */
-  sim_create_inferior (gdbsim_desc, abfd, argv, /* env */ NULL);
-  sim_resume (gdbsim_desc, 1, 0);	/* execute one instr */
-  return pid;
-}
-
-/* Attaching is not supported.  */
-int
-myattach (int pid)
-{
-  return -1;
-}
-
-/* Kill the inferior process.  Make us have no inferior.  */
-
-void
-kill_inferior (void)
-{
-  sim_close (gdbsim_desc, 0);
-  default_callback.shutdown (&default_callback);
-}
-
-/* Fetch one register.  */
-
-static void
-fetch_register (int regno)
-{
-  sim_fetch_register (gdbsim_desc, regno, &registers[REGISTER_BYTE (regno)],
-		      REGISTER_RAW_SIZE (regno));
-}
-
-/* Fetch all registers, or just one, from the child process.  */
-
-void
-fetch_inferior_registers (int regno)
-{
-  if (regno == -1 || regno == 0)
-    for (regno = 0; regno < NUM_REGS /*-NUM_FREGS*/ ; regno++)
-      fetch_register (regno);
-  else
-    fetch_register (regno);
-}
-
-/* Store our register values back into the inferior.
-   If REGNO is -1, do this for all registers.
-   Otherwise, REGNO specifies which register (so we can save time).  */
-
-void
-store_inferior_registers (int regno)
-{
-  if (regno == -1)
-    {
-      for (regno = 0; regno < NUM_REGS; regno++)
-	store_inferior_registers (regno);
-    }
-  else
-    sim_store_register (gdbsim_desc, regno, &registers[REGISTER_BYTE (regno)],
-			REGISTER_RAW_SIZE (regno));
-}
-
-/* Return nonzero if the given thread is still alive.  */
-int
-mythread_alive (int pid)
-{
-  return 1;
-}
-
-/* Wait for process, returns status */
-
-unsigned char
-mywait (char *status)
-{
-  int sigrc;
-  enum sim_stop reason;
-
-  sim_stop_reason (gdbsim_desc, &reason, &sigrc);
-  switch (reason)
-    {
-    case sim_exited:
-      if (remote_debug)
-	printf ("\nChild exited with retcode = %x \n", sigrc);
-      *status = 'W';
-      return sigrc;
-
-#if 0
-    case sim_stopped:
-      if (remote_debug)
-	printf ("\nChild terminated with signal = %x \n", sigrc);
-      *status = 'X';
-      return sigrc;
-#endif
-
-    default:			/* should this be sim_signalled or sim_stopped?  FIXME!! */
-      if (remote_debug)
-	printf ("\nChild received signal = %x \n", sigrc);
-      fetch_inferior_registers (0);
-      *status = 'T';
-      return (unsigned char) sigrc;
-    }
-}
-
-/* Resume execution of the inferior process.
-   If STEP is nonzero, single-step it.
-   If SIGNAL is nonzero, give it that signal.  */
-
-void
-myresume (int step, int signo)
-{
-  /* Should be using target_signal_to_host() or signal numbers in target.h
-     to convert GDB signal number to target signal number.  */
-  sim_resume (gdbsim_desc, step, signo);
-}
-
-/* Copy LEN bytes from inferior's memory starting at MEMADDR
-   to debugger memory starting at MYADDR.  */
-
-void
-read_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
-{
-  sim_read (gdbsim_desc, memaddr, myaddr, len);
-}
-
-/* Copy LEN bytes of data from debugger memory at MYADDR
-   to inferior's memory at MEMADDR.
-   On failure (cannot write the inferior)
-   returns the value of errno.  */
-
-int
-write_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
-{
-  sim_write (gdbsim_desc, memaddr, myaddr, len);	/* should check for error.  FIXME!! */
-  return 0;
-}
-
-void
-initialize_low (void)
-{
-}
diff --git a/gdb/gdbserver/low-sparc.c b/gdb/gdbserver/low-sparc.c
deleted file mode 100644
index 4b03140..0000000
--- a/gdb/gdbserver/low-sparc.c
+++ /dev/null
@@ -1,314 +0,0 @@
-/* Low level interface to ptrace, for the remote server for GDB.
-   Copyright 1986, 1987, 1993, 1994, 1995, 1997, 1999, 2000, 2001, 2002
-   Free Software Foundation, Inc.
-
-   This file is part of GDB.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
-
-#include "server.h"
-#include <sys/wait.h>
-#include "frame.h"
-#include "inferior.h"
-/***************************
-#include "initialize.h"
-****************************/
-
-#include <stdio.h>
-#include <sys/param.h>
-#include <sys/dir.h>
-#include <sys/user.h>
-#include <signal.h>
-#include <sys/ioctl.h>
-#include <sgtty.h>
-#include <fcntl.h>
-
-/***************Begin MY defs*********************/
-static char my_registers[REGISTER_BYTES];
-char *registers = my_registers;
-/***************End MY defs*********************/
-
-#include <sys/ptrace.h>
-#include <sys/reg.h>
-
-extern int sys_nerr;
-extern char **sys_errlist;
-extern int errno;
-
-/* Start an inferior process and returns its pid.
-   ALLARGS is a vector of program-name and args. */
-
-int
-create_inferior (char *program, char **allargs)
-{
-  int pid;
-
-  pid = fork ();
-  if (pid < 0)
-    perror_with_name ("fork");
-
-  if (pid == 0)
-    {
-      ptrace (PTRACE_TRACEME);
-
-      execv (program, allargs);
-
-      fprintf (stderr, "Cannot exec %s: %s.\n", program,
-	       errno < sys_nerr ? sys_errlist[errno] : "unknown error");
-      fflush (stderr);
-      _exit (0177);
-    }
-
-  return pid;
-}
-
-/* Attaching is not supported.  */
-int
-myattach (int pid)
-{
-  return -1;
-}
-
-/* Kill the inferior process.  Make us have no inferior.  */
-
-void
-kill_inferior (void)
-{
-  if (inferior_pid == 0)
-    return;
-  ptrace (8, inferior_pid, 0, 0);
-  wait (0);
-/*************inferior_died ();****VK**************/
-}
-
-/* Return nonzero if the given thread is still alive.  */
-int
-mythread_alive (int pid)
-{
-  return 1;
-}
-
-/* Wait for process, returns status */
-
-unsigned char
-mywait (char *status)
-{
-  int pid;
-  union wait w;
-
-  enable_async_io ();
-  pid = waitpid (inferior_pid, &w, 0);
-  disable_async_io ();
-  if (pid != inferior_pid)
-    perror_with_name ("wait");
-
-  if (WIFEXITED (w))
-    {
-      fprintf (stderr, "\nChild exited with retcode = %x \n", WEXITSTATUS (w));
-      *status = 'W';
-      return ((unsigned char) WEXITSTATUS (w));
-    }
-  else if (!WIFSTOPPED (w))
-    {
-      fprintf (stderr, "\nChild terminated with signal = %x \n", WTERMSIG (w));
-      *status = 'X';
-      return ((unsigned char) WTERMSIG (w));
-    }
-
-  fetch_inferior_registers (0);
-
-  *status = 'T';
-  return ((unsigned char) WSTOPSIG (w));
-}
-
-/* Resume execution of the inferior process.
-   If STEP is nonzero, single-step it.
-   If SIGNAL is nonzero, give it that signal.  */
-
-void
-myresume (int step, int signal)
-{
-  errno = 0;
-  ptrace (step ? PTRACE_SINGLESTEP : PTRACE_CONT, inferior_pid, 1, signal);
-  if (errno)
-    perror_with_name ("ptrace");
-}
-
-/* Fetch one or more registers from the inferior.  REGNO == -1 to get
-   them all.  We actually fetch more than requested, when convenient,
-   marking them as valid so we won't fetch them again.  */
-
-void
-fetch_inferior_registers (int ignored)
-{
-  struct regs inferior_registers;
-  struct fp_status inferior_fp_registers;
-  int i;
-
-  /* Global and Out regs are fetched directly, as well as the control
-     registers.  If we're getting one of the in or local regs,
-     and the stack pointer has not yet been fetched,
-     we have to do that first, since they're found in memory relative
-     to the stack pointer.  */
-
-  if (ptrace (PTRACE_GETREGS, inferior_pid,
-	      (PTRACE_ARG3_TYPE) & inferior_registers, 0))
-    perror ("ptrace_getregs");
-
-  registers[REGISTER_BYTE (0)] = 0;
-  memcpy (&registers[REGISTER_BYTE (1)], &inferior_registers.r_g1,
-	  15 * REGISTER_RAW_SIZE (G0_REGNUM));
-  *(int *) &registers[REGISTER_BYTE (PS_REGNUM)] = inferior_registers.r_ps;
-  *(int *) &registers[REGISTER_BYTE (PC_REGNUM)] = inferior_registers.r_pc;
-  *(int *) &registers[REGISTER_BYTE (NPC_REGNUM)] = inferior_registers.r_npc;
-  *(int *) &registers[REGISTER_BYTE (Y_REGNUM)] = inferior_registers.r_y;
-
-  /* Floating point registers */
-
-  if (ptrace (PTRACE_GETFPREGS, inferior_pid,
-	      (PTRACE_ARG3_TYPE) & inferior_fp_registers,
-	      0))
-    perror ("ptrace_getfpregs");
-  memcpy (&registers[REGISTER_BYTE (FP0_REGNUM)], &inferior_fp_registers,
-	  sizeof inferior_fp_registers.fpu_fr);
-
-  /* These regs are saved on the stack by the kernel.  Only read them
-     all (16 ptrace calls!) if we really need them.  */
-
-  read_inferior_memory (*(CORE_ADDR *) & registers[REGISTER_BYTE (SP_REGNUM)],
-			&registers[REGISTER_BYTE (L0_REGNUM)],
-			16 * REGISTER_RAW_SIZE (L0_REGNUM));
-}
-
-/* Store our register values back into the inferior.
-   If REGNO is -1, do this for all registers.
-   Otherwise, REGNO specifies which register (so we can save time).  */
-
-void
-store_inferior_registers (int ignored)
-{
-  struct regs inferior_registers;
-  struct fp_status inferior_fp_registers;
-  CORE_ADDR sp = *(CORE_ADDR *) & registers[REGISTER_BYTE (SP_REGNUM)];
-
-  write_inferior_memory (sp, &registers[REGISTER_BYTE (L0_REGNUM)],
-			 16 * REGISTER_RAW_SIZE (L0_REGNUM));
-
-  memcpy (&inferior_registers.r_g1, &registers[REGISTER_BYTE (G1_REGNUM)],
-	  15 * REGISTER_RAW_SIZE (G1_REGNUM));
-
-  inferior_registers.r_ps =
-    *(int *) &registers[REGISTER_BYTE (PS_REGNUM)];
-  inferior_registers.r_pc =
-    *(int *) &registers[REGISTER_BYTE (PC_REGNUM)];
-  inferior_registers.r_npc =
-    *(int *) &registers[REGISTER_BYTE (NPC_REGNUM)];
-  inferior_registers.r_y =
-    *(int *) &registers[REGISTER_BYTE (Y_REGNUM)];
-
-  if (ptrace (PTRACE_SETREGS, inferior_pid,
-	      (PTRACE_ARG3_TYPE) & inferior_registers, 0))
-    perror ("ptrace_setregs");
-
-  memcpy (&inferior_fp_registers, &registers[REGISTER_BYTE (FP0_REGNUM)],
-	  sizeof inferior_fp_registers.fpu_fr);
-
-  if (ptrace (PTRACE_SETFPREGS, inferior_pid,
-	      (PTRACE_ARG3_TYPE) & inferior_fp_registers, 0))
-    perror ("ptrace_setfpregs");
-}
-
-/* NOTE! I tried using PTRACE_READDATA, etc., to read and write memory
-   in the NEW_SUN_PTRACE case.
-   It ought to be straightforward.  But it appears that writing did
-   not write the data that I specified.  I cannot understand where
-   it got the data that it actually did write.  */
-
-/* Copy LEN bytes from inferior's memory starting at MEMADDR
-   to debugger memory starting at MYADDR.  */
-
-void
-read_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
-{
-  register int i;
-  /* Round starting address down to longword boundary.  */
-  register CORE_ADDR addr = memaddr & -(CORE_ADDR) sizeof (int);
-  /* Round ending address up; get number of longwords that makes.  */
-  register int count
-  = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int);
-  /* Allocate buffer of that many longwords.  */
-  register int *buffer = (int *) alloca (count * sizeof (int));
-
-  /* Read all the longwords */
-  for (i = 0; i < count; i++, addr += sizeof (int))
-    {
-      buffer[i] = ptrace (1, inferior_pid, addr, 0);
-    }
-
-  /* Copy appropriate bytes out of the buffer.  */
-  memcpy (myaddr, (char *) buffer + (memaddr & (sizeof (int) - 1)), len);
-}
-
-/* Copy LEN bytes of data from debugger memory at MYADDR
-   to inferior's memory at MEMADDR.
-   On failure (cannot write the inferior)
-   returns the value of errno.  */
-
-int
-write_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
-{
-  register int i;
-  /* Round starting address down to longword boundary.  */
-  register CORE_ADDR addr = memaddr & -(CORE_ADDR) sizeof (int);
-  /* Round ending address up; get number of longwords that makes.  */
-  register int count
-  = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int);
-  /* Allocate buffer of that many longwords.  */
-  register int *buffer = (int *) alloca (count * sizeof (int));
-  extern int errno;
-
-  /* Fill start and end extra bytes of buffer with existing memory data.  */
-
-  buffer[0] = ptrace (1, inferior_pid, addr, 0);
-
-  if (count > 1)
-    {
-      buffer[count - 1]
-	= ptrace (1, inferior_pid,
-		  addr + (count - 1) * sizeof (int), 0);
-    }
-
-  /* Copy data to be written over corresponding part of buffer */
-
-  bcopy (myaddr, (char *) buffer + (memaddr & (sizeof (int) - 1)), len);
-
-  /* Write the entire buffer.  */
-
-  for (i = 0; i < count; i++, addr += sizeof (int))
-    {
-      errno = 0;
-      ptrace (4, inferior_pid, addr, buffer[i]);
-      if (errno)
-	return errno;
-    }
-
-  return 0;
-}
-
-void
-initialize_low (void)
-{
-}
diff --git a/gdb/gdbserver/low-sun3.c b/gdb/gdbserver/low-sun3.c
deleted file mode 100644
index ccaded8..0000000
--- a/gdb/gdbserver/low-sun3.c
+++ /dev/null
@@ -1,291 +0,0 @@
-/* Low level interface to ptrace, for the remote server for GDB.
-   Copyright 1986, 1987, 1993, 1994, 1995, 1999, 2000, 2001, 2002
-   Free Software Foundation, Inc.
-
-   This file is part of GDB.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
-
-#include "server.h"
-#include "<sys/wait.h>"
-#include "frame.h"
-#include "inferior.h"
-
-#include <stdio.h>
-#include <sys/param.h>
-#include <sys/dir.h>
-#include <sys/user.h>
-#include <signal.h>
-#include <sys/ioctl.h>
-#include <sgtty.h>
-#include <fcntl.h>
-
-/***************Begin MY defs*********************/
-static char my_registers[REGISTER_BYTES];
-char *registers = my_registers;
-/***************End MY defs*********************/
-
-#include <sys/ptrace.h>
-#include <machine/reg.h>
-
-extern int sys_nerr;
-extern char **sys_errlist;
-extern int errno;
-
-/* Start an inferior process and returns its pid.
-   ALLARGS is a vector of program-name and args. */
-
-int
-create_inferior (char *program, char **allargs)
-{
-  int pid;
-
-  pid = fork ();
-  if (pid < 0)
-    perror_with_name ("fork");
-
-  if (pid == 0)
-    {
-      ptrace (PTRACE_TRACEME);
-
-      execv (program, allargs);
-
-      fprintf (stderr, "Cannot exec %s: %s.\n", program,
-	       errno < sys_nerr ? sys_errlist[errno] : "unknown error");
-      fflush (stderr);
-      _exit (0177);
-    }
-
-  return pid;
-}
-
-/* Attaching is not supported.  */
-int
-myattach (int pid)
-{
-  return -1;
-}
-
-/* Kill the inferior process.  Make us have no inferior.  */
-
-void
-kill_inferior (void)
-{
-  if (inferior_pid == 0)
-    return;
-  ptrace (8, inferior_pid, 0, 0);
-  wait (0);
-/*************inferior_died ();****VK**************/
-}
-
-/* Return nonzero if the given thread is still alive.  */
-int
-mythread_alive (int pid)
-{
-  return 1;
-}
-
-/* Wait for process, returns status */
-
-unsigned char
-mywait (char *status)
-{
-  int pid;
-  union wait w;
-
-  pid = wait (&w);
-  if (pid != inferior_pid)
-    perror_with_name ("wait");
-
-  if (WIFEXITED (w))
-    {
-      fprintf (stderr, "\nChild exited with retcode = %x \n", WEXITSTATUS (w));
-      *status = 'W';
-      return ((unsigned char) WEXITSTATUS (w));
-    }
-  else if (!WIFSTOPPED (w))
-    {
-      fprintf (stderr, "\nChild terminated with signal = %x \n", WTERMSIG (w));
-      *status = 'X';
-      return ((unsigned char) WTERMSIG (w));
-    }
-
-  fetch_inferior_registers (0);
-
-  *status = 'T';
-  return ((unsigned char) WSTOPSIG (w));
-}
-
-/* Resume execution of the inferior process.
-   If STEP is nonzero, single-step it.
-   If SIGNAL is nonzero, give it that signal.  */
-
-void
-myresume (int step, int signal)
-{
-  errno = 0;
-  ptrace (step ? PTRACE_SINGLESTEP : PTRACE_CONT, inferior_pid, 1, signal);
-  if (errno)
-    perror_with_name ("ptrace");
-}
-
-/* Fetch one or more registers from the inferior.  REGNO == -1 to get
-   them all.  We actually fetch more than requested, when convenient,
-   marking them as valid so we won't fetch them again.  */
-
-void
-fetch_inferior_registers (int ignored)
-{
-  struct regs inferior_registers;
-  struct fp_status inferior_fp_registers;
-
-  ptrace (PTRACE_GETREGS, inferior_pid,
-	  (PTRACE_ARG3_TYPE) & inferior_registers);
-#ifdef FP0_REGNUM
-  ptrace (PTRACE_GETFPREGS, inferior_pid,
-	  (PTRACE_ARG3_TYPE) & inferior_fp_registers);
-#endif
-
-  memcpy (registers, &inferior_registers, 16 * 4);
-#ifdef FP0_REGNUM
-  memcpy (&registers[REGISTER_BYTE (FP0_REGNUM)], &inferior_fp_registers,
-	  sizeof inferior_fp_registers.fps_regs);
-#endif
-  *(int *) &registers[REGISTER_BYTE (PS_REGNUM)] = inferior_registers.r_ps;
-  *(int *) &registers[REGISTER_BYTE (PC_REGNUM)] = inferior_registers.r_pc;
-#ifdef FP0_REGNUM
-  memcpy
-    (&registers[REGISTER_BYTE (FPC_REGNUM)],
-     &inferior_fp_registers.fps_control,
-     sizeof inferior_fp_registers - sizeof inferior_fp_registers.fps_regs);
-#endif
-}
-
-/* Store our register values back into the inferior.
-   If REGNO is -1, do this for all registers.
-   Otherwise, REGNO specifies which register (so we can save time).  */
-
-void
-store_inferior_registers (int ignored)
-{
-  struct regs inferior_registers;
-  struct fp_status inferior_fp_registers;
-
-  memcpy (&inferior_registers, registers, 16 * 4);
-#ifdef FP0_REGNUM
-  memcpy (&inferior_fp_registers,
-	  &registers[REGISTER_BYTE (FP0_REGNUM)],
-	  sizeof inferior_fp_registers.fps_regs);
-#endif
-  inferior_registers.r_ps = *(int *) &registers[REGISTER_BYTE (PS_REGNUM)];
-  inferior_registers.r_pc = *(int *) &registers[REGISTER_BYTE (PC_REGNUM)];
-
-#ifdef FP0_REGNUM
-  memcpy (&inferior_fp_registers.fps_control,
-	  &registers[REGISTER_BYTE (FPC_REGNUM)],
-	  (sizeof inferior_fp_registers
-	   - sizeof inferior_fp_registers.fps_regs));
-#endif
-
-  ptrace (PTRACE_SETREGS, inferior_pid,
-	  (PTRACE_ARG3_TYPE) & inferior_registers);
-#if FP0_REGNUM
-  ptrace (PTRACE_SETFPREGS, inferior_pid,
-	  (PTRACE_ARG3_TYPE) & inferior_fp_registers);
-#endif
-}
-
-/* NOTE! I tried using PTRACE_READDATA, etc., to read and write memory
-   in the NEW_SUN_PTRACE case.
-   It ought to be straightforward.  But it appears that writing did
-   not write the data that I specified.  I cannot understand where
-   it got the data that it actually did write.  */
-
-/* Copy LEN bytes from inferior's memory starting at MEMADDR
-   to debugger memory starting at MYADDR.  */
-
-void
-read_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
-{
-  register int i;
-  /* Round starting address down to longword boundary.  */
-  register CORE_ADDR addr = memaddr & -(CORE_ADDR) sizeof (int);
-  /* Round ending address up; get number of longwords that makes.  */
-  register int count
-  = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int);
-  /* Allocate buffer of that many longwords.  */
-  register int *buffer = (int *) alloca (count * sizeof (int));
-
-  /* Read all the longwords */
-  for (i = 0; i < count; i++, addr += sizeof (int))
-    {
-      buffer[i] = ptrace (1, inferior_pid, addr, 0);
-    }
-
-  /* Copy appropriate bytes out of the buffer.  */
-  memcpy (myaddr, (char *) buffer + (memaddr & (sizeof (int) - 1)), len);
-}
-
-/* Copy LEN bytes of data from debugger memory at MYADDR
-   to inferior's memory at MEMADDR.
-   On failure (cannot write the inferior)
-   returns the value of errno.  */
-
-int
-write_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
-{
-  register int i;
-  /* Round starting address down to longword boundary.  */
-  register CORE_ADDR addr = memaddr & -(CORE_ADDR) sizeof (int);
-  /* Round ending address up; get number of longwords that makes.  */
-  register int count
-  = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int);
-  /* Allocate buffer of that many longwords.  */
-  register int *buffer = (int *) alloca (count * sizeof (int));
-  extern int errno;
-
-  /* Fill start and end extra bytes of buffer with existing memory data.  */
-
-  buffer[0] = ptrace (1, inferior_pid, addr, 0);
-
-  if (count > 1)
-    {
-      buffer[count - 1]
-	= ptrace (1, inferior_pid,
-		  addr + (count - 1) * sizeof (int), 0);
-    }
-
-  /* Copy data to be written over corresponding part of buffer */
-
-  memcpy ((char *) buffer + (memaddr & (sizeof (int) - 1)), myaddr, len);
-
-  /* Write the entire buffer.  */
-
-  for (i = 0; i < count; i++, addr += sizeof (int))
-    {
-      errno = 0;
-      ptrace (4, inferior_pid, addr, buffer[i]);
-      if (errno)
-	return errno;
-    }
-
-  return 0;
-}
-
-void
-initialize_low (void)
-{
-}
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index d0963ba..81fde5b 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -217,6 +217,28 @@
 	    case 'd':
 	      remote_debug = !remote_debug;
 	      break;
+	    case 'D':
+	      fprintf (stderr, "Detaching from inferior\n");
+	      detach_inferior ();
+	      write_ok (own_buf);
+	      putpkt (own_buf);
+	      remote_close ();		  
+
+	      /* If we are attached, then we can exit.  Otherwise, we need to
+		 hang around doing nothing, until the child is gone.  */
+	      if (!attached)
+		{
+		  int status, ret;
+
+		  do {
+		    ret = waitpid (signal_pid, &status, 0);
+		    if (WIFEXITED (status) || WIFSIGNALED (status))
+		      break;
+		  } while (ret != -1 || errno != ECHILD);
+		}
+
+	      exit (0);
+
 	    case '!':
 	      if (attached == 0)
 		{
diff --git a/gdb/gdbserver/target.h b/gdb/gdbserver/target.h
index c09ac8d..1c47a3ae 100644
--- a/gdb/gdbserver/target.h
+++ b/gdb/gdbserver/target.h
@@ -48,6 +48,10 @@
 
   void (*kill) (void);
 
+  /* Detach from all inferiors.  */
+
+  void (*detach) (void);
+
   /* Return 1 iff the thread with process ID PID is alive.  */
 
   int (*thread_alive) (int pid);
@@ -122,6 +126,9 @@
 #define kill_inferior() \
   (*the_target->kill) ()
 
+#define detach_inferior() \
+  (*the_target->detach) ()
+
 #define mythread_alive(pid) \
   (*the_target->thread_alive) (pid)
 
diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c
index 8be456f..9b63616 100644
--- a/gdb/gnu-nat.c
+++ b/gdb/gnu-nat.c
@@ -62,6 +62,7 @@
 #include "gdbcore.h"
 #include "gdbthread.h"
 #include "gdb_assert.h"
+#include "gdb_obstack.h"
 
 #include "gnu-nat.h"
 
diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c
index 0ebcf22..1253b4d 100644
--- a/gdb/h8300-tdep.c
+++ b/gdb/h8300-tdep.c
@@ -73,6 +73,9 @@
   E_VBR_REGNUM
 };
 
+#define E_PSEUDO_CCR_REGNUM (NUM_REGS)
+#define E_PSEUDO_EXR_REGNUM (NUM_REGS+1)
+
 #define UNSIGNED_SHORT(X) ((X) & 0xffff)
 
 #define IS_PUSH(x) ((x & 0xfff0)==0x6df0)
@@ -91,13 +94,23 @@
    An argument register spill is an instruction that moves an argument
    from the register in which it was passed to the stack slot in which
    it really lives.  It is a byte, word, or longword move from an
-   argument register to a negative offset from the frame pointer.  */
+   argument register to a negative offset from the frame pointer.
+   
+   CV, 2003-06-16: Or, in optimized code or when the `register' qualifier
+   is used, it could be a byte, word or long move to registers r3-r5.  */
 
 static int
 h8300_is_argument_spill (CORE_ADDR pc)
 {
   int w = read_memory_unsigned_integer (pc, 2);
 
+  if (((w & 0xff88) == 0x0c88                 /* mov.b Rsl, Rdl */
+       || (w & 0xff88) == 0x0d00              /* mov.w Rs, Rd */
+       || (w & 0xff88) == 0x0f80)             /* mov.l Rs, Rd */
+      && (w & 0x70) <= 0x20                   /* Rs is R0, R1 or R2 */
+      && (w & 0x7) >= 0x3 && (w & 0x7) <= 0x5)/* Rd is R3, R4 or R5 */
+    return 2;
+
   if ((w & 0xfff0) == 0x6ee0                  /* mov.b Rs,@(d:16,er6) */
       && 8 <= (w & 0xf) && (w & 0xf) <= 10)   /* Rs is R0L, R1L, or R2L  */
     {
@@ -240,6 +253,17 @@
   if (IS_SUBL_SP (w))
     start_pc += 6 + adjust;
 
+  /* Skip past another possible stm insn for registers R3 to R5 (possibly used
+     for register qualified arguments.  */
+  w = read_memory_unsigned_integer (start_pc, 2);
+  /* First look for push insns.  */
+  if (w == 0x0110 || w == 0x0120 || w == 0x0130)
+    {
+      w = read_memory_unsigned_integer (start_pc + 2, 2);
+      if (IS_PUSH (w) && (w & 0xf) >= 0x3 && (w & 0xf) <= 0x5)
+	start_pc += 4;
+    }
+
   /* Check for spilling an argument register to the stack frame.
      This could also be an initializing store from non-prologue code,
      but I don't think there's any harm in skipping that.  */
@@ -254,17 +278,6 @@
   return start_pc;
 }
 
-static int
-gdb_print_insn_h8300 (bfd_vma memaddr, disassemble_info * info)
-{
-  if (h8300smode)
-    return print_insn_h8300s (memaddr, info);
-  else if (h8300hmode)
-    return print_insn_h8300h (memaddr, info);
-  else
-    return print_insn_h8300 (memaddr, info);
-}
-
 /* Fetch the instruction at ADDR, returning 0 if ADDR is beyond LIM or
    is not the address of a valid instruction, the address of the next
    instruction beyond ADDR otherwise.  *PWORD1 receives the first word
@@ -341,7 +354,7 @@
 
   next_ip = h8300_next_prologue_insn (ip, limit, &insn_word);
 
-  if (insn_word == 0x0100)
+  if (insn_word == 0x0100)	/* mov.l */
     {
       insn_word = read_memory_unsigned_integer (ip + 2, 2);
       adjust = 2;
@@ -551,7 +564,7 @@
 #define round_up(n, unit)   (((n) + (unit) - 1) & -(unit))
 #define round_down(n, unit) ((n) & -(unit))
 
-/* Function: push_arguments
+/* Function: push_dummy_call
    Setup the function arguments for calling a function in the inferior.
    In this discussion, a `word' is 16 bits on the H8/300s, and 32 bits
    on the H8/300H.
@@ -616,12 +629,14 @@
      to begin with.  */
 
 static CORE_ADDR
-h8300_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
-		      int struct_return, CORE_ADDR struct_addr)
+h8300_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
+		       struct regcache *regcache, CORE_ADDR bp_addr, int nargs,
+		       struct value **args, CORE_ADDR sp, int struct_return,
+		       CORE_ADDR struct_addr)
 {
-  int stack_align, stack_alloc, stack_offset;
+  int stack_alloc = 0, stack_offset = 0;
   int wordsize = BINWORD;
-  int reg;
+  int reg = E_ARG0_REGNUM;
   int argument;
 
   /* First, make sure the stack is properly aligned.  */
@@ -629,22 +644,18 @@
 
   /* Now make sure there's space on the stack for the arguments.  We
      may over-allocate a little here, but that won't hurt anything.  */
-  stack_alloc = 0;
   for (argument = 0; argument < nargs; argument++)
     stack_alloc += round_up (TYPE_LENGTH (VALUE_TYPE (args[argument])),
                              wordsize);
   sp -= stack_alloc;
 
   /* Now load as many arguments as possible into registers, and push
-     the rest onto the stack.  */
-  reg = E_ARG0_REGNUM;
-  stack_offset = 0;
-
-  /* If we're returning a structure by value, then we must pass a
+     the rest onto the stack.
+     If we're returning a structure by value, then we must pass a
      pointer to the buffer for the return value as an invisible first
      argument.  */
   if (struct_return)
-    write_register (reg++, struct_addr);
+    regcache_cooked_write_unsigned (regcache, reg++, struct_addr);
 
   for (argument = 0; argument < nargs; argument++)
     {
@@ -688,7 +699,7 @@
                 {
                   ULONGEST word = extract_unsigned_integer (padded + offset, 
 							    wordsize);
-                  write_register (reg++, word);
+		  regcache_cooked_write_unsigned (regcache, reg++, word);
                 }
             }
         }
@@ -704,24 +715,13 @@
         }
     }
 
-  return sp;
-}
-
-/* Function: push_return_address
-   Setup the return address for a dummy frame, as called by
-   call_function_by_hand.  Only necessary when you are using an
-   empty CALL_DUMMY, ie. the target will not actually be executing
-   a JSR/BSR instruction.  */
-
-static CORE_ADDR
-h8300_push_return_address (CORE_ADDR pc, CORE_ADDR sp)
-{
-  unsigned char buf[4];
-  int wordsize = BINWORD;
-
+  /* Store return address.  */
   sp -= wordsize;
-  store_unsigned_integer (buf, wordsize, CALL_DUMMY_ADDRESS ());
-  write_memory (sp, buf, wordsize);
+  write_memory_unsigned_integer (sp, wordsize, bp_addr);
+
+  /* Update stack pointer.  */
+  regcache_cooked_write_unsigned (regcache, E_SP_REGNUM, sp);
+
   return sp;
 }
 
@@ -878,7 +878,8 @@
      type is selected. */
   static char *register_names[] = {
     "r0", "r1", "r2", "r3", "r4", "r5", "r6",
-    "sp", "ccr","pc","cycles", "tick", "inst", ""
+    "sp", "","pc","cycles", "tick", "inst",
+    "ccr", /* pseudo register */
   };
   if (regno < 0
       || regno >= (sizeof (register_names) / sizeof (*register_names)))
@@ -893,7 +894,9 @@
 {
   static char *register_names[] = {
     "er0", "er1", "er2", "er3", "er4", "er5", "er6",
-    "sp", "ccr", "pc", "cycles", "exr", "tick", "inst"
+    "sp", "", "pc", "cycles", "", "tick", "inst",
+    "mach", "macl",
+    "ccr", "exr" /* pseudo registers */
   };
   if (regno < 0
       || regno >= (sizeof (register_names) / sizeof (*register_names)))
@@ -908,8 +911,9 @@
 {
   static char *register_names[] = {
     "er0", "er1", "er2", "er3", "er4", "er5", "er6",
-    "sp", "ccr", "pc", "cycles", "exr", "tick", "inst",
-    "mach", "macl", "sbr", "vbr"
+    "sp", "", "pc", "cycles", "", "tick", "inst",
+    "mach", "macl", "sbr", "vbr",
+    "ccr", "exr" /* pseudo registers */
   };
   if (regno < 0
       || regno >= (sizeof (register_names) / sizeof (*register_names)))
@@ -932,7 +936,7 @@
   frame_read_signed_register (frame, regno, &rval);
 
   fprintf_filtered (file, "%-14s ", name);
-  if (regno == E_CCR_REGNUM || (regno == E_EXR_REGNUM && h8300smode))
+  if (regno == E_PSEUDO_CCR_REGNUM || (regno == E_PSEUDO_EXR_REGNUM && h8300smode))
     {
       fprintf_filtered (file, "0x%02x        ", (unsigned char)rval);
       print_longest (file, 'u', 1, rval);
@@ -942,7 +946,7 @@
       fprintf_filtered (file, "0x%s  ", phex ((ULONGEST)rval, BINWORD));
       print_longest (file, 'd', 1, rval);
     }
-  if (regno == E_CCR_REGNUM)
+  if (regno == E_PSEUDO_CCR_REGNUM)
     {
       /* CCR register */
       int C, Z, N, V;
@@ -981,7 +985,7 @@
       if ((Z | (N ^ V)) == 1)
 	fprintf_filtered (file, "<= ");
     }
-  else if (regno == E_EXR_REGNUM && h8300smode)
+  else if (regno == E_PSEUDO_EXR_REGNUM && h8300smode)
     {
       /* EXR register */
       unsigned char l = rval & 0xff;
@@ -999,10 +1003,41 @@
 			    struct frame_info *frame, int regno, int cpregs)
 {
   if (regno < 0)
-    for (regno = 0; regno < NUM_REGS; ++regno)
-      h8300_print_register (gdbarch, file, frame, regno);
+    {
+      for (regno = E_R0_REGNUM; regno <= E_SP_REGNUM; ++regno)
+	h8300_print_register (gdbarch, file, frame, regno);
+      h8300_print_register (gdbarch, file, frame, E_PSEUDO_CCR_REGNUM);
+      h8300_print_register (gdbarch, file, frame, E_PC_REGNUM);
+      if (h8300smode)
+        {
+	  h8300_print_register (gdbarch, file, frame, E_PSEUDO_EXR_REGNUM);
+	  if (h8300sxmode)
+	    {
+	      h8300_print_register (gdbarch, file, frame, E_SBR_REGNUM);
+	      h8300_print_register (gdbarch, file, frame, E_VBR_REGNUM);
+	    }
+	  h8300_print_register (gdbarch, file, frame, E_MACH_REGNUM);
+	  h8300_print_register (gdbarch, file, frame, E_MACL_REGNUM);
+	  h8300_print_register (gdbarch, file, frame, E_CYCLES_REGNUM);
+	  h8300_print_register (gdbarch, file, frame, E_TICKS_REGNUM);
+	  h8300_print_register (gdbarch, file, frame, E_INSTS_REGNUM);
+	}
+      else
+        {
+	  h8300_print_register (gdbarch, file, frame, E_CYCLES_REGNUM);
+	  h8300_print_register (gdbarch, file, frame, E_TICK_REGNUM);
+	  h8300_print_register (gdbarch, file, frame, E_INST_REGNUM);
+	}
+    }
   else
-    h8300_print_register (gdbarch, file, frame, regno);
+    {
+      if (regno == E_CCR_REGNUM)
+        h8300_print_register (gdbarch, file, frame, E_PSEUDO_CCR_REGNUM);
+      else if (regno == E_PSEUDO_EXR_REGNUM && h8300smode)
+	h8300_print_register (gdbarch, file, frame, E_PSEUDO_EXR_REGNUM);
+      else
+	h8300_print_register (gdbarch, file, frame, regno);
+    }
 }
 
 static CORE_ADDR
@@ -1014,7 +1049,7 @@
 static struct type *
 h8300_register_type (struct gdbarch *gdbarch, int regno)
 {
-  if (regno < 0 || regno >= NUM_REGS)
+  if (regno < 0 || regno >= NUM_REGS + NUM_PSEUDO_REGS)
     internal_error (__FILE__, __LINE__,
 		    "h8300_register_type: illegal register number %d",
 		    regno);
@@ -1027,19 +1062,61 @@
 	  case E_SP_REGNUM:
 	  case E_FP_REGNUM:
 	    return builtin_type_void_data_ptr;
-	  case E_CCR_REGNUM:
-	    return builtin_type_uint8;
-	  case E_EXR_REGNUM:
-	    if (h8300smode)
-	      return builtin_type_uint8;
-	    /*FALLTHRU*/
 	  default:
-	    return h8300hmode ? builtin_type_int32
-			      : builtin_type_int16;
+	    if (regno == E_PSEUDO_CCR_REGNUM)
+	      return builtin_type_uint8;
+	    else if (regno == E_PSEUDO_EXR_REGNUM)
+	      return builtin_type_uint8;
+	    else if (h8300hmode)
+	      return builtin_type_int32;
+	    else
+	      return builtin_type_int16;
         }
     }
 }
 
+static void
+h8300_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
+			    int regno, void *buf)
+{
+  if (regno == E_PSEUDO_CCR_REGNUM)
+    regcache_raw_read (regcache, E_CCR_REGNUM, buf);
+  else if (regno == E_PSEUDO_EXR_REGNUM)
+    regcache_raw_read (regcache, E_EXR_REGNUM, buf);
+  else
+    regcache_raw_read (regcache, regno, buf);
+}
+
+static void
+h8300_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
+			     int regno, const void *buf)
+{
+  if (regno == E_PSEUDO_CCR_REGNUM)
+    regcache_raw_write (regcache, E_CCR_REGNUM, buf);
+  else if (regno == E_PSEUDO_EXR_REGNUM)
+    regcache_raw_write (regcache, E_EXR_REGNUM, buf);
+  else
+    regcache_raw_write (regcache, regno, buf);
+}
+
+static int
+h8300_dbg_reg_to_regnum (int regno)
+{
+  if (regno == E_CCR_REGNUM)
+    return E_PSEUDO_CCR_REGNUM;
+  return regno;
+}
+
+static int
+h8300s_dbg_reg_to_regnum (int regno)
+{
+  if (regno == E_CCR_REGNUM)
+    return E_PSEUDO_CCR_REGNUM;
+  if (regno == E_EXR_REGNUM)
+    return E_PSEUDO_EXR_REGNUM;
+  return regno;
+}
+
 static CORE_ADDR
 h8300_extract_struct_value_address (struct regcache *regcache)
 {
@@ -1108,11 +1185,17 @@
       h8300smode = 0;
       h8300hmode = 0;
       set_gdbarch_num_regs (gdbarch, 13);
+      set_gdbarch_num_pseudo_regs (gdbarch, 1);
+      set_gdbarch_ecoff_reg_to_regnum (gdbarch, h8300_dbg_reg_to_regnum);
+      set_gdbarch_dwarf_reg_to_regnum (gdbarch, h8300_dbg_reg_to_regnum);
+      set_gdbarch_dwarf2_reg_to_regnum (gdbarch, h8300_dbg_reg_to_regnum);
+      set_gdbarch_stab_reg_to_regnum (gdbarch, h8300_dbg_reg_to_regnum);
       set_gdbarch_register_name (gdbarch, h8300_register_name);
       set_gdbarch_ptr_bit (gdbarch, 2 * TARGET_CHAR_BIT);
       set_gdbarch_addr_bit (gdbarch, 2 * TARGET_CHAR_BIT);
       set_gdbarch_extract_return_value (gdbarch, h8300_extract_return_value);
       set_gdbarch_store_return_value (gdbarch, h8300_store_return_value);
+      set_gdbarch_print_insn (gdbarch, print_insn_h8300);
       break;
     case bfd_mach_h8300h:
     case bfd_mach_h8300hn:
@@ -1120,23 +1203,35 @@
       h8300smode = 0;
       h8300hmode = 1;
       set_gdbarch_num_regs (gdbarch, 13);
+      set_gdbarch_num_pseudo_regs (gdbarch, 1);
+      set_gdbarch_ecoff_reg_to_regnum (gdbarch, h8300_dbg_reg_to_regnum);
+      set_gdbarch_dwarf_reg_to_regnum (gdbarch, h8300_dbg_reg_to_regnum);
+      set_gdbarch_dwarf2_reg_to_regnum (gdbarch, h8300_dbg_reg_to_regnum);
+      set_gdbarch_stab_reg_to_regnum (gdbarch, h8300_dbg_reg_to_regnum);
       set_gdbarch_register_name (gdbarch, h8300_register_name);
       set_gdbarch_ptr_bit (gdbarch, 4 * TARGET_CHAR_BIT);
       set_gdbarch_addr_bit (gdbarch, 4 * TARGET_CHAR_BIT);
       set_gdbarch_extract_return_value (gdbarch, h8300h_extract_return_value);
       set_gdbarch_store_return_value (gdbarch, h8300h_store_return_value);
+      set_gdbarch_print_insn (gdbarch, print_insn_h8300h);
       break;
     case bfd_mach_h8300s:
     case bfd_mach_h8300sn:
       h8300sxmode = 0;
       h8300smode = 1;
       h8300hmode = 1;
-      set_gdbarch_num_regs (gdbarch, 14);
+      set_gdbarch_num_regs (gdbarch, 16);
+      set_gdbarch_num_pseudo_regs (gdbarch, 2);
+      set_gdbarch_ecoff_reg_to_regnum (gdbarch, h8300s_dbg_reg_to_regnum);
+      set_gdbarch_dwarf_reg_to_regnum (gdbarch, h8300s_dbg_reg_to_regnum);
+      set_gdbarch_dwarf2_reg_to_regnum (gdbarch, h8300s_dbg_reg_to_regnum);
+      set_gdbarch_stab_reg_to_regnum (gdbarch, h8300s_dbg_reg_to_regnum);
       set_gdbarch_register_name (gdbarch, h8300s_register_name);
       set_gdbarch_ptr_bit (gdbarch, 4 * TARGET_CHAR_BIT);
       set_gdbarch_addr_bit (gdbarch, 4 * TARGET_CHAR_BIT);
       set_gdbarch_extract_return_value (gdbarch, h8300h_extract_return_value);
       set_gdbarch_store_return_value (gdbarch, h8300h_store_return_value);
+      set_gdbarch_print_insn (gdbarch, print_insn_h8300s);
       break;
     case bfd_mach_h8300sx:
     case bfd_mach_h8300sxn:
@@ -1144,14 +1239,23 @@
       h8300smode = 1;
       h8300hmode = 1;
       set_gdbarch_num_regs (gdbarch, 18);
+      set_gdbarch_num_pseudo_regs (gdbarch, 2);
+      set_gdbarch_ecoff_reg_to_regnum (gdbarch, h8300s_dbg_reg_to_regnum);
+      set_gdbarch_dwarf_reg_to_regnum (gdbarch, h8300s_dbg_reg_to_regnum);
+      set_gdbarch_dwarf2_reg_to_regnum (gdbarch, h8300s_dbg_reg_to_regnum);
+      set_gdbarch_stab_reg_to_regnum (gdbarch, h8300s_dbg_reg_to_regnum);
       set_gdbarch_register_name (gdbarch, h8300sx_register_name);
       set_gdbarch_ptr_bit (gdbarch, 4 * TARGET_CHAR_BIT);
       set_gdbarch_addr_bit (gdbarch, 4 * TARGET_CHAR_BIT);
       set_gdbarch_extract_return_value (gdbarch, h8300h_extract_return_value);
       set_gdbarch_store_return_value (gdbarch, h8300h_store_return_value);
+      set_gdbarch_print_insn (gdbarch, print_insn_h8300s);
       break;
     }
 
+  set_gdbarch_pseudo_register_read (gdbarch, h8300_pseudo_register_read);
+  set_gdbarch_pseudo_register_write (gdbarch, h8300_pseudo_register_write);
+
   /* NOTE: cagney/2002-12-06: This can be deleted when this arch is
      ready to unwind the PC first (see frame.c:get_prev_frame()).  */
   set_gdbarch_deprecated_init_frame_pc (gdbarch, init_frame_pc_default);
@@ -1160,7 +1264,6 @@
    * Basic register fields and methods.
    */
 
-  set_gdbarch_num_pseudo_regs (gdbarch, 0);
   set_gdbarch_sp_regnum (gdbarch, E_SP_REGNUM);
   set_gdbarch_deprecated_fp_regnum (gdbarch, E_FP_REGNUM);
   set_gdbarch_pc_regnum (gdbarch, E_PC_REGNUM);
@@ -1181,6 +1284,7 @@
   set_gdbarch_deprecated_saved_pc_after_call (gdbarch, 
 					      h8300_saved_pc_after_call);
   set_gdbarch_deprecated_frame_saved_pc (gdbarch, h8300_frame_saved_pc);
+  set_gdbarch_deprecated_pop_frame (gdbarch, h8300_pop_frame);
 
   /* 
    * Miscelany
@@ -1202,6 +1306,7 @@
   set_gdbarch_use_struct_convention (gdbarch, always_use_struct_convention);
   set_gdbarch_breakpoint_from_pc (gdbarch, h8300_breakpoint_from_pc);
   set_gdbarch_push_dummy_code (gdbarch, h8300_push_dummy_code);
+  set_gdbarch_push_dummy_call (gdbarch, h8300_push_dummy_call);
 
   set_gdbarch_int_bit (gdbarch, 2 * TARGET_CHAR_BIT);
   set_gdbarch_long_bit (gdbarch, 4 * TARGET_CHAR_BIT);
@@ -1212,18 +1317,6 @@
   /* set_gdbarch_stack_align (gdbarch, SOME_stack_align); */
   set_gdbarch_believe_pcc_promotion (gdbarch, 1);
 
-  /*
-   * Call Dummies
-   * 
-   * These values and methods are used when gdb calls a target function.  */
-  /* Can all be replaced by push_dummy_call */
-  set_gdbarch_deprecated_push_return_address (gdbarch, 
-					      h8300_push_return_address);
-  set_gdbarch_deprecated_push_arguments (gdbarch, h8300_push_arguments);
-  set_gdbarch_deprecated_pop_frame (gdbarch, h8300_pop_frame);
-  set_gdbarch_deprecated_dummy_write_sp (gdbarch, deprecated_write_sp);
-
-
   return gdbarch;
 }
 
@@ -1232,6 +1325,5 @@
 void
 _initialize_h8300_tdep (void)
 {
-  deprecated_tm_print_insn = gdb_print_insn_h8300;
   register_gdbarch_init (bfd_arch_h8300, h8300_gdbarch_init);
 }
diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
index 7c8e762..37aa44b 100644
--- a/gdb/hppa-tdep.c
+++ b/gdb/hppa-tdep.c
@@ -129,9 +129,6 @@
 
 static int hppa_alignof (struct type *);
 
-/* To support multi-threading and stepping. */
-int hppa_prepare_to_proceed ();
-
 static int prologue_inst_adjust_sp (unsigned long);
 
 static int is_branch (unsigned long);
diff --git a/gdb/hppah-nat.c b/gdb/hppah-nat.c
index 0b8b04f..380a901 100644
--- a/gdb/hppah-nat.c
+++ b/gdb/hppah-nat.c
@@ -930,16 +930,6 @@
   return child_pid_to_str (id);
 }
 
-/* This function has no meaning in a non-threaded world.  Thus, we
-   return 0 (FALSE).  See the use of "hppa_prepare_to_proceed" in
-   hppa-tdep.c. */
-
-pid_t
-hppa_switched_threads (pid_t pid)
-{
-  return (pid_t) 0;
-}
-
 void
 hppa_ensure_vforking_parent_remains_stopped (int pid)
 {
diff --git a/gdb/i386-nto-tdep.c b/gdb/i386-nto-tdep.c
index 381119f..f9a2887 100644
--- a/gdb/i386-nto-tdep.c
+++ b/gdb/i386-nto-tdep.c
@@ -240,6 +240,7 @@
 i386nto_sigcontext_addr (struct frame_info *next_frame)
 {
   char buf[4];
+  CORE_ADDR sp;
 
   frame_unwind_register (next_frame, SP_REGNUM, buf);
   sp = extract_unsigned_integer (buf, 4);
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index 467f686..3b98180 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -1324,65 +1324,143 @@
   else
     regcache_raw_write (regcache, regnum, buf);
 }
+
 
-/* Return true iff register REGNUM's virtual format is different from
-   its raw format.  Note that this definition assumes that the host
-   supports IEEE 32-bit floats, since it doesn't say that SSE
-   registers need conversion.  Even if we can't find a counterexample,
-   this is still sloppy.  */
+/* These registers don't have pervasive standard uses.  Move them to
+   i386-tdep.h if necessary.  */
+
+#define I386_EBX_REGNUM		3 /* %ebx */
+#define I386_ECX_REGNUM		1 /* %ecx */
+#define I386_ESI_REGNUM		6 /* %esi */
+#define I386_EDI_REGNUM		7 /* %edi */
+
+/* Return the register number of the register allocated by GCC after
+   REGNUM, or -1 if there is no such register.  */
 
 static int
-i386_register_convertible (int regnum)
+i386_next_regnum (int regnum)
 {
+  /* GCC allocates the registers in the order:
+
+     %eax, %edx, %ecx, %ebx, %esi, %edi, %ebp, %esp, ...
+
+     Since storing a variable in %esp doesn't make any sense we return
+     -1 for %ebp and for %esp itself.  */
+  static int next_regnum[] =
+  {
+    I386_EDX_REGNUM,		/* Slot for %eax.  */
+    I386_EBX_REGNUM,		/* Slot for %ecx.  */
+    I386_ECX_REGNUM,		/* Slot for %edx.  */
+    I386_ESI_REGNUM,		/* Slot for %ebx.  */
+    -1, -1,			/* Slots for %esp and %ebp.  */
+    I386_EDI_REGNUM,		/* Slot for %esi.  */
+    I386_EBP_REGNUM		/* Slot for %edi.  */
+  };
+
+  if (regnum >= 0 && regnum < sizeof (next_regnum) / sizeof (next_regnum[0]))
+    return next_regnum[regnum];
+
+  return -1;
+}
+
+/* Return nonzero if a value of type TYPE stored in register REGNUM
+   needs any special handling.  */
+
+static int
+i386_convert_register_p (int regnum, struct type *type)
+{
+  int len = TYPE_LENGTH (type);
+
+  /* Values may be spread across multiple registers.  Most debugging
+     formats aren't expressive enough to specify the locations, so
+     some heuristics is involved.  Right now we only handle types that
+     have a length that is a multiple of the word size, since GCC
+     doesn't seem to put any other types into registers.  */
+  if (len > 4 && len % 4 == 0)
+    {
+      int last_regnum = regnum;
+
+      while (len > 4)
+	{
+	  last_regnum = i386_next_regnum (last_regnum);
+	  len -= 4;
+	}
+
+      if (last_regnum != -1)
+	return 1;
+    }
+
   return i386_fp_regnum_p (regnum);
 }
 
-/* Convert data from raw format for register REGNUM in buffer FROM to
-   virtual format with type TYPE in buffer TO.  */
+/* Read a value of type TYPE from register REGNUM in frame FRAME, and
+   return its contents in TO.  */
 
 static void
-i386_register_convert_to_virtual (int regnum, struct type *type,
-				  char *from, char *to)
+i386_register_to_value (struct frame_info *frame, int regnum,
+			struct type *type, void *to)
 {
-  gdb_assert (i386_fp_regnum_p (regnum));
+  int len = TYPE_LENGTH (type);
+  char *buf = to;
 
-  /* We only support floating-point values.  */
-  if (TYPE_CODE (type) != TYPE_CODE_FLT)
+  /* FIXME: kettenis/20030609: What should we do if REGNUM isn't
+     available in FRAME (i.e. if it wasn't saved)?  */
+
+  if (i386_fp_regnum_p (regnum))
     {
-      warning ("Cannot convert floating-point register value "
-	       "to non-floating-point type.");
-      memset (to, 0, TYPE_LENGTH (type));
+      i387_register_to_value (frame, regnum, type, to);
       return;
     }
 
-  /* Convert to TYPE.  This should be a no-op if TYPE is equivalent to
-     the extended floating-point format used by the FPU.  */
-  convert_typed_floating (from, builtin_type_i387_ext, to, type);
+  /* Read a value spread accross multiple registers.  */
+
+  gdb_assert (len > 4 && len % 4 == 0);
+
+  while (len > 0)
+    {
+      gdb_assert (regnum != -1);
+      gdb_assert (register_size (current_gdbarch, regnum) == 4);
+
+      frame_read_register (frame, regnum, buf);
+      regnum = i386_next_regnum (regnum);
+      len -= 4;
+      buf += 4;
+    }
 }
 
-/* Convert data from virtual format with type TYPE in buffer FROM to
-   raw format for register REGNUM in buffer TO.  */
+/* Write the contents FROM of a value of type TYPE into register
+   REGNUM in frame FRAME.  */
 
 static void
-i386_register_convert_to_raw (struct type *type, int regnum,
-			      const char *from, char *to)
+i386_value_to_register (struct frame_info *frame, int regnum,
+			struct type *type, const void *from)
 {
-  gdb_assert (i386_fp_regnum_p (regnum));
+  int len = TYPE_LENGTH (type);
+  const char *buf = from;
 
-  /* We only support floating-point values.  */
-  if (TYPE_CODE (type) != TYPE_CODE_FLT)
+  if (i386_fp_regnum_p (regnum))
     {
-      warning ("Cannot convert non-floating-point type "
-	       "to floating-point register value.");
-      memset (to, 0, TYPE_LENGTH (type));
+      i387_value_to_register (frame, regnum, type, from);
       return;
     }
 
-  /* Convert from TYPE.  This should be a no-op if TYPE is equivalent
-     to the extended floating-point format used by the FPU.  */
-  convert_typed_floating (from, type, to, builtin_type_i387_ext);
+  /* Write a value spread accross multiple registers.  */
+
+  gdb_assert (len > 4 && len % 4 == 0);
+
+  while (len > 0)
+    {
+      gdb_assert (regnum != -1);
+      gdb_assert (register_size (current_gdbarch, regnum) == 4);
+
+      put_frame_register (frame, regnum, buf);
+      regnum = i386_next_regnum (regnum);
+      len -= 4;
+      buf += 4;
+    }
 }
-     
+
+
 
 #ifdef STATIC_TRANSFORM_NAME
 /* SunPRO encodes the static variables.  This is not related to C++
@@ -1612,7 +1690,7 @@
 
 
 /* Get the ith function argument for the current function.  */
-CORE_ADDR
+static CORE_ADDR
 i386_fetch_pointer_argument (struct frame_info *frame, int argi, 
 			     struct type *type)
 {
@@ -1692,9 +1770,9 @@
   /* Call dummy code.  */
   set_gdbarch_push_dummy_call (gdbarch, i386_push_dummy_call);
 
-  set_gdbarch_deprecated_register_convertible (gdbarch, i386_register_convertible);
-  set_gdbarch_deprecated_register_convert_to_virtual (gdbarch, i386_register_convert_to_virtual);
-  set_gdbarch_deprecated_register_convert_to_raw (gdbarch, i386_register_convert_to_raw);
+  set_gdbarch_convert_register_p (gdbarch, i386_convert_register_p);
+  set_gdbarch_register_to_value (gdbarch,  i386_register_to_value);
+  set_gdbarch_value_to_register (gdbarch, i386_value_to_register);
 
   set_gdbarch_extract_return_value (gdbarch, i386_extract_return_value);
   set_gdbarch_store_return_value (gdbarch, i386_store_return_value);
diff --git a/gdb/i387-tdep.c b/gdb/i387-tdep.c
index c6a2d5d..f7800af 100644
--- a/gdb/i387-tdep.c
+++ b/gdb/i387-tdep.c
@@ -21,128 +21,26 @@
    Boston, MA 02111-1307, USA.  */
 
 #include "defs.h"
+#include "doublest.h"
+#include "floatformat.h"
 #include "frame.h"
+#include "gdbcore.h"
 #include "inferior.h"
 #include "language.h"
-#include "value.h"
-#include "gdbcore.h"
-#include "floatformat.h"
 #include "regcache.h"
+#include "value.h"
+
 #include "gdb_assert.h"
 #include "gdb_string.h"
-#include "doublest.h"
 
 #include "i386-tdep.h"
+#include "i387-tdep.h"
 
-
-/* FIXME: The functions on this page are used by the old `info float'
-   implementations that a few of the i386 targets provide.  These
-   functions should be removed if all of these have been converted to
-   use the generic implementation based on the new register file
-   layout.  */
-
-static void print_387_control_bits (unsigned int control);
-static void print_387_status_bits (unsigned int status);
-
-static void
-print_387_control_bits (unsigned int control)
-{
-  switch ((control >> 8) & 3)
-    {
-    case 0:
-      puts_unfiltered (" 24 bit; ");
-      break;
-    case 1:
-      puts_unfiltered (" (bad); ");
-      break;
-    case 2:
-      puts_unfiltered (" 53 bit; ");
-      break;
-    case 3:
-      puts_unfiltered (" 64 bit; ");
-      break;
-    }
-  switch ((control >> 10) & 3)
-    {
-    case 0:
-      puts_unfiltered ("NEAR; ");
-      break;
-    case 1:
-      puts_unfiltered ("DOWN; ");
-      break;
-    case 2:
-      puts_unfiltered ("UP; ");
-      break;
-    case 3:
-      puts_unfiltered ("CHOP; ");
-      break;
-    }
-  if (control & 0x3f)
-    {
-      puts_unfiltered ("mask");
-      if (control & 0x0001)
-	puts_unfiltered (" INVAL");
-      if (control & 0x0002)
-	puts_unfiltered (" DENOR");
-      if (control & 0x0004)
-	puts_unfiltered (" DIVZ");
-      if (control & 0x0008)
-	puts_unfiltered (" OVERF");
-      if (control & 0x0010)
-	puts_unfiltered (" UNDER");
-      if (control & 0x0020)
-	puts_unfiltered (" LOS");
-      puts_unfiltered (";");
-    }
-
-  if (control & 0xe080)
-    warning ("\nreserved bits on: %s",
-	     local_hex_string (control & 0xe080));
-}
-
-void
-print_387_control_word (unsigned int control)
-{
-  printf_filtered ("control %s:", local_hex_string(control & 0xffff));
-  print_387_control_bits (control);
-  puts_unfiltered ("\n");
-}
-
-static void
-print_387_status_bits (unsigned int status)
-{
-  printf_unfiltered (" flags %d%d%d%d; ",
-		     (status & 0x4000) != 0,
-		     (status & 0x0400) != 0,
-		     (status & 0x0200) != 0,
-		     (status & 0x0100) != 0);
-  printf_unfiltered ("top %d; ", (status >> 11) & 7);
-  if (status & 0xff) 
-    {
-      puts_unfiltered ("excep");
-      if (status & 0x0001) puts_unfiltered (" INVAL");
-      if (status & 0x0002) puts_unfiltered (" DENOR");
-      if (status & 0x0004) puts_unfiltered (" DIVZ");
-      if (status & 0x0008) puts_unfiltered (" OVERF");
-      if (status & 0x0010) puts_unfiltered (" UNDER");
-      if (status & 0x0020) puts_unfiltered (" LOS");
-      if (status & 0x0040) puts_unfiltered (" STACK");
-    }
-}
-
-void
-print_387_status_word (unsigned int status)
-{
-  printf_filtered ("status %s:", local_hex_string (status & 0xffff));
-  print_387_status_bits (status);
-  puts_unfiltered ("\n");
-}
-
-
 /* Implement the `info float' layout based on the register definitions
    in `tm-i386.h'.  */
 
 /* Print the floating point number specified by RAW.  */
+
 static void
 print_i387_value (char *raw, struct ui_file *file)
 {
@@ -166,6 +64,7 @@
 }
 
 /* Print the classification for the register contents RAW.  */
+
 static void
 print_i387_ext (unsigned char *raw, struct ui_file *file)
 {
@@ -217,6 +116,7 @@
 }
 
 /* Print the status word STATUS.  */
+
 static void
 print_i387_status_word (unsigned int status, struct ui_file *file)
 {
@@ -246,6 +146,7 @@
 }
 
 /* Print the control word CONTROL.  */
+
 static void
 print_i387_control_word (unsigned int control, struct ui_file *file)
 {
@@ -386,12 +287,60 @@
   fprintf_filtered (file, "Opcode:              %s\n",
 		    local_hex_string_custom (fop ? (fop | 0xd800) : 0, "04"));
 }
+
 
-/* FIXME: kettenis/2000-05-21: Right now more than a few i386 targets
-   define their own routines to manage the floating-point registers in
-   GDB's register array.  Most (if not all) of these targets use the
-   format used by the "fsave" instruction in their communication with
-   the OS.  They should all be converted to use the routines below.  */
+/* Read a value of type TYPE from register REGNUM in frame FRAME, and
+   return its contents in TO.  */
+
+void
+i387_register_to_value (struct frame_info *frame, int regnum,
+			struct type *type, void *to)
+{
+  char from[I386_MAX_REGISTER_SIZE];
+
+  gdb_assert (i386_fp_regnum_p (regnum));
+
+  /* We only support floating-point values.  */
+  if (TYPE_CODE (type) != TYPE_CODE_FLT)
+    {
+      warning ("Cannot convert floating-point register value "
+	       "to non-floating-point type.");
+      return;
+    }
+
+  /* Convert to TYPE.  This should be a no-op if TYPE is equivalent to
+     the extended floating-point format used by the FPU.  */
+  frame_read_register (frame, regnum, from);
+  convert_typed_floating (from, builtin_type_i387_ext, to, type);
+}
+
+/* Write the contents FROM of a value of type TYPE into register
+   REGNUM in frame FRAME.  */
+
+void
+i387_value_to_register (struct frame_info *frame, int regnum,
+			struct type *type, const void *from)
+{
+  char to[I386_MAX_REGISTER_SIZE];
+
+  gdb_assert (i386_fp_regnum_p (regnum));
+
+  /* We only support floating-point values.  */
+  if (TYPE_CODE (type) != TYPE_CODE_FLT)
+    {
+      warning ("Cannot convert non-floating-point type "
+	       "to floating-point register value.");
+      return;
+    }
+
+  /* Convert from TYPE.  This should be a no-op if TYPE is equivalent
+     to the extended floating-point format used by the FPU.  */
+  convert_typed_floating (from, type, to, builtin_type_i387_ext);
+  put_frame_register (frame, regnum, to);
+}
+
+
+/* Handle FSAVE and FXSAVE formats.  */
 
 /* At fsave_offset[REGNUM] you'll find the offset to the location in
    the data structure used by the "fsave" instruction where GDB
diff --git a/gdb/i387-tdep.h b/gdb/i387-tdep.h
index 7079310..df5c77b 100644
--- a/gdb/i387-tdep.h
+++ b/gdb/i387-tdep.h
@@ -24,6 +24,7 @@
 struct gdbarch;
 struct ui_file;
 struct frame_info;
+struct type;
 
 /* Print out the i387 floating point state.  */
 
@@ -32,6 +33,18 @@
 				   struct frame_info *frame,
 				   const char *args);
 
+/* Read a value of type TYPE from register REGNUM in frame FRAME, and
+   return its contents in TO.  */
+
+extern void i387_register_to_value (struct frame_info *frame, int regnum,
+				    struct type *type, void *to);
+
+/* Write the contents FROM of a value of type TYPE into register
+   REGNUM in frame FRAME.  */
+
+extern void i387_value_to_register (struct frame_info *frame, int regnum,
+				    struct type *type, const void *from);
+
 /* Fill register REGNUM in GDB's register array with the appropriate
    value from *FSAVE.  This function masks off any of the reserved
    bits in *FSAVE.  */
diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c
index b3290da..63ebbeb 100644
--- a/gdb/ia64-tdep.c
+++ b/gdb/ia64-tdep.c
@@ -235,13 +235,13 @@
   return ia64_register_names[reg];
 }
 
-int
+static int
 ia64_register_raw_size (int reg)
 {
   return (IA64_FR0_REGNUM <= reg && reg <= IA64_FR127_REGNUM) ? 16 : 8;
 }
 
-int
+static int
 ia64_register_virtual_size (int reg)
 {
   return (IA64_FR0_REGNUM <= reg && reg <= IA64_FR127_REGNUM) ? 16 : 8;
@@ -297,7 +297,7 @@
     return builtin_type_long;
 }
 
-int
+static int
 ia64_register_byte (int reg)
 {
   return (8 * reg) +
@@ -2002,14 +2002,15 @@
   /* Sync gdb's idea of what the registers are with the target. */
   target_store_registers (-1);
 
-  /* FIXME: This doesn't belong here!  Instead, SAVE_DUMMY_FRAME_TOS needs
-     to be defined to call generic_save_dummy_frame_tos().  But at the
-     time of this writing, SAVE_DUMMY_FRAME_TOS wasn't gdbarch'd, so
-     I chose to put this call here instead of using the old mechanisms. 
-     Once SAVE_DUMMY_FRAME_TOS is gdbarch'd, all we need to do is add the
-     line
+  /* FIXME: This doesn't belong here!  Instead,
+     DEPRECATED_SAVE_DUMMY_FRAME_TOS needs to be defined to call
+     generic_save_dummy_frame_tos().  But at the time of this writing,
+     DEPRECATED_SAVE_DUMMY_FRAME_TOS wasn't gdbarch'd, so I chose to
+     put this call here instead of using the old mechanisms.  Once
+     DEPRECATED_SAVE_DUMMY_FRAME_TOS is gdbarch'd, all we need to do
+     is add the line
 
-	set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos);
+	set_gdbarch_deprecated_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos);
 
      to ia64_gdbarch_init() and remove the line below. */
   generic_save_dummy_frame_tos (sp);
diff --git a/gdb/infcall.c b/gdb/infcall.c
index 0a10c31..123fba0 100644
--- a/gdb/infcall.c
+++ b/gdb/infcall.c
@@ -423,11 +423,11 @@
       A follow-on change is to modify this interface so that it takes
       thread OR frame OR tpid as a parameter, and returns a dummy
       frame handle.  The handle can then be used further down as a
-      parameter SAVE_DUMMY_FRAME_TOS.  Hmm, thinking about it, since
-      everything is ment to be using generic dummy frames, why not
-      even use some of the dummy frame code to here - do a regcache
-      dup and then pass the duped regcache, along with all the other
-      stuff, at one single point.
+      parameter to generic_save_dummy_frame_tos().  Hmm, thinking
+      about it, since everything is ment to be using generic dummy
+      frames, why not even use some of the dummy frame code to here -
+      do a regcache dup and then pass the duped regcache, along with
+      all the other stuff, at one single point.
 
       In fact, you can even save the structure's return address in the
       dummy frame and fix one of those nasty lost struct return edge
@@ -474,15 +474,14 @@
 		    || (INNER_THAN (2, 1) && sp >= old_sp));
       }
     else
-      /* FIXME: cagney/2002-09-18: Hey, you loose!  Who knows how
-	 badly aligned the SP is!  Further, per comment above, if the
-	 generic dummy frame ends up empty (because nothing is pushed)
-	 GDB won't be able to correctly perform back traces.  If a
-	 target is having trouble with backtraces, first thing to do
-	 is add FRAME_ALIGN() to its architecture vector.  After that,
-	 try adding SAVE_DUMMY_FRAME_TOS() and modifying
-	 DEPRECATED_FRAME_CHAIN so that when the next outer frame is a
-	 generic dummy, it returns the current frame's base.  */
+      /* FIXME: cagney/2002-09-18: Hey, you loose!
+
+	 Who knows how badly aligned the SP is!  Further, per comment
+	 above, if the generic dummy frame ends up empty (because
+	 nothing is pushed) GDB won't be able to correctly perform
+	 back traces.  If a target is having trouble with backtraces,
+	 first thing to do is add FRAME_ALIGN() to the architecture
+	 vector. If that fails, try unwind_dummy_id().  */
       sp = old_sp;
   }
 
@@ -831,8 +830,8 @@
       gdb_assert (DEPRECATED_USE_GENERIC_DUMMY_FRAMES);
       generic_save_dummy_frame_tos (sp);
     }
-  else if (SAVE_DUMMY_FRAME_TOS_P ())
-    SAVE_DUMMY_FRAME_TOS (sp);
+  else if (DEPRECATED_SAVE_DUMMY_FRAME_TOS_P ())
+    DEPRECATED_SAVE_DUMMY_FRAME_TOS (sp);
 
   /* Now proceed, having reached the desired place.  */
   clear_proceed_status ();
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 0ed0ce2..911e865 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -81,6 +81,8 @@
 
 static void detach_command (char *, int);
 
+static void disconnect_command (char *, int);
+
 static void unset_environment_command (char *, int);
 
 static void set_environment_command (char *, int);
@@ -1876,6 +1878,26 @@
     detach_hook ();
 }
 
+/* Disconnect from the current target without resuming it (leaving it
+   waiting for a debugger).
+
+   We'd better not have left any breakpoints in the program or the
+   next debugger will get confused.  Currently only supported for some
+   remote targets, since the normal attach mechanisms don't work on
+   stopped processes on some native platforms (e.g. GNU/Linux).  */
+
+static void
+disconnect_command (char *args, int from_tty)
+{
+  dont_repeat ();		/* Not for the faint of heart */
+  target_disconnect (args, from_tty);
+#if defined(SOLIB_RESTART)
+  SOLIB_RESTART ();
+#endif
+  if (detach_hook)
+    detach_hook ();
+}
+
 /* Stop the execution of the target while running in async mode, in
    the backgound. */
 void
@@ -2014,6 +2036,11 @@
 If a process, it is no longer traced, and it continues its execution.  If\n\
 you were debugging a file, the file is closed and gdb no longer accesses it.");
 
+  add_com ("disconnect", class_run, disconnect_command,
+	   "Disconnect from a target.\n\
+The target will wait for another debugger to connect.  Not available for\n\
+all targets.");
+
   add_com ("signal", class_run, signal_command,
 	   "Continue program giving it signal specified by the argument.\n\
 An argument of \"0\" means continue program without giving it a signal.");
diff --git a/gdb/infrun.c b/gdb/infrun.c
index df17968..b2e371e 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -79,6 +79,8 @@
 
 static void xdb_handle_command (char *args, int from_tty);
 
+static int prepare_to_proceed (void);
+
 void _initialize_infrun (void);
 
 int inferior_ignoring_startup_exec_events = 0;
@@ -667,6 +669,55 @@
   bpstat_clear (&stop_bpstat);
 }
 
+/* This should be suitable for any targets that support threads. */
+
+static int
+prepare_to_proceed (void)
+{
+  ptid_t wait_ptid;
+  struct target_waitstatus wait_status;
+
+  /* Get the last target status returned by target_wait().  */
+  get_last_target_status (&wait_ptid, &wait_status);
+
+  /* Make sure we were stopped either at a breakpoint, or because
+     of a Ctrl-C.  */
+  if (wait_status.kind != TARGET_WAITKIND_STOPPED
+      || (wait_status.value.sig != TARGET_SIGNAL_TRAP &&
+          wait_status.value.sig != TARGET_SIGNAL_INT))
+    {
+      return 0;
+    }
+
+  if (!ptid_equal (wait_ptid, minus_one_ptid)
+      && !ptid_equal (inferior_ptid, wait_ptid))
+    {
+      /* Switched over from WAIT_PID.  */
+      CORE_ADDR wait_pc = read_pc_pid (wait_ptid);
+
+      if (wait_pc != read_pc ())
+	{
+	  /* Switch back to WAIT_PID thread.  */
+	  inferior_ptid = wait_ptid;
+
+	  /* FIXME: This stuff came from switch_to_thread() in
+	     thread.c (which should probably be a public function).  */
+	  flush_cached_frames ();
+	  registers_changed ();
+	  stop_pc = wait_pc;
+	  select_frame (get_current_frame ());
+	}
+
+	/* We return 1 to indicate that there is a breakpoint here,
+	   so we need to step over it before continuing to avoid
+	   hitting it straight away. */
+	if (breakpoint_here_p (wait_pc))
+	   return 1;
+    }
+
+  return 0;
+  
+}
 
 /* Record the pc of the program the last time it stopped.  This is
    just used internally by wait_for_inferior, but need to be preserved
@@ -722,7 +773,6 @@
       write_pc (addr);
     }
 
-#ifdef PREPARE_TO_PROCEED
   /* In a multi-threaded task we may select another thread
      and then continue or step.
 
@@ -731,15 +781,11 @@
      any execution (i.e. it will report a breakpoint hit
      incorrectly).  So we must step over it first.
 
-     PREPARE_TO_PROCEED checks the current thread against the thread
+     prepare_to_proceed checks the current thread against the thread
      that reported the most recent event.  If a step-over is required
      it returns TRUE and sets the current thread to the old thread. */
-  if (PREPARE_TO_PROCEED (1) && breakpoint_here_p (read_pc ()))
-    {
-      oneproc = 1;
-    }
-
-#endif /* PREPARE_TO_PROCEED */
+  if (prepare_to_proceed () && breakpoint_here_p (read_pc ()))
+    oneproc = 1;
 
 #ifdef HP_OS_BUG
   if (trap_expected_after_continue)
diff --git a/gdb/infttrace.c b/gdb/infttrace.c
index f86ab02..e0238e8 100644
--- a/gdb/infttrace.c
+++ b/gdb/infttrace.c
@@ -142,12 +142,6 @@
 static int vforking_child_pid = 0;
 static int vfork_in_flight = 0;
 
-/* To support PREPARE_TO_PROCEED (hppa_prepare_to_proceed).
- */
-static pid_t old_gdb_pid = 0;
-static pid_t reported_pid = 0;
-static int reported_bpt = 0;
-
 /* 1 if ok as results of a ttrace or ttrace_wait call, 0 otherwise.
  */
 #define TT_OK( _status, _errno ) \
@@ -2912,12 +2906,6 @@
    */
   return_pid = map_to_gdb_tid (real_tid);
 
-  /* Remember this for later use in "hppa_prepare_to_proceed".
-   */
-  old_gdb_pid = PIDGET (inferior_ptid);
-  reported_pid = return_pid;
-  reported_bpt = ((tsp.tts_event & TTEVT_SIGNAL) && (5 == tsp.tts_u.tts_signal.tts_signo));
-
   if (real_tid == 0 || return_pid == 0)
     {
       warning ("Internal error: process-wait failed.");
@@ -5536,64 +5524,6 @@
 }
 
 
-/* If the current pid is not the pid this module reported
- * from "ptrace_wait" with the most recent event, then the
- * user has switched threads.
- *
- * If the last reported event was a breakpoint, then return
- * the old thread id, else return 0.
- */
-pid_t
-hppa_switched_threads (pid_t gdb_pid)
-{
-  if (gdb_pid == old_gdb_pid)
-    {
-      /*
-       * Core gdb is working with the same pid that it
-       * was before we reported the last event.  This
-       * is ok: e.g. we reported hitting a thread-specific
-       * breakpoint, but we were reporting the wrong
-       * thread, so the core just ignored the event.
-       *
-       * No thread switch has happened.
-       */
-      return (pid_t) 0;
-    }
-  else if (gdb_pid == reported_pid)
-    {
-      /*
-       * Core gdb is working with the pid we reported, so
-       * any continue or step will be able to figure out
-       * that it needs to step over any hit breakpoints
-       * without our (i.e. PREPARE_TO_PROCEED's) help.
-       */
-      return (pid_t) 0;
-    }
-  else if (!reported_bpt)
-    {
-      /*
-       * The core switched, but we didn't just report a
-       * breakpoint, so there's no just-hit breakpoint
-       * instruction at "reported_pid"'s PC, and thus there
-       * is no need to step over it.
-       */
-      return (pid_t) 0;
-    }
-  else
-    {
-      /* There's been a real switch, and we reported
-       * a hit breakpoint.  Let "hppa_prepare_to_proceed"
-       * know, so it can see whether the breakpoint is
-       * still active.
-       */
-      return reported_pid;
-    }
-
-  /* Keep compiler happy with an obvious return at the end.
-   */
-  return (pid_t) 0;
-}
-
 void
 hppa_ensure_vforking_parent_remains_stopped (int pid)
 {
diff --git a/gdb/lin-lwp.c b/gdb/lin-lwp.c
index 48fd516..a82adb7 100644
--- a/gdb/lin-lwp.c
+++ b/gdb/lin-lwp.c
@@ -40,6 +40,8 @@
 static int debug_lin_lwp;
 extern char *strsignal (int sig);
 
+#include "linux-nat.h"
+
 /* On GNU/Linux there are no real LWP's.  The closest thing to LWP's
    are processes sharing the same VM space.  A multi-threaded process
    is basically a group of such processes.  However, such a grouping
@@ -73,43 +75,6 @@
      threads will run out of processes, even if the threads exit,
      because the "zombies" stay around.  */
 
-/* Structure describing a LWP.  */
-struct lwp_info
-{
-  /* The process id of the LWP.  This is a combination of the LWP id
-     and overall process id.  */
-  ptid_t ptid;
-
-  /* Non-zero if this LWP is cloned.  In this context "cloned" means
-     that the LWP is reporting to its parent using a signal other than
-     SIGCHLD.  */
-  int cloned;
-
-  /* Non-zero if we sent this LWP a SIGSTOP (but the LWP didn't report
-     it back yet).  */
-  int signalled;
-
-  /* Non-zero if this LWP is stopped.  */
-  int stopped;
-
-  /* Non-zero if this LWP will be/has been resumed.  Note that an LWP
-     can be marked both as stopped and resumed at the same time.  This
-     happens if we try to resume an LWP that has a wait status
-     pending.  We shouldn't let the LWP run until that wait status has
-     been processed, but we should not report that wait status if GDB
-     didn't try to let the LWP run.  */
-  int resumed;
-
-  /* If non-zero, a pending wait status.  */
-  int status;
-
-  /* Non-zero if we were stepping this LWP.  */
-  int step;
-
-  /* Next LWP in list.  */
-  struct lwp_info *next;
-};
-
 /* List of known LWPs.  */
 static struct lwp_info *lwp_list;
 
@@ -298,46 +263,6 @@
 }
 
 
-/* Implementation of the PREPARE_TO_PROCEED hook for the GNU/Linux LWP
-   layer.
-
-   Note that this implementation is potentially redundant now that
-   default_prepare_to_proceed() has been added.
-
-   FIXME This may not support switching threads after Ctrl-C
-   correctly. The default implementation does support this. */
-
-int
-lin_lwp_prepare_to_proceed (void)
-{
-  if (!ptid_equal (trap_ptid, null_ptid)
-      && !ptid_equal (inferior_ptid, trap_ptid))
-    {
-      /* Switched over from TRAP_PID.  */
-      CORE_ADDR stop_pc = read_pc ();
-      CORE_ADDR trap_pc;
-
-      /* Avoid switching where it wouldn't do any good, i.e. if both
-         threads are at the same breakpoint.  */
-      trap_pc = read_pc_pid (trap_ptid);
-      if (trap_pc != stop_pc && breakpoint_here_p (trap_pc))
-	{
-	  /* User hasn't deleted the breakpoint.  Return non-zero, and
-	     switch back to TRAP_PID.  */
-	  inferior_ptid = trap_ptid;
-
-	  /* FIXME: Is this stuff really necessary?  */
-	  flush_cached_frames ();
-	  registers_changed ();
-
-	  return 1;
-	}
-    }
-
-  return 0;
-}
-
-
 #if 0
 static void
 lin_lwp_open (char *args, int from_tty)
@@ -1109,6 +1034,23 @@
 	  save_errno = EINTR;
 	}
 
+      /* Check for stop events reported by a process we didn't already
+	 know about - in this case, anything other than inferior_ptid.
+
+	 If we're expecting to receive stopped processes after fork,
+	 vfork, and clone events, then we'll just add the new one to
+	 our list and go back to waiting for the event to be reported
+	 - the stopped process might be returned from waitpid before
+	 or after the event is.  If we want to handle debugging of
+	 CLONE_PTRACE processes we need to do more here, i.e. switch
+	 to multi-threaded mode.  */
+      if (pid != -1 && WIFSTOPPED (status) && WSTOPSIG (status) == SIGSTOP
+	  && pid != GET_PID (inferior_ptid))
+	{
+	  pid = -1;
+	  save_errno = EINTR;
+	}
+
       clear_sigio_trap ();
       clear_sigint_trap ();
     }
@@ -1272,6 +1214,22 @@
 
 	  lp = find_lwp_pid (pid_to_ptid (lwpid));
 
+	  /* Check for stop events reported by a process we didn't
+	     already know about - anything not already in our LWP
+	     list.
+
+	     If we're expecting to receive stopped processes after
+	     fork, vfork, and clone events, then we'll just add the
+	     new one to our list and go back to waiting for the event
+	     to be reported - the stopped process might be returned
+	     from waitpid before or after the event is.  */
+	  if (WIFSTOPPED (status) && !lp)
+	    {
+	      linux_record_stopped_pid (lwpid);
+	      status = 0;
+	      continue;
+	    }
+
 	  /* Make sure we don't report an event for the exit of an LWP not in
 	     our list, i.e.  not part of the current process.  This can happen
 	     if we detach from a program we original forked and then it
@@ -1282,6 +1240,13 @@
 	      continue;
 	    }
 
+	  /* NOTE drow/2003-06-17: This code seems to be meant for debugging
+	     CLONE_PTRACE processes which do not use the thread library -
+	     otherwise we wouldn't find the new LWP this way.  That doesn't
+	     currently work, and the following code is currently unreachable
+	     due to the two blocks above.  If it's fixed some day, this code
+	     should be broken out into a function so that we can also pick up
+	     LWPs from the new interface.  */
 	  if (!lp)
 	    {
 	      lp = add_lwp (BUILD_LWP (lwpid, GET_PID (inferior_ptid)));
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
new file mode 100644
index 0000000..61931c6
--- /dev/null
+++ b/gdb/linux-nat.c
@@ -0,0 +1,219 @@
+/* GNU/Linux native-dependent code common to multiple platforms.
+   Copyright (C) 2003 Free Software Foundation, Inc.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include "defs.h"
+#include "inferior.h"
+#include "target.h"
+
+#include "gdb_wait.h"
+#include <sys/ptrace.h>
+
+#include "linux-nat.h"
+
+/* If the system headers did not provide the constants, hard-code the normal
+   values.  */
+#ifndef PTRACE_EVENT_FORK
+
+#define PTRACE_SETOPTIONS	0x4200
+#define PTRACE_GETEVENTMSG	0x4201
+
+/* options set using PTRACE_SETOPTIONS */
+#define PTRACE_O_TRACESYSGOOD	0x00000001
+#define PTRACE_O_TRACEFORK	0x00000002
+#define PTRACE_O_TRACEVFORK	0x00000004
+#define PTRACE_O_TRACECLONE	0x00000008
+#define PTRACE_O_TRACEEXEC	0x00000010
+
+/* Wait extended result codes for the above trace options.  */
+#define PTRACE_EVENT_FORK	1
+#define PTRACE_EVENT_VFORK	2
+#define PTRACE_EVENT_CLONE	3
+#define PTRACE_EVENT_EXEC	4
+
+#endif /* PTRACE_EVENT_FORK */
+
+/* We can't always assume that this flag is available, but all systems
+   with the ptrace event handlers also have __WALL, so it's safe to use
+   here.  */
+#ifndef __WALL
+#define __WALL          0x40000000 /* Wait for any child.  */
+#endif
+
+struct simple_pid_list
+{
+  int pid;
+  struct simple_pid_list *next;
+};
+struct simple_pid_list *stopped_pids;
+
+/* This variable is a tri-state flag: -1 for unknown, 0 if PTRACE_O_TRACEFORK
+   can not be used, 1 if it can.  */
+
+static int linux_supports_tracefork_flag = -1;
+
+
+/* Trivial list manipulation functions to keep track of a list of
+   new stopped processes.  */
+static void
+add_to_pid_list (struct simple_pid_list **listp, int pid)
+{
+  struct simple_pid_list *new_pid = xmalloc (sizeof (struct simple_pid_list));
+  new_pid->pid = pid;
+  new_pid->next = *listp;
+  *listp = new_pid;
+}
+
+static int
+pull_pid_from_list (struct simple_pid_list **listp, int pid)
+{
+  struct simple_pid_list **p;
+
+  for (p = listp; *p != NULL; p = &(*p)->next)
+    if ((*p)->pid == pid)
+      {
+	struct simple_pid_list *next = (*p)->next;
+	xfree (*p);
+	*p = next;
+	return 1;
+      }
+  return 0;
+}
+
+void
+linux_record_stopped_pid (int pid)
+{
+  add_to_pid_list (&stopped_pids, pid);
+}
+
+
+/* A helper function for linux_test_for_tracefork, called after fork ().  */
+
+static void
+linux_tracefork_child (void)
+{
+  int ret;
+
+  ptrace (PTRACE_TRACEME, 0, 0, 0);
+  kill (getpid (), SIGSTOP);
+  fork ();
+  exit (0);
+}
+
+/* Determine if PTRACE_O_TRACEFORK can be used to follow fork events.  We
+   create a child process, attach to it, use PTRACE_SETOPTIONS to enable
+   fork tracing, and let it fork.  If the process exits, we assume that
+   we can't use TRACEFORK; if we get the fork notification, and we can
+   extract the new child's PID, then we assume that we can.  */
+
+static void
+linux_test_for_tracefork (void)
+{
+  int child_pid, ret, status;
+  long second_pid;
+
+  child_pid = fork ();
+  if (child_pid == -1)
+    perror_with_name ("linux_test_for_tracefork: fork");
+
+  if (child_pid == 0)
+    linux_tracefork_child ();
+
+  ret = waitpid (child_pid, &status, 0);
+  if (ret == -1)
+    perror_with_name ("linux_test_for_tracefork: waitpid");
+  else if (ret != child_pid)
+    error ("linux_test_for_tracefork: waitpid: unexpected result %d.", ret);
+  if (! WIFSTOPPED (status))
+    error ("linux_test_for_tracefork: waitpid: unexpected status %d.", status);
+
+  linux_supports_tracefork_flag = 0;
+
+  ret = ptrace (PTRACE_SETOPTIONS, child_pid, 0, PTRACE_O_TRACEFORK);
+  if (ret != 0)
+    {
+      ptrace (PTRACE_KILL, child_pid, 0, 0);
+      waitpid (child_pid, &status, 0);
+      return;
+    }
+
+  ptrace (PTRACE_CONT, child_pid, 0, 0);
+  ret = waitpid (child_pid, &status, 0);
+  if (ret == child_pid && WIFSTOPPED (status)
+      && status >> 16 == PTRACE_EVENT_FORK)
+    {
+      second_pid = 0;
+      ret = ptrace (PTRACE_GETEVENTMSG, child_pid, 0, &second_pid);
+      if (ret == 0 && second_pid != 0)
+	{
+	  int second_status;
+
+	  linux_supports_tracefork_flag = 1;
+	  waitpid (second_pid, &second_status, 0);
+	  ptrace (PTRACE_DETACH, second_pid, 0, 0);
+	}
+    }
+
+  if (WIFSTOPPED (status))
+    {
+      ptrace (PTRACE_DETACH, child_pid, 0, 0);
+      waitpid (child_pid, &status, 0);
+    }
+}
+
+/* Return non-zero iff we have tracefork functionality available.
+   This function also sets linux_supports_tracefork_flag.  */
+
+static int
+linux_supports_tracefork (void)
+{
+  if (linux_supports_tracefork_flag == -1)
+    linux_test_for_tracefork ();
+  return linux_supports_tracefork_flag;
+}
+
+
+int
+child_insert_fork_catchpoint (int pid)
+{
+  if (linux_supports_tracefork ())
+    error ("Fork catchpoints have not been implemented yet.");
+  else
+    error ("Your system does not support fork catchpoints.");
+}
+
+int
+child_insert_vfork_catchpoint (int pid)
+{
+  if (linux_supports_tracefork ())
+    error ("Vfork catchpoints have not been implemented yet.");
+  else
+    error ("Your system does not support vfork catchpoints.");
+}
+
+int
+child_insert_exec_catchpoint (int pid)
+{
+  if (linux_supports_tracefork ())
+    error ("Exec catchpoints have not been implemented yet.");
+  else
+    error ("Your system does not support exec catchpoints.");
+}
+
+
diff --git a/gdb/linux-nat.h b/gdb/linux-nat.h
new file mode 100644
index 0000000..b0d9600
--- /dev/null
+++ b/gdb/linux-nat.h
@@ -0,0 +1,73 @@
+/* Native debugging support for GNU/Linux (LWP layer).
+   Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+/* Structure describing an LWP.  */
+
+struct lwp_info
+{
+  /* The process id of the LWP.  This is a combination of the LWP id
+     and overall process id.  */
+  ptid_t ptid;
+
+  /* Non-zero if this LWP is cloned.  In this context "cloned" means
+     that the LWP is reporting to its parent using a signal other than
+     SIGCHLD.  */
+  int cloned;
+
+  /* Non-zero if we sent this LWP a SIGSTOP (but the LWP didn't report
+     it back yet).  */
+  int signalled;
+
+  /* Non-zero if this LWP is stopped.  */
+  int stopped;
+
+  /* Non-zero if this LWP will be/has been resumed.  Note that an LWP
+     can be marked both as stopped and resumed at the same time.  This
+     happens if we try to resume an LWP that has a wait status
+     pending.  We shouldn't let the LWP run until that wait status has
+     been processed, but we should not report that wait status if GDB
+     didn't try to let the LWP run.  */
+  int resumed;
+
+  /* If non-zero, a pending wait status.  */
+  int status;
+
+  /* Non-zero if we were stepping this LWP.  */
+  int step;
+
+  /* Next LWP in list.  */
+  struct lwp_info *next;
+};
+
+/* Read/write to target memory via the Linux kernel's "proc file
+   system".  */
+struct mem_attrib;
+struct target_ops;
+
+extern int linux_proc_xfer_memory (CORE_ADDR addr, char *myaddr, int len,
+				   int write, struct mem_attrib *attrib,
+				   struct target_ops *target);
+
+extern void linux_record_stopped_pid (int pid);
+
+/* Iterator function for lin-lwp's lwp list.  */
+struct lwp_info *iterate_over_lwps (int (*callback) (struct lwp_info *, 
+						     void *), 
+				    void *data);
diff --git a/gdb/linux-proc.c b/gdb/linux-proc.c
index a951296..e4ea747 100644
--- a/gdb/linux-proc.c
+++ b/gdb/linux-proc.c
@@ -35,6 +35,8 @@
 #include "cli/cli-decode.h"	/* for add_info */
 #include "gdb_string.h"
 
+#include "linux-nat.h"
+
 #ifndef O_LARGEFILE
 #define O_LARGEFILE 0
 #endif
@@ -171,13 +173,13 @@
 #ifdef FILL_FPXREGSET
   gdb_fpxregset_t fpxregs;
 #endif
-  unsigned long merged_pid = ptid_get_tid (ptid) << 16 | ptid_get_pid (ptid);
+  unsigned long lwp = ptid_get_lwp (ptid);
 
   fill_gregset (&gregs, -1);
   note_data = (char *) elfcore_write_prstatus (obfd,
 					       note_data,
 					       note_size,
-					       merged_pid,
+					       lwp,
 					       stop_signal, &gregs);
 
   fill_fpregset (&fpregs, -1);
@@ -210,7 +212,7 @@
  */
 
 static int
-linux_corefile_thread_callback (struct thread_info *ti, void *data)
+linux_corefile_thread_callback (struct lwp_info *ti, void *data)
 {
   struct linux_corefile_thread_data *args = data;
   ptid_t saved_ptid = inferior_ptid;
@@ -268,7 +270,7 @@
   thread_args.note_data = note_data;
   thread_args.note_size = note_size;
   thread_args.num_notes = 0;
-  iterate_over_threads (linux_corefile_thread_callback, &thread_args);
+  iterate_over_lwps (linux_corefile_thread_callback, &thread_args);
   if (thread_args.num_notes == 0)
     {
       /* iterate_over_threads didn't come up with any threads;
diff --git a/gdb/mcore-tdep.c b/gdb/mcore-tdep.c
index 18d7600..4b860e5 100644
--- a/gdb/mcore-tdep.c
+++ b/gdb/mcore-tdep.c
@@ -1079,7 +1079,7 @@
 
   set_gdbarch_deprecated_call_dummy_words (gdbarch, call_dummy_words);
   set_gdbarch_deprecated_sizeof_call_dummy_words (gdbarch, 0);
-  set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos);
+  set_gdbarch_deprecated_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos);
   set_gdbarch_deprecated_saved_pc_after_call (gdbarch, mcore_saved_pc_after_call);
   set_gdbarch_function_start_offset (gdbarch, 0);
   set_gdbarch_decr_pc_after_break (gdbarch, 0);
diff --git a/gdb/mi/ChangeLog b/gdb/mi/ChangeLog
index 57651c2..ed861f0 100644
--- a/gdb/mi/ChangeLog
+++ b/gdb/mi/ChangeLog
@@ -1,3 +1,7 @@
+2003-06-17  Daniel Jacobowitz  <drow@mvista.com>
+
+        * mi-cmds.c (mi_cmds): Add "-target-disconnect".
+
 2003-06-11  David Carlton  <carlton@bactrian.org>
 
 	* mi-cmd-stack.c: Include dictionary.h.
diff --git a/gdb/mi/mi-cmds.c b/gdb/mi/mi-cmds.c
index 9ec174f..9182402 100644
--- a/gdb/mi/mi-cmds.c
+++ b/gdb/mi/mi-cmds.c
@@ -127,6 +127,7 @@
   {"target-attach", 0, 0},
   {"target-compare-sections", 0, 0},
   {"target-detach", "detach", 0},
+  {"target-disconnect", "disconnect", 0},
   {"target-download", 0, mi_cmd_target_download},
   {"target-exec-status", 0, 0},
   {"target-list-available-targets", 0, 0},
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index 70bb92b..4009ca5 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -42,11 +42,12 @@
 #include "osabi.h"
 #include "mips-tdep.h"
 #include "block.h"
-
+#include "reggroups.h"
 #include "opcode/mips.h"
 #include "elf/mips.h"
 #include "elf-bfd.h"
 #include "symcat.h"
+#include "sim-regno.h"
 
 static void set_reg_offset (CORE_ADDR *saved_regs, int regnum, CORE_ADDR off);
 
@@ -270,6 +271,7 @@
 {
   bfd_byte reg[MAX_REGISTER_SIZE];
   int reg_offset = 0;
+  gdb_assert (reg_num >= NUM_REGS);
   /* Need to transfer the left or right part of the register, based on
      the targets byte order.  */
   switch (endian)
@@ -298,9 +300,9 @@
 	fprintf_unfiltered (gdb_stdlog, "%02x", out[buf_offset + i]);
     }
   if (in != NULL)
-    regcache_raw_read_part (regcache, reg_num, reg_offset, length, in + buf_offset);
+    regcache_cooked_read_part (regcache, reg_num, reg_offset, length, in + buf_offset);
   if (out != NULL)
-    regcache_raw_write_part (regcache, reg_num, reg_offset, length, out + buf_offset);
+    regcache_cooked_write_part (regcache, reg_num, reg_offset, length, out + buf_offset);
   if (mips_debug && in != NULL)
     {
       int i;
@@ -440,21 +442,27 @@
 
   enum mips_abi abi = mips_abi (current_gdbarch);
 
+  /* Map [NUM_REGS .. 2*NUM_REGS) onto the raw registers, but then
+     don't make the raw register names visible.  */
+  int rawnum = regno % NUM_REGS;
+  if (regno < NUM_REGS)
+    return "";
+
   /* The MIPS integer registers are always mapped from 0 to 31.  The
      names of the registers (which reflects the conventions regarding
      register use) vary depending on the ABI.  */
-  if (0 <= regno && regno < 32)
+  if (0 <= rawnum && rawnum < 32)
     {
       if (abi == MIPS_ABI_N32 || abi == MIPS_ABI_N64)
-	return mips_n32_n64_gpr_names[regno];
+	return mips_n32_n64_gpr_names[rawnum];
       else
-	return mips_gpr_names[regno];
+	return mips_gpr_names[rawnum];
     }
-  else if (32 <= regno && regno < NUM_REGS)
-    return mips_processor_reg_names[regno - 32];
+  else if (32 <= rawnum && rawnum < NUM_REGS)
+    return mips_processor_reg_names[rawnum - 32];
   else
     internal_error (__FILE__, __LINE__,
-		    "mips_register_name: bad register number %d", regno);
+		    "mips_register_name: bad register number %d", rawnum);
 }
 
 /* *INDENT-OFF* */
@@ -524,8 +532,63 @@
 };
 /* *INDENT-ON* */
 
+/* Return the groups that a MIPS register can be categorised into.  */
 
+static int
+mips_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
+			  struct reggroup *reggroup)
+{
+  int vector_p;
+  int float_p;
+  int raw_p;
+  int rawnum = regnum % NUM_REGS;
+  int pseudo = regnum / NUM_REGS;
+  if (reggroup == all_reggroup)
+    return pseudo;
+  vector_p = TYPE_VECTOR (register_type (gdbarch, regnum));
+  float_p = TYPE_CODE (register_type (gdbarch, regnum)) == TYPE_CODE_FLT;
+  /* FIXME: cagney/2003-04-13: Can't yet use gdbarch_num_regs
+     (gdbarch), as not all architectures are multi-arch.  */
+  raw_p = rawnum < NUM_REGS;
+  if (REGISTER_NAME (regnum) == NULL
+      || REGISTER_NAME (regnum)[0] == '\0')
+    return 0;
+  if (reggroup == float_reggroup)
+    return float_p && pseudo;
+  if (reggroup == vector_reggroup)
+    return vector_p && pseudo;
+  if (reggroup == general_reggroup)
+    return (!vector_p && !float_p) && pseudo;
+  /* Save the pseudo registers.  Need to make certain that any code
+     extracting register values from a saved register cache also uses
+     pseudo registers.  */
+  if (reggroup == save_reggroup)
+    return raw_p && pseudo;
+  /* Restore the same pseudo register.  */
+  if (reggroup == restore_reggroup)
+    return raw_p && pseudo;
+  return 0;   
+}
 
+/* Map the symbol table registers which live in the range [1 *
+   NUM_REGS .. 2 * NUM_REGS) back onto the corresponding raw
+   registers.  */
+
+static void
+mips_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
+			   int cookednum, void *buf)
+{
+  gdb_assert (cookednum >= NUM_REGS && cookednum < 2 * NUM_REGS);
+  return regcache_raw_read (regcache, cookednum % NUM_REGS, buf);
+}
+
+static void
+mips_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
+			    int cookednum, const void *buf)
+{
+  gdb_assert (cookednum >= NUM_REGS && cookednum < 2 * NUM_REGS);
+  return regcache_raw_write (regcache, cookednum % NUM_REGS, buf);
+}
 
 /* Table to translate MIPS16 register field to actual register number.  */
 static int mips16_to_32_reg[8] =
@@ -575,22 +638,73 @@
 
 /* Number of bytes of storage in the actual machine representation for
    register N.  NOTE: This indirectly defines the register size
-   transfered by the GDB protocol. */
+   transfered by the GDB protocol.  */
 
 static int mips64_transfers_32bit_regs_p = 0;
 
 static int
-mips_register_raw_size (int reg_nr)
+mips_register_raw_size (int regnum)
 {
-  if (mips64_transfers_32bit_regs_p)
-    return REGISTER_VIRTUAL_SIZE (reg_nr);
-  else if (reg_nr >= FP0_REGNUM && reg_nr < FP0_REGNUM + 32
-	   && FP_REGISTER_DOUBLE)
-    /* For MIPS_ABI_N32 (for example) we need 8 byte floating point
-       registers.  */
-    return 8;
+  gdb_assert (regnum >= 0);
+  if (regnum < NUM_REGS)
+    {
+      /* For compatibility with old code, implemnt the broken register raw
+	 size map for the raw registers.
+
+	 NOTE: cagney/2003-06-15: This is so bogus.  The register's
+	 raw size is changing according to the ABI
+	 (FP_REGISTER_DOUBLE).  Also, GDB's protocol is defined by a
+	 combination of REGISTER_RAW_SIZE and REGISTER_BYTE.  */
+      if (mips64_transfers_32bit_regs_p)
+	return REGISTER_VIRTUAL_SIZE (regnum);
+      else if (regnum >= FP0_REGNUM && regnum < FP0_REGNUM + 32
+	       && FP_REGISTER_DOUBLE)
+	/* For MIPS_ABI_N32 (for example) we need 8 byte floating point
+	   registers.  */
+	return 8;
+      else
+	return MIPS_REGSIZE;
+    }
+  else if (regnum < 2 * NUM_REGS)
+    {
+      /* For the moment map [NUM_REGS .. 2*NUM_REGS) onto the same raw
+	 registers, but always return the virtual size.  */
+      int rawnum = regnum % NUM_REGS;
+      return TYPE_LENGTH (MIPS_REGISTER_TYPE (rawnum));
+    }
   else
-    return MIPS_REGSIZE;
+    internal_error (__FILE__, __LINE__, "Register %d out of range", regnum);
+}
+
+/* Register offset in a buffer for each register.
+
+   FIXME: cagney/2003-06-15: This is so bogus.  Instead REGISTER_TYPE
+   should strictly return the layout of the buffer.  Unfortunatly
+   remote.c and the MIPS have come to rely on a custom layout that
+   doesn't 1:1 map onto the register type.  */
+
+static int
+mips_register_byte (int regnum)
+{
+  gdb_assert (regnum >= 0);
+  if (regnum < NUM_REGS)
+    /* Pick up the relevant per-tm file register byte method.  */
+    return MIPS_REGISTER_BYTE (regnum);
+  else if (regnum < 2 * NUM_REGS)
+    {
+      int reg;
+      int byte;
+      /* Start with the end of the raw register buffer - assum that
+	 MIPS_REGISTER_BYTE (NUM_REGS) returns that end.  */
+      byte = MIPS_REGISTER_BYTE (NUM_REGS);
+      /* Add space for all the proceeding registers based on their
+         real size.  */
+      for (reg = NUM_REGS; reg < regnum; reg++)
+	byte += TYPE_LENGTH (MIPS_REGISTER_TYPE ((reg % NUM_REGS)));
+      return byte;
+    }
+  else
+    internal_error (__FILE__, __LINE__, "Register %d out of range", regnum);
 }
 
 /* Convert between RAW and VIRTUAL registers.  The RAW register size
@@ -634,52 +748,46 @@
 	    TYPE_LENGTH (virtual_type));
 }
 
-void
-mips_register_convert_to_type (int regnum, struct type *type, char *buffer)
+static int
+mips_convert_register_p (int regnum, struct type *type)
 {
-  if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG
-      && REGISTER_RAW_SIZE (regnum) == 4
-      && (regnum) >= FP0_REGNUM && (regnum) < FP0_REGNUM + 32
-      && TYPE_CODE(type) == TYPE_CODE_FLT
-      && TYPE_LENGTH(type) == 8) 
-    {
-      char temp[4];
-      memcpy (temp, ((char *)(buffer))+4, 4);
-      memcpy (((char *)(buffer))+4, (buffer), 4);
-      memcpy (((char *)(buffer)), temp, 4); 
-    }
+  return (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG
+	  && REGISTER_RAW_SIZE (regnum) == 4
+	  && (regnum) >= FP0_REGNUM && (regnum) < FP0_REGNUM + 32
+	  && TYPE_CODE(type) == TYPE_CODE_FLT
+	  && TYPE_LENGTH(type) == 8);
 }
 
-void
-mips_register_convert_from_type (int regnum, struct type *type, char *buffer)
+static void
+mips_register_to_value (struct frame_info *frame, int regnum,
+			struct type *type, void *to)
 {
-if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG
-    && REGISTER_RAW_SIZE (regnum) == 4
-    && (regnum) >= FP0_REGNUM && (regnum) < FP0_REGNUM + 32
-    && TYPE_CODE(type) == TYPE_CODE_FLT
-    && TYPE_LENGTH(type) == 8) 
-  {
-    char temp[4];
-    memcpy (temp, ((char *)(buffer))+4, 4);
-    memcpy (((char *)(buffer))+4, (buffer), 4);
-    memcpy (((char *)(buffer)), temp, 4);
-  }
+  frame_read_register (frame, regnum + 0, (char *) to + 4);
+  frame_read_register (frame, regnum + 1, (char *) to + 0);
 }
 
-/* Return the GDB type object for the "standard" data type
-   of data in register REG.  
-   
-   Note: kevinb/2002-08-01: The definition below should faithfully
-   reproduce the behavior of each of the REGISTER_VIRTUAL_TYPE
-   definitions found in config/mips/tm-*.h.  I'm concerned about the
-   ``FCRCS_REGNUM <= reg && reg <= LAST_EMBED_REGNUM'' clause though.
-   In some cases DEPRECATED_FP_REGNUM is in this range, and I doubt
-   that this code is correct for the 64-bit case.  */
+static void
+mips_value_to_register (struct frame_info *frame, int regnum,
+			struct type *type, const void *from)
+{
+  put_frame_register (frame, regnum + 0, (const char *) from + 4);
+  put_frame_register (frame, regnum + 1, (const char *) from + 0);
+}
+
+/* Return the GDB type object for the "standard" data type of data in
+   register REG.  */
 
 static struct type *
-mips_register_virtual_type (int reg)
+mips_register_type (struct gdbarch *gdbarch, int regnum)
 {
-  if (FP0_REGNUM <= reg && reg < FP0_REGNUM + 32)
+  /* For moment, map [NUM_REGS .. 2*NUM_REGS) onto the same raw
+     registers.  Even return the same type.  */
+  int rawnum = regnum % NUM_REGS;
+  gdb_assert (rawnum >= 0 && rawnum < NUM_REGS);
+#ifdef MIPS_REGISTER_TYPE
+  return MIPS_REGISTER_TYPE (rawnum);
+#else
+  if (FP0_REGNUM <= rawnum && rawnum < FP0_REGNUM + 32)
     {
       /* Floating point registers...  */
       if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
@@ -687,9 +795,9 @@
       else
 	return builtin_type_ieee_double_little;
     }
-  else if (reg == PS_REGNUM /* CR */)
+  else if (rawnum == PS_REGNUM /* CR */)
     return builtin_type_uint32;
-  else if (FCRCS_REGNUM <= reg && reg <= LAST_EMBED_REGNUM)
+  else if (FCRCS_REGNUM <= rawnum && rawnum <= LAST_EMBED_REGNUM)
     return builtin_type_uint32;
   else
     {
@@ -700,6 +808,7 @@
       else
 	return builtin_type_uint32;
     }
+#endif
 }
 
 /* TARGET_READ_SP -- Remove useless bits from the stack pointer.  */
@@ -1613,28 +1722,44 @@
     CORE_ADDR reg_position = (get_frame_base (fci)
 			      + PROC_FREG_OFFSET (proc_desc));
 
-    /* Apparently, the freg_offset gives the offset to the first 64
-       bit saved.
-
-       When the ABI specifies 64 bit saved registers, the FREG_OFFSET
-       designates the first saved 64 bit register.
-
-       When the ABI specifies 32 bit saved registers, the ``64 bit
-       saved DOUBLE'' consists of two adjacent 32 bit registers, Hence
-       FREG_OFFSET, designates the address of the lower register of
-       the register pair.  Adjust the offset so that it designates the
-       upper register of the pair -- i.e., the address of the first
-       saved 32 bit register.  */
-
-    if (MIPS_SAVED_REGSIZE == 4)
-      reg_position += MIPS_SAVED_REGSIZE;
-
     /* Fill in the offsets for the float registers which float_mask
        says were saved.  */
     for (ireg = MIPS_NUMREGS - 1; float_mask; --ireg, float_mask <<= 1)
       if (float_mask & 0x80000000)
 	{
-	  set_reg_offset (saved_regs, FP0_REGNUM + ireg, reg_position);
+	  if (MIPS_SAVED_REGSIZE == 4 && TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
+	    {
+	      /* On a big endian 32 bit ABI, floating point registers
+		 are paired to form doubles such that the most
+		 significant part is in $f[N+1] and the least
+		 significant in $f[N] vis: $f[N+1] ||| $f[N].  The
+		 registers are also spilled as a pair and stored as a
+		 double.
+
+	         When little-endian the least significant part is
+	         stored first leading to the memory order $f[N] and
+	         then $f[N+1].
+
+		 Unfortunatly, when big-endian the most significant
+		 part of the double is stored first, and the least
+		 significant is stored second.  This leads to the
+		 registers being ordered in memory as firt $f[N+1] and
+		 then $f[N].
+
+		 For the big-endian case make certain that the
+		 addresses point at the correct (swapped) locations
+		 $f[N] and $f[N+1] pair (keep in mind that
+		 reg_position is decremented each time through the
+		 loop).  */
+	      if ((ireg & 1))
+		set_reg_offset (saved_regs, FP0_REGNUM + ireg,
+				reg_position - MIPS_SAVED_REGSIZE);
+	      else
+		set_reg_offset (saved_regs, FP0_REGNUM + ireg,
+				reg_position + MIPS_SAVED_REGSIZE);
+	    }
+	  else
+	    set_reg_offset (saved_regs, FP0_REGNUM + ireg, reg_position);
 	  reg_position -= MIPS_SAVED_REGSIZE;
 	}
 
@@ -1648,37 +1773,23 @@
 static CORE_ADDR
 read_next_frame_reg (struct frame_info *fi, int regno)
 {
-  int optimized;
-  CORE_ADDR addr;
-  int realnum;
-  enum lval_type lval;
-  char raw_buffer[MAX_REGISTER_SIZE];
-
+  /* Always a pseudo.  */
+  gdb_assert (regno >= NUM_REGS);
   if (fi == NULL)
     {
-      regcache_cooked_read (current_regcache, regno, raw_buffer);
+      LONGEST val;
+      regcache_cooked_read_signed (current_regcache, regno, &val);
+      return val;
     }
+  else if ((regno % NUM_REGS) == SP_REGNUM)
+    /* The SP_REGNUM is special, its value is stored in saved_regs.
+       In fact, it is so special that it can even only be fetched
+       using a raw register number!  Once this code as been converted
+       to frame-unwind the problem goes away.  */
+    return frame_unwind_register_signed (fi, regno % NUM_REGS);
   else
-    {
-      frame_register_unwind (fi, regno, &optimized, &lval, &addr, &realnum,
-			     raw_buffer);
-      /* FIXME: cagney/2002-09-13: This is just soooo bad.  The MIPS
-	 should have a pseudo register range that correspons to the ABI's,
-	 rather than the ISA's, view of registers.  These registers would
-	 then implicitly describe their size and hence could be used
-	 without the below munging.  */
-      if (lval == lval_memory)
-	{
-	  if (regno < 32)
-	    {
-	      /* Only MIPS_SAVED_REGSIZE bytes of GP registers are
-		 saved. */
-	      return read_memory_integer (addr, MIPS_SAVED_REGSIZE);
-	    }
-	}
-    }
+    return frame_unwind_register_signed (fi, regno);
 
-  return extract_signed_integer (raw_buffer, REGISTER_VIRTUAL_SIZE (regno));
 }
 
 /* mips_addr_bits_remove - remove useless address bits  */
@@ -1768,23 +1879,29 @@
 mips_frame_saved_pc (struct frame_info *frame)
 {
   CORE_ADDR saved_pc;
-  mips_extra_func_info_t proc_desc = get_frame_extra_info (frame)->proc_desc;
-  /* We have to get the saved pc from the sigcontext
-     if it is a signal handler frame.  */
-  int pcreg = (get_frame_type (frame) == SIGTRAMP_FRAME) ? PC_REGNUM
-  : (proc_desc ? PROC_PC_REG (proc_desc) : RA_REGNUM);
 
   if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (frame), 0, 0))
     {
       LONGEST tmp;
-      frame_unwind_signed_register (frame, PC_REGNUM, &tmp);
+      /* Always unwind the cooked PC register value.  */
+      frame_unwind_signed_register (frame, NUM_REGS + PC_REGNUM, &tmp);
       saved_pc = tmp;
     }
-  else if (proc_desc && PROC_DESC_IS_DUMMY (proc_desc))
-    saved_pc = read_memory_integer (get_frame_base (frame) - MIPS_SAVED_REGSIZE, MIPS_SAVED_REGSIZE);
   else
-    saved_pc = read_next_frame_reg (frame, pcreg);
-
+    {
+      mips_extra_func_info_t proc_desc
+	= get_frame_extra_info (frame)->proc_desc;
+      if (proc_desc && PROC_DESC_IS_DUMMY (proc_desc))
+	saved_pc = read_memory_integer (get_frame_base (frame) - MIPS_SAVED_REGSIZE, MIPS_SAVED_REGSIZE);
+      else
+	{
+	  /* We have to get the saved pc from the sigcontext if it is
+	     a signal handler frame.  */
+	  int pcreg = (get_frame_type (frame) == SIGTRAMP_FRAME ? PC_REGNUM
+		       : proc_desc ? PROC_PC_REG (proc_desc) : RA_REGNUM);
+	  saved_pc = read_next_frame_reg (frame, NUM_REGS + pcreg);
+	}
+    }
   return ADDR_BITS_REMOVE (saved_pc);
 }
 
@@ -1800,13 +1917,22 @@
 /* Set a register's saved stack address in temp_saved_regs.  If an
    address has already been set for this register, do nothing; this
    way we will only recognize the first save of a given register in a
-   function prologue.  */
+   function prologue.
+
+   For simplicity, save the address in both [0 .. NUM_REGS) and
+   [NUM_REGS .. 2*NUM_REGS).  Strictly speaking, only the second range
+   is used as it is only second range (the ABI instead of ISA
+   registers) that comes into play when finding saved registers in a
+   frame.  */
 
 static void
 set_reg_offset (CORE_ADDR *saved_regs, int regno, CORE_ADDR offset)
 {
   if (saved_regs[regno] == 0)
-    saved_regs[regno] = offset;
+    {
+      saved_regs[regno + 0 * NUM_REGS] = offset;
+      saved_regs[regno + 1 * NUM_REGS] = offset;
+    }
 }
 
 
@@ -2158,7 +2284,7 @@
 	    {
 	      unsigned alloca_adjust;
 	      PROC_FRAME_REG (&temp_proc_desc) = 30;
-	      frame_addr = read_next_frame_reg (next_frame, 30);
+	      frame_addr = read_next_frame_reg (next_frame, NUM_REGS + 30);
 	      alloca_adjust = (unsigned) (frame_addr - (sp + low_word));
 	      if (alloca_adjust > 0)
 		{
@@ -2181,7 +2307,7 @@
 	    {
 	      unsigned alloca_adjust;
 	      PROC_FRAME_REG (&temp_proc_desc) = 30;
-	      frame_addr = read_next_frame_reg (next_frame, 30);
+	      frame_addr = read_next_frame_reg (next_frame, NUM_REGS + 30);
 	      alloca_adjust = (unsigned) (frame_addr - sp);
 	      if (alloca_adjust > 0)
 		{
@@ -2209,7 +2335,7 @@
   CORE_ADDR sp;
 
   if (cur_frame)
-    sp = read_next_frame_reg (next_frame, SP_REGNUM);
+    sp = read_next_frame_reg (next_frame, NUM_REGS + SP_REGNUM);
   else
     sp = 0;
 
@@ -2482,7 +2608,7 @@
 get_frame_pointer (struct frame_info *frame,
 		   mips_extra_func_info_t proc_desc)
 {
-  return (read_next_frame_reg (frame, PROC_FRAME_REG (proc_desc))
+  return (read_next_frame_reg (frame, NUM_REGS + PROC_FRAME_REG (proc_desc))
 	  + PROC_FRAME_OFFSET (proc_desc)
 	  - PROC_FRAME_ADJUST (proc_desc));
 }
@@ -2568,7 +2694,7 @@
          interrupted by a signal at it's very start.  */
       if (get_frame_pc (fci) == PROC_LOW_ADDR (proc_desc)
 	  && !PROC_DESC_IS_DUMMY (proc_desc))
-	deprecated_update_frame_base_hack (fci, read_next_frame_reg (get_next_frame (fci), SP_REGNUM));
+	deprecated_update_frame_base_hack (fci, read_next_frame_reg (get_next_frame (fci), NUM_REGS + SP_REGNUM));
       else if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (fci), 0, 0))
 	/* Do not ``fix'' fci->frame.  It will have the value of the
            generic dummy frame's top-of-stack (since the draft
@@ -4079,10 +4205,11 @@
 mips_print_register (struct ui_file *file, struct frame_info *frame,
 		     int regnum, int all)
 {
+  struct gdbarch *gdbarch = get_frame_arch (frame);
   char raw_buffer[MAX_REGISTER_SIZE];
   int offset;
 
-  if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (regnum)) == TYPE_CODE_FLT)
+  if (TYPE_CODE (gdbarch_register_type (gdbarch, regnum)) == TYPE_CODE_FLT)
     {
       mips_print_fp_register (file, frame, regnum);
       return;
@@ -4111,8 +4238,7 @@
   else
     offset = 0;
 
-  print_scalar_formatted (raw_buffer + offset,
-			  REGISTER_VIRTUAL_TYPE (regnum),
+  print_scalar_formatted (raw_buffer + offset, gdbarch_register_type (gdbarch, regnum),
 			  'x', 0, file);
 }
 
@@ -4134,39 +4260,43 @@
 
 static int
 print_gp_register_row (struct ui_file *file, struct frame_info *frame,
-		       int regnum)
+		       int start_regnum)
 {
+  struct gdbarch *gdbarch = get_frame_arch (frame);
   /* do values for GP (int) regs */
   char raw_buffer[MAX_REGISTER_SIZE];
   int ncols = (MIPS_REGSIZE == 8 ? 4 : 8);	/* display cols per row */
   int col, byte;
-  int start_regnum = regnum;
-  int numregs = NUM_REGS;
-
+  int regnum;
 
   /* For GP registers, we print a separate row of names above the vals */
   fprintf_filtered (file, "     ");
-  for (col = 0; col < ncols && regnum < numregs; regnum++)
+  for (col = 0, regnum = start_regnum;
+       col < ncols && regnum < NUM_REGS + NUM_PSEUDO_REGS;
+       regnum++)
     {
       if (*REGISTER_NAME (regnum) == '\0')
 	continue;		/* unused register */
-      if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (regnum)) == TYPE_CODE_FLT)
+      if (TYPE_CODE (gdbarch_register_type (gdbarch, regnum)) == TYPE_CODE_FLT)
 	break;			/* end the row: reached FP register */
       fprintf_filtered (file, MIPS_REGSIZE == 8 ? "%17s" : "%9s",
 			REGISTER_NAME (regnum));
       col++;
     }
+  /* print the R0 to R31 names */
   fprintf_filtered (file,
-		    start_regnum < MIPS_NUMREGS ? "\n R%-4d" : "\n      ",
-		    start_regnum);	/* print the R0 to R31 names */
+		    (start_regnum % NUM_REGS) < MIPS_NUMREGS
+		    ? "\n R%-4d" : "\n      ",
+		    start_regnum);
 
-  regnum = start_regnum;	/* go back to start of row */
   /* now print the values in hex, 4 or 8 to the row */
-  for (col = 0; col < ncols && regnum < numregs; regnum++)
+  for (col = 0, regnum = start_regnum;
+       col < ncols && regnum < NUM_REGS + NUM_PSEUDO_REGS;
+       regnum++)
     {
       if (*REGISTER_NAME (regnum) == '\0')
 	continue;		/* unused register */
-      if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (regnum)) == TYPE_CODE_FLT)
+      if (TYPE_CODE (gdbarch_register_type (gdbarch, regnum)) == TYPE_CODE_FLT)
 	break;			/* end row: reached FP register */
       /* OK: get the data in raw format.  */
       if (!frame_register_read (frame, regnum, raw_buffer))
@@ -4202,6 +4332,7 @@
 {
   if (regnum != -1)		/* do one specified register */
     {
+      gdb_assert (regnum >= NUM_REGS);
       if (*(REGISTER_NAME (regnum)) == '\0')
 	error ("Not a valid register for the current processor type");
 
@@ -4211,10 +4342,10 @@
   else
     /* do all (or most) registers */
     {
-      regnum = 0;
-      while (regnum < NUM_REGS)
+      regnum = NUM_REGS;
+      while (regnum < NUM_REGS + NUM_PSEUDO_REGS)
 	{
-	  if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (regnum)) == TYPE_CODE_FLT)
+	  if (TYPE_CODE (gdbarch_register_type (gdbarch, regnum)) == TYPE_CODE_FLT)
 	    {
 	      if (all)		/* true for "INFO ALL-REGISTERS" command */
 		regnum = print_fp_register_row (file, frame, regnum);
@@ -4701,30 +4832,30 @@
          least significant part of FP0.  */
       if (mips_debug)
 	fprintf_unfiltered (gdb_stderr, "Return float in $fp0\n");
-      mips_xfer_register (regcache, FP0_REGNUM, TYPE_LENGTH (type),
+      mips_xfer_register (regcache, NUM_REGS + FP0_REGNUM, TYPE_LENGTH (type),
 			  TARGET_BYTE_ORDER, in, out, 0);
     }
   else if (TYPE_CODE (type) == TYPE_CODE_FLT
 	   && TYPE_LENGTH (type) == 8
 	   && tdep->mips_fpu_type != MIPS_FPU_NONE)
     {
-      /* A double-precision floating-point value.  It fits in the
-         least significant part of FP0/FP1 but with byte ordering
-         based on the target (???).  */
+      /* A double-precision floating-point value.  The most
+         significant part goes in FP1, and the least significant in
+         FP0.  */
       if (mips_debug)
-	fprintf_unfiltered (gdb_stderr, "Return float in $fp0/$fp1\n");
+	fprintf_unfiltered (gdb_stderr, "Return float in $fp1/$fp0\n");
       switch (TARGET_BYTE_ORDER)
 	{
 	case BFD_ENDIAN_LITTLE:
-	  mips_xfer_register (regcache, FP0_REGNUM + 0, 4,
+	  mips_xfer_register (regcache, NUM_REGS + FP0_REGNUM + 0, 4,
 			      TARGET_BYTE_ORDER, in, out, 0);
-	  mips_xfer_register (regcache, FP0_REGNUM + 1, 4,
+	  mips_xfer_register (regcache, NUM_REGS + FP0_REGNUM + 1, 4,
 			      TARGET_BYTE_ORDER, in, out, 4);
 	  break;
 	case BFD_ENDIAN_BIG:
-	  mips_xfer_register (regcache, FP0_REGNUM + 1, 4,
+	  mips_xfer_register (regcache, NUM_REGS + FP0_REGNUM + 1, 4,
 			      TARGET_BYTE_ORDER, in, out, 0);
-	  mips_xfer_register (regcache, FP0_REGNUM + 0, 4,
+	  mips_xfer_register (regcache, NUM_REGS + FP0_REGNUM + 0, 4,
 			      TARGET_BYTE_ORDER, in, out, 4);
 	  break;
 	default:
@@ -4759,7 +4890,8 @@
 			/ TARGET_CHAR_BIT);
 	  if (mips_debug)
 	    fprintf_unfiltered (gdb_stderr, "Return float struct+%d\n", offset);
-	  mips_xfer_register (regcache, regnum, TYPE_LENGTH (TYPE_FIELD_TYPE (type, field)),
+	  mips_xfer_register (regcache, NUM_REGS + regnum,
+			      TYPE_LENGTH (TYPE_FIELD_TYPE (type, field)),
 			      TARGET_BYTE_ORDER, in, out, offset);
 	}
     }
@@ -4783,8 +4915,8 @@
 	  if (mips_debug)
 	    fprintf_unfiltered (gdb_stderr, "Return struct+%d:%d in $%d\n",
 				offset, xfer, regnum);
-	  mips_xfer_register (regcache, regnum, xfer, BFD_ENDIAN_UNKNOWN,
-			      in, out, offset);
+	  mips_xfer_register (regcache, NUM_REGS + regnum, xfer,
+			      BFD_ENDIAN_UNKNOWN, in, out, offset);
 	}
     }
 #endif
@@ -4806,8 +4938,8 @@
 	  if (mips_debug)
 	    fprintf_unfiltered (gdb_stderr, "Return scalar+%d:%d in $%d\n",
 				offset, xfer, regnum);
-	  mips_xfer_register (regcache, regnum, xfer, TARGET_BYTE_ORDER,
-			      in, out, offset);
+	  mips_xfer_register (regcache, NUM_REGS + regnum, xfer,
+			      TARGET_BYTE_ORDER, in, out, offset);
 	}
     }
 }
@@ -4841,7 +4973,7 @@
          of FP0.  */
       if (mips_debug)
 	fprintf_unfiltered (gdb_stderr, "Return float in $fp0\n");
-      mips_xfer_register (regcache, FP0_REGNUM, TYPE_LENGTH (type),
+      mips_xfer_register (regcache, NUM_REGS + FP0_REGNUM, TYPE_LENGTH (type),
 			  TARGET_BYTE_ORDER, in, out, 0);
     }
   else if (TYPE_CODE (type) == TYPE_CODE_STRUCT
@@ -4871,7 +5003,8 @@
 			/ TARGET_CHAR_BIT);
 	  if (mips_debug)
 	    fprintf_unfiltered (gdb_stderr, "Return float struct+%d\n", offset);
-	  mips_xfer_register (regcache, regnum, TYPE_LENGTH (TYPE_FIELD_TYPE (type, field)),
+	  mips_xfer_register (regcache, NUM_REGS + regnum,
+			      TYPE_LENGTH (TYPE_FIELD_TYPE (type, field)),
 			      TARGET_BYTE_ORDER, in, out, offset);
 	}
     }
@@ -4893,8 +5026,8 @@
 	  if (mips_debug)
 	    fprintf_unfiltered (gdb_stderr, "Return struct+%d:%d in $%d\n",
 				offset, xfer, regnum);
-	  mips_xfer_register (regcache, regnum, xfer, BFD_ENDIAN_UNKNOWN,
-			      in, out, offset);
+	  mips_xfer_register (regcache, NUM_REGS + regnum, xfer,
+			      BFD_ENDIAN_UNKNOWN, in, out, offset);
 	}
     }
   else
@@ -4914,8 +5047,8 @@
 	  if (mips_debug)
 	    fprintf_unfiltered (gdb_stderr, "Return scalar+%d:%d in $%d\n",
 				offset, xfer, regnum);
-	  mips_xfer_register (regcache, regnum, xfer, TARGET_BYTE_ORDER,
-			      in, out, offset);
+	  mips_xfer_register (regcache, NUM_REGS + regnum, xfer,
+			      TARGET_BYTE_ORDER, in, out, offset);
 	}
     }
 }
@@ -5436,9 +5569,10 @@
   CORE_ADDR addrx;
   enum lval_type lvalx;
   int optimizedx;
+  int realnumx;
 
-  if (!target_has_registers)
-    error ("No registers.");
+  /* Always a pseudo.  */
+  gdb_assert (regnum >= NUM_REGS);
 
   /* Make certain that all needed parameters are present.  */
   if (addrp == NULL)
@@ -5447,26 +5581,20 @@
     lvalp = &lvalx;
   if (optimizedp == NULL)
     optimizedp = &optimizedx;
-  deprecated_unwind_get_saved_register (raw_buffer, optimizedp, addrp, frame,
-					regnum, lvalp);
-  /* FIXME: cagney/2002-09-13: This is just so bad.  The MIPS should
-     have a pseudo register range that correspons to the ABI's, rather
-     than the ISA's, view of registers.  These registers would then
-     implicitly describe their size and hence could be used without
-     the below munging.  */
-  if ((*lvalp) == lval_memory)
-    {
-      if (raw_buffer != NULL)
-	{
-	  if (regnum < 32)
-	    {
-	      /* Only MIPS_SAVED_REGSIZE bytes of GP registers are
-		 saved. */
-	      LONGEST val = read_memory_integer ((*addrp), MIPS_SAVED_REGSIZE);
-	      store_unsigned_integer (raw_buffer, REGISTER_RAW_SIZE (regnum), val);
-	    }
-	}
-    }
+
+  if ((regnum % NUM_REGS) == SP_REGNUM)
+    /* The SP_REGNUM is special, its value is stored in saved_regs.
+       In fact, it is so special that it can even only be fetched
+       using a raw register number!  Once this code as been converted
+       to frame-unwind the problem goes away.  */
+    frame_register_unwind (deprecated_get_next_frame_hack (frame),
+			   regnum % NUM_REGS, optimizedp, lvalp, addrp,
+			   &realnumx, raw_buffer);
+  else
+    /* Get it from the next frame.  */
+    frame_register_unwind (deprecated_get_next_frame_hack (frame),
+			   regnum, optimizedp, lvalp, addrp,
+			   &realnumx, raw_buffer);
 }
 
 /* Immediately after a function call, return the saved pc.
@@ -5481,48 +5609,64 @@
 }
 
 
-/* Convert a dbx stab register number (from `r' declaration) to a gdb
-   REGNUM */
+/* Convert a dbx stab register number (from `r' declaration) to a GDB
+   [1 * NUM_REGS .. 2 * NUM_REGS) REGNUM.  */
 
 static int
 mips_stab_reg_to_regnum (int num)
 {
+  int regnum;
   if (num >= 0 && num < 32)
-    return num;
+    regnum = num;
   else if (num >= 38 && num < 70)
-    return num + FP0_REGNUM - 38;
+    regnum = num + FP0_REGNUM - 38;
   else if (num == 70)
-    return HI_REGNUM;
+    regnum = HI_REGNUM;
   else if (num == 71)
-    return LO_REGNUM;
+    regnum = LO_REGNUM;
   else
-    {
-      /* This will hopefully (eventually) provoke a warning.  Should
-         we be calling complaint() here?  */
-      return NUM_REGS + NUM_PSEUDO_REGS;
-    }
+    /* This will hopefully (eventually) provoke a warning.  Should
+       we be calling complaint() here?  */
+    return NUM_REGS + NUM_PSEUDO_REGS;
+  return NUM_REGS + regnum;
 }
 
 
-/* Convert a dwarf, dwarf2, or ecoff register number to a gdb REGNUM */
+/* Convert a dwarf, dwarf2, or ecoff register number to a GDB [1 *
+   NUM_REGS .. 2 * NUM_REGS) REGNUM.  */
 
 static int
 mips_dwarf_dwarf2_ecoff_reg_to_regnum (int num)
 {
+  int regnum;
   if (num >= 0 && num < 32)
-    return num;
+    regnum = num;
   else if (num >= 32 && num < 64)
-    return num + FP0_REGNUM - 32;
+    regnum = num + FP0_REGNUM - 32;
   else if (num == 64)
-    return HI_REGNUM;
+    regnum = HI_REGNUM;
   else if (num == 65)
-    return LO_REGNUM;
+    regnum = LO_REGNUM;
   else
-    {
-      /* This will hopefully (eventually) provoke a warning.  Should
-         we be calling complaint() here?  */
-      return NUM_REGS + NUM_PSEUDO_REGS;
-    }
+    /* This will hopefully (eventually) provoke a warning.  Should we
+       be calling complaint() here?  */
+    return NUM_REGS + NUM_PSEUDO_REGS;
+  return NUM_REGS + regnum;
+}
+
+static int
+mips_register_sim_regno (int regnum)
+{
+  /* Only makes sense to supply raw registers.  */
+  gdb_assert (regnum >= 0 && regnum < NUM_REGS);
+  /* FIXME: cagney/2002-05-13: Need to look at the pseudo register to
+     decide if it is valid.  Should instead define a standard sim/gdb
+     register numbering scheme.  */
+  if (REGISTER_NAME (NUM_REGS + regnum) != NULL
+      && REGISTER_NAME (NUM_REGS + regnum)[0] != '\0')
+    return regnum;
+  else
+    return LEGACY_SIM_REGNO_IGNORE;    
 }
 
 
@@ -5589,6 +5733,7 @@
   struct gdbarch_tdep *tdep;
   int elf_flags;
   enum mips_abi mips_abi, found_abi, wanted_abi;
+  int num_regs;
 
   /* Reset the disassembly info, in case it was set to something
      non-default.  */
@@ -5742,16 +5887,23 @@
   set_gdbarch_double_bit (gdbarch, 64);
   set_gdbarch_long_double_bit (gdbarch, 64);
   set_gdbarch_deprecated_register_raw_size (gdbarch, mips_register_raw_size);
+  set_gdbarch_deprecated_register_byte (gdbarch, mips_register_byte);
+  set_gdbarch_register_reggroup_p (gdbarch, mips_register_reggroup_p);
+  set_gdbarch_pseudo_register_read (gdbarch, mips_pseudo_register_read);
+  set_gdbarch_pseudo_register_write (gdbarch, mips_pseudo_register_write);
   tdep->found_abi = found_abi;
   tdep->mips_abi = mips_abi;
 
   set_gdbarch_elf_make_msymbol_special (gdbarch, 
 					mips_elf_make_msymbol_special);
 
+
   if (info.osabi == GDB_OSABI_IRIX)
-    set_gdbarch_num_regs (gdbarch, 71);
+    num_regs = 71;
   else
-    set_gdbarch_num_regs (gdbarch, 90);
+    num_regs = 90;
+  set_gdbarch_num_regs (gdbarch, num_regs);
+  set_gdbarch_num_pseudo_regs (gdbarch, num_regs);
 
   switch (mips_abi)
     {
@@ -5943,6 +6095,7 @@
   set_gdbarch_ecoff_reg_to_regnum (gdbarch, mips_dwarf_dwarf2_ecoff_reg_to_regnum);
   set_gdbarch_dwarf_reg_to_regnum (gdbarch, mips_dwarf_dwarf2_ecoff_reg_to_regnum);
   set_gdbarch_dwarf2_reg_to_regnum (gdbarch, mips_dwarf_dwarf2_ecoff_reg_to_regnum);
+  set_gdbarch_register_sim_regno (gdbarch, mips_register_sim_regno);
 
   /* Initialize a frame */
   set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, mips_find_saved_regs);
@@ -5953,7 +6106,7 @@
   set_gdbarch_call_dummy_address (gdbarch, mips_call_dummy_address);
   set_gdbarch_deprecated_pop_frame (gdbarch, mips_pop_frame);
   set_gdbarch_frame_align (gdbarch, mips_frame_align);
-  set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos);
+  set_gdbarch_deprecated_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos);
   set_gdbarch_deprecated_register_convertible (gdbarch, mips_register_convertible);
   set_gdbarch_deprecated_register_convert_to_virtual (gdbarch, mips_register_convert_to_virtual);
   set_gdbarch_deprecated_register_convert_to_raw (gdbarch, mips_register_convert_to_raw);
@@ -5979,9 +6132,7 @@
 
   set_gdbarch_function_start_offset (gdbarch, 0);
 
-  /* There are MIPS targets which do not yet use this since they still
-     define REGISTER_VIRTUAL_TYPE.  */
-  set_gdbarch_deprecated_register_virtual_type (gdbarch, mips_register_virtual_type);
+  set_gdbarch_register_type (gdbarch, mips_register_type);
 
   set_gdbarch_print_registers_info (gdbarch, mips_print_registers_info);
   set_gdbarch_pc_in_sigtramp (gdbarch, mips_pc_in_sigtramp);
@@ -6265,12 +6416,6 @@
 		      "mips_dump_tdep: RA_REGNUM = %d\n",
 		      RA_REGNUM);
   fprintf_unfiltered (file,
-		      "mips_dump_tdep: REGISTER_CONVERT_FROM_TYPE # %s\n",
-		      XSTRING (REGISTER_CONVERT_FROM_TYPE (REGNUM, VALTYPE, RAW_BUFFER)));
-  fprintf_unfiltered (file,
-		      "mips_dump_tdep: REGISTER_CONVERT_TO_TYPE # %s\n",
-		      XSTRING (REGISTER_CONVERT_TO_TYPE (REGNUM, VALTYPE, RAW_BUFFER)));
-  fprintf_unfiltered (file,
 		      "mips_dump_tdep: REGISTER_NAMES = delete?\n");
   fprintf_unfiltered (file,
 		      "mips_dump_tdep: ROUND_DOWN = function?\n");
diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c
index 85b4a8e..3519495 100644
--- a/gdb/mn10300-tdep.c
+++ b/gdb/mn10300-tdep.c
@@ -1201,7 +1201,7 @@
   set_gdbarch_deprecated_push_arguments (gdbarch, mn10300_push_arguments);
   set_gdbarch_reg_struct_has_addr (gdbarch, mn10300_reg_struct_has_addr);
   set_gdbarch_deprecated_push_return_address (gdbarch, mn10300_push_return_address);
-  set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos);
+  set_gdbarch_deprecated_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos);
   set_gdbarch_use_struct_convention (gdbarch, mn10300_use_struct_convention);
 
   tdep->am33_mode = am33_mode;
diff --git a/gdb/nto-tdep.c b/gdb/nto-tdep.c
index 94f156e..056b93f 100644
--- a/gdb/nto-tdep.c
+++ b/gdb/nto-tdep.c
@@ -72,7 +72,7 @@
 {
   if (!strcmp (arch, "i386") || !strcmp (arch, "x86"))
     return CPUTYPE_X86;
-  if (!strcmp (arch, "rs6000") || !strcmp (arch, "ppc"))
+  if (!strcmp (arch, "rs6000") || !strcmp (arch, "powerpc"))
     return CPUTYPE_PPC;
   if (!strcmp (arch, "mips"))
     return CPUTYPE_MIPS;
@@ -97,7 +97,8 @@
       arch = "x86";
       endian = "";
     }
-  else if (strcmp (TARGET_ARCHITECTURE->arch_name, "rs6000") == 0)
+  else if (strcmp (TARGET_ARCHITECTURE->arch_name, "rs6000") == 0
+	   || strcmp (TARGET_ARCHITECTURE->arch_name, "powerpc") == 0)
     {
       arch = "ppc";
       endian = "be";
@@ -130,7 +131,8 @@
       arch = "x86";
       endian = "";
     }
-  else if (strcmp (TARGET_ARCHITECTURE->arch_name, "rs6000") == 0)
+  else if (strcmp (TARGET_ARCHITECTURE->arch_name, "rs6000") == 0
+	   || strcmp (TARGET_ARCHITECTURE->arch_name, "powerpc") == 0)
     {
       arch = "ppc";
       endian = "be";
@@ -269,7 +271,7 @@
 		      int which, CORE_ADDR reg_addr)
 {
   nto_regset_t regset;
-  
+
 /* See corelow.c:get_core_registers for values of WHICH.  */
   if (which == 0)
     {
@@ -305,11 +307,11 @@
 _initialize_nto_tdep (void)
 {
   add_setshow_cmd ("nto-debug", class_maintenance, var_zinteger,
-		  &nto_internal_debugging, "Set QNX NTO internal debugging.\n\
+		   &nto_internal_debugging, "Set QNX NTO internal debugging.\n\
 When non-zero, nto specific debug info is\n\
 displayed. Different information is displayed\n\
-for different positive values.",  "Show QNX NTO internal debugging.\n",
-		  NULL, NULL, &setdebuglist, &showdebuglist);
+for different positive values.", "Show QNX NTO internal debugging.\n",
+		   NULL, NULL, &setdebuglist, &showdebuglist);
 
   /* We use SIG45 for pulses, or something, so nostop, noprint
      and pass them.  */
diff --git a/gdb/osabi.c b/gdb/osabi.c
index 5f935d2..252129b 100644
--- a/gdb/osabi.c
+++ b/gdb/osabi.c
@@ -384,6 +384,14 @@
 	      *os_ident_ptr = GDB_OSABI_SOLARIS;
 	      break;
 
+	    case GNU_ABI_TAG_FREEBSD:
+	      *os_ident_ptr = GDB_OSABI_FREEBSD_ELF;
+	      break;
+	      
+	    case GNU_ABI_TAG_NETBSD:
+	      *os_ident_ptr = GDB_OSABI_NETBSD_ELF;
+	      break;
+	      
 	    default:
 	      internal_error
 		(__FILE__, __LINE__,
diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
index f2d76b8..ab038b7 100644
--- a/gdb/ppc-linux-tdep.c
+++ b/gdb/ppc-linux-tdep.c
@@ -770,12 +770,12 @@
   (sizeof (ppc64_standard_linkage) / sizeof (ppc64_standard_linkage[0]))
 
 
-/* Recognize a 64-bit PowerPC Linux linkage function --- what GDB
+/* Recognize a 64-bit PowerPC GNU/Linux linkage function --- what GDB
    calls a "solib trampoline".  */
 static int
 ppc64_in_solib_call_trampoline (CORE_ADDR pc, char *name)
 {
-  /* Detecting solib call trampolines on PPC64 Linux is a pain.
+  /* Detecting solib call trampolines on PPC64 GNU/Linux is a pain.
 
      It's not specifically solib call trampolines that are the issue.
      Any call from one function to another function that uses a
@@ -787,7 +787,7 @@
      also an inter-TOC call, and requires a trampoline --- so "solib
      call trampolines" are just a special case.
 
-     The 64-bit PowerPC Linux ABI calls these call trampolines
+     The 64-bit PowerPC GNU/Linux ABI calls these call trampolines
      "linkage functions".  Since they need to be near the functions
      that call them, they all appear in .text, not in any special
      section.  The .plt section just contains an array of function
diff --git a/gdb/rdi-share/host.h b/gdb/rdi-share/host.h
index 9944c15..121a823 100644
--- a/gdb/rdi-share/host.h
+++ b/gdb/rdi-share/host.h
@@ -214,4 +214,7 @@
 
 #endif
 
+/* Needs to be supplied by the host.  */
+extern void Fail (const char *, ...);
+
 /* end of host.h */
diff --git a/gdb/regcache.c b/gdb/regcache.c
index facaab3..509390f 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -423,8 +423,7 @@
 do_cooked_read (void *src, int regnum, void *buf)
 {
   struct regcache *regcache = src;
-  if (!regcache_valid_p (regcache, regnum)
-      && regcache->readonly_p)
+  if (!regcache->register_valid_p[regnum] && regcache->readonly_p)
     /* Don't even think about fetching a register from a read-only
        cache when the register isn't yet valid.  There isn't a target
        from which the register value can be fetched.  */
diff --git a/gdb/regformats/reg-ppc64.dat b/gdb/regformats/reg-ppc64.dat
deleted file mode 100644
index 281432a..0000000
--- a/gdb/regformats/reg-ppc64.dat
+++ /dev/null
@@ -1,76 +0,0 @@
-name:ppc64
-expedite:r1,pc
-64:r0
-64:r1
-64:r2
-64:r3
-64:r4
-64:r5
-64:r6
-64:r7
-64:r8
-64:r9
-64:r10
-64:r11
-64:r12
-64:r13
-64:r14
-64:r15
-64:r16
-64:r17
-64:r18
-64:r19
-64:r20
-64:r21
-64:r22
-64:r23
-64:r24
-64:r25
-64:r26
-64:r27
-64:r28
-64:r29
-64:r30
-64:r31
-
-64:f0
-64:f1
-64:f2
-64:f3
-64:f4
-64:f5
-64:f6
-64:f7
-64:f8
-64:f9
-64:f10
-64:f11
-64:f12
-64:f13
-64:f14
-64:f15
-64:f16
-64:f17
-64:f18
-64:f19
-64:f20
-64:f21
-64:f22
-64:f23
-64:f24
-64:f25
-64:f26
-64:f27
-64:f28
-64:f29
-64:f30
-64:f31
-
-64:pc
-64:ps
-
-32:cr
-64:lr
-64:ctr
-32:xer
-32:fpscr
diff --git a/gdb/remote-array.c b/gdb/remote-array.c
deleted file mode 100644
index ff56881..0000000
--- a/gdb/remote-array.c
+++ /dev/null
@@ -1,1424 +0,0 @@
-/* Remote debugging interface for Array Tech RAID controller..
-
-   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-   1999, 2000, 2001, 2002 Free Software Foundation, Inc.
-
-   Contributed by Cygnus Support. Written by Rob Savoye for Cygnus.
-
-   This module talks to a debug monitor called 'MONITOR', which
-   We communicate with MONITOR via either a direct serial line, or a TCP
-   (or possibly TELNET) stream to a terminal multiplexor,
-   which in turn talks to the target board.
-
-   This file is part of GDB.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
-
-#include "defs.h"
-#include "gdbcore.h"
-#include "target.h"
-#include <ctype.h>
-#include <sys/types.h>
-#include "gdb_string.h"
-#include "command.h"
-#include "serial.h"
-#include "monitor.h"
-#include "remote-utils.h"
-#include "inferior.h"
-#include "version.h"
-#include "regcache.h"
-
-extern int baud_rate;
-
-#define ARRAY_PROMPT ">> "
-
-static void debuglogs (int, char *, ...);
-static void array_open ();
-static void array_close ();
-static void array_detach ();
-static void array_attach ();
-static void array_resume (ptid_t ptid, int step, enum target_signal sig);
-static void array_fetch_register ();
-static void array_store_register ();
-static void array_fetch_registers ();
-static void array_store_registers ();
-static void array_prepare_to_store ();
-static void array_files_info ();
-static void array_kill ();
-static void array_create_inferior ();
-static void array_mourn_inferior ();
-static void make_gdb_packet ();
-static int array_xfer_memory ();
-static ptid_t array_wait (ptid_t ptid,
-                                 struct target_waitstatus *status);
-static int array_insert_breakpoint ();
-static int array_remove_breakpoint ();
-static int tohex ();
-static int to_hex ();
-static int from_hex ();
-static int array_send_packet ();
-static int array_get_packet ();
-static unsigned long ascii2hexword ();
-static void hexword2ascii ();
-
-#define LOG_FILE "monitor.log"
-#if defined (LOG_FILE)
-FILE *log_file;
-#endif
-
-static int timeout = 30;
-/* Having this larger than 400 causes us to be incompatible with
-   m68k-stub.c and i386-stub.c.  Normally, no one would notice because
-   it only matters for writing large chunks of memory (e.g. in
-   downloads).  Also, this needs to be more than 400 if required to
-   hold the registers (see below, where we round it up based on
-   DEPRECATED_REGISTER_BYTES).  */
-#define PBUFSIZ 400
-
-/* 
- * Descriptor for I/O to remote machine.  Initialize it to NULL so that
- * array_open knows that we don't have a file open when the program starts.
- */
-struct serial *array_desc = NULL;
-
-/*
- * this array of registers need to match the indexes used by GDB. The
- * whole reason this exists is cause the various ROM monitors use
- * different strings than GDB does, and doesn't support all the
- * registers either. So, typing "info reg sp" becomes a "r30".
- */
-extern char *tmp_mips_processor_type;
-extern int mips_set_processor_type ();
-
-static struct target_ops array_ops;
-
-static void
-init_array_ops (void)
-{
-  array_ops.to_shortname = "array";
-  array_ops.to_longname =
-    "Debug using the standard GDB remote protocol for the Array Tech target.",
-    array_ops.to_doc =
-    "Debug using the standard GDB remote protocol for the Array Tech target.\n\
-Specify the serial device it is connected to (e.g. /dev/ttya).";
-  array_ops.to_open = array_open;
-  array_ops.to_close = array_close;
-  array_ops.to_detach = array_detach;
-  array_ops.to_resume = array_resume;
-  array_ops.to_wait = array_wait;
-  array_ops.to_fetch_registers = array_fetch_registers;
-  array_ops.to_store_registers = array_store_registers;
-  array_ops.to_prepare_to_store = array_prepare_to_store;
-  array_ops.to_xfer_memory = array_xfer_memory;
-  array_ops.to_files_info = array_files_info;
-  array_ops.to_insert_breakpoint = array_insert_breakpoint;
-  array_ops.to_remove_breakpoint = array_remove_breakpoint;
-  array_ops.to_kill = array_kill;
-  array_ops.to_create_inferior = array_create_inferior;
-  array_ops.to_mourn_inferior = array_mourn_inferior;
-  array_ops.to_stratum = process_stratum;
-  array_ops.to_has_all_memory = 1;
-  array_ops.to_has_memory = 1;
-  array_ops.to_has_stack = 1;
-  array_ops.to_has_registers = 1;
-  array_ops.to_has_execution = 1;
-  array_ops.to_magic = OPS_MAGIC;
-};
-
-/*
- * printf_monitor -- send data to monitor.  Works just like printf.
- */
-static void
-printf_monitor (char *pattern,...)
-{
-  va_list args;
-  char buf[PBUFSIZ];
-  int i;
-
-  va_start (args, pattern);
-
-  vsprintf (buf, pattern, args);
-
-  debuglogs (1, "printf_monitor(), Sending: \"%s\".", buf);
-
-  if (strlen (buf) > PBUFSIZ)
-    error ("printf_monitor(): string too long");
-  if (serial_write (array_desc, buf, strlen (buf)))
-    fprintf_unfiltered (gdb_stderr, "serial_write failed: %s\n", 
-			safe_strerror (errno));
-}
-/*
- * write_monitor -- send raw data to monitor.
- */
-static void
-write_monitor (char data[], int len)
-{
-  if (serial_write (array_desc, data, len))
-    fprintf_unfiltered (gdb_stderr, "serial_write failed: %s\n",
-			safe_strerror (errno));
-
-  *(data + len + 1) = '\0';
-  debuglogs (1, "write_monitor(), Sending: \"%s\".", data);
-
-}
-
-/*
- * debuglogs -- deal with debugging info to multiple sources. This takes
- *      two real args, the first one is the level to be compared against 
- *      the sr_get_debug() value, the second arg is a printf buffer and args
- *      to be formatted and printed. A CR is added after each string is printed.
- */
-static void
-debuglogs (int level, char *pattern,...)
-{
-  va_list args;
-  char *p;
-  unsigned char buf[PBUFSIZ];
-  char newbuf[PBUFSIZ];
-  int i;
-
-  va_start (args, pattern);
-
-  if ((level < 0) || (level > 100))
-    {
-      error ("Bad argument passed to debuglogs(), needs debug level");
-      return;
-    }
-
-  vsprintf (buf, pattern, args);	/* format the string */
-
-  /* convert some characters so it'll look right in the log */
-  p = newbuf;
-  for (i = 0; buf[i] != '\0'; i++)
-    {
-      if (i > PBUFSIZ)
-	error ("Debug message too long");
-      switch (buf[i])
-	{
-	case '\n':		/* newlines */
-	  *p++ = '\\';
-	  *p++ = 'n';
-	  continue;
-	case '\r':		/* carriage returns */
-	  *p++ = '\\';
-	  *p++ = 'r';
-	  continue;
-	case '\033':		/* escape */
-	  *p++ = '\\';
-	  *p++ = 'e';
-	  continue;
-	case '\t':		/* tab */
-	  *p++ = '\\';
-	  *p++ = 't';
-	  continue;
-	case '\b':		/* backspace */
-	  *p++ = '\\';
-	  *p++ = 'b';
-	  continue;
-	default:		/* no change */
-	  *p++ = buf[i];
-	}
-
-      if (buf[i] < 26)
-	{			/* modify control characters */
-	  *p++ = '^';
-	  *p++ = buf[i] + 'A';
-	  continue;
-	}
-      if (buf[i] >= 128)
-	{			/* modify control characters */
-	  *p++ = '!';
-	  *p++ = buf[i] + 'A';
-	  continue;
-	}
-    }
-  *p = '\0';			/* terminate the string */
-
-  if (sr_get_debug () > level)
-    printf_unfiltered ("%s\n", newbuf);
-
-#ifdef LOG_FILE			/* write to the monitor log */
-  if (log_file != 0x0)
-    {
-      fputs (newbuf, log_file);
-      fputc ('\n', log_file);
-      fflush (log_file);
-    }
-#endif
-}
-
-/* readchar -- read a character from the remote system, doing all the fancy
- *    timeout stuff.
- */
-static int
-readchar (int timeout)
-{
-  int c;
-
-  c = serial_readchar (array_desc, abs (timeout));
-
-  if (sr_get_debug () > 5)
-    {
-      putchar (c & 0x7f);
-      debuglogs (5, "readchar: timeout = %d\n", timeout);
-    }
-
-#ifdef LOG_FILE
-  if (isascii (c))
-    putc (c & 0x7f, log_file);
-#endif
-
-  if (c >= 0)
-    return c & 0x7f;
-
-  if (c == SERIAL_TIMEOUT)
-    {
-      if (timeout <= 0)
-	return c;		/* Polls shouldn't generate timeout errors */
-      error ("Timeout reading from remote system.");
-#ifdef LOG_FILE
-      fputs ("ERROR: Timeout reading from remote system", log_file);
-#endif
-    }
-  perror_with_name ("readchar");
-}
-
-/* 
- * expect --  scan input from the remote system, until STRING is found.
- *      If DISCARD is non-zero, then discard non-matching input, else print
- *      it out. Let the user break out immediately.
- */
-static void
-expect (char *string, int discard)
-{
-  char *p = string;
-  int c;
-
-
-  debuglogs (1, "Expecting \"%s\".", string);
-
-  immediate_quit++;
-  while (1)
-    {
-      c = readchar (timeout);
-      if (!isascii (c))
-	continue;
-      if (c == *p++)
-	{
-	  if (*p == '\0')
-	    {
-	      immediate_quit--;
-	      debuglogs (4, "Matched");
-	      return;
-	    }
-	}
-      else
-	{
-	  if (!discard)
-	    {
-	      fputc_unfiltered (c, gdb_stdout);
-	    }
-	  p = string;
-	}
-    }
-}
-
-/* Keep discarding input until we see the MONITOR array_cmds->prompt.
-
-   The convention for dealing with the expect_prompt is that you
-   o give your command
-   o *then* wait for the expect_prompt.
-
-   Thus the last thing that a procedure does with the serial line
-   will be an expect_prompt().  Exception:  array_resume does not
-   wait for the expect_prompt, because the terminal is being handed over
-   to the inferior.  However, the next thing which happens after that
-   is a array_wait which does wait for the expect_prompt.
-   Note that this includes abnormal exit, e.g. error().  This is
-   necessary to prevent getting into states from which we can't
-   recover.  */
-static void
-expect_prompt (int discard)
-{
-  expect (ARRAY_PROMPT, discard);
-}
-
-/*
- * junk -- ignore junk characters. Returns a 1 if junk, 0 otherwise
- */
-static int
-junk (char ch)
-{
-  switch (ch)
-    {
-    case '\0':
-    case ' ':
-    case '-':
-    case '\t':
-    case '\r':
-    case '\n':
-      if (sr_get_debug () > 5)
-	debuglogs (5, "Ignoring \'%c\'.", ch);
-      return 1;
-    default:
-      if (sr_get_debug () > 5)
-	debuglogs (5, "Accepting \'%c\'.", ch);
-      return 0;
-    }
-}
-
-/* 
- *  get_hex_digit -- Get a hex digit from the remote system & return its value.
- *              If ignore is nonzero, ignore spaces, newline & tabs.
- */
-static int
-get_hex_digit (int ignore)
-{
-  static int ch;
-  while (1)
-    {
-      ch = readchar (timeout);
-      if (junk (ch))
-	continue;
-      if (sr_get_debug () > 4)
-	{
-	  debuglogs (4, "get_hex_digit() got a 0x%x(%c)", ch, ch);
-	}
-      else
-	{
-#ifdef LOG_FILE			/* write to the monitor log */
-	  if (log_file != 0x0)
-	    {
-	      fputs ("get_hex_digit() got a 0x", log_file);
-	      fputc (ch, log_file);
-	      fputc ('\n', log_file);
-	      fflush (log_file);
-	    }
-#endif
-	}
-
-      if (ch >= '0' && ch <= '9')
-	return ch - '0';
-      else if (ch >= 'A' && ch <= 'F')
-	return ch - 'A' + 10;
-      else if (ch >= 'a' && ch <= 'f')
-	return ch - 'a' + 10;
-      else if (ch == ' ' && ignore)
-	;
-      else
-	{
-	  expect_prompt (1);
-	  debuglogs (4, "Invalid hex digit from remote system. (0x%x)", ch);
-	  error ("Invalid hex digit from remote system. (0x%x)", ch);
-	}
-    }
-}
-
-/* get_hex_byte -- Get a byte from monitor and put it in *BYT. 
- *    Accept any number leading spaces.
- */
-static void
-get_hex_byte (char *byt)
-{
-  int val;
-
-  val = get_hex_digit (1) << 4;
-  debuglogs (4, "get_hex_byte() -- Read first nibble 0x%x", val);
-
-  val |= get_hex_digit (0);
-  debuglogs (4, "get_hex_byte() -- Read second nibble 0x%x", val);
-  *byt = val;
-
-  debuglogs (4, "get_hex_byte() -- Read a 0x%x", val);
-}
-
-/* 
- * get_hex_word --  Get N 32-bit words from remote, each preceded by a space,
- *      and put them in registers starting at REGNO.
- */
-static int
-get_hex_word (void)
-{
-  long val, newval;
-  int i;
-
-  val = 0;
-
-  for (i = 0; i < 8; i++)
-    val = (val << 4) + get_hex_digit (i == 0);
-
-  debuglogs (4, "get_hex_word() got a 0x%x.", val);
-
-  return val;
-}
-
-/* This is called not only when we first attach, but also when the
-   user types "run" after having attached.  */
-static void
-array_create_inferior (char *execfile, char *args, char **env)
-{
-  int entry_pt;
-
-  if (args && *args)
-    error ("Can't pass arguments to remote MONITOR process");
-
-  if (execfile == 0 || exec_bfd == 0)
-    error ("No executable file specified");
-
-  entry_pt = (int) bfd_get_start_address (exec_bfd);
-
-/* The "process" (board) is already stopped awaiting our commands, and
-   the program is already downloaded.  We just set its PC and go.  */
-
-  clear_proceed_status ();
-
-  /* Tell wait_for_inferior that we've started a new process.  */
-  init_wait_for_inferior ();
-
-  /* Set up the "saved terminal modes" of the inferior
-     based on what modes we are starting it with.  */
-  target_terminal_init ();
-
-  /* Install inferior's terminal modes.  */
-  target_terminal_inferior ();
-
-  /* insert_step_breakpoint ();  FIXME, do we need this?  */
-
-  /* Let 'er rip... */
-  proceed ((CORE_ADDR) entry_pt, TARGET_SIGNAL_DEFAULT, 0);
-}
-
-/*
- * array_open -- open a connection to a remote debugger.
- *      NAME is the filename used for communication.
- */
-static int baudrate = 9600;
-static char dev_name[100];
-
-static void
-array_open (char *args, char *name, int from_tty)
-{
-  char packet[PBUFSIZ];
-
-  if (args == NULL)
-    error ("Use `target %s DEVICE-NAME' to use a serial port, or \n\
-`target %s HOST-NAME:PORT-NUMBER' to use a network connection.", name, name);
-
-/*  if (is_open) */
-  array_close (0);
-
-  target_preopen (from_tty);
-  unpush_target (&array_ops);
-
-  tmp_mips_processor_type = "lsi33k";	/* change the default from r3051 */
-  mips_set_processor_type_command ("lsi33k", 0);
-
-  strcpy (dev_name, args);
-  array_desc = serial_open (dev_name);
-
-  if (array_desc == NULL)
-    perror_with_name (dev_name);
-
-  if (baud_rate != -1)
-    {
-      if (serial_setbaudrate (array_desc, baud_rate))
-	{
-	  serial_close (array_desc);
-	  perror_with_name (name);
-	}
-    }
-
-  serial_raw (array_desc);
-
-#if defined (LOG_FILE)
-  log_file = fopen (LOG_FILE, "w");
-  if (log_file == NULL)
-    perror_with_name (LOG_FILE);
-  fprintf (log_file, "GDB %s (%s", version, host_name);
-  fprintf (log_file, " --target %s)\n", array_ops.to_shortname);
-  fprintf (log_file, "Remote target %s connected to %s\n\n", array_ops.to_shortname, dev_name);
-#endif
-
-  /* see if the target is alive. For a ROM monitor, we can just try to force the
-     expect_prompt to print a few times. For the GDB remote protocol, the application
-     being debugged is sitting at a breakpoint and waiting for GDB to initialize
-     the connection. We force it to give us an empty packet to see if it's alive.
-   */
-  debuglogs (3, "Trying to ACK the target's debug stub");
-  /* unless your are on the new hardware, the old board won't initialize
-     because the '@' doesn't flush output like it does on the new ROMS.
-   */
-  printf_monitor ("@");		/* ask for the last signal */
-  expect_prompt (1);		/* See if we get a expect_prompt */
-#ifdef TEST_ARRAY		/* skip packet for testing */
-  make_gdb_packet (packet, "?");	/* ask for a bogus packet */
-  if (array_send_packet (packet) == 0)
-    error ("Couldn't transmit packet\n");
-  printf_monitor ("@\n");	/* force it to flush stdout */
-  expect_prompt (1);		/* See if we get a expect_prompt */
-#endif
-  push_target (&array_ops);
-  if (from_tty)
-    printf ("Remote target %s connected to %s\n", array_ops.to_shortname, dev_name);
-}
-
-/*
- * array_close -- Close out all files and local state before this
- *      target loses control.
- */
-
-static void
-array_close (int quitting)
-{
-  serial_close (array_desc);
-  array_desc = NULL;
-
-  debuglogs (1, "array_close (quitting=%d)", quitting);
-
-#if defined (LOG_FILE)
-  if (log_file)
-    {
-      if (ferror (log_file))
-	printf_filtered ("Error writing log file.\n");
-      if (fclose (log_file) != 0)
-	printf_filtered ("Error closing log file.\n");
-    }
-#endif
-}
-
-/* 
- * array_detach -- terminate the open connection to the remote
- *      debugger. Use this when you want to detach and do something
- *      else with your gdb.
- */
-static void
-array_detach (int from_tty)
-{
-
-  debuglogs (1, "array_detach ()");
-
-  pop_target ();		/* calls array_close to do the real work */
-  if (from_tty)
-    printf ("Ending remote %s debugging\n", target_shortname);
-}
-
-/*
- * array_attach -- attach GDB to the target.
- */
-static void
-array_attach (char *args, int from_tty)
-{
-  if (from_tty)
-    printf ("Starting remote %s debugging\n", target_shortname);
-
-  debuglogs (1, "array_attach (args=%s)", args);
-
-  printf_monitor ("go %x\n");
-  /* swallow the echo.  */
-  expect ("go %x\n", 1);
-}
-
-/*
- * array_resume -- Tell the remote machine to resume.
- */
-static void
-array_resume (ptid_t ptid, int step, enum target_signal sig)
-{
-  debuglogs (1, "array_resume (step=%d, sig=%d)", step, sig);
-
-  if (step)
-    {
-      printf_monitor ("s\n");
-    }
-  else
-    {
-      printf_monitor ("go\n");
-    }
-}
-
-#define TMPBUFSIZ 5
-
-/*
- * array_wait -- Wait until the remote machine stops, then return,
- *          storing status in status just as `wait' would.
- */
-static ptid_t
-array_wait (ptid_t ptid, struct target_waitstatus *status)
-{
-  int old_timeout = timeout;
-  int result, i;
-  char c;
-  struct serial *tty_desc;
-  serial_ttystate ttystate;
-
-  debuglogs (1, "array_wait (), printing extraneous text.");
-
-  status->kind = TARGET_WAITKIND_EXITED;
-  status->value.integer = 0;
-
-  timeout = 0;			/* Don't time out -- user program is running. */
-
-#if !defined(__GO32__) && !defined(__MSDOS__) && !defined(_WIN32)
-  tty_desc = serial_fdopen (0);
-  ttystate = serial_get_tty_state (tty_desc);
-  serial_raw (tty_desc);
-
-  i = 0;
-  /* poll on the serial port and the keyboard. */
-  while (1)
-    {
-      c = readchar (timeout);
-      if (c > 0)
-	{
-	  if (c == *(ARRAY_PROMPT + i))
-	    {
-	      if (++i >= strlen (ARRAY_PROMPT))
-		{		/* matched the prompt */
-		  debuglogs (4, "array_wait(), got the expect_prompt.");
-		  break;
-		}
-	    }
-	  else
-	    {			/* not the prompt */
-	      i = 0;
-	    }
-	  fputc_unfiltered (c, gdb_stdout);
-	  gdb_flush (gdb_stdout);
-	}
-      c = serial_readchar (tty_desc, timeout);
-      if (c > 0)
-	{
-	  serial_write (array_desc, &c, 1);
-	  /* do this so it looks like there's keyboard echo */
-	  if (c == 3)		/* exit on Control-C */
-	    break;
-#if 0
-	  fputc_unfiltered (c, gdb_stdout);
-	  gdb_flush (gdb_stdout);
-#endif
-	}
-    }
-  serial_set_tty_state (tty_desc, ttystate);
-#else
-  expect_prompt (1);
-  debuglogs (4, "array_wait(), got the expect_prompt.");
-#endif
-
-  status->kind = TARGET_WAITKIND_STOPPED;
-  status->value.sig = TARGET_SIGNAL_TRAP;
-
-  timeout = old_timeout;
-
-  return inferior_ptid;
-}
-
-/*
- * array_fetch_registers -- read the remote registers into the
- *      block regs.
- */
-static void
-array_fetch_registers (int ignored)
-{
-  char reg[MAX_REGISTER_SIZE];
-  int regno;
-  char *p;
-  char *packet = alloca (PBUFSIZ);
-
-  debuglogs (1, "array_fetch_registers (ignored=%d)\n", ignored);
-
-  memset (packet, 0, PBUFSIZ);
-  make_gdb_packet (packet, "g");
-  if (array_send_packet (packet) == 0)
-    error ("Couldn't transmit packet\n");
-  if (array_get_packet (packet) == 0)
-    error ("Couldn't receive packet\n");
-  /* FIXME: read bytes from packet */
-  debuglogs (4, "array_fetch_registers: Got a \"%s\" back\n", packet);
-  for (regno = 0; regno <= PC_REGNUM + 4; regno++)
-    {
-      /* supply register stores in target byte order, so swap here */
-      /* FIXME: convert from ASCII hex to raw bytes */
-      LONGEST i = ascii2hexword (packet + (regno * 8));
-      debuglogs (5, "Adding register %d = %x\n", regno, i);
-      store_unsigned_integer (&reg, REGISTER_RAW_SIZE (regno), i);
-      supply_register (regno, (char *) &reg);
-    }
-}
-
-/* 
- * This is unused by targets like this one that use a
- * protocol based on GDB's remote protocol.
- */
-static void
-array_fetch_register (int ignored)
-{
-  array_fetch_registers (0 /* ignored */);
-}
-
-/*
- * Get all the registers from the targets. They come back in a large array.
- */
-static void
-array_store_registers (int ignored)
-{
-  int regno;
-  unsigned long i;
-  char packet[PBUFSIZ];
-  char buf[PBUFSIZ];
-  char num[9];
-
-  debuglogs (1, "array_store_registers()");
-
-  memset (packet, 0, PBUFSIZ);
-  memset (buf, 0, PBUFSIZ);
-  buf[0] = 'G';
-
-  /* Unimplemented registers read as all bits zero.  */
-  /* FIXME: read bytes from packet */
-  for (regno = 0; regno < 41; regno++)
-    {				/* FIXME */
-      /* supply register stores in target byte order, so swap here */
-      /* FIXME: convert from ASCII hex to raw bytes */
-      i = (unsigned long) read_register (regno);
-      hexword2ascii (num, i);
-      strcpy (buf + (regno * 8) + 1, num);
-    }
-  *(buf + (regno * 8) + 2) = 0;
-  make_gdb_packet (packet, buf);
-  if (array_send_packet (packet) == 0)
-    error ("Couldn't transmit packet\n");
-  if (array_get_packet (packet) == 0)
-    error ("Couldn't receive packet\n");
-
-  registers_changed ();
-}
-
-/* 
- * This is unused by targets like this one that use a
- * protocol based on GDB's remote protocol.
- */
-static void
-array_store_register (int ignored)
-{
-  array_store_registers (0 /* ignored */);
-}
-
-/* Get ready to modify the registers array.  On machines which store
-   individual registers, this doesn't need to do anything.  On machines
-   which store all the registers in one fell swoop, this makes sure
-   that registers contains all the registers from the program being
-   debugged.  */
-
-static void
-array_prepare_to_store (void)
-{
-  /* Do nothing, since we can store individual regs */
-}
-
-static void
-array_files_info (void)
-{
-  printf ("\tAttached to %s at %d baud.\n",
-	  dev_name, baudrate);
-}
-
-/*
- * array_write_inferior_memory -- Copy LEN bytes of data from debugger
- *      memory at MYADDR to inferior's memory at MEMADDR.  Returns length moved.
- */
-static int
-array_write_inferior_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len)
-{
-  unsigned long i;
-  int j;
-  char packet[PBUFSIZ];
-  char buf[PBUFSIZ];
-  char num[9];
-  char *p;
-
-  debuglogs (1, "array_write_inferior_memory (memaddr=0x%x, myaddr=0x%x, len=%d)", memaddr, myaddr, len);
-  memset (buf, '\0', PBUFSIZ);	/* this also sets the string terminator */
-  p = buf;
-
-  *p++ = 'M';			/* The command to write memory */
-  hexword2ascii (num, memaddr);	/* convert the address */
-  strcpy (p, num);		/* copy the address */
-  p += 8;
-  *p++ = ',';			/* add comma delimeter */
-  hexword2ascii (num, len);	/* Get the length as a 4 digit number */
-  *p++ = num[4];
-  *p++ = num[5];
-  *p++ = num[6];
-  *p++ = num[7];
-  *p++ = ':';			/* add the colon delimeter */
-  for (j = 0; j < len; j++)
-    {				/* copy the data in after converting it */
-      *p++ = tohex ((myaddr[j] >> 4) & 0xf);
-      *p++ = tohex (myaddr[j] & 0xf);
-    }
-
-  make_gdb_packet (packet, buf);
-  if (array_send_packet (packet) == 0)
-    error ("Couldn't transmit packet\n");
-  if (array_get_packet (packet) == 0)
-    error ("Couldn't receive packet\n");
-
-  return len;
-}
-
-/*
- * array_read_inferior_memory -- read LEN bytes from inferior memory
- *      at MEMADDR.  Put the result at debugger address MYADDR.  Returns
- *      length moved.
- */
-static int
-array_read_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
-{
-  int j;
-  char buf[20];
-  char packet[PBUFSIZ];
-  int count;			/* Number of bytes read so far.  */
-  unsigned long startaddr;	/* Starting address of this pass.  */
-  int len_this_pass;		/* Number of bytes to read in this pass.  */
-
-  debuglogs (1, "array_read_inferior_memory (memaddr=0x%x, myaddr=0x%x, len=%d)", memaddr, myaddr, len);
-
-  /* Note that this code works correctly if startaddr is just less
-     than UINT_MAX (well, really CORE_ADDR_MAX if there was such a
-     thing).  That is, something like
-     array_read_bytes (CORE_ADDR_MAX - 4, foo, 4)
-     works--it never adds len To memaddr and gets 0.  */
-  /* However, something like
-     array_read_bytes (CORE_ADDR_MAX - 3, foo, 4)
-     doesn't need to work.  Detect it and give up if there's an attempt
-     to do that.  */
-  if (((memaddr - 1) + len) < memaddr)
-    {
-      errno = EIO;
-      return 0;
-    }
-
-  for (count = 0, startaddr = memaddr; count < len; startaddr += len_this_pass)
-    {
-      /* Try to align to 16 byte boundry (why?) */
-      len_this_pass = 16;
-      if ((startaddr % 16) != 0)
-	{
-	  len_this_pass -= startaddr % 16;
-	}
-      /* Only transfer bytes we need */
-      if (len_this_pass > (len - count))
-	{
-	  len_this_pass = (len - count);
-	}
-      /* Fetch the bytes */
-      debuglogs (3, "read %d bytes from inferior address %x", len_this_pass,
-		 startaddr);
-      sprintf (buf, "m%08lx,%04x", startaddr, len_this_pass);
-      make_gdb_packet (packet, buf);
-      if (array_send_packet (packet) == 0)
-	{
-	  error ("Couldn't transmit packet\n");
-	}
-      if (array_get_packet (packet) == 0)
-	{
-	  error ("Couldn't receive packet\n");
-	}
-      if (*packet == 0)
-	{
-	  error ("Got no data in the GDB packet\n");
-	}
-      /* Pick packet apart and xfer bytes to myaddr */
-      debuglogs (4, "array_read_inferior_memory: Got a \"%s\" back\n", packet);
-      for (j = 0; j < len_this_pass; j++)
-	{
-	  /* extract the byte values */
-	  myaddr[count++] = from_hex (*(packet + (j * 2))) * 16 + from_hex (*(packet + (j * 2) + 1));
-	  debuglogs (5, "myaddr[%d] set to %x\n", count - 1, myaddr[count - 1]);
-	}
-    }
-  return (count);
-}
-
-/* Transfer LEN bytes between GDB address MYADDR and target address
-   MEMADDR.  If WRITE is non-zero, transfer them to the target,
-   otherwise transfer them from the target.  TARGET is unused.
-
-   Returns the number of bytes transferred. */
-
-static int
-array_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
-		   struct mem_attrib *attrib, struct target_ops *target)
-{
-  if (write)
-    return array_write_inferior_memory (memaddr, myaddr, len);
-  else
-    return array_read_inferior_memory (memaddr, myaddr, len);
-}
-
-static void
-array_kill (char *args, int from_tty)
-{
-  return;			/* ignore attempts to kill target system */
-}
-
-/* Clean up when a program exits.
-   The program actually lives on in the remote processor's RAM, and may be
-   run again without a download.  Don't leave it full of breakpoint
-   instructions.  */
-
-static void
-array_mourn_inferior (void)
-{
-  remove_breakpoints ();
-  generic_mourn_inferior ();	/* Do all the proper things now */
-}
-
-#define MAX_ARRAY_BREAKPOINTS 16
-
-static CORE_ADDR breakaddr[MAX_ARRAY_BREAKPOINTS] =
-{0};
-
-/*
- * array_insert_breakpoint -- add a breakpoint
- */
-static int
-array_insert_breakpoint (CORE_ADDR addr, char *shadow)
-{
-  int i;
-  int bp_size = 0;
-  CORE_ADDR bp_addr = addr;
-
-  debuglogs (1, "array_insert_breakpoint() addr = 0x%x", addr);
-  BREAKPOINT_FROM_PC (&bp_addr, &bp_size);
-
-  for (i = 0; i <= MAX_ARRAY_BREAKPOINTS; i++)
-    {
-      if (breakaddr[i] == 0)
-	{
-	  breakaddr[i] = addr;
-	  if (sr_get_debug () > 4)
-	    printf ("Breakpoint at %s\n", paddr_nz (addr));
-	  array_read_inferior_memory (bp_addr, shadow, bp_size);
-	  printf_monitor ("b 0x%x\n", addr);
-	  expect_prompt (1);
-	  return 0;
-	}
-    }
-
-  fprintf_unfiltered (gdb_stderr, "Too many breakpoints (> 16) for monitor\n");
-  return 1;
-}
-
-/*
- * _remove_breakpoint -- Tell the monitor to remove a breakpoint
- */
-static int
-array_remove_breakpoint (CORE_ADDR addr, char *shadow)
-{
-  int i;
-
-  debuglogs (1, "array_remove_breakpoint() addr = 0x%x", addr);
-
-  for (i = 0; i < MAX_ARRAY_BREAKPOINTS; i++)
-    {
-      if (breakaddr[i] == addr)
-	{
-	  breakaddr[i] = 0;
-	  /* some monitors remove breakpoints based on the address */
-	  printf_monitor ("bd %x\n", i);
-	  expect_prompt (1);
-	  return 0;
-	}
-    }
-  fprintf_unfiltered (gdb_stderr,
-		      "Can't find breakpoint associated with 0x%s\n",
-		      paddr_nz (addr));
-  return 1;
-}
-
-static void
-array_stop (void)
-{
-  debuglogs (1, "array_stop()");
-  printf_monitor ("\003");
-  expect_prompt (1);
-}
-
-/* 
- * array_command -- put a command string, in args, out to MONITOR.
- *      Output from MONITOR is placed on the users terminal until the
- *      expect_prompt is seen. FIXME
- */
-static void
-monitor_command (char *args, int fromtty)
-{
-  debuglogs (1, "monitor_command (args=%s)", args);
-
-  if (array_desc == NULL)
-    error ("monitor target not open.");
-
-  if (!args)
-    error ("Missing command.");
-
-  printf_monitor ("%s\n", args);
-  expect_prompt (0);
-}
-
-/*
- * make_gdb_packet -- make a GDB packet. The data is always ASCII.
- *       A debug packet whose contents are <data>
- *       is encapsulated for transmission in the form:
- *
- *              $ <data> # CSUM1 CSUM2
- *
- *       <data> must be ASCII alphanumeric and cannot include characters
- *       '$' or '#'.  If <data> starts with two characters followed by
- *       ':', then the existing stubs interpret this as a sequence number.
- *
- *       CSUM1 and CSUM2 are ascii hex representation of an 8-bit 
- *       checksum of <data>, the most significant nibble is sent first.
- *       the hex digits 0-9,a-f are used.
- *
- */
-static void
-make_gdb_packet (char *buf, char *data)
-{
-  int i;
-  unsigned char csum = 0;
-  int cnt;
-  char *p;
-
-  debuglogs (3, "make_gdb_packet(%s)\n", data);
-  cnt = strlen (data);
-  if (cnt > PBUFSIZ)
-    error ("make_gdb_packet(): to much data\n");
-
-  /* start with the packet header */
-  p = buf;
-  *p++ = '$';
-
-  /* calculate the checksum */
-  for (i = 0; i < cnt; i++)
-    {
-      csum += data[i];
-      *p++ = data[i];
-    }
-
-  /* terminate the data with a '#' */
-  *p++ = '#';
-
-  /* add the checksum as two ascii digits */
-  *p++ = tohex ((csum >> 4) & 0xf);
-  *p++ = tohex (csum & 0xf);
-  *p = 0x0;			/* Null terminator on string */
-}
-
-/*
- * array_send_packet -- send a GDB packet to the target with error handling. We
- *              get a '+' (ACK) back if the packet is received and the checksum
- *              matches. Otherwise a '-' (NAK) is returned. It returns a 1 for a
- *              successful transmition, or a 0 for a failure.
- */
-static int
-array_send_packet (char *packet)
-{
-  int c, retries, i;
-  char junk[PBUFSIZ];
-
-  retries = 0;
-
-#if 0
-  /* scan the packet to make sure it only contains valid characters.
-     this may sound silly, but sometimes a garbled packet will hang
-     the target board. We scan the whole thing, then print the error
-     message.
-   */
-  for (i = 0; i < strlen (packet); i++)
-    {
-      debuglogs (5, "array_send_packet(): Scanning \'%c\'\n", packet[i]);
-      /* legit hex numbers or command */
-      if ((isxdigit (packet[i])) || (isalpha (packet[i])))
-	continue;
-      switch (packet[i])
-	{
-	case '+':		/* ACK */
-	case '-':		/* NAK */
-	case '#':		/* end of packet */
-	case '$':		/* start of packet */
-	  continue;
-	default:		/* bogus character */
-	  retries++;
-	  debuglogs (4, "array_send_packet(): Found a non-ascii digit \'%c\' in the packet.\n", packet[i]);
-	}
-    }
-#endif
-
-  if (retries > 0)
-    error ("Can't send packet, found %d non-ascii characters", retries);
-
-  /* ok, try to send the packet */
-  retries = 0;
-  while (retries++ <= 10)
-    {
-      printf_monitor ("%s", packet);
-
-      /* read until either a timeout occurs (-2) or '+' is read */
-      while (retries <= 10)
-	{
-	  c = readchar (-timeout);
-	  debuglogs (3, "Reading a GDB protocol packet... Got a '%c'\n", c);
-	  switch (c)
-	    {
-	    case '+':
-	      debuglogs (3, "Got Ack\n");
-	      return 1;
-	    case SERIAL_TIMEOUT:
-	      debuglogs (3, "Timed out reading serial port\n");
-	      printf_monitor ("@");	/* resync with the monitor */
-	      expect_prompt (1);	/* See if we get a expect_prompt */
-	      break;		/* Retransmit buffer */
-	    case '-':
-	      debuglogs (3, "Got NAK\n");
-	      printf_monitor ("@");	/* resync with the monitor */
-	      expect_prompt (1);	/* See if we get a expect_prompt */
-	      break;
-	    case '$':
-	      /* it's probably an old response, or the echo of our command.
-	       * just gobble up the packet and ignore it.
-	       */
-	      debuglogs (3, "Got a junk packet\n");
-	      i = 0;
-	      do
-		{
-		  c = readchar (timeout);
-		  junk[i++] = c;
-		}
-	      while (c != '#');
-	      c = readchar (timeout);
-	      junk[i++] = c;
-	      c = readchar (timeout);
-	      junk[i++] = c;
-	      junk[i++] = '\0';
-	      debuglogs (3, "Reading a junk packet, got a \"%s\"\n", junk);
-	      continue;		/* Now, go look for next packet */
-	    default:
-	      continue;
-	    }
-	  retries++;
-	  debuglogs (3, "Retransmitting packet \"%s\"\n", packet);
-	  break;		/* Here to retransmit */
-	}
-    }				/* outer while */
-  return 0;
-}
-
-/*
- * array_get_packet -- get a GDB packet from the target. Basically we read till we
- *              see a '#', then check the checksum. It returns a 1 if it's gotten a
- *              packet, or a 0 it the packet wasn't transmitted correctly.
- */
-static int
-array_get_packet (char *packet)
-{
-  int c;
-  int retries;
-  unsigned char csum;
-  unsigned char pktcsum;
-  char *bp;
-
-  csum = 0;
-  bp = packet;
-
-  memset (packet, 1, PBUFSIZ);
-  retries = 0;
-  while (retries <= 10)
-    {
-      do
-	{
-	  c = readchar (timeout);
-	  if (c == SERIAL_TIMEOUT)
-	    {
-	      debuglogs (3, "array_get_packet: got time out from serial port.\n");
-	    }
-	  debuglogs (3, "Waiting for a '$', got a %c\n", c);
-	}
-      while (c != '$');
-
-      retries = 0;
-      while (retries <= 10)
-	{
-	  c = readchar (timeout);
-	  debuglogs (3, "array_get_packet: got a '%c'\n", c);
-	  switch (c)
-	    {
-	    case SERIAL_TIMEOUT:
-	      debuglogs (3, "Timeout in mid-packet, retrying\n");
-	      return 0;
-	    case '$':
-	      debuglogs (3, "Saw new packet start in middle of old one\n");
-	      return 0;		/* Start a new packet, count retries */
-	    case '#':
-	      *bp = '\0';
-	      pktcsum = from_hex (readchar (timeout)) << 4;
-	      pktcsum |= from_hex (readchar (timeout));
-	      if (csum == 0)
-		debuglogs (3, "\nGDB packet checksum zero, must be a bogus packet\n");
-	      if (csum == pktcsum)
-		{
-		  debuglogs (3, "\nGDB packet checksum correct, packet data is \"%s\",\n", packet);
-		  printf_monitor ("@");
-		  expect_prompt (1);
-		  return 1;
-		}
-	      debuglogs (3, "Bad checksum, sentsum=0x%x, csum=0x%x\n", pktcsum, csum);
-	      return 0;
-	    case '*':		/* Run length encoding */
-	      debuglogs (5, "Run length encoding in packet\n");
-	      csum += c;
-	      c = readchar (timeout);
-	      csum += c;
-	      c = c - ' ' + 3;	/* Compute repeat count */
-
-	      if (c > 0 && c < 255 && bp + c - 1 < packet + PBUFSIZ - 1)
-		{
-		  memset (bp, *(bp - 1), c);
-		  bp += c;
-		  continue;
-		}
-	      *bp = '\0';
-	      printf_filtered ("Repeat count %d too large for buffer.\n", c);
-	      return 0;
-
-	    default:
-	      if ((!isxdigit (c)) && (!ispunct (c)))
-		debuglogs (4, "Got a non-ascii digit \'%c\'.\\n", c);
-	      if (bp < packet + PBUFSIZ - 1)
-		{
-		  *bp++ = c;
-		  csum += c;
-		  continue;
-		}
-
-	      *bp = '\0';
-	      puts_filtered ("Remote packet too long.\n");
-	      return 0;
-	    }
-	}
-    }
-  return 0;			/* exceeded retries */
-}
-
-/*
- * ascii2hexword -- convert an ascii number represented by 8 digits to a hex value.
- */
-static unsigned long
-ascii2hexword (unsigned char *mem)
-{
-  unsigned long val;
-  int i;
-  char buf[9];
-
-  val = 0;
-  for (i = 0; i < 8; i++)
-    {
-      val <<= 4;
-      if (mem[i] >= 'A' && mem[i] <= 'F')
-	val = val + mem[i] - 'A' + 10;
-      if (mem[i] >= 'a' && mem[i] <= 'f')
-	val = val + mem[i] - 'a' + 10;
-      if (mem[i] >= '0' && mem[i] <= '9')
-	val = val + mem[i] - '0';
-      buf[i] = mem[i];
-    }
-  buf[8] = '\0';
-  debuglogs (4, "ascii2hexword() got a 0x%x from %s(%x).\n", val, buf, mem);
-  return val;
-}
-
-/*
- * ascii2hexword -- convert a hex value to an ascii number represented by 8
- *      digits.
- */
-static void
-hexword2ascii (unsigned char *mem, unsigned long num)
-{
-  int i;
-  unsigned char ch;
-
-  debuglogs (4, "hexword2ascii() converting %x ", num);
-  for (i = 7; i >= 0; i--)
-    {
-      mem[i] = tohex ((num >> 4) & 0xf);
-      mem[i] = tohex (num & 0xf);
-      num = num >> 4;
-    }
-  mem[8] = '\0';
-  debuglogs (4, "\tto a %s", mem);
-}
-
-/* Convert hex digit A to a number.  */
-static int
-from_hex (int a)
-{
-  if (a == 0)
-    return 0;
-
-  debuglogs (4, "from_hex got a 0x%x(%c)\n", a, a);
-  if (a >= '0' && a <= '9')
-    return a - '0';
-  if (a >= 'a' && a <= 'f')
-    return a - 'a' + 10;
-  if (a >= 'A' && a <= 'F')
-    return a - 'A' + 10;
-  else
-    {
-      error ("Reply contains invalid hex digit 0x%x", a);
-    }
-}
-
-/* Convert number NIB to a hex digit.  */
-static int
-tohex (int nib)
-{
-  if (nib < 10)
-    return '0' + nib;
-  else
-    return 'a' + nib - 10;
-}
-
-/*
- * _initialize_remote_monitors -- setup a few addtitional commands that
- *              are usually only used by monitors.
- */
-void
-_initialize_remote_monitors (void)
-{
-  /* generic monitor command */
-  add_com ("monitor", class_obscure, monitor_command,
-	   "Send a command to the debug monitor.");
-
-}
-
-/*
- * _initialize_array -- do any special init stuff for the target.
- */
-void
-_initialize_array (void)
-{
-  init_array_ops ();
-  add_target (&array_ops);
-}
diff --git a/gdb/remote-fileio.h b/gdb/remote-fileio.h
index da248ec..68c6450 100644
--- a/gdb/remote-fileio.h
+++ b/gdb/remote-fileio.h
@@ -24,6 +24,8 @@
 #ifndef REMOTE_FILEIO_H
 #define REMOTE_FILEIO_H
 
+struct cmd_list_element;
+
 /* Unified interface to remote fileio, called in remote.c from
    remote_wait () and remote_async_wait () */
 extern void remote_fileio_request (char *buf);
diff --git a/gdb/remote-rdi.c b/gdb/remote-rdi.c
index 94cb676..a868f38 100644
--- a/gdb/remote-rdi.c
+++ b/gdb/remote-rdi.c
@@ -1065,8 +1065,8 @@
 
 /* A little dummy to make linking with the library succeed. */
 
-int
-Fail (void)
+void
+Fail (const char *ignored, ...)
 {
-  return 0;
+  
 }
diff --git a/gdb/remote.c b/gdb/remote.c
index d5a5cf6..492661b 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -126,7 +126,6 @@
 static int tohex (int nib);
 
 static void remote_detach (char *args, int from_tty);
-static void remote_async_detach (char *args, int from_tty);
 
 static void remote_interrupt (int signo);
 
@@ -2421,15 +2420,19 @@
   strcpy (buf, "D");
   remote_send (buf, (rs->remote_packet_size));
 
+  /* Unregister the file descriptor from the event loop. */
+  if (target_is_async_p ())
+    serial_async (remote_desc, NULL, 0);
+
   target_mourn_inferior ();
   if (from_tty)
     puts_filtered ("Ending remote debugging.\n");
-
 }
 
-/* Same as remote_detach, but with async support. */
+/* Same as remote_detach, but don't send the "D" packet; just disconnect.  */
+
 static void
-remote_async_detach (char *args, int from_tty)
+remote_disconnect (char *args, int from_tty)
 {
   struct remote_state *rs = get_remote_state ();
   char *buf = alloca (rs->remote_packet_size);
@@ -2437,10 +2440,6 @@
   if (args)
     error ("Argument given to \"detach\" when remotely debugging.");
 
-  /* Tell the remote target to detach.  */
-  strcpy (buf, "D");
-  remote_send (buf, (rs->remote_packet_size));
-
   /* Unregister the file descriptor from the event loop. */
   if (target_is_async_p ())
     serial_async (remote_desc, NULL, 0);
@@ -3532,16 +3531,19 @@
 static void
 remote_prepare_to_store (void)
 {
+  struct remote_state *rs = get_remote_state ();
+  int i;
+  char buf[MAX_REGISTER_SIZE];
+
   /* Make sure the entire registers array is valid.  */
   switch (remote_protocol_P.support)
     {
     case PACKET_DISABLE:
     case PACKET_SUPPORT_UNKNOWN:
-      /* NOTE: This isn't rs->sizeof_g_packet because here, we are
-         forcing the register cache to read its and not the target
-         registers.  */
-      deprecated_read_register_bytes (0, (char *) NULL,
-				      DEPRECATED_REGISTER_BYTES); /* OK */
+      /* Make sure all the necessary registers are cached.  */
+      for (i = 0; i < NUM_REGS; i++)
+	if (rs->regs[i].in_g_packet)
+	  regcache_raw_read (current_regcache, rs->regs[i].regnum, buf);
       break;
     case PACKET_ENABLE:
       break;
@@ -5435,6 +5437,7 @@
   remote_ops.to_open = remote_open;
   remote_ops.to_close = remote_close;
   remote_ops.to_detach = remote_detach;
+  remote_ops.to_disconnect = remote_disconnect;
   remote_ops.to_resume = remote_resume;
   remote_ops.to_wait = remote_wait;
   remote_ops.to_fetch_registers = remote_fetch_registers;
@@ -5855,6 +5858,7 @@
   remote_cisco_ops.to_open = remote_cisco_open;
   remote_cisco_ops.to_close = remote_cisco_close;
   remote_cisco_ops.to_detach = remote_detach;
+  remote_cisco_ops.to_disconnect = remote_disconnect;
   remote_cisco_ops.to_resume = remote_resume;
   remote_cisco_ops.to_wait = remote_cisco_wait;
   remote_cisco_ops.to_fetch_registers = remote_fetch_registers;
@@ -5950,7 +5954,8 @@
 Specify the serial device it is connected to (e.g. /dev/ttya).";
   remote_async_ops.to_open = remote_async_open;
   remote_async_ops.to_close = remote_close;
-  remote_async_ops.to_detach = remote_async_detach;
+  remote_async_ops.to_detach = remote_detach;
+  remote_async_ops.to_disconnect = remote_disconnect;
   remote_async_ops.to_resume = remote_async_resume;
   remote_async_ops.to_wait = remote_async_wait;
   remote_async_ops.to_fetch_registers = remote_fetch_registers;
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index 2e52ee5..e12a6be 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -2940,7 +2940,7 @@
 
   set_gdbarch_deprecated_fix_call_dummy (gdbarch, rs6000_fix_call_dummy);
   set_gdbarch_frame_align (gdbarch, rs6000_frame_align);
-  set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos);
+  set_gdbarch_deprecated_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos);
   set_gdbarch_deprecated_push_return_address (gdbarch, ppc_push_return_address);
   set_gdbarch_believe_pcc_promotion (gdbarch, 1);
 
diff --git a/gdb/s390-nat.c b/gdb/s390-nat.c
index 4dc8045..732cf94 100644
--- a/gdb/s390-nat.c
+++ b/gdb/s390-nat.c
@@ -60,20 +60,14 @@
     retval = PT_CR_9 + ((regnum - (S390_FIRST_CR + 9)) * S390_CR_SIZE);
   else
     {
-#ifdef GDBSERVER
-      error ("s390_register_u_addr invalid regnum %s %d regnum=%d",
-             __FILE__, (int) __LINE__, regnum);
-#else
       internal_error (__FILE__, __LINE__,
                       "s390_register_u_addr invalid regnum regnum=%d",
                       regnum);
-#endif
       retval = 0;
     }
   return retval + blockend;
 }
 
-#ifndef GDBSERVER
 /* watch_areas are required if you put 2 or more watchpoints on the same 
    address or overlapping areas gdb will call us to delete the watchpoint 
    more than once when we try to delete them.
@@ -362,4 +356,3 @@
 #error "libc files are inconsistent with linux/include/asm-s390/"
 #error "3) you didn't do a completely clean build & delete config.cache."
 #endif
-#endif /* GDBSERVER */
diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c
index e3bf677..87ddef0 100644
--- a/gdb/s390-tdep.c
+++ b/gdb/s390-tdep.c
@@ -84,7 +84,6 @@
     return S390_FP0_OFFSET + (((reg_nr) - S390_FP0_REGNUM) * S390_FPR_SIZE);
 }
 
-#ifndef GDBSERVER
 #define S390_MAX_INSTR_SIZE (6)
 #define S390_SYSCALL_OPCODE (0x0a)
 #define S390_SYSCALL_SIZE   (2)
@@ -1860,7 +1859,7 @@
   set_gdbarch_deprecated_pc_in_call_dummy (gdbarch, deprecated_pc_in_call_dummy_at_entry_point);
   set_gdbarch_frame_align (gdbarch, s390_frame_align);
   set_gdbarch_deprecated_push_arguments (gdbarch, s390_push_arguments);
-  set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos);
+  set_gdbarch_deprecated_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos);
   set_gdbarch_deprecated_push_return_address (gdbarch,
                                               s390_push_return_address);
   set_gdbarch_deprecated_sizeof_call_dummy_words (gdbarch, sizeof (s390_call_dummy_words));
@@ -1915,5 +1914,3 @@
   if (!deprecated_tm_print_insn)	/* Someone may have already set it */
     deprecated_tm_print_insn = gdb_print_insn_s390;
 }
-
-#endif /* GDBSERVER */
diff --git a/gdb/solib.c b/gdb/solib.c
index 6428a7c..82df65a 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -87,13 +87,19 @@
    (or set of directories, as in LD_LIBRARY_PATH) to search for all
    shared libraries if not found in SOLIB_ABSOLUTE_PREFIX.
 
-   Search order:
-   * If path is absolute, look in SOLIB_ABSOLUTE_PREFIX.
-   * If path is absolute or relative, look for it literally (unmodified).
+   Search algorithm:
+   * If there is a solib_absolute_prefix and path is absolute:
+   *   Search for solib_absolute_prefix/path.
+   * else
+   *   Look for it literally (unmodified).
    * Look in SOLIB_SEARCH_PATH.
    * If available, use target defined search function.
-   * Look in inferior's $PATH.
-   * Look in inferior's $LD_LIBRARY_PATH.
+   * If solib_absolute_prefix is NOT set, perform the following two searches:
+   *   Look in inferior's $PATH.
+   *   Look in inferior's $LD_LIBRARY_PATH.
+   *   
+   * The last check avoids doing this search when targetting remote
+   * machines since solib_absolute_prefix will almost always be set.
 
    RETURNS
 
@@ -148,7 +154,7 @@
         in_pathname++;
     }
   
-  /* If not found, next search the solib_search_path (if any).  */
+  /* If not found, search the solib_search_path (if any).  */
   if (found_file < 0 && solib_search_path != NULL)
     found_file = openp (solib_search_path,
 			1, in_pathname, O_RDONLY, 0, &temp_pathname);
@@ -167,13 +173,13 @@
                  (in_pathname, O_RDONLY, &temp_pathname);
 
   /* If not found, next search the inferior's $PATH environment variable. */
-  if (found_file < 0 && solib_search_path != NULL)
+  if (found_file < 0 && solib_absolute_prefix == NULL)
     found_file = openp (get_in_environ (inferior_environ, "PATH"),
 			1, in_pathname, O_RDONLY, 0, &temp_pathname);
 
   /* If not found, next search the inferior's $LD_LIBRARY_PATH 
      environment variable. */
-  if (found_file < 0 && solib_search_path != NULL)
+  if (found_file < 0 && solib_absolute_prefix == NULL)
     found_file = openp (get_in_environ (inferior_environ, "LD_LIBRARY_PATH"),
 			1, in_pathname, O_RDONLY, 0, &temp_pathname);
 
diff --git a/gdb/sparc-nat.c b/gdb/sparc-nat.c
index b634f6c..33145e0 100644
--- a/gdb/sparc-nat.c
+++ b/gdb/sparc-nat.c
@@ -108,7 +108,7 @@
 	= inferior_registers.r_pc;
       *(int *) &deprecated_registers[REGISTER_BYTE (NPC_REGNUM)]
 	= inferior_registers.r_npc;
-      *(int *) &registers[REGISTER_BYTE (Y_REGNUM)] = inferior_registers.r_y;
+      *(int *) &deprecated_registers[REGISTER_BYTE (Y_REGNUM)] = inferior_registers.r_y;
 
       for (i = G0_REGNUM; i <= O7_REGNUM; i++)
 	deprecated_register_valid[i] = 1;
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 0fab10f..3b7ebc2 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -1807,11 +1807,7 @@
       char *val = sect_opts[i].value;
       char *sec = sect_opts[i].name;
  
-      val = sect_opts[i].value;
-      if (val[0] == '0' && val[1] == 'x')
-	addr = strtoul (val+2, NULL, 16);
-      else
-	addr = strtoul (val, NULL, 10);
+      addr = parse_and_eval_address (val);
 
       /* Here we store the section offsets in the order they were
          entered on the command line. */
@@ -1967,6 +1963,7 @@
 	      objfile->psymtabs = NULL;
 	      objfile->free_psymtabs = NULL;
 	      objfile->msymbols = NULL;
+	      objfile->sym_private = NULL;
 	      objfile->minimal_symbol_count = 0;
 	      memset (&objfile->msymbol_hash, 0,
 		      sizeof (objfile->msymbol_hash));
diff --git a/gdb/target.c b/gdb/target.c
index fd0165a..e738208 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -95,6 +95,8 @@
 
 static void debug_to_detach (char *, int);
 
+static void debug_to_disconnect (char *, int);
+
 static void debug_to_resume (ptid_t, int, enum target_signal);
 
 static ptid_t debug_to_wait (ptid_t, struct target_waitstatus *);
@@ -371,6 +373,9 @@
   de_fault (to_detach, 
 	    (void (*) (char *, int)) 
 	    target_ignore);
+  de_fault (to_disconnect, 
+	    (void (*) (char *, int)) 
+	    tcomplain);
   de_fault (to_resume, 
 	    (void (*) (ptid_t, int, enum target_signal)) 
 	    noprocess);
@@ -556,6 +561,7 @@
       INHERIT (to_attach, t);
       INHERIT (to_post_attach, t);
       INHERIT (to_detach, t);
+      INHERIT (to_disconnect, t);
       INHERIT (to_resume, t);
       INHERIT (to_wait, t);
       INHERIT (to_post_wait, t);
@@ -1141,6 +1147,16 @@
 }
 
 void
+target_disconnect (char *args, int from_tty)
+{
+  /* Handle any optimized stores to the inferior.  */
+#ifdef DO_DEFERRED_STORES
+  DO_DEFERRED_STORES;
+#endif
+  (current_target.to_disconnect) (args, from_tty);
+}
+
+void
 target_link (char *modname, CORE_ADDR *t_reloc)
 {
   if (STREQ (current_target.to_shortname, "rombug"))
@@ -1562,6 +1578,15 @@
 }
 
 static void
+debug_to_disconnect (char *args, int from_tty)
+{
+  debug_target.to_disconnect (args, from_tty);
+
+  fprintf_unfiltered (gdb_stdlog, "target_disconnect (%s, %d)\n",
+		      args, from_tty);
+}
+
+static void
 debug_to_resume (ptid_t ptid, int step, enum target_signal siggnal)
 {
   debug_target.to_resume (ptid, step, siggnal);
@@ -2202,6 +2227,7 @@
   current_target.to_attach = debug_to_attach;
   current_target.to_post_attach = debug_to_post_attach;
   current_target.to_detach = debug_to_detach;
+  current_target.to_disconnect = debug_to_disconnect;
   current_target.to_resume = debug_to_resume;
   current_target.to_wait = debug_to_wait;
   current_target.to_post_wait = debug_to_post_wait;
diff --git a/gdb/target.h b/gdb/target.h
index c2d8793..a3e10e8 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -198,6 +198,7 @@
     void (*to_attach) (char *, int);
     void (*to_post_attach) (int);
     void (*to_detach) (char *, int);
+    void (*to_disconnect) (char *, int);
     void (*to_resume) (ptid_t, int, enum target_signal);
     ptid_t (*to_wait) (ptid_t, struct target_waitstatus *);
     void (*to_post_wait) (ptid_t, int);
@@ -414,6 +415,11 @@
 
 extern void target_detach (char *, int);
 
+/* Disconnect from the current target without resuming it (leaving it
+   waiting for a debugger).  */
+
+extern void target_disconnect (char *, int);
+
 /* Resume execution of the target process PTID.  STEP says whether to
    single-step or to run free; SIGGNAL is the signal to be given to
    the target, or TARGET_SIGNAL_0 for no signal.  The caller may not
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 4392f54..8a1a411 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,40 @@
+2003-06-22  Daniel Jacobowitz  <drow@mvista.com>
+
+	* gdb.base/relocate.exp: Test add-symbol-file with a variable
+	offset.
+
+2003-06-22  Daniel Jacobowitz  <drow@mvista.com>
+
+	* gdb.c++/pr-1210.cc: New file.
+	* gdb.c++/pr-1210.exp: New file.
+
+2003-06-21  Daniel Jacobowitz  <drow@mvista.com>
+
+	* lib/mi-support.exp (mi_run_cmd): Expect an MI response to
+	000-exec-continue.
+
+2003-06-15  Mark Kettenis  <kettenis@gnu.org>
+
+	* gdb.base/attach.exp: Use -1 for the ID of a nonexistent process
+	on *-*-*bsd* instead of *-*-freebsd*.
+
+2003-06-14  Andrew Cagney  <cagney@redhat.com>
+
+	* gdb.base/store.exp: Test longest and doublest.  Test all
+	parameters.  Weaken return statement match.
+	* gdb.base/store.c: Add longest and doublest - aka long long and
+	long double functions.  Put all parameters into local register
+	variables.  Use negative values.
+
+2003-06-14  Andrew Cagney  <cagney@redhat.com>
+
+	* gdb.base/fileio.c: Include <errno.h>, and <sys/wait.h>.  Gag
+	-Wformat errors.  Add lost line.  Use WEXITSTATUS to get system
+	exit status.
+	* gdb.base/fileio.exp: Disable target when nointerrupts and
+	noinferiorio, instead of limiting it to remote.  Use remote_exec
+	instead of system.
+	
 2003-06-12  Jeff Johnston  <jjohnstn@redhat.com>
 
 	* gdb.base/float.exp: Add ia64 support.
diff --git a/gdb/testsuite/gdb.base/attach.exp b/gdb/testsuite/gdb.base/attach.exp
index 6adb6e3..66e9f0e 100644
--- a/gdb/testsuite/gdb.base/attach.exp
+++ b/gdb/testsuite/gdb.base/attach.exp
@@ -111,9 +111,10 @@
    # the default.  However, there are a few exceptions.
    #
    set boguspid 0
-   if { [istarget "*-*-freebsd*"] } {
+   if { [istarget "*-*-*bsd*"] } {
        # In FreeBSD 5.0, PID 0 is used for "swapper".  Use -1 instead
-       # (which should have the desired effect on any version of FreeBSD).
+       # (which should have the desired effect on any version of
+       # FreeBSD, and probably other *BSD's too).
        set boguspid -1
    }
    send_gdb "attach $boguspid\n"
diff --git a/gdb/testsuite/gdb.base/fileio.c b/gdb/testsuite/gdb.base/fileio.c
index fd410cd..591b3b6 100644
--- a/gdb/testsuite/gdb.base/fileio.c
+++ b/gdb/testsuite/gdb.base/fileio.c
@@ -6,8 +6,9 @@
 #include <sys/fcntl.h>
 #include <sys/stat.h>
 #include <sys/time.h>
-/**************************************************************************
- * TESTS :
+#include <errno.h>
+#include <sys/wait.h>
+/* TESTS :
  * - open(const char *pathname, int flags, mode_t mode);
 1) Attempt to create file that already exists - EEXIST
 2) Attempt to open a directory for writing - EISDIR
@@ -53,15 +54,14 @@
 Not applicable.
 
 system (const char * string);
-1) Invalid string/command. -  returns 127.
+1) Invalid string/command. -  returns 127.  */
 
- ***************************************************************************/
+static const char *strerrno (int err);
 
 #define FILENAME    "foo.fileio.test"
 #define RENAMED     "bar.fileio.test"
 #define NONEXISTANT "nofoo.fileio.test"
 #define NOWRITE     "nowrt.fileio.test"
-
 #define TESTDIR1     "dir1.fileio.test"
 #define TESTDIR2     "dir2.fileio.test"
 #define TESTSUBDIR   "dir1.fileio.test/subdir.fileio.test"
@@ -84,21 +84,21 @@
   errno = 0;
   ret = open (FILENAME, O_CREAT | O_EXCL | O_WRONLY, S_IWUSR | S_IRUSR);
   printf ("open 2: ret = %d, errno = %d %s\n", ret, errno,
-	  errno == EEXIST ? "OK" : "");
+	  strerrno (errno));
   if (ret >= 0)
     close (ret);
   /* Open directory (for writing) */
   errno = 0;
   ret = open (".", O_WRONLY);
   printf ("open 3: ret = %d, errno = %d %s\n", ret, errno,
-	  errno == EISDIR ? "OK" : "");
+	  strerrno (errno));
   if (ret >= 0)
     close (ret);
   /* Opening nonexistant file */
   errno = 0;
   ret = open (NONEXISTANT, O_RDONLY);
   printf ("open 4: ret = %d, errno = %d %s\n", ret, errno,
-	  errno == ENOENT ? "OK" : "");
+	  strerrno (errno));
   if (ret >= 0)
     close (ret);
   /* Open for write but no write permission */
@@ -110,7 +110,7 @@
       errno = 0;
       ret = open (NOWRITE, O_WRONLY);
       printf ("open 5: ret = %d, errno = %d %s\n", ret, errno,
-	      errno == EACCES ? "OK" : "");
+	      strerrno (errno));
       if (ret >= 0)
 	close (ret);
     }
@@ -140,7 +140,7 @@
   errno = 0;
   ret = write (999, STRING, strlen (STRING));
   printf ("write 2: ret = %d, errno = %d, %s\n", ret, errno,
-	  errno == EBADF ? "OK" : "");
+	  strerrno (errno));
   /* Write to a read-only file */
   errno = 0;
   fd = open (FILENAME, O_RDONLY);
@@ -149,7 +149,7 @@
       errno = 0;
       ret = write (fd, STRING, strlen (STRING));
       printf ("write 3: ret = %d, errno = %d %s\n", ret, errno,
-	      errno == EBADF ? "OK" : "");
+	      strerrno (errno));
     }
   else
     printf ("write 3: ret = %d, errno = %d\n", ret, errno);
@@ -182,14 +182,14 @@
   errno = 0;
   ret = read (999, buf, 16);
   printf ("read 2: ret = %d, errno = %d %s\n", ret, errno,
-	  errno == EBADF ? "OK" : "");
+	  strerrno (errno));
 }
 
 int
 test_lseek ()
 {
   int fd;
-  off_t ret;
+  off_t ret = 0;
 
   /* Test seeking */
   errno = 0;
@@ -198,15 +198,15 @@
     {
       errno = 0;
       ret = lseek (fd, 0, SEEK_CUR);
-      printf ("lseek 1: ret = %ld, errno = %d, %s\n", ret, errno,
+      printf ("lseek 1: ret = %ld, errno = %d, %s\n", (long) ret, errno,
               ret == 0 ? "OK" : "");
       errno = 0;
       ret = lseek (fd, 0, SEEK_END);
-      printf ("lseek 2: ret = %ld, errno = %d, %s\n", ret, errno,
+      printf ("lseek 2: ret = %ld, errno = %d, %s\n", (long) ret, errno,
               ret == 11 ? "OK" : "");
       errno = 0;
       ret = lseek (fd, 3, SEEK_SET);
-      printf ("lseek 3: ret = %ld, errno = %d, %s\n", ret, errno,
+      printf ("lseek 3: ret = %ld, errno = %d, %s\n", (long) ret, errno,
               ret == 3 ? "OK" : "");
       close (fd);
     }
@@ -232,7 +232,7 @@
     {
       errno = 0;
       ret = close (fd);
-      printf ("close 1: ret = %ld, errno = %d, %s\n", ret, errno,
+      printf ("close 1: ret = %d, errno = %d, %s\n", ret, errno,
               ret == 0 ? "OK" : "");
     }
   else
@@ -240,8 +240,8 @@
   /* Close an invalid file descriptor */
   errno = 0;
   ret = close (999);
-  printf ("close 2: ret = %ld, errno = %d, %s\n", ret, errno,
-  	  errno == EBADF ? "OK" : "");
+  printf ("close 2: ret = %d, errno = %d, %s\n", ret, errno,
+  	  strerrno (errno));
 }
 
 int
@@ -262,17 +262,17 @@
   errno = 0;
   ret = stat (NULL, &st);
   printf ("stat 2: ret = %d, errno = %d %s\n", ret, errno,
-  	  errno == ENOENT ? "OK" : "");
+  	  strerrno (errno));
   /* Empty pathname */
   errno = 0;
   ret = stat ("", &st);
   printf ("stat 3: ret = %d, errno = %d %s\n", ret, errno,
-  	  errno == ENOENT ? "OK" : "");
+  	  strerrno (errno));
   /* Nonexistant file */
   errno = 0;
   ret = stat (NONEXISTANT, &st);
   printf ("stat 4: ret = %d, errno = %d %s\n", ret, errno,
-  	  errno == ENOENT ? "OK" : "");
+  	  strerrno (errno));
 }
 
 int
@@ -301,7 +301,7 @@
   errno = 0;
   ret = fstat (999, &st);
   printf ("fstat 2: ret = %d, errno = %d %s\n", ret, errno,
-	  errno == EBADF ? "OK" : "");
+  	  strerrno (errno));
 }
 
 int
@@ -326,6 +326,7 @@
     printf ("isatty 5: file couldn't open\n");
 }
 
+
 int
 test_system ()
 {
@@ -344,7 +345,7 @@
     printf ("system 1: ret = %d %s\n", ret, ret == 0 ? "OK" : "");
   /* Invalid command (just guessing ;-) ) */
   ret = system ("wrtzlpfrmpft");
-  printf ("system 2: ret = %d %s\n", ret, ret == 127 ? "OK" : "");
+  printf ("system 2: ret = %d %s\n", ret, WEXITSTATUS (ret) == 127 ? "OK" : "");
 }
 
 int
@@ -365,7 +366,7 @@
 	  errno = 0;
 	  ret = stat (RENAMED, &st);
 	  printf ("rename 1: ret = %d, errno = %d %s\n", ret, errno,
-		  errno == 0 ? "OK" : "");
+		  strerrno (errno));
 	  errno = 0;
 	}
       else
@@ -377,22 +378,22 @@
   errno = 0;
   ret = rename (RENAMED, TESTDIR2);
   printf ("rename 2: ret = %d, errno = %d %s\n", ret, errno,
-          errno == EISDIR ? "OK" : "");
+	  strerrno (errno));
   /* newpath is a non-empty directory */
   errno = 0;
   ret = rename (TESTDIR2, TESTDIR1);
   printf ("rename 3: ret = %d, errno = %d %s\n", ret, errno,
-          errno == ENOTEMPTY || errno == EEXIST ? "OK" : "");
+          strerrno (errno));
   /* newpath is a subdirectory of old path */
   errno = 0;
   ret = rename (TESTDIR1, TESTSUBDIR);
   printf ("rename 4: ret = %d, errno = %d %s\n", ret, errno,
-          errno == EINVAL ? "OK" : "");
+	  strerrno (errno));
   /* oldpath does not exist */
   errno = 0;
   ret = rename (NONEXISTANT, FILENAME);
   printf ("rename 5: ret = %d, errno = %d %s\n", ret, errno,
-          errno == ENOENT ? "OK" : "");
+	  strerrno (errno));
 }
 
 int
@@ -406,7 +407,7 @@
   errno = 0;
   ret = unlink (RENAMED);
   printf ("unlink 1: ret = %d, errno = %d %s\n", ret, errno,
-          errno == 0 ? "OK" : "");
+	  strerrno (errno));
   /* No write access */
   sprintf (name, "%s/%s", TESTDIR2, FILENAME);
   errno = 0;
@@ -420,7 +421,7 @@
 	  errno = 0;
 	  ret = unlink (name);
 	  printf ("unlink 2: ret = %d, errno = %d %s\n", ret, errno,
-		  errno == EACCES ? "OK" : "");
+		  strerrno (errno));
         }
       else
 	printf ("unlink 2: ret = %d chmod failed\n", ret, errno);
@@ -431,7 +432,7 @@
   errno = 0;
   ret = unlink (NONEXISTANT);
   printf ("unlink 3: ret = %d, errno = %d %s\n", ret, errno,
-          errno == ENOENT ? "OK" : "");
+          strerrno (errno));
 }
 
 int
@@ -441,11 +442,45 @@
 
   errno = 0;
   ret = time (&t);
-  printf ("time 1: ret = %d, errno = %d, t = %d %s\n", ret, errno, t, ret == t ? "OK" : "");
+  printf ("time 1: ret = %ld, errno = %d, t = %ld %s\n", (long) ret, errno, (long) t, ret == t ? "OK" : "");
   errno = 0;
   ret = time (NULL);
-  printf ("time 2: ret = %d, errno = %d, t = %d %s\n", ret, errno, t,
-          ret >= t && ret < t + 10 ? "OK" : "");
+  printf ("time 2: ret = %ld, errno = %d, t = %ld %s\n",
+	  (long) ret, errno, (long) t, ret >= t && ret < t + 10 ? "OK" : "");
+}
+
+static const char *
+strerrno (int err)
+{
+  switch (err)
+    {
+    case 0: return "OK";
+#ifdef EACCES
+    case EACCES: return "EACCES";
+#endif
+#ifdef EBADF
+    case EBADF: return "EBADF";
+#endif
+#ifdef EEXIST
+    case EEXIST: return "EEXIST";
+#endif
+#ifdef EFAULT
+    case EFAULT: return "EFAULT";
+#endif
+#ifdef EINVAL
+    case EINVAL: return "EINVAL";
+#endif
+#ifdef EISDIR
+    case EISDIR: return "EISDIR";
+#endif
+#ifdef ENOENT
+    case ENOENT: return "ENOENT";
+#endif
+#ifdef ENOTEMPTY
+    case ENOTEMPTY: return "ENOTEMPTY";
+#endif
+    default: return "E??";
+    }
 }
 
 int
diff --git a/gdb/testsuite/gdb.base/fileio.exp b/gdb/testsuite/gdb.base/fileio.exp
index 49e8c38..279f1ab 100644
--- a/gdb/testsuite/gdb.base/fileio.exp
+++ b/gdb/testsuite/gdb.base/fileio.exp
@@ -20,6 +20,15 @@
 
 # This file was written by Corinna Vinschen <vinschen@redhat.com>
 
+if [target_info exists gdb,nointerrupts] {
+    verbose "Skipping interrupt.exp because of nointerrupts."
+    continue
+}
+
+if [target_info exists gdb,noinferiorio] {
+    verbose "Skipping interrupt.exp because of noinferiorio."
+    return
+}
 
 if $tracelevel then {
         strace $tracelevel
@@ -32,11 +41,6 @@
 set srcfile ${testfile}.c
 set binfile ${objdir}/${subdir}/${testfile}
 
-# test only on a remote target board
-if {! [is_remote target]} {
-    return 0;
-}
-
 if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
     gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
 }
@@ -48,8 +52,8 @@
     return -1;
 }
 
-catch "system \"chmod -f +w dir2.fileio.test\""
-catch "system \"rm -rf *.fileio.test\""
+remote_exec build "test -r dir2.fileio.test && chmod -f +w dir2.fileio.test"
+remote_exec build "rm -rf *.fileio.test"
 
 set oldtimeout $timeout
 set timeout [expr "$timeout + 60"]
@@ -77,17 +81,17 @@
 
 send_gdb "tbreak 88\n" ; gdb_expect -re "$gdb_prompt $"
 gdb_test continue \
-"Continuing\\..*open 2:.*OK.*test_open \\(\\) at.*$srcfile:88.*" \
+"Continuing\\..*open 2:.*EEXIST.*test_open \\(\\) at.*$srcfile:88.*" \
 "Creating already existing file returns EEXIST"
 
 send_gdb "tbreak 95\n" ; gdb_expect -re "$gdb_prompt $"
 gdb_test continue \
-"Continuing\\..*open 3:.*OK.*test_open \\(\\) at.*$srcfile:95.*" \
+"Continuing\\..*open 3:.*EISDIR.*test_open \\(\\) at.*$srcfile:95.*" \
 "Open directory for writing returns EISDIR"
 
 send_gdb "tbreak 102\n" ; gdb_expect -re "$gdb_prompt $"
 gdb_test continue \
-"Continuing\\..*open 4:.*OK.*test_open \\(\\) at.*$srcfile:102.*" \
+"Continuing\\..*open 4:.*ENOENT.*test_open \\(\\) at.*$srcfile:102.*" \
 "Opening nonexistant file returns ENOENT"
 
 send_gdb "tbreak 109\n" ; gdb_expect -re "$gdb_prompt $"
@@ -96,7 +100,7 @@
 
 send_gdb "tbreak 119\n" ; gdb_expect -re "$gdb_prompt $"
 gdb_test continue \
-"Continuing\\..*open 5:.*OK.*test_open \\(\\) at.*$srcfile:119.*" \
+"Continuing\\..*open 5:.*EACCES.*test_open \\(\\) at.*$srcfile:119.*" \
 "Open for write but no write permission returns EACCES"
 
 send_gdb "tbreak 140\n" ; gdb_expect -re "$gdb_prompt $"
@@ -106,12 +110,12 @@
 
 send_gdb "tbreak 145\n" ; gdb_expect -re "$gdb_prompt $"
 gdb_test continue \
-"Continuing\\..*write 2:.*OK.*test_write \\(\\) at.*$srcfile:145.*" \
+"Continuing\\..*write 2:.*EBADF.*test_write \\(\\) at.*$srcfile:145.*" \
 "Write using invalid file descriptor returns EBADF"
 
 send_gdb "tbreak 156\n" ; gdb_expect -re "$gdb_prompt $"
 gdb_test continue \
-"Continuing\\..*write 3:.*OK.*test_write \\(\\) at.*$srcfile:156.*" \
+"Continuing\\..*write 3:.*EBADF.*test_write \\(\\) at.*$srcfile:156.*" \
 "Writing to a read-only file returns EBADF"
 
 send_gdb "tbreak 182\n" ; gdb_expect -re "$gdb_prompt $"
@@ -121,7 +125,7 @@
 
 send_gdb "tbreak 186\n" ; gdb_expect -re "$gdb_prompt $"
 gdb_test continue \
-"Continuing\\..*read 2:.*OK.*test_read \\(\\) at.*$srcfile:186.*" \
+"Continuing\\..*read 2:.*EBADF.*test_read \\(\\) at.*$srcfile:186.*" \
 "Read using invalid file descriptor returns EBADF"
 
 send_gdb "tbreak 221\n" ; gdb_expect -re "$gdb_prompt $"
@@ -136,7 +140,7 @@
 
 send_gdb "tbreak 245\n" ; gdb_expect -re "$gdb_prompt $"
 gdb_test continue \
-"Continuing\\..*close 2:.*OK.*test_close \\(\\) at.*$srcfile:245.*" \
+"Continuing\\..*close 2:.*EBADF.*test_close \\(\\) at.*$srcfile:245.*" \
 "Closing an invalid file descriptor returns EBADF"
 
 send_gdb "tbreak 262\n" ; gdb_expect -re "$gdb_prompt $"
@@ -146,17 +150,17 @@
 
 send_gdb "tbreak 267\n" ; gdb_expect -re "$gdb_prompt $"
 gdb_test continue \
-"Continuing\\..*stat 2:.*OK.*test_stat \\(\\) at.*$srcfile:267.*" \
-"Stat a NULL pathname returns ENOENT"
+	"Continuing\\..*stat 2:.*(ENOENT|EFAULT).*test_stat \\(\\) at.*$srcfile:267.*" \
+"Stat a NULL pathname returns ENOENT or EFAULT"
 
 send_gdb "tbreak 272\n" ; gdb_expect -re "$gdb_prompt $"
 gdb_test continue \
-"Continuing\\..*stat 3:.*OK.*test_stat \\(\\) at.*$srcfile:272.*" \
+"Continuing\\..*stat 3:.*ENOENT.*test_stat \\(\\) at.*$srcfile:272.*" \
 "Stat an empty pathname returns ENOENT"
 
 send_gdb "tbreak 276\n" ; gdb_expect -re "$gdb_prompt $"
 gdb_test continue \
-"Continuing\\..*stat 4:.*OK.*test_stat \\(\\) at.*$srcfile:276.*" \
+"Continuing\\..*stat 4:.*ENOENT.*test_stat \\(\\) at.*$srcfile:276.*" \
 "Stat a nonexistant file returns ENOENT"
 
 send_gdb "tbreak 301\n" ; gdb_expect -re "$gdb_prompt $"
@@ -166,7 +170,7 @@
 
 send_gdb "tbreak 305\n" ; gdb_expect -re "$gdb_prompt $"
 gdb_test continue \
-"Continuing\\..*fstat 2:.*OK.*test_fstat \\(\\) at.*$srcfile:305.*" \
+"Continuing\\..*fstat 2:.*EBADF.*test_fstat \\(\\) at.*$srcfile:305.*" \
 "Fstat an invalid file descriptor returns EBADF"
 
 send_gdb "tbreak 314\n" ; gdb_expect -re "$gdb_prompt $"
@@ -200,6 +204,7 @@
 "Continuing\\..*system 1:.*OK.*test_system \\(\\) at.*$srcfile:347.*" \
 "System(3) call"
 
+# Is this ok?  POSIX says system returns a waitpid status?
 send_gdb "tbreak 349\n" ; gdb_expect -re "$gdb_prompt $"
 gdb_test continue \
 "Continuing\\..*system 2:.*OK.*test_system \\(\\) at.*$srcfile:349.*" \
@@ -212,22 +217,22 @@
 
 send_gdb "tbreak 383\n" ; gdb_expect -re "$gdb_prompt $"
 gdb_test continue \
-"Continuing\\..*rename 2:.*OK.*test_rename \\(\\) at.*$srcfile:383.*" \
+"Continuing\\..*rename 2:.*EISDIR.*test_rename \\(\\) at.*$srcfile:383.*" \
 "Renaming a file to existing directory returns EISDIR"
 
 send_gdb "tbreak 388\n" ; gdb_expect -re "$gdb_prompt $"
 gdb_test continue \
-"Continuing\\..*rename 3:.*OK.*test_rename \\(\\) at.*$srcfile:388.*" \
+	"Continuing\\..*rename 3:.*(ENOTEMPTY|EEXIST).*test_rename \\(\\) at.*$srcfile:388.*" \
 "Renaming a directory to a non-empty directory returns ENOTEMPTY or EEXIST"
 
 send_gdb "tbreak 393\n" ; gdb_expect -re "$gdb_prompt $"
 gdb_test continue \
-"Continuing\\..*rename 4:.*OK.*test_rename \\(\\) at.*$srcfile:393.*" \
+"Continuing\\..*rename 4:.*EINVAL.*test_rename \\(\\) at.*$srcfile:393.*" \
 "Renaming a directory to a subdir of itself returns EINVAL"
 
 send_gdb "tbreak 397\n" ; gdb_expect -re "$gdb_prompt $"
 gdb_test continue \
-"Continuing\\..*rename 5:.*OK.*test_rename \\(\\) at.*$srcfile:397.*" \
+"Continuing\\..*rename 5:.*ENOENT.*test_rename \\(\\) at.*$srcfile:397.*" \
 "Renaming a nonexistant file returns ENOENT"
 
 send_gdb "tbreak 412\n" ; gdb_expect -re "$gdb_prompt $"
@@ -242,12 +247,12 @@
     setup_xfail "*-*-*"
 }
 gdb_test continue \
-"Continuing\\..*unlink 2:.*OK.*test_unlink \\(\\) at.*$srcfile:432.*" \
+"Continuing\\..*unlink 2:.*EACCES.*test_unlink \\(\\) at.*$srcfile:432.*" \
 "Unlinking a file in a directory w/o write access returns EACCES"
 
 send_gdb "tbreak 436\n" ; gdb_expect -re "$gdb_prompt $"
 gdb_test continue \
-"Continuing\\..*unlink 3:.*OK.*test_unlink \\(\\) at.*$srcfile:436.*" \
+"Continuing\\..*unlink 3:.*ENOENT.*test_unlink \\(\\) at.*$srcfile:436.*" \
 "Unlinking a nonexistant file returns ENOENT"
 
 send_gdb "tbreak 446\n" ; gdb_expect -re "$gdb_prompt $"
@@ -264,8 +269,8 @@
 send_gdb "quit\n"
 send_gdb "y\n"
 
-catch "system \"chmod -f +w dir2.fileio.test\""
-catch "system \"rm -rf *.fileio.test\""
+remote_exec build "test -r dir2.fileio.test && chmod -f +w dir2.fileio.test"
+remote_exec build "rm -rf *.fileio.test"
 
 set timeout $oldtimeout
 return 0
diff --git a/gdb/testsuite/gdb.base/relocate.exp b/gdb/testsuite/gdb.base/relocate.exp
index bcaa48a..8d8ff90 100644
--- a/gdb/testsuite/gdb.base/relocate.exp
+++ b/gdb/testsuite/gdb.base/relocate.exp
@@ -105,4 +105,30 @@
   pass "functions have different addresses"
 }
 
+# Now use a variable as an offset to add-symbol-file, and check that
+# the functions' addresses change.
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+
+gdb_test "set \$offset = 0x10000" ""
+
+# Load the object file.
+gdb_test "add-symbol-file ${binfile} \$offset" \
+	"Reading symbols from .*${testfile}\\.o\\.\\.\\.done\\." \
+	"add-symbol-file ${testfile}.o \$offset" \
+	"add symbol table from file \".*${testfile}\\.o\" at\[ \t\r\n\]+\.text_addr = 0x10000\[\r\n\]+\\(y or n\\) " \
+	"y"
+
+# Print the addresses of functions.
+set new_function_foo_addr [get_var_address function_foo]
+
+# Make sure they have different addresses.
+if { "${function_foo_addr}" == "${new_function_foo_addr}" } {
+  fail "function foo has a different address"
+} else {
+  pass "function foo has a different address"
+}
+
 return 0
diff --git a/gdb/testsuite/gdb.base/store.c b/gdb/testsuite/gdb.base/store.c
index 802945f..46acc6a 100644
--- a/gdb/testsuite/gdb.base/store.c
+++ b/gdb/testsuite/gdb.base/store.c
@@ -31,6 +31,14 @@
   return u + v;
 }
 
+typedef long long longest;
+
+longest
+add_longest (register longest u, register longest v)
+{
+  return u + v;
+}
+
 float
 add_float (register float u, register float v)
 {
@@ -43,56 +51,82 @@
   return u + v;
 }
 
+typedef long double doublest;
+
+doublest
+add_doublest (register doublest u, register doublest v)
+{
+  return u + v;
+}
+
 /* */
 
 char
 wack_char (register char u, register char v)
 {
-  register char l = u;
-  l = add_char (l, v);
+  register char l = u, r = v;
+  l = add_char (l, r);
   return l;
 }
 
 short
 wack_short (register short u, register short v)
 {
-  register short l = u;
-  l = add_short (l, v);
+  register short l = u, r = v;
+  l = add_short (l, r);
   return l;
 }
 
 int
 wack_int (register int u, register int v)
 {
-  register int l = u;
-  l = add_int (l, v);
+  register int l = u, r = v;
+  l = add_int (l, r);
   return l;
 }
 
 long
 wack_long (register long u, register long v)
 {
-  register long l = u;
-  l = add_long (l, v);
+  register long l = u, r = v;
+  l = add_long (l, r);
+  return l;
+}
+
+long
+wack_longest (register longest u, register longest v)
+{
+  register longest l = u, r = v;
+  l = add_longest (l, r);
   return l;
 }
 
 float
 wack_float (register float u, register float v)
 {
-  register float l = u;
-  l = add_float (l, v);
+  register float l = u, r = v;
+  l = add_float (l, r);
   return l;
 }
 
 double
 wack_double (register double u, register double v)
 {
-  register double l = u;
-  l = add_double (l, v);
+  register double l = u, r = v;
+  l = add_double (l, r);
   return l;
 }
 
+doublest
+wack_doublest (register doublest u, register doublest v)
+{
+  register doublest l = u, r = v;
+  l = add_doublest (l, r);
+  return l;
+}
+
+/* */
+
 struct s_1 { short s[1]; } z_1, s_1;
 struct s_2 { short s[2]; } z_2, s_2;
 struct s_3 { short s[3]; } z_3, s_3;
@@ -219,20 +253,24 @@
 main ()
 {
   /* These calls are for current frame test.  */
-  wack_char (1, 2);
-  wack_short (1, 2);
-  wack_int (1, 2);
-  wack_long (1, 2);
-  wack_float (1, 2);
-  wack_double (1, 2);
+  wack_char (-1, -2);
+  wack_short (-1, -2);
+  wack_int (-1, -2);
+  wack_long (-1, -2);
+  wack_longest (-1, -2);
+  wack_float (-1, -2);
+  wack_double (-1, -2);
+  wack_doublest (-1, -2);
 
   /* These calls are for up frame.  */
-  wack_char (1, 2);
-  wack_short (1, 2);
-  wack_int (1, 2);
-  wack_long (1, 2);
-  wack_float (1, 2);
-  wack_double (1, 2);
+  wack_char (-1, -2);
+  wack_short (-1, -2);
+  wack_int (-1, -2);
+  wack_long (-1, -2);
+  wack_longest (-1, -2);
+  wack_float (-1, -2);
+  wack_double (-1, -2);
+  wack_doublest (-1, -2);
 
   /* These calls are for current frame test.  */
   wack_struct_1 ();
diff --git a/gdb/testsuite/gdb.base/store.exp b/gdb/testsuite/gdb.base/store.exp
index d6e941a..5e0e60e 100644
--- a/gdb/testsuite/gdb.base/store.exp
+++ b/gdb/testsuite/gdb.base/store.exp
@@ -54,43 +54,49 @@
 
 #
 
-proc check_set { t old new add } {
+proc check_set { t l r new add } {
     global gdb_prompt
     gdb_test "tbreak wack_${t}"
-    gdb_test "continue" "register ${t} l = u;" "continue set ${t}"
-    gdb_test "next" "l = add_${t} .l, v.;" "next ${t}"
-    gdb_test "print l" " = ${old}" "print old ${t}"
+    gdb_test "continue" "register ${t} l = u, r = v;" "continue to wack_${t}"
+    gdb_test "next" "l = add_${t} .l, r.;" "next ${t}"
+    gdb_test "print l" " = ${l}" "print old l - ${t}"
+    gdb_test "print r" " = ${r}" "print old r - ${t}"
     gdb_test "set variable l = 4"
-    gdb_test "print l" " = ${new}" "print new ${t}"
+    gdb_test "print l" " = ${new}" "print new l - ${t}"
     gdb_test "next" "return l;"
-    gdb_test "print l" " = ${add}" "print add ${t}"
+    gdb_test "print l" " = ${add}" "print add  - ${t}"
 }
 
-check_set "char" "1 ..001." "4 ..004." "6 ..006."
-check_set "short" "1" "4" "6"
-check_set "int" "1" "4" "6"
-check_set "long" "1" "4" "6"
-check_set "float" "1" "4" "6"
-check_set "double" "1" "4" "6"
+check_set "char" "-1 .*" "-2 .*" "4 ..004." "2 ..002."
+check_set "short" "-1" "-2" "4" "2"
+check_set "int" "-1" "-2" "4" "2"
+check_set "long" "-1" "-2" "4" "2"
+check_set "longest" "-1" "-2" "4" "2"
+check_set "float" "-1" "-2" "4" "2"
+check_set "double" "-1" "-2" "4" "2"
+check_set "doublest" "-1" "-2" "4" "2"
 
 #
 
-proc up_set { t old new } {
+proc up_set { t l r new } {
     global gdb_prompt
     gdb_test "tbreak add_${t}"
-    gdb_test "continue" "return u . v;" "continue up ${t}"
-    gdb_test "up" "l = add_${t} .l, v.;" "up ${t}"
-    gdb_test "print l" " = ${old}" "print old up ${t}"
+    gdb_test "continue" "return u . v;" "continue to add_${t}"
+    gdb_test "up" "l = add_${t} .l, r.;" "up ${t}"
+    gdb_test "print l" " = ${l}" "up print old l - ${t}"
+    gdb_test "print r" " = ${r}" "up print old r - ${t}"
     gdb_test "set variable l = 4"
-    gdb_test "print l" " = ${new}" "print new up ${t}"
+    gdb_test "print l" " = ${new}" "up print new l - ${t}"
 }
 
-up_set "char" "1 ..001." "4 ..004."
-up_set "short" "1" "4"
-up_set "int" "1" "4"
-up_set "long" "1" "4"
-up_set "float" "1" "4"
-up_set "double" "1" "4"
+up_set "char" "-1 .*" "-2 .*" "4 ..004."
+up_set "short" "-1" "-2" "4"
+up_set "int" "-1" "-2" "4"
+up_set "long" "-1" "-2" "4"
+up_set "longest" "-1" "-2" "4"
+up_set "float" "-1" "-2" "4"
+up_set "double" "-1" "-2" "4"
+up_set "doublest" "-1" "-2" "4"
 
 #
 
@@ -133,7 +139,11 @@
     gdb_test "tbreak wack_field_${t}"
     gdb_test "continue" "register struct f_${t} u = f_${t};" \
 	    "continue field ${t}"
-    gdb_test "next" "return u;" "next field ${t}"
+
+    # Match either the return statement, or the line immediatly after
+    # it.  The compiler can end up merging the return statement into
+    # the return instruction.
+    gdb_test "next" "(return u;|\})" "next field ${t}"
 
     gdb_test "print u" " = {i = 1, j = 1, k = 1}" "old field ${t}"
     gdb_test "set variable u = F_${t}"
diff --git a/gdb/testsuite/gdb.c++/pr-1210.cc b/gdb/testsuite/gdb.c++/pr-1210.cc
new file mode 100644
index 0000000..5747e5d
--- /dev/null
+++ b/gdb/testsuite/gdb.c++/pr-1210.cc
@@ -0,0 +1,19 @@
+class A
+{
+};
+
+class B : virtual public A
+{
+};
+
+class C : public A
+{
+     protected:
+         B myB;
+};
+
+int main()
+{
+     C *obj = new C();
+     return 0;
+}
diff --git a/gdb/testsuite/gdb.c++/pr-1210.exp b/gdb/testsuite/gdb.c++/pr-1210.exp
new file mode 100644
index 0000000..3ff850d
--- /dev/null
+++ b/gdb/testsuite/gdb.c++/pr-1210.exp
@@ -0,0 +1,76 @@
+# Copyright 2003 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
+
+# Tests for PR gdb/1210.
+
+# This file is part of the gdb testsuite.
+
+if $tracelevel then {
+	strace $tracelevel
+}
+
+if { [skip_cplus_tests] } { continue }
+
+#
+# test running programs
+#
+set prms_id 0
+set bug_id 0
+
+set testfile "pr-1210"
+set srcfile ${testfile}.cc
+set binfile ${objdir}/${subdir}/${testfile}
+
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {
+    gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+}
+
+if [get_compiler_info ${binfile} "c++"] {
+    return -1
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+if ![runto_main] then {
+    perror "couldn't run to breakpoint"
+    continue
+}
+
+gdb_test "next" ".*return 0;" "step past initialization"
+
+gdb_test_multiple "print *obj" "" {
+  -re "Cannot access memory.*$gdb_prompt $" {
+    fail "print *obj"
+  }
+  -re " = {<A> = {<No data fields>}, myB = {<A> = {<No data fields>}.*}}\r\n$gdb_prompt $" {
+    pass "print *obj"
+  }
+}
+
+gdb_test_multiple "print obj->myB" "" {
+  -re "Cannot access memory.*$gdb_prompt $" {
+    fail "print obj->myB"
+  }
+  -re " = {<A> = {<No data fields>}.*}\r\n$gdb_prompt $" {
+    pass "print obj->myB"
+  }
+}
+
+gdb_exit
+return 0
diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
index 5907628..4239a37 100644
--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -636,7 +636,7 @@
 	    }
 	    send_gdb "000-exec-continue\n";
 	    gdb_expect 60 {
-		-re "Continu\[^\r\n\]*\[\r\n\]" {}
+		-re "000\\^running\[\r\n\]+$mi_gdb_prompt$" {}
 		default {}
 	    }
 	    return;
diff --git a/gdb/trad-frame.h b/gdb/trad-frame.h
index 4d75315..2b04c7e 100644
--- a/gdb/trad-frame.h
+++ b/gdb/trad-frame.h
@@ -22,6 +22,8 @@
 #ifndef TRAD_FRAME_H
 #define TRAD_FRAME_H
 
+struct frame_info;
+
 /* A traditional saved regs table, indexed by REGNUM, encoding where
    the value of REGNUM for the previous frame can be found in this
    frame.
diff --git a/gdb/tui/ChangeLog b/gdb/tui/ChangeLog
index 79a3353..9ab3461 100644
--- a/gdb/tui/ChangeLog
+++ b/gdb/tui/ChangeLog
@@ -1,3 +1,20 @@
+2003-06-22  Daniel Jacobowitz  <drow@mvista.com>
+
+	* tui-hooks.c: Update include order.
+	* tui.c: Likewise.
+	* tuiCommand.c: Likewise.
+	* tuiData.c: Likewise.
+	* tuiDataWin.c: Likewise.
+	* tuiDisassem.c: Likewise.
+	* tuiGeneralWin.c: Likewise.
+	* tuiIO.c: Likewise.
+	* tuiLayout.c: Likewise.
+	* tuiRegs.c: Likewise.
+	* tuiSource.c: Likewise.
+	* tuiSourceWin.c: Likewise.
+	* tuiStack.c: Likewise.
+	* tuiWin.c: Likewise.
+
 2003-06-12  Andreas Schwab  <schwab@suse.de>
 
 	* tuiSource.c (tuiVerticalSourceScroll): Use get_frame_pc.
diff --git a/gdb/tui/tui-hooks.c b/gdb/tui/tui-hooks.c
index 569ab07..e00ba85 100644
--- a/gdb/tui/tui-hooks.c
+++ b/gdb/tui/tui-hooks.c
@@ -1,6 +1,6 @@
 /* GDB hooks for TUI.
 
-   Copyright 2001, 2002 Free Software Foundation, Inc.
+   Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -19,23 +19,6 @@
    Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-/* FIXME: cagney/2002-02-28: The GDB coding standard indicates that
-   "defs.h" should be included first.  Unfortunatly some systems
-   (currently Debian GNU/Linux) include the <stdbool.h> via <curses.h>
-   and they clash with "bfd.h"'s definiton of true/false.  The correct
-   fix is to remove true/false from "bfd.h", however, until that
-   happens, hack around it by including "config.h" and <curses.h>
-   first.  */
-
-#include "config.h"
-#ifdef HAVE_NCURSES_H
-#include <ncurses.h>
-#else
-#ifdef HAVE_CURSES_H
-#include <curses.h>
-#endif
-#endif
-
 #include "defs.h"
 #include "symtab.h"
 #include "inferior.h"
@@ -66,6 +49,14 @@
 #include "tuiDataWin.h"
 #include "tuiSourceWin.h"
 
+#ifdef HAVE_NCURSES_H
+#include <ncurses.h>
+#else
+#ifdef HAVE_CURSES_H
+#include <curses.h>
+#endif
+#endif
+
 int tui_target_has_run = 0;
 
 static void (* tui_target_new_objfile_chain) (struct objfile*);
diff --git a/gdb/tui/tui.c b/gdb/tui/tui.c
index 517cf46..7e665d5 100644
--- a/gdb/tui/tui.c
+++ b/gdb/tui/tui.c
@@ -1,6 +1,6 @@
 /* General functions for the WDB TUI.
 
-   Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation,
+   Copyright 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation,
    Inc.
 
    Contributed by Hewlett-Packard Company.
@@ -22,23 +22,6 @@
    Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-/* FIXME: cagney/2002-02-28: The GDB coding standard indicates that
-   "defs.h" should be included first.  Unfortunatly some systems
-   (currently Debian GNU/Linux) include the <stdbool.h> via <curses.h>
-   and they clash with "bfd.h"'s definiton of true/false.  The correct
-   fix is to remove true/false from "bfd.h", however, until that
-   happens, hack around it by including "config.h" and <curses.h>
-   first.  */
-
-#include "config.h"
-#ifdef HAVE_NCURSES_H       
-#include <ncurses.h>
-#else
-#ifdef HAVE_CURSES_H
-#include <curses.h>
-#endif
-#endif
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <ctype.h>
@@ -70,6 +53,14 @@
 #include "symtab.h"
 #include "source.h"
 
+#ifdef HAVE_NCURSES_H       
+#include <ncurses.h>
+#else
+#ifdef HAVE_CURSES_H
+#include <curses.h>
+#endif
+#endif
+
 /* Tells whether the TUI is active or not.  */
 int tui_active = 0;
 static int tui_finish_init = 1;
diff --git a/gdb/tui/tuiCommand.c b/gdb/tui/tuiCommand.c
index ca3d531..675b34c 100644
--- a/gdb/tui/tuiCommand.c
+++ b/gdb/tui/tuiCommand.c
@@ -1,6 +1,6 @@
 /* Specific command window processing.
 
-   Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation,
+   Copyright 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation,
    Inc.
 
    Contributed by Hewlett-Packard Company.
@@ -22,15 +22,13 @@
    Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-/* FIXME: cagney/2002-02-28: The GDB coding standard indicates that
-   "defs.h" should be included first.  Unfortunatly some systems
-   (currently Debian GNU/Linux) include the <stdbool.h> via <curses.h>
-   and they clash with "bfd.h"'s definiton of true/false.  The correct
-   fix is to remove true/false from "bfd.h", however, until that
-   happens, hack around it by including "config.h" and <curses.h>
-   first.  */
+#include "defs.h"
+#include <ctype.h>
+#include "tui.h"
+#include "tuiData.h"
+#include "tuiWin.h"
+#include "tuiIO.h"
 
-#include "config.h"
 #ifdef HAVE_NCURSES_H       
 #include <ncurses.h>
 #else
@@ -39,13 +37,6 @@
 #endif
 #endif
 
-#include "defs.h"
-#include <ctype.h>
-#include "tui.h"
-#include "tuiData.h"
-#include "tuiWin.h"
-#include "tuiIO.h"
-
 
 /*****************************************
 ** STATIC LOCAL FUNCTIONS FORWARD DECLS    **
diff --git a/gdb/tui/tuiData.c b/gdb/tui/tuiData.c
index 225583e..5acc33c 100644
--- a/gdb/tui/tuiData.c
+++ b/gdb/tui/tuiData.c
@@ -1,6 +1,6 @@
 /* TUI data manipulation routines.
 
-   Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation,
+   Copyright 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation,
    Inc.
 
    Contributed by Hewlett-Packard Company.
@@ -22,15 +22,12 @@
    Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-/* FIXME: cagney/2002-02-28: The GDB coding standard indicates that
-   "defs.h" should be included first.  Unfortunatly some systems
-   (currently Debian GNU/Linux) include the <stdbool.h> via <curses.h>
-   and they clash with "bfd.h"'s definiton of true/false.  The correct
-   fix is to remove true/false from "bfd.h", however, until that
-   happens, hack around it by including "config.h" and <curses.h>
-   first.  */
+#include "defs.h"
+#include "symtab.h"
+#include "tui.h"
+#include "tuiData.h"
+#include "tuiGeneralWin.h"
 
-#include "config.h"
 #ifdef HAVE_NCURSES_H       
 #include <ncurses.h>
 #else
@@ -39,12 +36,6 @@
 #endif
 #endif
 
-#include "defs.h"
-#include "symtab.h"
-#include "tui.h"
-#include "tuiData.h"
-#include "tuiGeneralWin.h"
-
 /****************************
 ** GLOBAL DECLARATIONS
 ****************************/
diff --git a/gdb/tui/tuiDataWin.c b/gdb/tui/tuiDataWin.c
index e729afc..f3bedd2 100644
--- a/gdb/tui/tuiDataWin.c
+++ b/gdb/tui/tuiDataWin.c
@@ -1,6 +1,6 @@
 /* Data/register window display.
 
-   Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation,
+   Copyright 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation,
    Inc.
 
    Contributed by Hewlett-Packard Company.
@@ -22,15 +22,12 @@
    Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-/* FIXME: cagney/2002-02-28: The GDB coding standard indicates that
-   "defs.h" should be included first.  Unfortunatly some systems
-   (currently Debian GNU/Linux) include the <stdbool.h> via <curses.h>
-   and they clash with "bfd.h"'s definiton of true/false.  The correct
-   fix is to remove true/false from "bfd.h", however, until that
-   happens, hack around it by including "config.h" and <curses.h>
-   first.  */
+#include "defs.h"
+#include "tui.h"
+#include "tuiData.h"
+#include "tuiGeneralWin.h"
+#include "tuiRegs.h"
 
-#include "config.h"
 #ifdef HAVE_NCURSES_H       
 #include <ncurses.h>
 #else
@@ -39,12 +36,6 @@
 #endif
 #endif
 
-#include "defs.h"
-#include "tui.h"
-#include "tuiData.h"
-#include "tuiGeneralWin.h"
-#include "tuiRegs.h"
-
 
 /*****************************************
 ** STATIC LOCAL FUNCTIONS FORWARD DECLS    **
diff --git a/gdb/tui/tuiDisassem.c b/gdb/tui/tuiDisassem.c
index a8668c4..e36c5df 100644
--- a/gdb/tui/tuiDisassem.c
+++ b/gdb/tui/tuiDisassem.c
@@ -1,6 +1,6 @@
 /* Disassembly display.
 
-   Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation,
+   Copyright 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation,
    Inc.
 
    Contributed by Hewlett-Packard Company.
@@ -22,23 +22,6 @@
    Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-/* FIXME: cagney/2002-02-28: The GDB coding standard indicates that
-   "defs.h" should be included first.  Unfortunatly some systems
-   (currently Debian GNU/Linux) include the <stdbool.h> via <curses.h>
-   and they clash with "bfd.h"'s definiton of true/false.  The correct
-   fix is to remove true/false from "bfd.h", however, until that
-   happens, hack around it by including "config.h" and <curses.h>
-   first.  */
-
-#include "config.h"
-#ifdef HAVE_NCURSES_H       
-#include <ncurses.h>
-#else
-#ifdef HAVE_CURSES_H
-#include <curses.h>
-#endif
-#endif
-
 #include "defs.h"
 #include "symtab.h"
 #include "breakpoint.h"
@@ -55,6 +38,14 @@
 #include "tuiStack.h"
 #include "tui-file.h"
 
+#ifdef HAVE_NCURSES_H       
+#include <ncurses.h>
+#else
+#ifdef HAVE_CURSES_H
+#include <curses.h>
+#endif
+#endif
+
 struct tui_asm_line 
 {
   CORE_ADDR addr;
diff --git a/gdb/tui/tuiGeneralWin.c b/gdb/tui/tuiGeneralWin.c
index e250ca2..42faf75 100644
--- a/gdb/tui/tuiGeneralWin.c
+++ b/gdb/tui/tuiGeneralWin.c
@@ -1,6 +1,6 @@
 /* General window behavior.
 
-   Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation,
+   Copyright 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation,
    Inc.
 
    Contributed by Hewlett-Packard Company.
@@ -22,15 +22,12 @@
    Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-/* FIXME: cagney/2002-02-28: The GDB coding standard indicates that
-   "defs.h" should be included first.  Unfortunatly some systems
-   (currently Debian GNU/Linux) include the <stdbool.h> via <curses.h>
-   and they clash with "bfd.h"'s definiton of true/false.  The correct
-   fix is to remove true/false from "bfd.h", however, until that
-   happens, hack around it by including "config.h" and <curses.h>
-   first.  */
+#include "defs.h"
+#include "tui.h"
+#include "tuiData.h"
+#include "tuiGeneralWin.h"
+#include "tuiWin.h"
 
-#include "config.h"
 #ifdef HAVE_NCURSES_H       
 #include <ncurses.h>
 #else
@@ -39,12 +36,6 @@
 #endif
 #endif
 
-#include "defs.h"
-#include "tui.h"
-#include "tuiData.h"
-#include "tuiGeneralWin.h"
-#include "tuiWin.h"
-
 /***********************
 ** PUBLIC FUNCTIONS
 ***********************/
diff --git a/gdb/tui/tuiIO.c b/gdb/tui/tuiIO.c
index f53cef3..1a8bbc2 100644
--- a/gdb/tui/tuiIO.c
+++ b/gdb/tui/tuiIO.c
@@ -1,6 +1,6 @@
 /* TUI support I/O functions.
 
-   Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation,
+   Copyright 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation,
    Inc.
 
    Contributed by Hewlett-Packard Company.
@@ -22,24 +22,6 @@
    Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-/* FIXME: cagney/2002-02-28: The GDB coding standard indicates that
-   "defs.h" should be included first.  Unfortunatly some systems
-   (currently Debian GNU/Linux) include the <stdbool.h> via <curses.h>
-   and they clash with "bfd.h"'s definiton of true/false.  The correct
-   fix is to remove true/false from "bfd.h", however, until that
-   happens, hack around it by including "config.h" and <curses.h>
-   first.  */
-
-#include "config.h"
-#ifdef HAVE_NCURSES_H       
-#include <ncurses.h>
-#else
-#ifdef HAVE_CURSES_H
-#include <curses.h>
-#endif
-#endif
-
-#include <stdio.h>
 #include "defs.h"
 #include "terminal.h"
 #include "target.h"
@@ -59,6 +41,15 @@
 #include "cli-out.h"
 #include <fcntl.h>
 #include <signal.h>
+#include <stdio.h>
+
+#ifdef HAVE_NCURSES_H       
+#include <ncurses.h>
+#else
+#ifdef HAVE_CURSES_H
+#include <curses.h>
+#endif
+#endif
 
 /* Use definition from readline 4.3.  */
 #undef CTRL_CHAR
diff --git a/gdb/tui/tuiLayout.c b/gdb/tui/tuiLayout.c
index cddbd14..b79bfcb 100644
--- a/gdb/tui/tuiLayout.c
+++ b/gdb/tui/tuiLayout.c
@@ -1,6 +1,6 @@
 /* TUI layout window management.
 
-   Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation,
+   Copyright 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation,
    Inc.
 
    Contributed by Hewlett-Packard Company.
@@ -22,23 +22,6 @@
    Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-/* FIXME: cagney/2002-02-28: The GDB coding standard indicates that
-   "defs.h" should be included first.  Unfortunatly some systems
-   (currently Debian GNU/Linux) include the <stdbool.h> via <curses.h>
-   and they clash with "bfd.h"'s definiton of true/false.  The correct
-   fix is to remove true/false from "bfd.h", however, until that
-   happens, hack around it by including "config.h" and <curses.h>
-   first.  */
-
-#include "config.h"
-#ifdef HAVE_NCURSES_H       
-#include <ncurses.h>
-#else
-#ifdef HAVE_CURSES_H
-#include <curses.h>
-#endif
-#endif
-
 #include "defs.h"
 #include "command.h"
 #include "symtab.h"
@@ -56,6 +39,14 @@
 #include "tuiSourceWin.h"
 #include "tuiDisassem.h"
 
+#ifdef HAVE_NCURSES_H       
+#include <ncurses.h>
+#else
+#ifdef HAVE_CURSES_H
+#include <curses.h>
+#endif
+#endif
+
 /*******************************
 ** Static Local Decls
 ********************************/
diff --git a/gdb/tui/tuiRegs.c b/gdb/tui/tuiRegs.c
index 61b9334..9f0b1a4 100644
--- a/gdb/tui/tuiRegs.c
+++ b/gdb/tui/tuiRegs.c
@@ -1,6 +1,6 @@
 /* TUI display registers in window.
 
-   Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation,
+   Copyright 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation,
    Inc.
 
    Contributed by Hewlett-Packard Company.
@@ -22,23 +22,6 @@
    Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-/* FIXME: cagney/2002-02-28: The GDB coding standard indicates that
-   "defs.h" should be included first.  Unfortunatly some systems
-   (currently Debian GNU/Linux) include the <stdbool.h> via <curses.h>
-   and they clash with "bfd.h"'s definiton of true/false.  The correct
-   fix is to remove true/false from "bfd.h", however, until that
-   happens, hack around it by including "config.h" and <curses.h>
-   first.  */
-
-#include "config.h"
-#ifdef HAVE_NCURSES_H       
-#include <ncurses.h>
-#else
-#ifdef HAVE_CURSES_H
-#include <curses.h>
-#endif
-#endif
-
 #include "defs.h"
 #include "tui.h"
 #include "tuiData.h"
@@ -55,6 +38,14 @@
 #include "tuiGeneralWin.h"
 #include "tui-file.h"
 
+#ifdef HAVE_NCURSES_H       
+#include <ncurses.h>
+#else
+#ifdef HAVE_CURSES_H
+#include <curses.h>
+#endif
+#endif
+
 /*****************************************
 ** LOCAL DEFINITIONS                    **
 ******************************************/
diff --git a/gdb/tui/tuiSource.c b/gdb/tui/tuiSource.c
index 68e7d99..6428130 100644
--- a/gdb/tui/tuiSource.c
+++ b/gdb/tui/tuiSource.c
@@ -1,6 +1,6 @@
 /* TUI display source window.
 
-   Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation,
+   Copyright 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation,
    Inc.
 
    Contributed by Hewlett-Packard Company.
@@ -22,23 +22,6 @@
    Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-/* FIXME: cagney/2002-02-28: The GDB coding standard indicates that
-   "defs.h" should be included first.  Unfortunatly some systems
-   (currently Debian GNU/Linux) include the <stdbool.h> via <curses.h>
-   and they clash with "bfd.h"'s definiton of true/false.  The correct
-   fix is to remove true/false from "bfd.h", however, until that
-   happens, hack around it by including "config.h" and <curses.h>
-   first.  */
-
-#include "config.h"
-#ifdef HAVE_NCURSES_H       
-#include <ncurses.h>
-#else
-#ifdef HAVE_CURSES_H
-#include <curses.h>
-#endif
-#endif
-
 #include "defs.h"
 #include <ctype.h>
 #include "symtab.h"
@@ -53,6 +36,13 @@
 #include "tuiSourceWin.h"
 #include "tuiSource.h"
 
+#ifdef HAVE_NCURSES_H       
+#include <ncurses.h>
+#else
+#ifdef HAVE_CURSES_H
+#include <curses.h>
+#endif
+#endif
 
 /* Function to display source in the source window.  */
 TuiStatus
diff --git a/gdb/tui/tuiSourceWin.c b/gdb/tui/tuiSourceWin.c
index cd52333..cf5a079 100644
--- a/gdb/tui/tuiSourceWin.c
+++ b/gdb/tui/tuiSourceWin.c
@@ -1,6 +1,6 @@
 /* TUI display source/assembly window.
 
-   Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation,
+   Copyright 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation,
    Inc.
 
    Contributed by Hewlett-Packard Company.
@@ -22,23 +22,6 @@
    Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-/* FIXME: cagney/2002-02-28: The GDB coding standard indicates that
-   "defs.h" should be included first.  Unfortunatly some systems
-   (currently Debian GNU/Linux) include the <stdbool.h> via <curses.h>
-   and they clash with "bfd.h"'s definiton of true/false.  The correct
-   fix is to remove true/false from "bfd.h", however, until that
-   happens, hack around it by including "config.h" and <curses.h>
-   first.  */
-
-#include "config.h"
-#ifdef HAVE_NCURSES_H       
-#include <ncurses.h>
-#else
-#ifdef HAVE_CURSES_H
-#include <curses.h>
-#endif
-#endif
-
 #include "defs.h"
 #include <ctype.h>
 #include "symtab.h"
@@ -56,6 +39,13 @@
 #include "tuiSource.h"
 #include "tuiDisassem.h"
 
+#ifdef HAVE_NCURSES_H       
+#include <ncurses.h>
+#else
+#ifdef HAVE_CURSES_H
+#include <curses.h>
+#endif
+#endif
 
 /* Function to display the "main" routine.  */
 void
diff --git a/gdb/tui/tuiStack.c b/gdb/tui/tuiStack.c
index dca0618..a6ad07a 100644
--- a/gdb/tui/tuiStack.c
+++ b/gdb/tui/tuiStack.c
@@ -1,6 +1,6 @@
 /* TUI display locator.
 
-   Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation,
+   Copyright 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation,
    Inc.
 
    Contributed by Hewlett-Packard Company.
@@ -22,23 +22,6 @@
    Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-/* FIXME: cagney/2002-02-28: The GDB coding standard indicates that
-   "defs.h" should be included first.  Unfortunatly some systems
-   (currently Debian GNU/Linux) include the <stdbool.h> via <curses.h>
-   and they clash with "bfd.h"'s definiton of true/false.  The correct
-   fix is to remove true/false from "bfd.h", however, until that
-   happens, hack around it by including "config.h" and <curses.h>
-   first.  */
-
-#include "config.h"
-#ifdef HAVE_NCURSES_H       
-#include <ncurses.h>
-#else
-#ifdef HAVE_CURSES_H
-#include <curses.h>
-#endif
-#endif
-
 #include "defs.h"
 #include "symtab.h"
 #include "breakpoint.h"
@@ -56,6 +39,13 @@
 #include "tuiSourceWin.h"
 #include "tui-file.h"
 
+#ifdef HAVE_NCURSES_H       
+#include <ncurses.h>
+#else
+#ifdef HAVE_CURSES_H
+#include <curses.h>
+#endif
+#endif
 
 /* Get a printable name for the function at the address.
    The symbol name is demangled if demangling is turned on.
diff --git a/gdb/tui/tuiWin.c b/gdb/tui/tuiWin.c
index 268562e..ecd4920 100644
--- a/gdb/tui/tuiWin.c
+++ b/gdb/tui/tuiWin.c
@@ -1,6 +1,6 @@
 /* TUI window generic functions.
 
-   Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation,
+   Copyright 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation,
    Inc.
 
    Contributed by Hewlett-Packard Company.
@@ -27,26 +27,6 @@
 
    Author: Susan B. Macchia  */
 
-/* FIXME: cagney/2002-02-28: The GDB coding standard indicates that
-   "defs.h" should be included first.  Unfortunatly some systems
-   (currently Debian GNU/Linux) include the <stdbool.h> via <curses.h>
-   and they clash with "bfd.h"'s definiton of true/false.  The correct
-   fix is to remove true/false from "bfd.h", however, until that
-   happens, hack around it by including "config.h" and <curses.h>
-   first.  */
-
-#include "config.h"
-#ifdef HAVE_NCURSES_H       
-#include <ncurses.h>
-#else
-#ifdef HAVE_CURSES_H
-#include <curses.h>
-#endif
-#endif
-
-#include <string.h>
-#include <ctype.h>
-#include <readline/readline.h>
 #include "defs.h"
 #include "command.h"
 #include "symtab.h"
@@ -66,6 +46,18 @@
 #include "tuiSourceWin.h"
 #include "tuiDataWin.h"
 
+#ifdef HAVE_NCURSES_H       
+#include <ncurses.h>
+#else
+#ifdef HAVE_CURSES_H
+#include <curses.h>
+#endif
+#endif
+
+#include <string.h>
+#include <ctype.h>
+#include <readline/readline.h>
+
 /*******************************
 ** Static Local Decls
 ********************************/
diff --git a/gdb/valops.c b/gdb/valops.c
index 2767630..9d02a35 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -498,22 +498,6 @@
     COERCE_ARRAY (fromval);
   CHECK_TYPEDEF (type);
 
-  /* If TOVAL is a special machine register requiring conversion
-     of program values to a special raw format,
-     convert FROMVAL's contents now, with result in `raw_buffer',
-     and set USE_BUFFER to the number of bytes to write.  */
-
-  if (VALUE_REGNO (toval) >= 0)
-    {
-      int regno = VALUE_REGNO (toval);
-      if (CONVERT_REGISTER_P (regno))
-	{
-	  struct type *fromtype = check_typedef (VALUE_TYPE (fromval));
-	  VALUE_TO_REGISTER (fromtype, regno, VALUE_CONTENTS (fromval), raw_buffer);
-	  use_buffer = REGISTER_RAW_SIZE (regno);
-	}
-    }
-
   /* Since modifying a register can trash the frame chain, and modifying memory
      can trash the frame cache, we save the old frame and then restore the new
      frame afterwards.  */
@@ -587,17 +571,8 @@
     case lval_reg_frame_relative:
     case lval_register:
       {
-	/* value is stored in a series of registers in the frame
-	   specified by the structure.  Copy that value out, modify
-	   it, and copy it back in.  */
-	int amount_copied;
-	int amount_to_copy;
-	char *buffer;
-	int value_reg;
-	int reg_offset;
-	int byte_offset;
-	int regno;
 	struct frame_info *frame;
+	int value_reg;
 
 	/* Figure out which frame this is in currently.  */
 	if (VALUE_LVAL (toval) == lval_register)
@@ -613,92 +588,77 @@
 
 	if (!frame)
 	  error ("Value being assigned to is no longer active.");
-
-	/* Locate the first register that falls in the value that
-           needs to be transfered.  Compute the offset of the value in
-           that register.  */
-	{
-	  int offset;
-	  for (reg_offset = value_reg, offset = 0;
-	       offset + REGISTER_RAW_SIZE (reg_offset) <= VALUE_OFFSET (toval);
-	       reg_offset++);
-	  byte_offset = VALUE_OFFSET (toval) - offset;
-	}
-
-	/* Compute the number of register aligned values that need to
-           be copied.  */
-	if (VALUE_BITSIZE (toval))
-	  amount_to_copy = byte_offset + 1;
-	else
-	  amount_to_copy = byte_offset + TYPE_LENGTH (type);
-
-	/* And a bounce buffer.  Be slightly over generous.  */
-	buffer = (char *) alloca (amount_to_copy + MAX_REGISTER_SIZE);
-
-	/* Copy it in.  */
-	for (regno = reg_offset, amount_copied = 0;
-	     amount_copied < amount_to_copy;
-	     amount_copied += REGISTER_RAW_SIZE (regno), regno++)
-	  {
-	    frame_register_read (frame, regno, buffer + amount_copied);
-	  }
 	
-	/* Modify what needs to be modified.  */
-	if (VALUE_BITSIZE (toval))
+	if (VALUE_LVAL (toval) == lval_reg_frame_relative
+	    && CONVERT_REGISTER_P (VALUE_FRAME_REGNUM (toval), type))
 	  {
-	    modify_field (buffer + byte_offset,
-			  value_as_long (fromval),
-			  VALUE_BITPOS (toval), VALUE_BITSIZE (toval));
-	  }
-	else if (use_buffer)
-	  {
-	    memcpy (buffer + VALUE_OFFSET (toval), raw_buffer, use_buffer);
+	    /* If TOVAL is a special machine register requiring
+	       conversion of program values to a special raw format.  */
+	    VALUE_TO_REGISTER (frame, VALUE_FRAME_REGNUM (toval),
+			       type, VALUE_CONTENTS (fromval));
 	  }
 	else
 	  {
-	    memcpy (buffer + byte_offset, VALUE_CONTENTS (fromval),
-		    TYPE_LENGTH (type));
-	    /* Do any conversion necessary when storing this type to
-	       more than one register.  */
-#ifdef REGISTER_CONVERT_FROM_TYPE
-	    REGISTER_CONVERT_FROM_TYPE (value_reg, type,
-					(buffer + byte_offset));
-#endif
-	  }
+	    /* TOVAL is stored in a series of registers in the frame
+	       specified by the structure.  Copy that value out,
+	       modify it, and copy it back in.  */
+	    int amount_copied;
+	    int amount_to_copy;
+	    char *buffer;
+	    int reg_offset;
+	    int byte_offset;
+	    int regno;
 
-	/* Copy it out.  */
-	for (regno = reg_offset, amount_copied = 0;
-	     amount_copied < amount_to_copy;
-	     amount_copied += REGISTER_RAW_SIZE (regno), regno++)
-	  {
-	    enum lval_type lval;
-	    CORE_ADDR addr;
-	    int optim;
-	    int realnum;
-	    
-	    /* Just find out where to put it.  */
-	    frame_register (frame, regno, &optim, &lval, &addr, &realnum,
-			    NULL);
-	    
-	    if (optim)
-	      error ("Attempt to assign to a value that was optimized out.");
-	    if (lval == lval_memory)
-	      write_memory (addr, buffer + amount_copied,
-			    REGISTER_RAW_SIZE (regno));
-	    else if (lval == lval_register)
-	      regcache_cooked_write (current_regcache, realnum,
-				     (buffer + amount_copied));
+	    /* Locate the first register that falls in the value that
+	       needs to be transfered.  Compute the offset of the
+	       value in that register.  */
+	    {
+	      int offset;
+	      for (reg_offset = value_reg, offset = 0;
+		   offset + REGISTER_RAW_SIZE (reg_offset) <= VALUE_OFFSET (toval);
+		   reg_offset++);
+	      byte_offset = VALUE_OFFSET (toval) - offset;
+	    }
+
+	    /* Compute the number of register aligned values that need
+	       to be copied.  */
+	    if (VALUE_BITSIZE (toval))
+	      amount_to_copy = byte_offset + 1;
 	    else
-	      error ("Attempt to assign to an unmodifiable value.");
-	  }
+	      amount_to_copy = byte_offset + TYPE_LENGTH (type);
+	    
+	    /* And a bounce buffer.  Be slightly over generous.  */
+	    buffer = (char *) alloca (amount_to_copy + MAX_REGISTER_SIZE);
 
+	    /* Copy it in.  */
+	    for (regno = reg_offset, amount_copied = 0;
+		 amount_copied < amount_to_copy;
+		 amount_copied += REGISTER_RAW_SIZE (regno), regno++)
+	      frame_register_read (frame, regno, buffer + amount_copied);
+	    
+	    /* Modify what needs to be modified.  */
+	    if (VALUE_BITSIZE (toval))
+	      modify_field (buffer + byte_offset,
+			    value_as_long (fromval),
+			    VALUE_BITPOS (toval), VALUE_BITSIZE (toval));
+	    else if (use_buffer)
+	      memcpy (buffer + VALUE_OFFSET (toval), raw_buffer, use_buffer);
+	    else
+	      memcpy (buffer + byte_offset, VALUE_CONTENTS (fromval),
+		      TYPE_LENGTH (type));
+
+	    /* Copy it out.  */
+	    for (regno = reg_offset, amount_copied = 0;
+		 amount_copied < amount_to_copy;
+		 amount_copied += REGISTER_RAW_SIZE (regno), regno++)
+	      put_frame_register (frame, regno, buffer + amount_copied);
+
+	  }
 	if (register_changed_hook)
 	  register_changed_hook (-1);
 	target_changed_event ();
-
+	break;
       }
-      break;
-      
       
     default:
       error ("Left operand of assignment is not an lvalue.");
diff --git a/gdb/varobj.c b/gdb/varobj.c
index 0c9f048..1c5fc63 100644
--- a/gdb/varobj.c
+++ b/gdb/varobj.c
@@ -1379,9 +1379,8 @@
   return make_cleanup (do_free_variable_cleanup, var);
 }
 
-/* This returns the type of the variable. This skips past typedefs
-   and returns the real type of the variable. It also dereferences
-   pointers and references.
+/* This returns the type of the variable. It also skips past typedefs
+   to return the real type of the variable.
 
    NOTE: TYPE_TARGET_TYPE should NOT be used anywhere in this file
    except within get_target_type and get_type. */
@@ -1391,8 +1390,8 @@
   struct type *type;
   type = var->type;
 
-  while (type != NULL && TYPE_CODE (type) == TYPE_CODE_TYPEDEF)
-    type = TYPE_TARGET_TYPE (type);
+  if (type != NULL)
+    type = check_typedef (type);
 
   return type;
 }
@@ -1423,8 +1422,8 @@
   if (type != NULL)
     {
       type = TYPE_TARGET_TYPE (type);
-      while (type != NULL && TYPE_CODE (type) == TYPE_CODE_TYPEDEF)
-	type = TYPE_TARGET_TYPE (type);
+      if (type != NULL)
+	type = check_typedef (type);
     }
 
   return type;
diff --git a/gdb/version.in b/gdb/version.in
index d7456ac..9585c52 100644
--- a/gdb/version.in
+++ b/gdb/version.in
@@ -1 +1 @@
-2003-06-13-cvs
+2003-06-22-cvs
diff --git a/gdb/x86-64-tdep.c b/gdb/x86-64-tdep.c
index 6c38f8d..906ebd9 100644
--- a/gdb/x86-64-tdep.c
+++ b/gdb/x86-64-tdep.c
@@ -208,6 +208,15 @@
 
   return regnum;
 }
+
+/* Return nonzero if a value of type TYPE stored in register REGNUM
+   needs any special handling.  */
+
+static int
+x86_64_convert_register_p (int regnum, struct type *type)
+{
+  return i386_fp_regnum_p (regnum);
+}
 
 
 /* The returning of values is done according to the special algorithm.
@@ -1178,6 +1187,10 @@
   /* Call dummy code.  */
   set_gdbarch_push_dummy_call (gdbarch, x86_64_push_dummy_call);
 
+  set_gdbarch_convert_register_p (gdbarch, x86_64_convert_register_p);
+  set_gdbarch_register_to_value (gdbarch, i387_register_to_value);
+  set_gdbarch_value_to_register (gdbarch, i387_value_to_register);
+
   set_gdbarch_extract_return_value (gdbarch, x86_64_extract_return_value);
   set_gdbarch_store_return_value (gdbarch, x86_64_store_return_value);
   /* Override, since this is handled by x86_64_extract_return_value.  */
diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c
index 9c0c70a..076bd23 100644
--- a/gdb/xstormy16-tdep.c
+++ b/gdb/xstormy16-tdep.c
@@ -1104,7 +1104,7 @@
 
   set_gdbarch_stack_align (gdbarch, xstormy16_stack_align);
 
-  set_gdbarch_save_dummy_frame_tos (gdbarch, xstormy16_save_dummy_frame_tos);
+  set_gdbarch_deprecated_save_dummy_frame_tos (gdbarch, xstormy16_save_dummy_frame_tos);
 
   set_gdbarch_skip_trampoline_code (gdbarch, xstormy16_skip_trampoline_code);
 
diff --git a/include/ChangeLog b/include/ChangeLog
index 18d0b35..5e9ac7a 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,3 +1,18 @@
+2003-06-22  Zack Weinberg  <zack@codesourcery.com>
+
+	* safe-ctype.h (HC_UNKNOWN, HC_ASCII, HC_EBCDIC): Rename to
+	HOST_CHARSET_UNKNOWN, HOST_CHARSET_ASCII, HOST_CHARSET_EBCDIC
+	respectively.
+
+2003-06-21  Zack Weinberg  <zack@codesourcery.com>
+
+	* safe-ctype.h (HC_UNKNOWN, HC_ASCII, HC_EBCDIC, HOST_CHARSET):
+	New #defines.
+
+2003-06-17  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+	* ansidecl.h: Delete HAVE_LONG_DOUBLE GCC bootstrap support.
+
 2003-05-23  Jakub Jelinek  <jakub@redhat.com>
 
 	* bfdlink.h (struct bfd_link_info): Add execstack and noexecstack.
diff --git a/include/ansidecl.h b/include/ansidecl.h
index f8f2d73..d2c8776 100644
--- a/include/ansidecl.h
+++ b/include/ansidecl.h
@@ -312,15 +312,4 @@
 #define __extension__
 #endif
 
-/* Bootstrap support:  Adjust certain macros defined by Autoconf,
-   which are only valid for the stage1 compiler.  If we detect
-   a modern version of GCC, we are probably in stage2 or beyond,
-   so unconditionally reset the values.  Note that const, inline,
-   etc. have been dealt with above.  */
-#if (GCC_VERSION >= 2007)
-# ifndef HAVE_LONG_DOUBLE
-#  define HAVE_LONG_DOUBLE 1
-# endif
-#endif /* GCC >= 2.7 */
-
 #endif	/* ansidecl.h	*/
diff --git a/include/opcode/ChangeLog b/include/opcode/ChangeLog
index 94c3031..9785f4e 100644
--- a/include/opcode/ChangeLog
+++ b/include/opcode/ChangeLog
@@ -10,7 +10,7 @@
 
 2003-06-03  Michael Snyder  <msnyder@redhat.com>
 
-	* h8sx.h (enum h8_model): Add AV_H8S to distinguish from H8H.
+	* h8300.h (enum h8_model): Add AV_H8S to distinguish from H8H.
 	(ldc): Split ccr ops from exr ops (which are only available
 	on H8S or H8SX).
 	(stc): Ditto.
diff --git a/include/safe-ctype.h b/include/safe-ctype.h
index b2ad849..69a3f74 100644
--- a/include/safe-ctype.h
+++ b/include/safe-ctype.h
@@ -37,7 +37,24 @@
 
 #ifdef isalpha
  #error "safe-ctype.h and ctype.h may not be used simultaneously"
+#endif
+
+/* Determine host character set.  */
+#define HOST_CHARSET_UNKNOWN 0
+#define HOST_CHARSET_ASCII   1
+#define HOST_CHARSET_EBCDIC  2
+
+#if  '\n' == 0x0A && ' ' == 0x20 && '0' == 0x30 \
+   && 'A' == 0x41 && 'a' == 0x61 && '!' == 0x21
+#  define HOST_CHARSET HOST_CHARSET_ASCII
 #else
+# if '\n' == 0x15 && ' ' == 0x40 && '0' == 0xF0 \
+   && 'A' == 0xC1 && 'a' == 0x81 && '!' == 0x5A
+#  define HOST_CHARSET HOST_CHARSET_EBCDIC
+# else
+#  define HOST_CHARSET HOST_CHARSET_UNKNOWN
+# endif
+#endif
 
 /* Categories.  */
 
@@ -99,5 +116,4 @@
 #define TOUPPER(c) _sch_toupper[(c) & 0xff]
 #define TOLOWER(c) _sch_tolower[(c) & 0xff]
 
-#endif /* no ctype.h */
 #endif /* SAFE_CTYPE_H */
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index 75b6636..913bf54 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,12 +1,34 @@
+2003-06-22  Zack Weinberg  <zack@codesourcery.com>
+
+	* safe-ctype.c: Use HOST_CHARSET_ASCII and HOST_CHARSET_EBCDIC,
+	not HC_ASCII and HC_EBCDIC.
+	Add documentation in form expected by gather-docs.
+	* hex.c: Use HOST_CHARSET, not hand-coded check of character set.
+	* Makefile.in, functions.texi: Regenerate.
+
+2003-06-21  Zack Weinberg  <zack@codesourcery.com>
+
+	* safe-ctype.c: Separate out EOF==-1 check.  Use HOST_CHARSET
+	for charset determination.
+
+2003-06-19  Dara Hazeghi  <dhazeghi@yahoo.com>
+
+	* configure.in: Add check for malloc.h needed by
+	m68k for function free().
+	* configure: Regenerated.
+	* config.in: Add HAVE_MALLOC_H.
+	* hashtab.c: include malloc.h were available for
+	free().
+
 2003-06-09  Albert Chin-A-Young  <china@thewrittenword.com>
-	
+
 	PR bootstrap/10974
 	* physmem.c: Update comment.
 	* configure.in: Modify test for _system_configuration for older
 	AIX systems.
 
 	* config.in, configure: Regenerated.
-	
+
 2003-06-05  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
 
 	PR other/10810
@@ -100,7 +122,7 @@
 	ANSI_PROTOTYPES.
 	* vsprintf.c: Include "ansidecl.h" earlier, rely on
 	ANSI_PROTOTYPES and possibly include <stdarg.h>.
-	
+
 	* Makefile.in: Regenerate dependencies.
 
 2003-04-15  DJ Delorie  <dj@redhat.com>
@@ -198,7 +220,7 @@
 2003-02-22  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 	    Richard Earnshaw  <rearnsha@arm.com>
 	    Geoffrey Keating  <geoffk@apple.com>
-	
+
 	* configure.in: Check for sys/sysctl.h and sysctl.
 	* physmem.c: Add support for *bsd and darwin.
 	* Makefile.in: Generate depedency for physmem.o.
@@ -227,7 +249,7 @@
 	* physmem.c (physmem_total, physmem_available): De-ANSI-fy.
 	* configure.in (AC_CHECK_FUNCS): Add pstat_getstatic and
 	pstat_getdynamic.
-	
+
 2003-02-20  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
 	* Makefile.in (CFILES): Add physmem.c.
diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in
index d73ab2f..5d2dc3c 100644
--- a/libiberty/Makefile.in
+++ b/libiberty/Makefile.in
@@ -447,7 +447,8 @@
 getruntime.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
 hashtab.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/hashtab.h \
 	$(INCDIR)/libiberty.h
-hex.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
+hex.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
+	$(INCDIR)/safe-ctype.h
 lbasename.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
 	$(INCDIR)/safe-ctype.h
 lrealpath.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
diff --git a/libiberty/config.in b/libiberty/config.in
index 51d161a..50ed326 100644
--- a/libiberty/config.in
+++ b/libiberty/config.in
@@ -291,6 +291,9 @@
 /* Define if you have the <unistd.h> header file.  */
 #undef HAVE_UNISTD_H
 
+/* Define if you have the <malloc.h> header file.  */
+#undef HAVE_MALLOC_H
+
 /* whether byteorder is bigendian */
 #undef WORDS_BIGENDIAN
 
diff --git a/libiberty/configure b/libiberty/configure
index 9182fc3..77d5170 100755
--- a/libiberty/configure
+++ b/libiberty/configure
@@ -1492,7 +1492,7 @@
 fi
 echo "$ac_t""$CPP" 1>&6
 
-for ac_hdr in sys/file.h sys/param.h limits.h stdlib.h string.h unistd.h strings.h sys/time.h time.h sys/resource.h sys/stat.h sys/mman.h fcntl.h alloca.h sys/pstat.h sys/sysmp.h sys/sysinfo.h machine/hal_sysinfo.h sys/table.h sys/sysctl.h sys/systemcfg.h
+for ac_hdr in sys/file.h sys/param.h limits.h stdlib.h malloc.h string.h unistd.h strings.h sys/time.h time.h sys/resource.h sys/stat.h sys/mman.h fcntl.h alloca.h sys/pstat.h sys/sysmp.h sys/sysinfo.h machine/hal_sysinfo.h sys/table.h sys/sysctl.h sys/systemcfg.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
@@ -2900,7 +2900,7 @@
 esac
 
 
-for ac_hdr in unistd.h
+for ac_hdr in stdlib.h unistd.h sys/stat.h sys/types.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
@@ -3032,11 +3032,24 @@
 #include <fcntl.h>
 #include <sys/mman.h>
 
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_STDLIB_H
+# include <stdlib.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
 /* This mess was copied from the GNU getpagesize.h.  */
 #ifndef HAVE_GETPAGESIZE
-# ifdef HAVE_UNISTD_H
-#  include <unistd.h>
-# endif
 
 /* Assume that all systems that can run configure have sys/param.h.  */
 # ifndef HAVE_SYS_PARAM_H
@@ -3144,7 +3157,7 @@
 }
 
 EOF
-if { (eval echo configure:3148: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3161: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_func_mmap_fixed_mapped=yes
 else
@@ -3168,7 +3181,7 @@
 
 
 echo $ac_n "checking for working strncmp""... $ac_c" 1>&6
-echo "configure:3172: checking for working strncmp" >&5
+echo "configure:3185: checking for working strncmp" >&5
 if eval "test \"`echo '$''{'ac_cv_func_strncmp_works'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3176,7 +3189,7 @@
   ac_cv_func_strncmp_works=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 3180 "configure"
+#line 3193 "configure"
 #include "confdefs.h"
 
 /* Test by Jim Wilson and Kaveh Ghazi.
@@ -3240,7 +3253,7 @@
 }
 
 EOF
-if { (eval echo configure:3244: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3257: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_func_strncmp_works=yes
 else
diff --git a/libiberty/configure.in b/libiberty/configure.in
index 0eab855..5dca13e 100644
--- a/libiberty/configure.in
+++ b/libiberty/configure.in
@@ -143,7 +143,7 @@
 # It's OK to check for header files.  Although the compiler may not be
 # able to link anything, it had better be able to at least compile
 # something.
-AC_CHECK_HEADERS(sys/file.h sys/param.h limits.h stdlib.h string.h unistd.h strings.h sys/time.h time.h sys/resource.h sys/stat.h sys/mman.h fcntl.h alloca.h sys/pstat.h sys/sysmp.h sys/sysinfo.h machine/hal_sysinfo.h sys/table.h sys/sysctl.h sys/systemcfg.h)
+AC_CHECK_HEADERS(sys/file.h sys/param.h limits.h stdlib.h malloc.h string.h unistd.h strings.h sys/time.h time.h sys/resource.h sys/stat.h sys/mman.h fcntl.h alloca.h sys/pstat.h sys/sysmp.h sys/sysinfo.h machine/hal_sysinfo.h sys/table.h sys/sysctl.h sys/systemcfg.h)
 AC_HEADER_SYS_WAIT
 AC_HEADER_TIME
 
diff --git a/libiberty/functions.texi b/libiberty/functions.texi
index 2d30c5d..aac4424 100644
--- a/libiberty/functions.texi
+++ b/libiberty/functions.texi
@@ -3,6 +3,28 @@
 @c Edit the *.c files, configure with --enable-maintainer-mode,
 @c and let gather-docs build you a new copy.
 
+@c safe-ctype.c:24
+@defvr Extension HOST_CHARSET
+This macro indicates the basic character set and encoding used by the
+host: more precisely, the encoding used for character constants in
+preprocessor @samp{#if} statements (the C "execution character set").
+It is defined by @file{safe-ctype.h}, and will be an integer constant
+with one of the following values:
+
+@ftable @code
+@item HOST_CHARSET_UNKNOWN
+The host character set is unknown - that is, not one of the next two
+possibilities.
+
+@item HOST_CHARSET_ASCII
+The host character set is ASCII.
+
+@item HOST_CHARSET_EBCDIC
+The host character set is some variant of EBCDIC.  (Only one of the
+nineteen EBCDIC varying characters is tested; exercise caution.)
+@end ftable
+@end defvr
+
 @c alloca.c:26
 @deftypefn Replacement void* alloca (size_t @var{size})
 
@@ -317,7 +339,7 @@
 
 @end deftypefn
 
-@c hex.c:25
+@c hex.c:30
 @deftypefn Extension void hex_init (void)
 
 Initializes the array mapping the current character set to
@@ -327,7 +349,7 @@
 
 @end deftypefn
 
-@c hex.c:34
+@c hex.c:39
 @deftypefn Extension int hex_p (int @var{c})
 
 Evaluates to non-zero if the given character is a valid hex character,
@@ -336,7 +358,7 @@
 
 @end deftypefn
 
-@c hex.c:42
+@c hex.c:47
 @deftypefn Extension unsigned int hex_value (int @var{c})
 
 Returns the numeric equivalent of the given character when interpreted
@@ -382,6 +404,78 @@
 
 @end deftypefn
 
+@c safe-ctype.c:45
+@deffn  Extension ISALPHA  (@var{c})
+@deffnx Extension ISALNUM  (@var{c})
+@deffnx Extension ISBLANK  (@var{c})
+@deffnx Extension ISCNTRL  (@var{c})
+@deffnx Extension ISDIGIT  (@var{c})
+@deffnx Extension ISGRAPH  (@var{c})
+@deffnx Extension ISLOWER  (@var{c})
+@deffnx Extension ISPRINT  (@var{c})
+@deffnx Extension ISPUNCT  (@var{c})
+@deffnx Extension ISSPACE  (@var{c})
+@deffnx Extension ISUPPER  (@var{c})
+@deffnx Extension ISXDIGIT (@var{c})
+
+These twelve macros are defined by @file{safe-ctype.h}.  Each has the
+same meaning as the corresponding macro (with name in lowercase)
+defined by the standard header @file{ctype.h}.  For example,
+@code{ISALPHA} returns true for alphabetic characters and false for
+others.  However, there are two differences between these macros and
+those provided by @file{ctype.h}:
+
+@itemize @bullet
+@item These macros are guaranteed to have well-defined behavior for all 
+values representable by @code{signed char} and @code{unsigned char}, and
+for @code{EOF}.
+
+@item These macros ignore the current locale; they are true for these
+fixed sets of characters:
+@multitable {@code{XDIGIT}} {yada yada yada yada yada yada yada yada}
+@item @code{ALPHA}  @tab @kbd{A-Za-z}
+@item @code{ALNUM}  @tab @kbd{A-Za-z0-9}
+@item @code{BLANK}  @tab @kbd{space tab}
+@item @code{CNTRL}  @tab @code{!PRINT}
+@item @code{DIGIT}  @tab @kbd{0-9}
+@item @code{GRAPH}  @tab @code{ALNUM || PUNCT}
+@item @code{LOWER}  @tab @kbd{a-z}
+@item @code{PRINT}  @tab @code{GRAPH ||} @kbd{space}
+@item @code{PUNCT}  @tab @kbd{`~!@@#$%^&*()_-=+[@{]@}\|;:'",<.>/?}
+@item @code{SPACE}  @tab @kbd{space tab \n \r \f \v}
+@item @code{UPPER}  @tab @kbd{A-Z}
+@item @code{XDIGIT} @tab @kbd{0-9A-Fa-f}
+@end multitable
+
+Note that, if the host character set is ASCII or a superset thereof,
+all these macros will return false for all values of @code{char} outside
+the range of 7-bit ASCII.  In particular, both ISPRINT and ISCNTRL return
+false for characters with numeric values from 128 to 255.
+@end itemize
+@end deffn
+
+@c safe-ctype.c:94
+@deffn  Extension ISIDNUM         (@var{c})
+@deffnx Extension ISIDST          (@var{c})
+@deffnx Extension IS_VSPACE       (@var{c})
+@deffnx Extension IS_NVSPACE      (@var{c})
+@deffnx Extension IS_SPACE_OR_NUL (@var{c})
+@deffnx Extension IS_ISOBASIC     (@var{c})
+These six macros are defined by @file{safe-ctype.h} and provide
+additional character classes which are useful when doing lexical
+analysis of C or similar languages.  They are true for the following
+sets of characters:
+
+@multitable {@code{SPACE_OR_NUL}} {yada yada yada yada yada yada yada yada}
+@item @code{IDNUM}        @tab @kbd{A-Za-z0-9_}
+@item @code{IDST}         @tab @kbd{A-Za-z_}
+@item @code{VSPACE}       @tab @kbd{\r \n}
+@item @code{NVSPACE}      @tab @kbd{space tab \f \v \0}
+@item @code{SPACE_OR_NUL} @tab @code{VSPACE || NVSPACE}
+@item @code{ISOBASIC}     @tab @code{VSPACE || NVSPACE || PRINT}
+@end multitable
+@end deffn
+
 @c lbasename.c:23
 @deftypefn Replacement {const char*} lbasename (const char *@var{name})
 
diff --git a/libiberty/hashtab.c b/libiberty/hashtab.c
index 3896328..cbf8259 100644
--- a/libiberty/hashtab.c
+++ b/libiberty/hashtab.c
@@ -45,6 +45,10 @@
 #include <string.h>
 #endif
 
+#ifdef HAVE_MALLOC_H
+#include <malloc.h>
+#endif
+
 #include <stdio.h>
 
 #include "libiberty.h"
diff --git a/libiberty/hex.c b/libiberty/hex.c
index f425509..e4c5dfa 100644
--- a/libiberty/hex.c
+++ b/libiberty/hex.c
@@ -19,6 +19,11 @@
 
 #include <stdio.h>  /* for EOF */
 #include "libiberty.h"
+#include "safe-ctype.h" /* for HOST_CHARSET_ASCII */
+
+#if EOF != -1
+ #error "hex.c requires EOF == -1"
+#endif
 
 /*
 
@@ -62,9 +67,7 @@
 
 
 /* Are we ASCII? */
-#if '\n' == 0x0A && ' ' == 0x20 && '0' == 0x30 \
-  && 'A' == 0x41 && 'a' == 0x61 && '!' == 0x21 \
-  && EOF == -1
+#if HOST_CHARSET == HOST_CHARSET_ASCII
 
 const unsigned char _hex_value[_hex_array_size] =
 {
diff --git a/libiberty/safe-ctype.c b/libiberty/safe-ctype.c
index 3bac84b..91a0e9a 100644
--- a/libiberty/safe-ctype.c
+++ b/libiberty/safe-ctype.c
@@ -19,20 +19,109 @@
 not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 Boston, MA 02111-1307, USA.  */
 
-/* This is a compatible replacement of the standard C library's <ctype.h>
-   with the following properties:
+/*
 
-   - Implements all isxxx() macros required by C99.
-   - Also implements some character classes useful when
-     parsing C-like languages.
-   - Does not change behavior depending on the current locale.
-   - Behaves properly for all values in the range of a signed or
-     unsigned char.  */
+@defvr Extension HOST_CHARSET
+This macro indicates the basic character set and encoding used by the
+host: more precisely, the encoding used for character constants in
+preprocessor @samp{#if} statements (the C "execution character set").
+It is defined by @file{safe-ctype.h}, and will be an integer constant
+with one of the following values:
+
+@ftable @code
+@item HOST_CHARSET_UNKNOWN
+The host character set is unknown - that is, not one of the next two
+possibilities.
+
+@item HOST_CHARSET_ASCII
+The host character set is ASCII.
+
+@item HOST_CHARSET_EBCDIC
+The host character set is some variant of EBCDIC.  (Only one of the
+nineteen EBCDIC varying characters is tested; exercise caution.)
+@end ftable
+@end defvr
+
+@deffn  Extension ISALPHA  (@var{c})
+@deffnx Extension ISALNUM  (@var{c})
+@deffnx Extension ISBLANK  (@var{c})
+@deffnx Extension ISCNTRL  (@var{c})
+@deffnx Extension ISDIGIT  (@var{c})
+@deffnx Extension ISGRAPH  (@var{c})
+@deffnx Extension ISLOWER  (@var{c})
+@deffnx Extension ISPRINT  (@var{c})
+@deffnx Extension ISPUNCT  (@var{c})
+@deffnx Extension ISSPACE  (@var{c})
+@deffnx Extension ISUPPER  (@var{c})
+@deffnx Extension ISXDIGIT (@var{c})
+
+These twelve macros are defined by @file{safe-ctype.h}.  Each has the
+same meaning as the corresponding macro (with name in lowercase)
+defined by the standard header @file{ctype.h}.  For example,
+@code{ISALPHA} returns true for alphabetic characters and false for
+others.  However, there are two differences between these macros and
+those provided by @file{ctype.h}:
+
+@itemize @bullet
+@item These macros are guaranteed to have well-defined behavior for all 
+values representable by @code{signed char} and @code{unsigned char}, and
+for @code{EOF}.
+
+@item These macros ignore the current locale; they are true for these
+fixed sets of characters:
+@multitable {@code{XDIGIT}} {yada yada yada yada yada yada yada yada}
+@item @code{ALPHA}  @tab @kbd{A-Za-z}
+@item @code{ALNUM}  @tab @kbd{A-Za-z0-9}
+@item @code{BLANK}  @tab @kbd{space tab}
+@item @code{CNTRL}  @tab @code{!PRINT}
+@item @code{DIGIT}  @tab @kbd{0-9}
+@item @code{GRAPH}  @tab @code{ALNUM || PUNCT}
+@item @code{LOWER}  @tab @kbd{a-z}
+@item @code{PRINT}  @tab @code{GRAPH ||} @kbd{space}
+@item @code{PUNCT}  @tab @kbd{`~!@@#$%^&*()_-=+[@{]@}\|;:'",<.>/?}
+@item @code{SPACE}  @tab @kbd{space tab \n \r \f \v}
+@item @code{UPPER}  @tab @kbd{A-Z}
+@item @code{XDIGIT} @tab @kbd{0-9A-Fa-f}
+@end multitable
+
+Note that, if the host character set is ASCII or a superset thereof,
+all these macros will return false for all values of @code{char} outside
+the range of 7-bit ASCII.  In particular, both ISPRINT and ISCNTRL return
+false for characters with numeric values from 128 to 255.
+@end itemize
+@end deffn
+
+@deffn  Extension ISIDNUM         (@var{c})
+@deffnx Extension ISIDST          (@var{c})
+@deffnx Extension IS_VSPACE       (@var{c})
+@deffnx Extension IS_NVSPACE      (@var{c})
+@deffnx Extension IS_SPACE_OR_NUL (@var{c})
+@deffnx Extension IS_ISOBASIC     (@var{c})
+These six macros are defined by @file{safe-ctype.h} and provide
+additional character classes which are useful when doing lexical
+analysis of C or similar languages.  They are true for the following
+sets of characters:
+
+@multitable {@code{SPACE_OR_NUL}} {yada yada yada yada yada yada yada yada}
+@item @code{IDNUM}        @tab @kbd{A-Za-z0-9_}
+@item @code{IDST}         @tab @kbd{A-Za-z_}
+@item @code{VSPACE}       @tab @kbd{\r \n}
+@item @code{NVSPACE}      @tab @kbd{space tab \f \v \0}
+@item @code{SPACE_OR_NUL} @tab @code{VSPACE || NVSPACE}
+@item @code{ISOBASIC}     @tab @code{VSPACE || NVSPACE || PRINT}
+@end multitable
+@end deffn
+
+*/
 
 #include "ansidecl.h"
 #include <safe-ctype.h>
 #include <stdio.h>  /* for EOF */
 
+#if EOF != -1
+ #error "<safe-ctype.h> requires EOF == -1"
+#endif
+
 /* Shorthand */
 #define bl _sch_isblank
 #define cn _sch_iscntrl
@@ -64,9 +153,7 @@
 #define S  (const unsigned short) (nv|sp|bl|pr)	/* space */
 
 /* Are we ASCII? */
-#if '\n' == 0x0A && ' ' == 0x20 && '0' == 0x30 \
-  && 'A' == 0x41 && 'a' == 0x61 && '!' == 0x21 \
-  && EOF == -1
+#if HOST_CHARSET == HOST_CHARSET_ASCII
 
 const unsigned short _sch_istable[256] =
 {
@@ -159,5 +246,9 @@
 };
 
 #else
- #error "Unsupported host character set"
-#endif /* not ASCII */
+# if HOST_CHARSET == HOST_CHARSET_EBCDIC
+  #error "FIXME: write tables for EBCDIC"
+# else
+  #error "Unrecognized host character set"
+# endif
+#endif
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index c5e3fff..b112aae 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,20 @@
+2003-06-19  Christian Groessler  <chris@groessler.org>
+
+	* z8k-dis.c (instr_data_s): Change tabl_index from long to int.
+	(print_insn_z8k): Correctly check return value from
+	z8k_lookup_instr call.
+	(unparse_instr): Handle CLASS_IRO case.
+	* z8kgen.c: Fix function definitions.  Fix formatting.
+	(opt): Add brk opcode alias for non-simulator breakpoint.  Add
+	missing and fix existing in/out and sin/sout opcode definitions.
+	(args): "@ri", "@ro" - add CLASS_IRO register usage for in/out
+	opcodes.
+	(internal): Check p->flags for non-zero before dereferencing it.
+	(gas): Add CLASS_IRO line.  Insert new OPC_xxx lines for the added
+	opcodes and renumber the remaining lines repectively.
+	(main): Remove "-d" command line switch.
+	* z8k-opc.h: Regenerate with new z8kgen.c.
+
 2003-06-11  H.J. Lu <hongjiu.lu@intel.com>
 
 	* po/Make-in (DESTDIR): New.
diff --git a/opcodes/z8k-dis.c b/opcodes/z8k-dis.c
index 69d1792..5d15ee8 100644
--- a/opcodes/z8k-dis.c
+++ b/opcodes/z8k-dis.c
@@ -1,5 +1,5 @@
 /* Disassemble z8000 code.
-   Copyright 1992, 1993, 1998, 2000, 2001, 2002
+   Copyright 1992, 1993, 1998, 2000, 2001, 2002, 2003
    Free Software Foundation, Inc.
 
    This file is part of GNU Binutils.
@@ -40,7 +40,7 @@
   bfd_vma insn_start;
   jmp_buf bailout;
 
-  long tabl_index;
+  int tabl_index;
   char instr_asmsrc[80];
   unsigned long arg_reg[0x0f];
   unsigned long immediate;
@@ -169,7 +169,7 @@
   info->display_endian = BFD_ENDIAN_BIG;
 
   instr_data.tabl_index = z8k_lookup_instr (instr_data.nibbles, info);
-  if (instr_data.tabl_index > 0)
+  if (instr_data.tabl_index >= 0)
     {
       unpack_instr (&instr_data, is_segmented, info);
       unparse_instr (&instr_data, is_segmented);
@@ -581,6 +581,10 @@
 	    sprintf (tmp_str, "@r%ld", instr_data->arg_reg[datum_value]);
 	  strcat (out_str, tmp_str);
 	  break;
+	case CLASS_IRO:
+          sprintf (tmp_str, "@r%ld", instr_data->arg_reg[datum_value]);
+	  strcat (out_str, tmp_str);
+	  break;
 	case CLASS_FLAGS:
 	  sprintf (tmp_str, "0x%0lx", instr_data->flags);
 	  strcat (out_str, tmp_str);
diff --git a/opcodes/z8k-opc.h b/opcodes/z8k-opc.h
index 022f581..c714bde 100644
--- a/opcodes/z8k-opc.h
+++ b/opcodes/z8k-opc.h
@@ -26,7 +26,6 @@
 #define ARG_NIM4 0x0c
 #define ARG_DISP8 0x0c
 #define ARG_IMM4M1 0x0d
-#define CLASS_MASK 0x1fff0
 #define CLASS_X 0x10
 #define CLASS_BA 0x20
 #define CLASS_DA 0x30
@@ -46,8 +45,9 @@
 #define CLASS_BIT 0x500
 #define CLASS_FLAGS 0x600
 #define CLASS_IR 0x700
-#define CLASS_DISP8 0x800
-#define CLASS_BIT_1OR2 0x900
+#define CLASS_IRO       0x800
+#define CLASS_DISP8     0x900
+#define CLASS_BIT_1OR2  0xa00
 #define CLASS_REG 0x7000
 #define CLASS_REG_BYTE 0x2000
 #define CLASS_REG_WORD 0x3000
@@ -55,6 +55,7 @@
 #define CLASS_REG_LONG 0x5000
 #define CLASS_REGN0 0x8000
 #define CLASS_PR 0x10000
+#define CLASS_MASK     0x1fff0
 #define OPC_adc 0
 #define OPC_adcb 1
 #define OPC_add 2
@@ -111,138 +112,154 @@
 #define OPC_incb 53
 #define OPC_ind 54
 #define OPC_indb 55
-#define OPC_inib 56
-#define OPC_inibr 57
-#define OPC_iret 58
-#define OPC_jp 59
-#define OPC_jr 60
-#define OPC_ld 61
-#define OPC_lda 62
-#define OPC_ldar 63
-#define OPC_ldb 64
-#define OPC_ldctl 65
-#define OPC_ldir 66
-#define OPC_ldirb 67
-#define OPC_ldk 68
-#define OPC_ldl 69
-#define OPC_ldm 70
-#define OPC_ldps 71
-#define OPC_ldr 72
-#define OPC_ldrb 73
-#define OPC_ldrl 74
-#define OPC_mbit 75
-#define OPC_mreq 76
-#define OPC_mres 77
-#define OPC_mset 78
-#define OPC_mult 79
-#define OPC_multl 80
-#define OPC_neg 81
-#define OPC_negb 82
-#define OPC_nop 83
-#define OPC_or 84
-#define OPC_orb 85
-#define OPC_out 86
-#define OPC_outb 87
-#define OPC_outd 88
-#define OPC_outdb 89
-#define OPC_outib 90
-#define OPC_outibr 91
-#define OPC_pop 92
-#define OPC_popl 93
-#define OPC_push 94
-#define OPC_pushl 95
-#define OPC_res 96
-#define OPC_resb 97
-#define OPC_resflg 98
-#define OPC_ret 99
-#define OPC_rl 100
-#define OPC_rlb 101
-#define OPC_rlc 102
-#define OPC_rlcb 103
-#define OPC_rldb 104
-#define OPC_rr 105
-#define OPC_rrb 106
-#define OPC_rrc 107
-#define OPC_rrcb 108
-#define OPC_rrdb 109
-#define OPC_sbc 110
-#define OPC_sbcb 111
-#define OPC_sda 112
-#define OPC_sdab 113
-#define OPC_sdal 114
-#define OPC_sdl 115
-#define OPC_sdlb 116
-#define OPC_sdll 117
-#define OPC_set 118
-#define OPC_setb 119
-#define OPC_setflg 120
-#define OPC_sinb 121
-#define OPC_sind 122
-#define OPC_sindb 123
-#define OPC_sinib 124
-#define OPC_sinibr 125
-#define OPC_sla 126
-#define OPC_slab 127
-#define OPC_slal 128
-#define OPC_sll 129
-#define OPC_sllb 130
-#define OPC_slll 131
-#define OPC_sout 132
-#define OPC_soutb 133
-#define OPC_soutd 134
-#define OPC_soutdb 135
-#define OPC_soutib 136
-#define OPC_soutibr 137
-#define OPC_sra 138
-#define OPC_srab 139
-#define OPC_sral 140
-#define OPC_srl 141
-#define OPC_srlb 142
-#define OPC_srll 143
-#define OPC_sub 144
-#define OPC_subb 145
-#define OPC_subl 146
-#define OPC_tcc 147
-#define OPC_tccb 148
-#define OPC_test 149
-#define OPC_testb 150
-#define OPC_testl 151
-#define OPC_trdb 152
-#define OPC_trdrb 153
-#define OPC_trib 154
-#define OPC_trirb 155
-#define OPC_trtdrb 156
-#define OPC_trtib 157
-#define OPC_trtirb 158
-#define OPC_trtrb 159
-#define OPC_tset 160
-#define OPC_tsetb 161
-#define OPC_xor 162
-#define OPC_xorb 163
-#define OPC_ldd  164 
-#define OPC_lddb  165 
-#define OPC_lddr  166 
-#define OPC_lddrb 167  
-#define OPC_ldi  168 
-#define OPC_ldib 169  
-#define OPC_sc   170
-#define OPC_bpt   171
-#define OPC_ext0e 172
-#define OPC_ext0f 172
-#define OPC_ext8e 172
-#define OPC_ext8f 172
-#define OPC_rsvd36 172
-#define OPC_rsvd38 172
-#define OPC_rsvd78 172
-#define OPC_rsvd7e 172
-#define OPC_rsvd9d 172
-#define OPC_rsvd9f 172
-#define OPC_rsvdb9 172
-#define OPC_rsvdbf 172
-#define OPC_outi 173
-#define OPC_ldctlb 174
-#define OPC_sin 175
-#define OPC_trtdb 176
+#define OPC_indr    56
+#define OPC_indrb   57
+#define OPC_ini     58
+#define OPC_inib    59
+#define OPC_inir    60
+#define OPC_inirb   61
+#define OPC_iret    62
+#define OPC_jp      63
+#define OPC_jr      64
+#define OPC_ld      65
+#define OPC_lda     66
+#define OPC_ldar    67
+#define OPC_ldb     68
+#define OPC_ldctl   69
+#define OPC_ldir    70
+#define OPC_ldirb   71
+#define OPC_ldk     72
+#define OPC_ldl     73
+#define OPC_ldm     74
+#define OPC_ldps    75
+#define OPC_ldr     76
+#define OPC_ldrb    77
+#define OPC_ldrl    78
+#define OPC_mbit    79
+#define OPC_mreq    80
+#define OPC_mres    81
+#define OPC_mset    82
+#define OPC_mult    83
+#define OPC_multl   84
+#define OPC_neg     85
+#define OPC_negb    86
+#define OPC_nop     87
+#define OPC_or      88
+#define OPC_orb     89
+#define OPC_otdr    90
+#define OPC_otdrb   91
+#define OPC_otir    92
+#define OPC_otirb   93
+#define OPC_out     94
+#define OPC_outb    95
+#define OPC_outd    96
+#define OPC_outdb   97
+#define OPC_outi    98
+#define OPC_outib   99
+#define OPC_pop    100
+#define OPC_popl   101
+#define OPC_push   102
+#define OPC_pushl  103
+#define OPC_res    104
+#define OPC_resb   105
+#define OPC_resflg 106
+#define OPC_ret    107
+#define OPC_rl     108
+#define OPC_rlb    109
+#define OPC_rlc    110
+#define OPC_rlcb   111
+#define OPC_rldb   112
+#define OPC_rr     113
+#define OPC_rrb    114
+#define OPC_rrc    115
+#define OPC_rrcb   116
+#define OPC_rrdb   117
+#define OPC_sbc    118
+#define OPC_sbcb   119
+#define OPC_sda    120
+#define OPC_sdab   121
+#define OPC_sdal   122
+#define OPC_sdl    123
+#define OPC_sdlb   124
+#define OPC_sdll   125
+#define OPC_set    126
+#define OPC_setb   127
+#define OPC_setflg 128
+#define OPC_sin    129
+#define OPC_sinb   130
+#define OPC_sind   131
+#define OPC_sindb  132
+#define OPC_sindr  133
+#define OPC_sindrb 134
+#define OPC_sini   135
+#define OPC_sinib  136
+#define OPC_sinir  137
+#define OPC_sinirb 138
+#define OPC_sla    139
+#define OPC_slab   140
+#define OPC_slal   141
+#define OPC_sll    142
+#define OPC_sllb   143
+#define OPC_slll   144
+#define OPC_sotdr  145
+#define OPC_sotdrb 146
+#define OPC_sotir  147
+#define OPC_sotirb 148
+#define OPC_sout   149
+#define OPC_soutb  150
+#define OPC_soutd  151
+#define OPC_soutdb 152
+#define OPC_souti  153
+#define OPC_soutib 154
+#define OPC_sra    155
+#define OPC_srab   156
+#define OPC_sral   157
+#define OPC_srl    158
+#define OPC_srlb   159
+#define OPC_srll   160
+#define OPC_sub    161
+#define OPC_subb   162
+#define OPC_subl   163
+#define OPC_tcc    164
+#define OPC_tccb   165
+#define OPC_test   166
+#define OPC_testb  167
+#define OPC_testl  168
+#define OPC_trdb   169
+#define OPC_trdrb  170
+#define OPC_trib   171
+#define OPC_trirb  172
+#define OPC_trtdrb 173
+#define OPC_trtib  174
+#define OPC_trtirb 175
+#define OPC_trtrb  176
+#define OPC_tset   177
+#define OPC_tsetb  178
+#define OPC_xor    179
+#define OPC_xorb   180
+#define OPC_ldd    181
+#define OPC_lddb   182
+#define OPC_lddr   183
+#define OPC_lddrb  184
+#define OPC_ldi    185
+#define OPC_ldib   186
+#define OPC_sc     187
+#define OPC_bpt    188
+#define OPC_ext0e  188
+#define OPC_ext0f  188
+#define OPC_ext8e  188
+#define OPC_ext8f  188
+#define OPC_rsvd36 188
+#define OPC_rsvd38 188
+#define OPC_rsvd78 188
+#define OPC_rsvd7e 188
+#define OPC_rsvd9d 188
+#define OPC_rsvd9f 188
+#define OPC_rsvdb9 188
+#define OPC_rsvdbf 188
+#define OPC_ldctlb 189
+#define OPC_trtdb  190
+#define OPC_brk    191
 
 typedef struct {
 #ifdef NICENAMES
@@ -568,13 +585,21 @@
 "bpt",OPC_bpt,0,{0},
 	{CLASS_BIT+3,CLASS_BIT+6,CLASS_BIT+0,CLASS_BIT+0,0,0,0,0,0,},0,2,9},
 
+/* 0000 1111 0000 1100 *** brk */
+{
+#ifdef NICENAMES
+"brk",8,10,0x00,
+#endif
+"brk",OPC_brk,0,{0},
+	{CLASS_BIT+0,CLASS_BIT+0xf,CLASS_BIT+0,CLASS_BIT+0xc,0,0,0,0,0,},0,2,10},
+
 /* 0001 1111 ddN0 0000 *** call @rd */
 {
 #ifdef NICENAMES
 "call @rd",32,10,0x00,
 #endif
 "call",OPC_call,0,{CLASS_IR+(ARG_RD),},
-	{CLASS_BIT+1,CLASS_BIT+0xf,CLASS_REGN0+(ARG_RD),CLASS_BIT+0,0,0,0,0,0,},1,2,10},
+	{CLASS_BIT+1,CLASS_BIT+0xf,CLASS_REGN0+(ARG_RD),CLASS_BIT+0,0,0,0,0,0,},1,2,11},
 
 /* 0101 1111 0000 0000 address_dst *** call address_dst */
 {
@@ -582,7 +607,7 @@
 "call address_dst",32,12,0x00,
 #endif
 "call",OPC_call,0,{CLASS_DA+(ARG_DST),},
-	{CLASS_BIT+5,CLASS_BIT+0xf,CLASS_BIT+0,CLASS_BIT+0,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,10},
+	{CLASS_BIT+5,CLASS_BIT+0xf,CLASS_BIT+0,CLASS_BIT+0,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,11},
 
 /* 0101 1111 ddN0 0000 address_dst *** call address_dst(rd) */
 {
@@ -590,7 +615,7 @@
 "call address_dst(rd)",32,13,0x00,
 #endif
 "call",OPC_call,0,{CLASS_X+(ARG_RD),},
-	{CLASS_BIT+5,CLASS_BIT+0xf,CLASS_REGN0+(ARG_RD),CLASS_BIT+0,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,10},
+	{CLASS_BIT+5,CLASS_BIT+0xf,CLASS_REGN0+(ARG_RD),CLASS_BIT+0,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,11},
 
 /* 1101 disp12 *** calr disp12 */
 {
@@ -598,7 +623,7 @@
 "calr disp12",16,10,0x00,
 #endif
 "calr",OPC_calr,0,{CLASS_DISP,},
-	{CLASS_BIT+0xd,CLASS_DISP+(ARG_DISP12),0,0,0,0,0,0,0,},1,2,11},
+	{CLASS_BIT+0xd,CLASS_DISP+(ARG_DISP12),0,0,0,0,0,0,0,},1,2,12},
 
 /* 0000 1101 ddN0 1000 *** clr @rd */
 {
@@ -606,7 +631,7 @@
 "clr @rd",16,8,0x00,
 #endif
 "clr",OPC_clr,0,{CLASS_IR+(ARG_RD),},
-	{CLASS_BIT+0,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,0,0,0,0,},1,2,12},
+	{CLASS_BIT+0,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,0,0,0,0,},1,2,13},
 
 /* 0100 1101 0000 1000 address_dst *** clr address_dst */
 {
@@ -614,7 +639,7 @@
 "clr address_dst",16,11,0x00,
 #endif
 "clr",OPC_clr,0,{CLASS_DA+(ARG_DST),},
-	{CLASS_BIT+4,CLASS_BIT+0xd,CLASS_BIT+0,CLASS_BIT+8,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,12},
+	{CLASS_BIT+4,CLASS_BIT+0xd,CLASS_BIT+0,CLASS_BIT+8,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,13},
 
 /* 0100 1101 ddN0 1000 address_dst *** clr address_dst(rd) */
 {
@@ -622,7 +647,7 @@
 "clr address_dst(rd)",16,12,0x00,
 #endif
 "clr",OPC_clr,0,{CLASS_X+(ARG_RD),},
-	{CLASS_BIT+4,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_BIT+8,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,12},
+	{CLASS_BIT+4,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_BIT+8,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,13},
 
 /* 1000 1101 dddd 1000 *** clr rd */
 {
@@ -630,7 +655,7 @@
 "clr rd",16,7,0x00,
 #endif
 "clr",OPC_clr,0,{CLASS_REG_WORD+(ARG_RD),},
-	{CLASS_BIT+8,CLASS_BIT+0xd,CLASS_REG+(ARG_RD),CLASS_BIT+8,0,0,0,0,0,},1,2,12},
+	{CLASS_BIT+8,CLASS_BIT+0xd,CLASS_REG+(ARG_RD),CLASS_BIT+8,0,0,0,0,0,},1,2,13},
 
 /* 0000 1100 ddN0 1000 *** clrb @rd */
 {
@@ -638,7 +663,7 @@
 "clrb @rd",8,8,0x00,
 #endif
 "clrb",OPC_clrb,0,{CLASS_IR+(ARG_RD),},
-	{CLASS_BIT+0,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,0,0,0,0,},1,2,13},
+	{CLASS_BIT+0,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,0,0,0,0,},1,2,14},
 
 /* 0100 1100 0000 1000 address_dst *** clrb address_dst */
 {
@@ -646,7 +671,7 @@
 "clrb address_dst",8,11,0x00,
 #endif
 "clrb",OPC_clrb,0,{CLASS_DA+(ARG_DST),},
-	{CLASS_BIT+4,CLASS_BIT+0xc,CLASS_BIT+0,CLASS_BIT+8,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,13},
+	{CLASS_BIT+4,CLASS_BIT+0xc,CLASS_BIT+0,CLASS_BIT+8,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,14},
 
 /* 0100 1100 ddN0 1000 address_dst *** clrb address_dst(rd) */
 {
@@ -654,7 +679,7 @@
 "clrb address_dst(rd)",8,12,0x00,
 #endif
 "clrb",OPC_clrb,0,{CLASS_X+(ARG_RD),},
-	{CLASS_BIT+4,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+8,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,13},
+	{CLASS_BIT+4,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+8,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,14},
 
 /* 1000 1100 dddd 1000 *** clrb rbd */
 {
@@ -662,7 +687,7 @@
 "clrb rbd",8,7,0x00,
 #endif
 "clrb",OPC_clrb,0,{CLASS_REG_BYTE+(ARG_RD),},
-	{CLASS_BIT+8,CLASS_BIT+0xc,CLASS_REG+(ARG_RD),CLASS_BIT+8,0,0,0,0,0,},1,2,13},
+	{CLASS_BIT+8,CLASS_BIT+0xc,CLASS_REG+(ARG_RD),CLASS_BIT+8,0,0,0,0,0,},1,2,14},
 
 /* 0000 1101 ddN0 0000 *** com @rd */
 {
@@ -670,7 +695,7 @@
 "com @rd",16,12,0x18,
 #endif
 "com",OPC_com,0,{CLASS_IR+(ARG_RD),},
-	{CLASS_BIT+0,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_BIT+0,0,0,0,0,0,},1,2,14},
+	{CLASS_BIT+0,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_BIT+0,0,0,0,0,0,},1,2,15},
 
 /* 0100 1101 0000 0000 address_dst *** com address_dst */
 {
@@ -678,7 +703,7 @@
 "com address_dst",16,15,0x18,
 #endif
 "com",OPC_com,0,{CLASS_DA+(ARG_DST),},
-	{CLASS_BIT+4,CLASS_BIT+0xd,CLASS_BIT+0,CLASS_BIT+0,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,14},
+	{CLASS_BIT+4,CLASS_BIT+0xd,CLASS_BIT+0,CLASS_BIT+0,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,15},
 
 /* 0100 1101 ddN0 0000 address_dst *** com address_dst(rd) */
 {
@@ -686,7 +711,7 @@
 "com address_dst(rd)",16,16,0x18,
 #endif
 "com",OPC_com,0,{CLASS_X+(ARG_RD),},
-	{CLASS_BIT+4,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_BIT+0,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,14},
+	{CLASS_BIT+4,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_BIT+0,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,15},
 
 /* 1000 1101 dddd 0000 *** com rd */
 {
@@ -694,7 +719,7 @@
 "com rd",16,7,0x18,
 #endif
 "com",OPC_com,0,{CLASS_REG_WORD+(ARG_RD),},
-	{CLASS_BIT+8,CLASS_BIT+0xd,CLASS_REG+(ARG_RD),CLASS_BIT+0,0,0,0,0,0,},1,2,14},
+	{CLASS_BIT+8,CLASS_BIT+0xd,CLASS_REG+(ARG_RD),CLASS_BIT+0,0,0,0,0,0,},1,2,15},
 
 /* 0000 1100 ddN0 0000 *** comb @rd */
 {
@@ -702,7 +727,7 @@
 "comb @rd",8,12,0x1c,
 #endif
 "comb",OPC_comb,0,{CLASS_IR+(ARG_RD),},
-	{CLASS_BIT+0,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+0,0,0,0,0,0,},1,2,15},
+	{CLASS_BIT+0,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+0,0,0,0,0,0,},1,2,16},
 
 /* 0100 1100 0000 0000 address_dst *** comb address_dst */
 {
@@ -710,7 +735,7 @@
 "comb address_dst",8,15,0x1c,
 #endif
 "comb",OPC_comb,0,{CLASS_DA+(ARG_DST),},
-	{CLASS_BIT+4,CLASS_BIT+0xc,CLASS_BIT+0,CLASS_BIT+0,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,15},
+	{CLASS_BIT+4,CLASS_BIT+0xc,CLASS_BIT+0,CLASS_BIT+0,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,16},
 
 /* 0100 1100 ddN0 0000 address_dst *** comb address_dst(rd) */
 {
@@ -718,7 +743,7 @@
 "comb address_dst(rd)",8,16,0x1c,
 #endif
 "comb",OPC_comb,0,{CLASS_X+(ARG_RD),},
-	{CLASS_BIT+4,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+0,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,15},
+	{CLASS_BIT+4,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+0,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,16},
 
 /* 1000 1100 dddd 0000 *** comb rbd */
 {
@@ -726,7 +751,7 @@
 "comb rbd",8,7,0x1c,
 #endif
 "comb",OPC_comb,0,{CLASS_REG_BYTE+(ARG_RD),},
-	{CLASS_BIT+8,CLASS_BIT+0xc,CLASS_REG+(ARG_RD),CLASS_BIT+0,0,0,0,0,0,},1,2,15},
+	{CLASS_BIT+8,CLASS_BIT+0xc,CLASS_REG+(ARG_RD),CLASS_BIT+0,0,0,0,0,0,},1,2,16},
 
 /* 1000 1101 flags 0101 *** comflg flags */
 {
@@ -734,7 +759,7 @@
 "comflg flags",16,7,0x3c,
 #endif
 "comflg",OPC_comflg,0,{CLASS_FLAGS,},
-	{CLASS_BIT+8,CLASS_BIT+0xd,CLASS_FLAGS,CLASS_BIT+5,0,0,0,0,0,},1,2,16},
+	{CLASS_BIT+8,CLASS_BIT+0xd,CLASS_FLAGS,CLASS_BIT+5,0,0,0,0,0,},1,2,17},
 
 /* 0000 1101 ddN0 0001 imm16 *** cp @rd,imm16 */
 {
@@ -742,7 +767,7 @@
 "cp @rd,imm16",16,11,0x3c,
 #endif
 "cp",OPC_cp,0,{CLASS_IR+(ARG_RD),CLASS_IMM+(ARG_IMM16),},
-	{CLASS_BIT+0,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_BIT+1,CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,17},
+	{CLASS_BIT+0,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_BIT+1,CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,18},
 
 /* 0100 1101 ddN0 0001 address_dst imm16 *** cp address_dst(rd),imm16 */
 {
@@ -750,7 +775,7 @@
 "cp address_dst(rd),imm16",16,15,0x3c,
 #endif
 "cp",OPC_cp,0,{CLASS_X+(ARG_RD),CLASS_IMM+(ARG_IMM16),},
-	{CLASS_BIT+4,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_BIT+1,CLASS_ADDRESS+(ARG_DST),CLASS_IMM+(ARG_IMM16),0,0,0,},2,6,17},
+	{CLASS_BIT+4,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_BIT+1,CLASS_ADDRESS+(ARG_DST),CLASS_IMM+(ARG_IMM16),0,0,0,},2,6,18},
 
 /* 0100 1101 0000 0001 address_dst imm16 *** cp address_dst,imm16 */
 {
@@ -758,7 +783,7 @@
 "cp address_dst,imm16",16,14,0x3c,
 #endif
 "cp",OPC_cp,0,{CLASS_DA+(ARG_DST),CLASS_IMM+(ARG_IMM16),},
-	{CLASS_BIT+4,CLASS_BIT+0xd,CLASS_BIT+0,CLASS_BIT+1,CLASS_ADDRESS+(ARG_DST),CLASS_IMM+(ARG_IMM16),0,0,0,},2,6,17},
+	{CLASS_BIT+4,CLASS_BIT+0xd,CLASS_BIT+0,CLASS_BIT+1,CLASS_ADDRESS+(ARG_DST),CLASS_IMM+(ARG_IMM16),0,0,0,},2,6,18},
 
 /* 0000 1011 ssN0 dddd *** cp rd,@rs */
 {
@@ -766,7 +791,7 @@
 "cp rd,@rs",16,7,0x3c,
 #endif
 "cp",OPC_cp,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IR+(ARG_RS),},
-	{CLASS_BIT+0,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,17},
+	{CLASS_BIT+0,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,18},
 
 /* 0100 1011 0000 dddd address_src *** cp rd,address_src */
 {
@@ -774,7 +799,7 @@
 "cp rd,address_src",16,9,0x3c,
 #endif
 "cp",OPC_cp,0,{CLASS_REG_WORD+(ARG_RD),CLASS_DA+(ARG_SRC),},
-	{CLASS_BIT+4,CLASS_BIT+0xb,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,17},
+	{CLASS_BIT+4,CLASS_BIT+0xb,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,18},
 
 /* 0100 1011 ssN0 dddd address_src *** cp rd,address_src(rs) */
 {
@@ -782,7 +807,7 @@
 "cp rd,address_src(rs)",16,10,0x3c,
 #endif
 "cp",OPC_cp,0,{CLASS_REG_WORD+(ARG_RD),CLASS_X+(ARG_RS),},
-	{CLASS_BIT+4,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,17},
+	{CLASS_BIT+4,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,18},
 
 /* 0000 1011 0000 dddd imm16 *** cp rd,imm16 */
 {
@@ -790,7 +815,7 @@
 "cp rd,imm16",16,7,0x3c,
 #endif
 "cp",OPC_cp,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IMM+(ARG_IMM16),},
-	{CLASS_BIT+0,CLASS_BIT+0xb,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,17},
+	{CLASS_BIT+0,CLASS_BIT+0xb,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,18},
 
 /* 1000 1011 ssss dddd *** cp rd,rs */
 {
@@ -798,7 +823,7 @@
 "cp rd,rs",16,4,0x3c,
 #endif
 "cp",OPC_cp,0,{CLASS_REG_WORD+(ARG_RD),CLASS_REG_WORD+(ARG_RS),},
-	{CLASS_BIT+8,CLASS_BIT+0xb,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,17},
+	{CLASS_BIT+8,CLASS_BIT+0xb,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,18},
 
 /* 0000 1100 ddN0 0001 imm8 imm8 *** cpb @rd,imm8 */
 {
@@ -806,7 +831,7 @@
 "cpb @rd,imm8",8,11,0x3c,
 #endif
 "cpb",OPC_cpb,0,{CLASS_IR+(ARG_RD),CLASS_IMM+(ARG_IMM8),},
-	{CLASS_BIT+0,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+1,CLASS_IMM+(ARG_IMM8),CLASS_IMM+(ARG_IMM8),0,0,0,},2,4,18},
+	{CLASS_BIT+0,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+1,CLASS_IMM+(ARG_IMM8),CLASS_IMM+(ARG_IMM8),0,0,0,},2,4,19},
 
 /* 0100 1100 ddN0 0001 address_dst imm8 imm8 *** cpb address_dst(rd),imm8 */
 {
@@ -814,7 +839,7 @@
 "cpb address_dst(rd),imm8",8,15,0x3c,
 #endif
 "cpb",OPC_cpb,0,{CLASS_X+(ARG_RD),CLASS_IMM+(ARG_IMM8),},
-	{CLASS_BIT+4,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+1,CLASS_ADDRESS+(ARG_DST),CLASS_IMM+(ARG_IMM8),CLASS_IMM+(ARG_IMM8),0,0,},2,6,18},
+	{CLASS_BIT+4,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+1,CLASS_ADDRESS+(ARG_DST),CLASS_IMM+(ARG_IMM8),CLASS_IMM+(ARG_IMM8),0,0,},2,6,19},
 
 /* 0100 1100 0000 0001 address_dst imm8 imm8 *** cpb address_dst,imm8 */
 {
@@ -822,7 +847,7 @@
 "cpb address_dst,imm8",8,14,0x3c,
 #endif
 "cpb",OPC_cpb,0,{CLASS_DA+(ARG_DST),CLASS_IMM+(ARG_IMM8),},
-	{CLASS_BIT+4,CLASS_BIT+0xc,CLASS_BIT+0,CLASS_BIT+1,CLASS_ADDRESS+(ARG_DST),CLASS_IMM+(ARG_IMM8),CLASS_IMM+(ARG_IMM8),0,0,},2,6,18},
+	{CLASS_BIT+4,CLASS_BIT+0xc,CLASS_BIT+0,CLASS_BIT+1,CLASS_ADDRESS+(ARG_DST),CLASS_IMM+(ARG_IMM8),CLASS_IMM+(ARG_IMM8),0,0,},2,6,19},
 
 /* 0000 1010 ssN0 dddd *** cpb rbd,@rs */
 {
@@ -830,7 +855,7 @@
 "cpb rbd,@rs",8,7,0x3c,
 #endif
 "cpb",OPC_cpb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IR+(ARG_RS),},
-	{CLASS_BIT+0,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,18},
+	{CLASS_BIT+0,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,19},
 
 /* 0100 1010 0000 dddd address_src *** cpb rbd,address_src */
 {
@@ -838,7 +863,7 @@
 "cpb rbd,address_src",8,9,0x3c,
 #endif
 "cpb",OPC_cpb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_DA+(ARG_SRC),},
-	{CLASS_BIT+4,CLASS_BIT+0xa,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,18},
+	{CLASS_BIT+4,CLASS_BIT+0xa,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,19},
 
 /* 0100 1010 ssN0 dddd address_src *** cpb rbd,address_src(rs) */
 {
@@ -846,7 +871,7 @@
 "cpb rbd,address_src(rs)",8,10,0x3c,
 #endif
 "cpb",OPC_cpb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_X+(ARG_RS),},
-	{CLASS_BIT+4,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,18},
+	{CLASS_BIT+4,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,19},
 
 /* 0000 1010 0000 dddd imm8 imm8 *** cpb rbd,imm8 */
 {
@@ -854,7 +879,7 @@
 "cpb rbd,imm8",8,7,0x3c,
 #endif
 "cpb",OPC_cpb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM+(ARG_IMM8),},
-	{CLASS_BIT+0,CLASS_BIT+0xa,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM8),CLASS_IMM+(ARG_IMM8),0,0,0,},2,4,18},
+	{CLASS_BIT+0,CLASS_BIT+0xa,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM8),CLASS_IMM+(ARG_IMM8),0,0,0,},2,4,19},
 
 /* 1000 1010 ssss dddd *** cpb rbd,rbs */
 {
@@ -862,7 +887,7 @@
 "cpb rbd,rbs",8,4,0x3c,
 #endif
 "cpb",OPC_cpb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_REG_BYTE+(ARG_RS),},
-	{CLASS_BIT+8,CLASS_BIT+0xa,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,18},
+	{CLASS_BIT+8,CLASS_BIT+0xa,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,19},
 
 /* 1011 1011 ssN0 1000 0000 rrrr dddd cccc *** cpd rd,@rs,rr,cc */
 {
@@ -870,7 +895,7 @@
 "cpd rd,@rs,rr,cc",16,11,0x3c,
 #endif
 "cpd",OPC_cpd,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RR),CLASS_CC,},
-	{CLASS_BIT+0xb,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+8,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REG+(ARG_RD),CLASS_CC,0,},4,4,19},
+	{CLASS_BIT+0xb,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+8,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REG+(ARG_RD),CLASS_CC,0,},4,4,20},
 
 /* 1011 1010 ssN0 1000 0000 rrrr dddd cccc *** cpdb rbd,@rs,rr,cc */
 {
@@ -878,7 +903,7 @@
 "cpdb rbd,@rs,rr,cc",8,11,0x3c,
 #endif
 "cpdb",OPC_cpdb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RR),CLASS_CC,},
-	{CLASS_BIT+0xb,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+8,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REG+(ARG_RD),CLASS_CC,0,},4,4,20},
+	{CLASS_BIT+0xb,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+8,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REG+(ARG_RD),CLASS_CC,0,},4,4,21},
 
 /* 1011 1011 ssN0 1100 0000 rrrr dddd cccc *** cpdr rd,@rs,rr,cc */
 {
@@ -886,7 +911,7 @@
 "cpdr rd,@rs,rr,cc",16,11,0x3c,
 #endif
 "cpdr",OPC_cpdr,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RR),CLASS_CC,},
-	{CLASS_BIT+0xb,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+0xc,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REG+(ARG_RD),CLASS_CC,0,},4,4,21},
+	{CLASS_BIT+0xb,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+0xc,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REG+(ARG_RD),CLASS_CC,0,},4,4,22},
 
 /* 1011 1010 ssN0 1100 0000 rrrr dddd cccc *** cpdrb rbd,@rs,rr,cc */
 {
@@ -894,7 +919,7 @@
 "cpdrb rbd,@rs,rr,cc",8,11,0x3c,
 #endif
 "cpdrb",OPC_cpdrb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RR),CLASS_CC,},
-	{CLASS_BIT+0xb,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+0xc,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REG+(ARG_RD),CLASS_CC,0,},4,4,22},
+	{CLASS_BIT+0xb,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+0xc,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REG+(ARG_RD),CLASS_CC,0,},4,4,23},
 
 /* 1011 1011 ssN0 0000 0000 rrrr dddd cccc *** cpi rd,@rs,rr,cc */
 {
@@ -902,7 +927,7 @@
 "cpi rd,@rs,rr,cc",16,11,0x3c,
 #endif
 "cpi",OPC_cpi,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RR),CLASS_CC,},
-	{CLASS_BIT+0xb,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+0,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REG+(ARG_RD),CLASS_CC,0,},4,4,23},
+	{CLASS_BIT+0xb,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+0,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REG+(ARG_RD),CLASS_CC,0,},4,4,24},
 
 /* 1011 1010 ssN0 0000 0000 rrrr dddd cccc *** cpib rbd,@rs,rr,cc */
 {
@@ -910,7 +935,7 @@
 "cpib rbd,@rs,rr,cc",8,11,0x3c,
 #endif
 "cpib",OPC_cpib,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RR),CLASS_CC,},
-	{CLASS_BIT+0xb,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+0,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REG+(ARG_RD),CLASS_CC,0,},4,4,24},
+	{CLASS_BIT+0xb,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+0,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REG+(ARG_RD),CLASS_CC,0,},4,4,25},
 
 /* 1011 1011 ssN0 0100 0000 rrrr dddd cccc *** cpir rd,@rs,rr,cc */
 {
@@ -918,7 +943,7 @@
 "cpir rd,@rs,rr,cc",16,11,0x3c,
 #endif
 "cpir",OPC_cpir,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RR),CLASS_CC,},
-	{CLASS_BIT+0xb,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+4,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REG+(ARG_RD),CLASS_CC,0,},4,4,25},
+	{CLASS_BIT+0xb,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+4,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REG+(ARG_RD),CLASS_CC,0,},4,4,26},
 
 /* 1011 1010 ssN0 0100 0000 rrrr dddd cccc *** cpirb rbd,@rs,rr,cc */
 {
@@ -926,7 +951,7 @@
 "cpirb rbd,@rs,rr,cc",8,11,0x3c,
 #endif
 "cpirb",OPC_cpirb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RR),CLASS_CC,},
-	{CLASS_BIT+0xb,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+4,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REG+(ARG_RD),CLASS_CC,0,},4,4,26},
+	{CLASS_BIT+0xb,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+4,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REG+(ARG_RD),CLASS_CC,0,},4,4,27},
 
 /* 0001 0000 ssN0 dddd *** cpl rrd,@rs */
 {
@@ -934,7 +959,7 @@
 "cpl rrd,@rs",32,14,0x3c,
 #endif
 "cpl",OPC_cpl,0,{CLASS_REG_LONG+(ARG_RD),CLASS_IR+(ARG_RS),},
-	{CLASS_BIT+1,CLASS_BIT+0,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,27},
+	{CLASS_BIT+1,CLASS_BIT+0,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,28},
 
 /* 0101 0000 0000 dddd address_src *** cpl rrd,address_src */
 {
@@ -942,7 +967,7 @@
 "cpl rrd,address_src",32,15,0x3c,
 #endif
 "cpl",OPC_cpl,0,{CLASS_REG_LONG+(ARG_RD),CLASS_DA+(ARG_SRC),},
-	{CLASS_BIT+5,CLASS_BIT+0,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,27},
+	{CLASS_BIT+5,CLASS_BIT+0,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,28},
 
 /* 0101 0000 ssN0 dddd address_src *** cpl rrd,address_src(rs) */
 {
@@ -950,7 +975,7 @@
 "cpl rrd,address_src(rs)",32,16,0x3c,
 #endif
 "cpl",OPC_cpl,0,{CLASS_REG_LONG+(ARG_RD),CLASS_X+(ARG_RS),},
-	{CLASS_BIT+5,CLASS_BIT+0,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,27},
+	{CLASS_BIT+5,CLASS_BIT+0,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,28},
 
 /* 0001 0000 0000 dddd imm32 *** cpl rrd,imm32 */
 {
@@ -958,7 +983,7 @@
 "cpl rrd,imm32",32,14,0x3c,
 #endif
 "cpl",OPC_cpl,0,{CLASS_REG_LONG+(ARG_RD),CLASS_IMM+(ARG_IMM32),},
-	{CLASS_BIT+1,CLASS_BIT+0,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM32),0,0,0,0,},2,6,27},
+	{CLASS_BIT+1,CLASS_BIT+0,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM32),0,0,0,0,},2,6,28},
 
 /* 1001 0000 ssss dddd *** cpl rrd,rrs */
 {
@@ -966,7 +991,7 @@
 "cpl rrd,rrs",32,8,0x3c,
 #endif
 "cpl",OPC_cpl,0,{CLASS_REG_LONG+(ARG_RD),CLASS_REG_LONG+(ARG_RS),},
-	{CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,27},
+	{CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,28},
 
 /* 1011 1011 ssN0 1010 0000 rrrr ddN0 cccc *** cpsd @rd,@rs,rr,cc */
 {
@@ -974,7 +999,7 @@
 "cpsd @rd,@rs,rr,cc",16,11,0x3c,
 #endif
 "cpsd",OPC_cpsd,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RR),CLASS_CC,},
-	{CLASS_BIT+0xb,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+0xa,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_CC,0,},4,4,28},
+	{CLASS_BIT+0xb,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+0xa,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_CC,0,},4,4,29},
 
 /* 1011 1010 ssN0 1010 0000 rrrr ddN0 cccc *** cpsdb @rd,@rs,rr,cc */
 {
@@ -982,7 +1007,7 @@
 "cpsdb @rd,@rs,rr,cc",8,11,0x3c,
 #endif
 "cpsdb",OPC_cpsdb,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RR),CLASS_CC,},
-	{CLASS_BIT+0xb,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+0xa,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_CC,0,},4,4,29},
+	{CLASS_BIT+0xb,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+0xa,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_CC,0,},4,4,30},
 
 /* 1011 1011 ssN0 1110 0000 rrrr ddN0 cccc *** cpsdr @rd,@rs,rr,cc */
 {
@@ -990,7 +1015,7 @@
 "cpsdr @rd,@rs,rr,cc",16,11,0x3c,
 #endif
 "cpsdr",OPC_cpsdr,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RR),CLASS_CC,},
-	{CLASS_BIT+0xb,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+0xe,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_CC,0,},4,4,30},
+	{CLASS_BIT+0xb,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+0xe,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_CC,0,},4,4,31},
 
 /* 1011 1010 ssN0 1110 0000 rrrr ddN0 cccc *** cpsdrb @rd,@rs,rr,cc */
 {
@@ -998,7 +1023,7 @@
 "cpsdrb @rd,@rs,rr,cc",8,11,0x3c,
 #endif
 "cpsdrb",OPC_cpsdrb,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RR),CLASS_CC,},
-	{CLASS_BIT+0xb,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+0xe,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_CC,0,},4,4,31},
+	{CLASS_BIT+0xb,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+0xe,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_CC,0,},4,4,32},
 
 /* 1011 1011 ssN0 0010 0000 rrrr ddN0 cccc *** cpsi @rd,@rs,rr,cc */
 {
@@ -1006,7 +1031,7 @@
 "cpsi @rd,@rs,rr,cc",16,11,0x3c,
 #endif
 "cpsi",OPC_cpsi,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RR),CLASS_CC,},
-	{CLASS_BIT+0xb,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+2,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_CC,0,},4,4,32},
+	{CLASS_BIT+0xb,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+2,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_CC,0,},4,4,33},
 
 /* 1011 1010 ssN0 0010 0000 rrrr ddN0 cccc *** cpsib @rd,@rs,rr,cc */
 {
@@ -1014,7 +1039,7 @@
 "cpsib @rd,@rs,rr,cc",8,11,0x3c,
 #endif
 "cpsib",OPC_cpsib,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RR),CLASS_CC,},
-	{CLASS_BIT+0xb,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+2,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_CC,0,},4,4,33},
+	{CLASS_BIT+0xb,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+2,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_CC,0,},4,4,34},
 
 /* 1011 1011 ssN0 0110 0000 rrrr ddN0 cccc *** cpsir @rd,@rs,rr,cc */
 {
@@ -1022,7 +1047,7 @@
 "cpsir @rd,@rs,rr,cc",16,11,0x3c,
 #endif
 "cpsir",OPC_cpsir,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RR),CLASS_CC,},
-	{CLASS_BIT+0xb,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+6,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_CC,0,},4,4,34},
+	{CLASS_BIT+0xb,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+6,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_CC,0,},4,4,35},
 
 /* 1011 1010 ssN0 0110 0000 rrrr ddN0 cccc *** cpsirb @rd,@rs,rr,cc */
 {
@@ -1030,7 +1055,7 @@
 "cpsirb @rd,@rs,rr,cc",8,11,0x3c,
 #endif
 "cpsirb",OPC_cpsirb,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RR),CLASS_CC,},
-	{CLASS_BIT+0xb,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+6,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_CC,0,},4,4,35},
+	{CLASS_BIT+0xb,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+6,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_CC,0,},4,4,36},
 
 /* 1011 0000 dddd 0000 *** dab rbd */
 {
@@ -1038,7 +1063,7 @@
 "dab rbd",8,5,0x38,
 #endif
 "dab",OPC_dab,0,{CLASS_REG_BYTE+(ARG_RD),},
-	{CLASS_BIT+0xb,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_BIT+0,0,0,0,0,0,},1,2,36},
+	{CLASS_BIT+0xb,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_BIT+0,0,0,0,0,0,},1,2,37},
 
 /* 1111 dddd 0disp7 *** dbjnz rbd,disp7 */
 {
@@ -1046,7 +1071,7 @@
 "dbjnz rbd,disp7",16,11,0x00,
 #endif
 "dbjnz",OPC_dbjnz,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_DISP,},
-	{CLASS_BIT+0xf,CLASS_REG+(ARG_RD),CLASS_0DISP7,0,0,0,0,0,0,},2,2,37},
+	{CLASS_BIT+0xf,CLASS_REG+(ARG_RD),CLASS_0DISP7,0,0,0,0,0,0,},2,2,38},
 
 /* 0010 1011 ddN0 imm4m1 *** dec @rd,imm4m1 */
 {
@@ -1054,7 +1079,7 @@
 "dec @rd,imm4m1",16,11,0x1c,
 #endif
 "dec",OPC_dec,0,{CLASS_IR+(ARG_RD),CLASS_IMM +(ARG_IMM4M1),},
-	{CLASS_BIT+2,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4M1),0,0,0,0,0,},2,2,38},
+	{CLASS_BIT+2,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4M1),0,0,0,0,0,},2,2,39},
 
 /* 0110 1011 ddN0 imm4m1 address_dst *** dec address_dst(rd),imm4m1 */
 {
@@ -1062,7 +1087,7 @@
 "dec address_dst(rd),imm4m1",16,14,0x1c,
 #endif
 "dec",OPC_dec,0,{CLASS_X+(ARG_RD),CLASS_IMM +(ARG_IMM4M1),},
-	{CLASS_BIT+6,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4M1),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,38},
+	{CLASS_BIT+6,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4M1),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,39},
 
 /* 0110 1011 0000 imm4m1 address_dst *** dec address_dst,imm4m1 */
 {
@@ -1070,7 +1095,7 @@
 "dec address_dst,imm4m1",16,13,0x1c,
 #endif
 "dec",OPC_dec,0,{CLASS_DA+(ARG_DST),CLASS_IMM +(ARG_IMM4M1),},
-	{CLASS_BIT+6,CLASS_BIT+0xb,CLASS_BIT+0,CLASS_IMM+(ARG_IMM4M1),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,38},
+	{CLASS_BIT+6,CLASS_BIT+0xb,CLASS_BIT+0,CLASS_IMM+(ARG_IMM4M1),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,39},
 
 /* 1010 1011 dddd imm4m1 *** dec rd,imm4m1 */
 {
@@ -1078,7 +1103,7 @@
 "dec rd,imm4m1",16,4,0x1c,
 #endif
 "dec",OPC_dec,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IMM +(ARG_IMM4M1),},
-	{CLASS_BIT+0xa,CLASS_BIT+0xb,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM4M1),0,0,0,0,0,},2,2,38},
+	{CLASS_BIT+0xa,CLASS_BIT+0xb,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM4M1),0,0,0,0,0,},2,2,39},
 
 /* 0010 1010 ddN0 imm4m1 *** decb @rd,imm4m1 */
 {
@@ -1086,7 +1111,7 @@
 "decb @rd,imm4m1",8,11,0x1c,
 #endif
 "decb",OPC_decb,0,{CLASS_IR+(ARG_RD),CLASS_IMM +(ARG_IMM4M1),},
-	{CLASS_BIT+2,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4M1),0,0,0,0,0,},2,2,39},
+	{CLASS_BIT+2,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4M1),0,0,0,0,0,},2,2,40},
 
 /* 0110 1010 ddN0 imm4m1 address_dst *** decb address_dst(rd),imm4m1 */
 {
@@ -1094,7 +1119,7 @@
 "decb address_dst(rd),imm4m1",8,14,0x1c,
 #endif
 "decb",OPC_decb,0,{CLASS_X+(ARG_RD),CLASS_IMM +(ARG_IMM4M1),},
-	{CLASS_BIT+6,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4M1),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,39},
+	{CLASS_BIT+6,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4M1),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,40},
 
 /* 0110 1010 0000 imm4m1 address_dst *** decb address_dst,imm4m1 */
 {
@@ -1102,7 +1127,7 @@
 "decb address_dst,imm4m1",8,13,0x1c,
 #endif
 "decb",OPC_decb,0,{CLASS_DA+(ARG_DST),CLASS_IMM +(ARG_IMM4M1),},
-	{CLASS_BIT+6,CLASS_BIT+0xa,CLASS_BIT+0,CLASS_IMM+(ARG_IMM4M1),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,39},
+	{CLASS_BIT+6,CLASS_BIT+0xa,CLASS_BIT+0,CLASS_IMM+(ARG_IMM4M1),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,40},
 
 /* 1010 1010 dddd imm4m1 *** decb rbd,imm4m1 */
 {
@@ -1110,7 +1135,7 @@
 "decb rbd,imm4m1",8,4,0x1c,
 #endif
 "decb",OPC_decb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM +(ARG_IMM4M1),},
-	{CLASS_BIT+0xa,CLASS_BIT+0xa,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM4M1),0,0,0,0,0,},2,2,39},
+	{CLASS_BIT+0xa,CLASS_BIT+0xa,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM4M1),0,0,0,0,0,},2,2,40},
 
 /* 0111 1100 0000 00ii *** di i2 */
 {
@@ -1118,7 +1143,7 @@
 "di i2",16,7,0x00,
 #endif
 "di",OPC_di,0,{CLASS_IMM+(ARG_IMM2),},
-	{CLASS_BIT+7,CLASS_BIT+0xc,CLASS_BIT+0,CLASS_00II,0,0,0,0,0,},1,2,40},
+	{CLASS_BIT+7,CLASS_BIT+0xc,CLASS_BIT+0,CLASS_00II,0,0,0,0,0,},1,2,41},
 
 /* 0001 1011 ssN0 dddd *** div rrd,@rs */
 {
@@ -1126,7 +1151,7 @@
 "div rrd,@rs",16,107,0x3c,
 #endif
 "div",OPC_div,0,{CLASS_REG_LONG+(ARG_RD),CLASS_IR+(ARG_RS),},
-	{CLASS_BIT+1,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,41},
+	{CLASS_BIT+1,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,42},
 
 /* 0101 1011 0000 dddd address_src *** div rrd,address_src */
 {
@@ -1134,7 +1159,7 @@
 "div rrd,address_src",16,107,0x3c,
 #endif
 "div",OPC_div,0,{CLASS_REG_LONG+(ARG_RD),CLASS_DA+(ARG_SRC),},
-	{CLASS_BIT+5,CLASS_BIT+0xb,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,41},
+	{CLASS_BIT+5,CLASS_BIT+0xb,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,42},
 
 /* 0101 1011 ssN0 dddd address_src *** div rrd,address_src(rs) */
 {
@@ -1142,7 +1167,7 @@
 "div rrd,address_src(rs)",16,107,0x3c,
 #endif
 "div",OPC_div,0,{CLASS_REG_LONG+(ARG_RD),CLASS_X+(ARG_RS),},
-	{CLASS_BIT+5,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,41},
+	{CLASS_BIT+5,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,42},
 
 /* 0001 1011 0000 dddd imm16 *** div rrd,imm16 */
 {
@@ -1150,7 +1175,7 @@
 "div rrd,imm16",16,107,0x3c,
 #endif
 "div",OPC_div,0,{CLASS_REG_LONG+(ARG_RD),CLASS_IMM+(ARG_IMM16),},
-	{CLASS_BIT+1,CLASS_BIT+0xb,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,41},
+	{CLASS_BIT+1,CLASS_BIT+0xb,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,42},
 
 /* 1001 1011 ssss dddd *** div rrd,rs */
 {
@@ -1158,7 +1183,7 @@
 "div rrd,rs",16,107,0x3c,
 #endif
 "div",OPC_div,0,{CLASS_REG_LONG+(ARG_RD),CLASS_REG_WORD+(ARG_RS),},
-	{CLASS_BIT+9,CLASS_BIT+0xb,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,41},
+	{CLASS_BIT+9,CLASS_BIT+0xb,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,42},
 
 /* 0001 1010 ssN0 dddd *** divl rqd,@rs */
 {
@@ -1166,7 +1191,7 @@
 "divl rqd,@rs",32,744,0x3c,
 #endif
 "divl",OPC_divl,0,{CLASS_REG_QUAD+(ARG_RD),CLASS_IR+(ARG_RS),},
-	{CLASS_BIT+1,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,42},
+	{CLASS_BIT+1,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,43},
 
 /* 0101 1010 0000 dddd address_src *** divl rqd,address_src */
 {
@@ -1174,7 +1199,7 @@
 "divl rqd,address_src",32,745,0x3c,
 #endif
 "divl",OPC_divl,0,{CLASS_REG_QUAD+(ARG_RD),CLASS_DA+(ARG_SRC),},
-	{CLASS_BIT+5,CLASS_BIT+0xa,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,42},
+	{CLASS_BIT+5,CLASS_BIT+0xa,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,43},
 
 /* 0101 1010 ssN0 dddd address_src *** divl rqd,address_src(rs) */
 {
@@ -1182,7 +1207,7 @@
 "divl rqd,address_src(rs)",32,746,0x3c,
 #endif
 "divl",OPC_divl,0,{CLASS_REG_QUAD+(ARG_RD),CLASS_X+(ARG_RS),},
-	{CLASS_BIT+5,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,42},
+	{CLASS_BIT+5,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,43},
 
 /* 0001 1010 0000 dddd imm32 *** divl rqd,imm32 */
 {
@@ -1190,7 +1215,7 @@
 "divl rqd,imm32",32,744,0x3c,
 #endif
 "divl",OPC_divl,0,{CLASS_REG_QUAD+(ARG_RD),CLASS_IMM+(ARG_IMM32),},
-	{CLASS_BIT+1,CLASS_BIT+0xa,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM32),0,0,0,0,},2,6,42},
+	{CLASS_BIT+1,CLASS_BIT+0xa,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM32),0,0,0,0,},2,6,43},
 
 /* 1001 1010 ssss dddd *** divl rqd,rrs */
 {
@@ -1198,7 +1223,7 @@
 "divl rqd,rrs",32,744,0x3c,
 #endif
 "divl",OPC_divl,0,{CLASS_REG_QUAD+(ARG_RD),CLASS_REG_LONG+(ARG_RS),},
-	{CLASS_BIT+9,CLASS_BIT+0xa,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,42},
+	{CLASS_BIT+9,CLASS_BIT+0xa,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,43},
 
 /* 1111 dddd 1disp7 *** djnz rd,disp7 */
 {
@@ -1206,7 +1231,7 @@
 "djnz rd,disp7",16,11,0x00,
 #endif
 "djnz",OPC_djnz,0,{CLASS_REG_WORD+(ARG_RD),CLASS_DISP,},
-	{CLASS_BIT+0xf,CLASS_REG+(ARG_RD),CLASS_1DISP7,0,0,0,0,0,0,},2,2,43},
+	{CLASS_BIT+0xf,CLASS_REG+(ARG_RD),CLASS_1DISP7,0,0,0,0,0,0,},2,2,44},
 
 /* 0111 1100 0000 01ii *** ei i2 */
 {
@@ -1214,7 +1239,7 @@
 "ei i2",16,7,0x00,
 #endif
 "ei",OPC_ei,0,{CLASS_IMM+(ARG_IMM2),},
-	{CLASS_BIT+7,CLASS_BIT+0xc,CLASS_BIT+0,CLASS_01II,0,0,0,0,0,},1,2,44},
+	{CLASS_BIT+7,CLASS_BIT+0xc,CLASS_BIT+0,CLASS_01II,0,0,0,0,0,},1,2,45},
 
 /* 0010 1101 ssN0 dddd *** ex rd,@rs */
 {
@@ -1222,7 +1247,7 @@
 "ex rd,@rs",16,12,0x00,
 #endif
 "ex",OPC_ex,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IR+(ARG_RS),},
-	{CLASS_BIT+2,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,45},
+	{CLASS_BIT+2,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,46},
 
 /* 0110 1101 0000 dddd address_src *** ex rd,address_src */
 {
@@ -1230,7 +1255,7 @@
 "ex rd,address_src",16,15,0x00,
 #endif
 "ex",OPC_ex,0,{CLASS_REG_WORD+(ARG_RD),CLASS_DA+(ARG_SRC),},
-	{CLASS_BIT+6,CLASS_BIT+0xd,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,45},
+	{CLASS_BIT+6,CLASS_BIT+0xd,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,46},
 
 /* 0110 1101 ssN0 dddd address_src *** ex rd,address_src(rs) */
 {
@@ -1238,7 +1263,7 @@
 "ex rd,address_src(rs)",16,16,0x00,
 #endif
 "ex",OPC_ex,0,{CLASS_REG_WORD+(ARG_RD),CLASS_X+(ARG_RS),},
-	{CLASS_BIT+6,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,45},
+	{CLASS_BIT+6,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,46},
 
 /* 1010 1101 ssss dddd *** ex rd,rs */
 {
@@ -1246,7 +1271,7 @@
 "ex rd,rs",16,6,0x00,
 #endif
 "ex",OPC_ex,0,{CLASS_REG_WORD+(ARG_RD),CLASS_REG_WORD+(ARG_RS),},
-	{CLASS_BIT+0xa,CLASS_BIT+0xd,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,45},
+	{CLASS_BIT+0xa,CLASS_BIT+0xd,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,46},
 
 /* 0010 1100 ssN0 dddd *** exb rbd,@rs */
 {
@@ -1254,7 +1279,7 @@
 "exb rbd,@rs",8,12,0x00,
 #endif
 "exb",OPC_exb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IR+(ARG_RS),},
-	{CLASS_BIT+2,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,46},
+	{CLASS_BIT+2,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,47},
 
 /* 0110 1100 0000 dddd address_src *** exb rbd,address_src */
 {
@@ -1262,7 +1287,7 @@
 "exb rbd,address_src",8,15,0x00,
 #endif
 "exb",OPC_exb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_DA+(ARG_SRC),},
-	{CLASS_BIT+6,CLASS_BIT+0xc,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,46},
+	{CLASS_BIT+6,CLASS_BIT+0xc,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,47},
 
 /* 0110 1100 ssN0 dddd address_src *** exb rbd,address_src(rs) */
 {
@@ -1270,7 +1295,7 @@
 "exb rbd,address_src(rs)",8,16,0x00,
 #endif
 "exb",OPC_exb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_X+(ARG_RS),},
-	{CLASS_BIT+6,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,46},
+	{CLASS_BIT+6,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,47},
 
 /* 1010 1100 ssss dddd *** exb rbd,rbs */
 {
@@ -1278,7 +1303,7 @@
 "exb rbd,rbs",8,6,0x00,
 #endif
 "exb",OPC_exb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_REG_BYTE+(ARG_RS),},
-	{CLASS_BIT+0xa,CLASS_BIT+0xc,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,46},
+	{CLASS_BIT+0xa,CLASS_BIT+0xc,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,47},
 
 /* 0000 1110 imm8 *** ext0e imm8 */
 {
@@ -1286,7 +1311,7 @@
 "ext0e imm8",8,10,0x00,
 #endif
 "ext0e",OPC_ext0e,0,{CLASS_IMM+(ARG_IMM8),},
-	{CLASS_BIT+0,CLASS_BIT+0xe,CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},1,2,47},
+	{CLASS_BIT+0,CLASS_BIT+0xe,CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},1,2,48},
 
 /* 0000 1111 imm8 *** ext0f imm8 */
 {
@@ -1294,7 +1319,7 @@
 "ext0f imm8",8,10,0x00,
 #endif
 "ext0f",OPC_ext0f,0,{CLASS_IMM+(ARG_IMM8),},
-	{CLASS_BIT+0,CLASS_BIT+0xf,CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},1,2,48},
+	{CLASS_BIT+0,CLASS_BIT+0xf,CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},1,2,49},
 
 /* 1000 1110 imm8 *** ext8e imm8 */
 {
@@ -1302,7 +1327,7 @@
 "ext8e imm8",8,10,0x00,
 #endif
 "ext8e",OPC_ext8e,0,{CLASS_IMM+(ARG_IMM8),},
-	{CLASS_BIT+8,CLASS_BIT+0xe,CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},1,2,49},
+	{CLASS_BIT+8,CLASS_BIT+0xe,CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},1,2,50},
 
 /* 1000 1111 imm8 *** ext8f imm8 */
 {
@@ -1310,7 +1335,7 @@
 "ext8f imm8",8,10,0x00,
 #endif
 "ext8f",OPC_ext8f,0,{CLASS_IMM+(ARG_IMM8),},
-	{CLASS_BIT+8,CLASS_BIT+0xf,CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},1,2,50},
+	{CLASS_BIT+8,CLASS_BIT+0xf,CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},1,2,51},
 
 /* 1011 0001 dddd 1010 *** exts rrd */
 {
@@ -1318,7 +1343,7 @@
 "exts rrd",16,11,0x00,
 #endif
 "exts",OPC_exts,0,{CLASS_REG_LONG+(ARG_RD),},
-	{CLASS_BIT+0xb,CLASS_BIT+1,CLASS_REG+(ARG_RD),CLASS_BIT+0xa,0,0,0,0,0,},1,2,51},
+	{CLASS_BIT+0xb,CLASS_BIT+1,CLASS_REG+(ARG_RD),CLASS_BIT+0xa,0,0,0,0,0,},1,2,52},
 
 /* 1011 0001 dddd 0000 *** extsb rd */
 {
@@ -1326,7 +1351,7 @@
 "extsb rd",8,11,0x00,
 #endif
 "extsb",OPC_extsb,0,{CLASS_REG_WORD+(ARG_RD),},
-	{CLASS_BIT+0xb,CLASS_BIT+1,CLASS_REG+(ARG_RD),CLASS_BIT+0,0,0,0,0,0,},1,2,52},
+	{CLASS_BIT+0xb,CLASS_BIT+1,CLASS_REG+(ARG_RD),CLASS_BIT+0,0,0,0,0,0,},1,2,53},
 
 /* 1011 0001 dddd 0111 *** extsl rqd */
 {
@@ -1334,7 +1359,7 @@
 "extsl rqd",32,11,0x00,
 #endif
 "extsl",OPC_extsl,0,{CLASS_REG_QUAD+(ARG_RD),},
-	{CLASS_BIT+0xb,CLASS_BIT+1,CLASS_REG+(ARG_RD),CLASS_BIT+7,0,0,0,0,0,},1,2,53},
+	{CLASS_BIT+0xb,CLASS_BIT+1,CLASS_REG+(ARG_RD),CLASS_BIT+7,0,0,0,0,0,},1,2,54},
 
 /* 0111 1010 0000 0000 *** halt */
 {
@@ -1342,15 +1367,15 @@
 "halt",16,8,0x00,
 #endif
 "halt",OPC_halt,0,{0},
-	{CLASS_BIT+7,CLASS_BIT+0xa,CLASS_BIT+0,CLASS_BIT+0,0,0,0,0,0,},0,2,54},
+	{CLASS_BIT+7,CLASS_BIT+0xa,CLASS_BIT+0,CLASS_BIT+0,0,0,0,0,0,},0,2,55},
 
-/* 0011 1101 ssN0 dddd *** in rd,@rs */
+/* 0011 1101 ssss dddd *** in rd,@ri */
 {
 #ifdef NICENAMES
-"in rd,@rs",16,10,0x00,
+"in rd,@ri",16,10,0x00,
 #endif
-"in",OPC_in,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IR+(ARG_RS),},
-	{CLASS_BIT+3,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,55},
+"in",OPC_in,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IRO+(ARG_RS),},
+	{CLASS_BIT+3,CLASS_BIT+0xd,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,56},
 
 /* 0011 1011 dddd 0100 imm16 *** in rd,imm16 */
 {
@@ -1358,15 +1383,15 @@
 "in rd,imm16",16,12,0x00,
 #endif
 "in",OPC_in,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IMM+(ARG_IMM16),},
-	{CLASS_BIT+3,CLASS_BIT+0xb,CLASS_REG+(ARG_RD),CLASS_BIT+4,CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,55},
+	{CLASS_BIT+3,CLASS_BIT+0xb,CLASS_REG+(ARG_RD),CLASS_BIT+4,CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,56},
 
-/* 0011 1100 ssN0 dddd *** inb rbd,@rs */
+/* 0011 1100 ssss dddd *** inb rbd,@ri */
 {
 #ifdef NICENAMES
-"inb rbd,@rs",8,12,0x00,
+"inb rbd,@ri",8,12,0x00,
 #endif
-"inb",OPC_inb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IR+(ARG_RS),},
-	{CLASS_BIT+3,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,56},
+"inb",OPC_inb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IRO+(ARG_RS),},
+	{CLASS_BIT+3,CLASS_BIT+0xc,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,57},
 
 /* 0011 1010 dddd 0100 imm16 *** inb rbd,imm16 */
 {
@@ -1374,7 +1399,7 @@
 "inb rbd,imm16",8,10,0x00,
 #endif
 "inb",OPC_inb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM+(ARG_IMM16),},
-	{CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REG+(ARG_RD),CLASS_BIT+4,CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,56},
+	{CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REG+(ARG_RD),CLASS_BIT+4,CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,57},
 
 /* 0010 1001 ddN0 imm4m1 *** inc @rd,imm4m1 */
 {
@@ -1382,7 +1407,7 @@
 "inc @rd,imm4m1",16,11,0x1c,
 #endif
 "inc",OPC_inc,0,{CLASS_IR+(ARG_RD),CLASS_IMM +(ARG_IMM4M1),},
-	{CLASS_BIT+2,CLASS_BIT+9,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4M1),0,0,0,0,0,},2,2,57},
+	{CLASS_BIT+2,CLASS_BIT+9,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4M1),0,0,0,0,0,},2,2,58},
 
 /* 0110 1001 ddN0 imm4m1 address_dst *** inc address_dst(rd),imm4m1 */
 {
@@ -1390,7 +1415,7 @@
 "inc address_dst(rd),imm4m1",16,14,0x1c,
 #endif
 "inc",OPC_inc,0,{CLASS_X+(ARG_RD),CLASS_IMM +(ARG_IMM4M1),},
-	{CLASS_BIT+6,CLASS_BIT+9,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4M1),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,57},
+	{CLASS_BIT+6,CLASS_BIT+9,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4M1),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,58},
 
 /* 0110 1001 0000 imm4m1 address_dst *** inc address_dst,imm4m1 */
 {
@@ -1398,7 +1423,7 @@
 "inc address_dst,imm4m1",16,13,0x1c,
 #endif
 "inc",OPC_inc,0,{CLASS_DA+(ARG_DST),CLASS_IMM +(ARG_IMM4M1),},
-	{CLASS_BIT+6,CLASS_BIT+9,CLASS_BIT+0,CLASS_IMM+(ARG_IMM4M1),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,57},
+	{CLASS_BIT+6,CLASS_BIT+9,CLASS_BIT+0,CLASS_IMM+(ARG_IMM4M1),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,58},
 
 /* 1010 1001 dddd imm4m1 *** inc rd,imm4m1 */
 {
@@ -1406,7 +1431,7 @@
 "inc rd,imm4m1",16,4,0x1c,
 #endif
 "inc",OPC_inc,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IMM +(ARG_IMM4M1),},
-	{CLASS_BIT+0xa,CLASS_BIT+9,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM4M1),0,0,0,0,0,},2,2,57},
+	{CLASS_BIT+0xa,CLASS_BIT+9,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM4M1),0,0,0,0,0,},2,2,58},
 
 /* 0010 1000 ddN0 imm4m1 *** incb @rd,imm4m1 */
 {
@@ -1414,7 +1439,7 @@
 "incb @rd,imm4m1",8,11,0x1c,
 #endif
 "incb",OPC_incb,0,{CLASS_IR+(ARG_RD),CLASS_IMM +(ARG_IMM4M1),},
-	{CLASS_BIT+2,CLASS_BIT+8,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4M1),0,0,0,0,0,},2,2,58},
+	{CLASS_BIT+2,CLASS_BIT+8,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4M1),0,0,0,0,0,},2,2,59},
 
 /* 0110 1000 ddN0 imm4m1 address_dst *** incb address_dst(rd),imm4m1 */
 {
@@ -1422,7 +1447,7 @@
 "incb address_dst(rd),imm4m1",8,14,0x1c,
 #endif
 "incb",OPC_incb,0,{CLASS_X+(ARG_RD),CLASS_IMM +(ARG_IMM4M1),},
-	{CLASS_BIT+6,CLASS_BIT+8,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4M1),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,58},
+	{CLASS_BIT+6,CLASS_BIT+8,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4M1),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,59},
 
 /* 0110 1000 0000 imm4m1 address_dst *** incb address_dst,imm4m1 */
 {
@@ -1430,7 +1455,7 @@
 "incb address_dst,imm4m1",8,13,0x1c,
 #endif
 "incb",OPC_incb,0,{CLASS_DA+(ARG_DST),CLASS_IMM +(ARG_IMM4M1),},
-	{CLASS_BIT+6,CLASS_BIT+8,CLASS_BIT+0,CLASS_IMM+(ARG_IMM4M1),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,58},
+	{CLASS_BIT+6,CLASS_BIT+8,CLASS_BIT+0,CLASS_IMM+(ARG_IMM4M1),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,59},
 
 /* 1010 1000 dddd imm4m1 *** incb rbd,imm4m1 */
 {
@@ -1438,39 +1463,71 @@
 "incb rbd,imm4m1",8,4,0x1c,
 #endif
 "incb",OPC_incb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM +(ARG_IMM4M1),},
-	{CLASS_BIT+0xa,CLASS_BIT+8,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM4M1),0,0,0,0,0,},2,2,58},
+	{CLASS_BIT+0xa,CLASS_BIT+8,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM4M1),0,0,0,0,0,},2,2,59},
 
-/* 0011 1011 ssN0 1000 0000 aaaa ddN0 1000 *** ind @rd,@rs,ra */
+/* 0011 1011 ssss 1000 0000 aaaa ddN0 1000 *** ind @rd,@ri,ra */
 {
 #ifdef NICENAMES
-"ind @rd,@rs,ra",16,21,0x04,
+"ind @rd,@ri,ra",16,21,0x04,
 #endif
-"ind",OPC_ind,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RA),},
-	{CLASS_BIT+3,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+8,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,59},
+"ind",OPC_ind,0,{CLASS_IR+(ARG_RD),CLASS_IRO+(ARG_RS),CLASS_REG_WORD+(ARG_RA),},
+	{CLASS_BIT+3,CLASS_BIT+0xb,CLASS_REG+(ARG_RS),CLASS_BIT+8,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,60},
 
-/* 0011 1010 ssN0 1000 0000 aaaa ddN0 1000 *** indb @rd,@rs,rba */
+/* 0011 1010 ssss 1000 0000 aaaa ddN0 1000 *** indb @rd,@ri,ra */
 {
 #ifdef NICENAMES
-"indb @rd,@rs,rba",8,21,0x04,
+"indb @rd,@ri,ra",8,21,0x04,
 #endif
-"indb",OPC_indb,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_BYTE+(ARG_RA),},
-	{CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+8,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,60},
+"indb",OPC_indb,0,{CLASS_IR+(ARG_RD),CLASS_IRO+(ARG_RS),CLASS_REG_WORD+(ARG_RA),},
+	{CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REG+(ARG_RS),CLASS_BIT+8,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,61},
 
-/* 0011 1010 ssN0 0000 0000 aaaa ddN0 1000 *** inib @rd,@rs,ra */
+/* 0011 1011 ssss 1000 0000 aaaa ddN0 0000 *** indr @rd,@ri,ra */
 {
 #ifdef NICENAMES
-"inib @rd,@rs,ra",8,21,0x04,
+"indr @rd,@ri,ra",16,11,0x04,
 #endif
-"inib",OPC_inib,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RA),},
-	{CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+0,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,61},
+"indr",OPC_indr,0,{CLASS_IR+(ARG_RD),CLASS_IRO+(ARG_RS),CLASS_REG_WORD+(ARG_RA),},
+	{CLASS_BIT+3,CLASS_BIT+0xb,CLASS_REG+(ARG_RS),CLASS_BIT+8,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+0,0,},3,4,62},
 
-/* 0011 1010 ssN0 0000 0000 aaaa ddN0 0000 *** inibr @rd,@rs,ra */
+/* 0011 1010 ssss 1000 0000 aaaa ddN0 0000 *** indrb @rd,@ri,ra */
 {
 #ifdef NICENAMES
-"inibr @rd,@rs,ra",16,21,0x04,
+"indrb @rd,@ri,ra",8,11,0x04,
 #endif
-"inibr",OPC_inibr,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RA),},
-	{CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+0,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+0,0,},3,4,62},
+"indrb",OPC_indrb,0,{CLASS_IR+(ARG_RD),CLASS_IRO+(ARG_RS),CLASS_REG_WORD+(ARG_RA),},
+	{CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REG+(ARG_RS),CLASS_BIT+8,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+0,0,},3,4,63},
+
+/* 0011 1011 ssss 0000 0000 aaaa ddN0 1000 *** ini @rd,@ri,ra */
+{
+#ifdef NICENAMES
+"ini @rd,@ri,ra",16,21,0x04,
+#endif
+"ini",OPC_ini,0,{CLASS_IR+(ARG_RD),CLASS_IRO+(ARG_RS),CLASS_REG_WORD+(ARG_RA),},
+	{CLASS_BIT+3,CLASS_BIT+0xb,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,64},
+
+/* 0011 1010 ssss 0000 0000 aaaa ddN0 1000 *** inib @rd,@ri,ra */
+{
+#ifdef NICENAMES
+"inib @rd,@ri,ra",8,21,0x04,
+#endif
+"inib",OPC_inib,0,{CLASS_IR+(ARG_RD),CLASS_IRO+(ARG_RS),CLASS_REG_WORD+(ARG_RA),},
+	{CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,65},
+
+/* 0011 1011 ssss 0000 0000 aaaa ddN0 0000 *** inir @rd,@ri,ra */
+{
+#ifdef NICENAMES
+"inir @rd,@ri,ra",16,11,0x04,
+#endif
+"inir",OPC_inir,0,{CLASS_IR+(ARG_RD),CLASS_IRO+(ARG_RS),CLASS_REG_WORD+(ARG_RA),},
+	{CLASS_BIT+3,CLASS_BIT+0xb,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+0,0,},3,4,66},
+
+/* 0011 1010 ssss 0000 0000 aaaa ddN0 0000 *** inirb @rd,@ri,ra */
+{
+#ifdef NICENAMES
+"inirb @rd,@ri,ra",8,11,0x04,
+#endif
+"inirb",OPC_inirb,0,{CLASS_IR+(ARG_RD),CLASS_IRO+(ARG_RS),CLASS_REG_WORD+(ARG_RA),},
+	{CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+0,0,},3,4,67},
 
 /* 0111 1011 0000 0000 *** iret */
 {
@@ -1478,7 +1535,7 @@
 "iret",16,13,0x3f,
 #endif
 "iret",OPC_iret,0,{0},
-	{CLASS_BIT+7,CLASS_BIT+0xb,CLASS_BIT+0,CLASS_BIT+0,0,0,0,0,0,},0,2,63},
+	{CLASS_BIT+7,CLASS_BIT+0xb,CLASS_BIT+0,CLASS_BIT+0,0,0,0,0,0,},0,2,68},
 
 /* 0001 1110 ddN0 cccc *** jp cc,@rd */
 {
@@ -1486,7 +1543,7 @@
 "jp cc,@rd",16,10,0x00,
 #endif
 "jp",OPC_jp,0,{CLASS_CC,CLASS_IR+(ARG_RD),},
-	{CLASS_BIT+1,CLASS_BIT+0xe,CLASS_REGN0+(ARG_RD),CLASS_CC,0,0,0,0,0,},2,2,64},
+	{CLASS_BIT+1,CLASS_BIT+0xe,CLASS_REGN0+(ARG_RD),CLASS_CC,0,0,0,0,0,},2,2,69},
 
 /* 0101 1110 0000 cccc address_dst *** jp cc,address_dst */
 {
@@ -1494,7 +1551,7 @@
 "jp cc,address_dst",16,7,0x00,
 #endif
 "jp",OPC_jp,0,{CLASS_CC,CLASS_DA+(ARG_DST),},
-	{CLASS_BIT+5,CLASS_BIT+0xe,CLASS_BIT+0,CLASS_CC,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,64},
+	{CLASS_BIT+5,CLASS_BIT+0xe,CLASS_BIT+0,CLASS_CC,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,69},
 
 /* 0101 1110 ddN0 cccc address_dst *** jp cc,address_dst(rd) */
 {
@@ -1502,7 +1559,7 @@
 "jp cc,address_dst(rd)",16,8,0x00,
 #endif
 "jp",OPC_jp,0,{CLASS_CC,CLASS_X+(ARG_RD),},
-	{CLASS_BIT+5,CLASS_BIT+0xe,CLASS_REGN0+(ARG_RD),CLASS_CC,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,64},
+	{CLASS_BIT+5,CLASS_BIT+0xe,CLASS_REGN0+(ARG_RD),CLASS_CC,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,69},
 
 /* 1110 cccc disp8 *** jr cc,disp8 */
 {
@@ -1510,7 +1567,7 @@
 "jr cc,disp8",16,6,0x00,
 #endif
 "jr",OPC_jr,0,{CLASS_CC,CLASS_DISP,},
-	{CLASS_BIT+0xe,CLASS_CC,CLASS_DISP8,0,0,0,0,0,0,},2,2,65},
+	{CLASS_BIT+0xe,CLASS_CC,CLASS_DISP8,0,0,0,0,0,0,},2,2,70},
 
 /* 0000 1101 ddN0 0101 imm16 *** ld @rd,imm16 */
 {
@@ -1518,7 +1575,7 @@
 "ld @rd,imm16",16,7,0x00,
 #endif
 "ld",OPC_ld,0,{CLASS_IR+(ARG_RD),CLASS_IMM+(ARG_IMM16),},
-	{CLASS_BIT+0,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_BIT+5,CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,66},
+	{CLASS_BIT+0,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_BIT+5,CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,71},
 
 /* 0010 1111 ddN0 ssss *** ld @rd,rs */
 {
@@ -1526,7 +1583,7 @@
 "ld @rd,rs",16,8,0x00,
 #endif
 "ld",OPC_ld,0,{CLASS_IR+(ARG_RD),CLASS_REG_WORD+(ARG_RS),},
-	{CLASS_BIT+2,CLASS_BIT+0xf,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),0,0,0,0,0,},2,2,66},
+	{CLASS_BIT+2,CLASS_BIT+0xf,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),0,0,0,0,0,},2,2,71},
 
 /* 0100 1101 ddN0 0101 address_dst imm16 *** ld address_dst(rd),imm16 */
 {
@@ -1534,7 +1591,7 @@
 "ld address_dst(rd),imm16",16,15,0x00,
 #endif
 "ld",OPC_ld,0,{CLASS_X+(ARG_RD),CLASS_IMM+(ARG_IMM16),},
-	{CLASS_BIT+4,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_BIT+5,CLASS_ADDRESS+(ARG_DST),CLASS_IMM+(ARG_IMM16),0,0,0,},2,6,66},
+	{CLASS_BIT+4,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_BIT+5,CLASS_ADDRESS+(ARG_DST),CLASS_IMM+(ARG_IMM16),0,0,0,},2,6,71},
 
 /* 0110 1111 ddN0 ssss address_dst *** ld address_dst(rd),rs */
 {
@@ -1542,7 +1599,7 @@
 "ld address_dst(rd),rs",16,12,0x00,
 #endif
 "ld",OPC_ld,0,{CLASS_X+(ARG_RD),CLASS_REG_WORD+(ARG_RS),},
-	{CLASS_BIT+6,CLASS_BIT+0xf,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,66},
+	{CLASS_BIT+6,CLASS_BIT+0xf,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,71},
 
 /* 0100 1101 0000 0101 address_dst imm16 *** ld address_dst,imm16 */
 {
@@ -1550,7 +1607,7 @@
 "ld address_dst,imm16",16,14,0x00,
 #endif
 "ld",OPC_ld,0,{CLASS_DA+(ARG_DST),CLASS_IMM+(ARG_IMM16),},
-	{CLASS_BIT+4,CLASS_BIT+0xd,CLASS_BIT+0,CLASS_BIT+5,CLASS_ADDRESS+(ARG_DST),CLASS_IMM+(ARG_IMM16),0,0,0,},2,6,66},
+	{CLASS_BIT+4,CLASS_BIT+0xd,CLASS_BIT+0,CLASS_BIT+5,CLASS_ADDRESS+(ARG_DST),CLASS_IMM+(ARG_IMM16),0,0,0,},2,6,71},
 
 /* 0110 1111 0000 ssss address_dst *** ld address_dst,rs */
 {
@@ -1558,7 +1615,7 @@
 "ld address_dst,rs",16,11,0x00,
 #endif
 "ld",OPC_ld,0,{CLASS_DA+(ARG_DST),CLASS_REG_WORD+(ARG_RS),},
-	{CLASS_BIT+6,CLASS_BIT+0xf,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,66},
+	{CLASS_BIT+6,CLASS_BIT+0xf,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,71},
 
 /* 0011 0011 ddN0 ssss imm16 *** ld rd(imm16),rs */
 {
@@ -1566,7 +1623,7 @@
 "ld rd(imm16),rs",16,14,0x00,
 #endif
 "ld",OPC_ld,0,{CLASS_BA+(ARG_RD),CLASS_REG_WORD+(ARG_RS),},
-	{CLASS_BIT+3,CLASS_BIT+3,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,66},
+	{CLASS_BIT+3,CLASS_BIT+3,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,71},
 
 /* 0111 0011 ddN0 ssss 0000 xxxx 0000 0000 *** ld rd(rx),rs */
 {
@@ -1574,7 +1631,7 @@
 "ld rd(rx),rs",16,14,0x00,
 #endif
 "ld",OPC_ld,0,{CLASS_BX+(ARG_RD),CLASS_REG_WORD+(ARG_RS),},
-	{CLASS_BIT+7,CLASS_BIT+3,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_REG+(ARG_RX),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,66},
+	{CLASS_BIT+7,CLASS_BIT+3,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_REG+(ARG_RX),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,71},
 
 /* 0010 0001 ssN0 dddd *** ld rd,@rs */
 {
@@ -1582,7 +1639,7 @@
 "ld rd,@rs",16,7,0x00,
 #endif
 "ld",OPC_ld,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IR+(ARG_RS),},
-	{CLASS_BIT+2,CLASS_BIT+1,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,66},
+	{CLASS_BIT+2,CLASS_BIT+1,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,71},
 
 /* 0110 0001 0000 dddd address_src *** ld rd,address_src */
 {
@@ -1590,7 +1647,7 @@
 "ld rd,address_src",16,9,0x00,
 #endif
 "ld",OPC_ld,0,{CLASS_REG_WORD+(ARG_RD),CLASS_DA+(ARG_SRC),},
-	{CLASS_BIT+6,CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,66},
+	{CLASS_BIT+6,CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,71},
 
 /* 0110 0001 ssN0 dddd address_src *** ld rd,address_src(rs) */
 {
@@ -1598,7 +1655,7 @@
 "ld rd,address_src(rs)",16,10,0x00,
 #endif
 "ld",OPC_ld,0,{CLASS_REG_WORD+(ARG_RD),CLASS_X+(ARG_RS),},
-	{CLASS_BIT+6,CLASS_BIT+1,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,66},
+	{CLASS_BIT+6,CLASS_BIT+1,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,71},
 
 /* 0010 0001 0000 dddd imm16 *** ld rd,imm16 */
 {
@@ -1606,7 +1663,7 @@
 "ld rd,imm16",16,7,0x00,
 #endif
 "ld",OPC_ld,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IMM+(ARG_IMM16),},
-	{CLASS_BIT+2,CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,66},
+	{CLASS_BIT+2,CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,71},
 
 /* 1010 0001 ssss dddd *** ld rd,rs */
 {
@@ -1614,7 +1671,7 @@
 "ld rd,rs",16,3,0x00,
 #endif
 "ld",OPC_ld,0,{CLASS_REG_WORD+(ARG_RD),CLASS_REG_WORD+(ARG_RS),},
-	{CLASS_BIT+0xa,CLASS_BIT+1,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,66},
+	{CLASS_BIT+0xa,CLASS_BIT+1,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,71},
 
 /* 0011 0001 ssN0 dddd imm16 *** ld rd,rs(imm16) */
 {
@@ -1622,7 +1679,7 @@
 "ld rd,rs(imm16)",16,14,0x00,
 #endif
 "ld",OPC_ld,0,{CLASS_REG_WORD+(ARG_RD),CLASS_BA+(ARG_RS),},
-	{CLASS_BIT+3,CLASS_BIT+1,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,66},
+	{CLASS_BIT+3,CLASS_BIT+1,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,71},
 
 /* 0111 0001 ssN0 dddd 0000 xxxx 0000 0000 *** ld rd,rs(rx) */
 {
@@ -1630,7 +1687,7 @@
 "ld rd,rs(rx)",16,14,0x00,
 #endif
 "ld",OPC_ld,0,{CLASS_REG_WORD+(ARG_RD),CLASS_BX+(ARG_RS),},
-	{CLASS_BIT+7,CLASS_BIT+1,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_BIT+0,CLASS_REG+(ARG_RX),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,66},
+	{CLASS_BIT+7,CLASS_BIT+1,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_BIT+0,CLASS_REG+(ARG_RX),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,71},
 
 /* 0111 0110 0000 dddd address_src *** lda prd,address_src */
 {
@@ -1638,7 +1695,7 @@
 "lda prd,address_src",16,12,0x00,
 #endif
 "lda",OPC_lda,0,{CLASS_PR+(ARG_RD),CLASS_DA+(ARG_SRC),},
-	{CLASS_BIT+7,CLASS_BIT+6,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,67},
+	{CLASS_BIT+7,CLASS_BIT+6,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,72},
 
 /* 0111 0110 ssN0 dddd address_src *** lda prd,address_src(rs) */
 {
@@ -1646,7 +1703,7 @@
 "lda prd,address_src(rs)",16,13,0x00,
 #endif
 "lda",OPC_lda,0,{CLASS_PR+(ARG_RD),CLASS_X+(ARG_RS),},
-	{CLASS_BIT+7,CLASS_BIT+6,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,67},
+	{CLASS_BIT+7,CLASS_BIT+6,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,72},
 
 /* 0011 0100 ssN0 dddd imm16 *** lda prd,rs(imm16) */
 {
@@ -1654,7 +1711,7 @@
 "lda prd,rs(imm16)",16,15,0x00,
 #endif
 "lda",OPC_lda,0,{CLASS_PR+(ARG_RD),CLASS_BA+(ARG_RS),},
-	{CLASS_BIT+3,CLASS_BIT+4,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,67},
+	{CLASS_BIT+3,CLASS_BIT+4,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,72},
 
 /* 0111 0100 ssN0 dddd 0000 xxxx 0000 0000 *** lda prd,rs(rx) */
 {
@@ -1662,7 +1719,7 @@
 "lda prd,rs(rx)",16,15,0x00,
 #endif
 "lda",OPC_lda,0,{CLASS_PR+(ARG_RD),CLASS_BX+(ARG_RS),},
-	{CLASS_BIT+7,CLASS_BIT+4,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_BIT+0,CLASS_REG+(ARG_RX),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,67},
+	{CLASS_BIT+7,CLASS_BIT+4,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_BIT+0,CLASS_REG+(ARG_RX),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,72},
 
 /* 0011 0100 0000 dddd disp16 *** ldar prd,disp16 */
 {
@@ -1670,7 +1727,7 @@
 "ldar prd,disp16",16,15,0x00,
 #endif
 "ldar",OPC_ldar,0,{CLASS_PR+(ARG_RD),CLASS_DISP,},
-	{CLASS_BIT+3,CLASS_BIT+4,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_DISP+(ARG_DISP16),0,0,0,0,},2,4,68},
+	{CLASS_BIT+3,CLASS_BIT+4,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_DISP+(ARG_DISP16),0,0,0,0,},2,4,73},
 
 /* 0000 1100 ddN0 0101 imm8 imm8 *** ldb @rd,imm8 */
 {
@@ -1678,7 +1735,7 @@
 "ldb @rd,imm8",8,7,0x00,
 #endif
 "ldb",OPC_ldb,0,{CLASS_IR+(ARG_RD),CLASS_IMM+(ARG_IMM8),},
-	{CLASS_BIT+0,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+5,CLASS_IMM+(ARG_IMM8),CLASS_IMM+(ARG_IMM8),0,0,0,},2,4,69},
+	{CLASS_BIT+0,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+5,CLASS_IMM+(ARG_IMM8),CLASS_IMM+(ARG_IMM8),0,0,0,},2,4,74},
 
 /* 0010 1110 ddN0 ssss *** ldb @rd,rbs */
 {
@@ -1686,7 +1743,7 @@
 "ldb @rd,rbs",8,8,0x00,
 #endif
 "ldb",OPC_ldb,0,{CLASS_IR+(ARG_RD),CLASS_REG_BYTE+(ARG_RS),},
-	{CLASS_BIT+2,CLASS_BIT+0xe,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),0,0,0,0,0,},2,2,69},
+	{CLASS_BIT+2,CLASS_BIT+0xe,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),0,0,0,0,0,},2,2,74},
 
 /* 0100 1100 ddN0 0101 address_dst imm8 imm8 *** ldb address_dst(rd),imm8 */
 {
@@ -1694,7 +1751,7 @@
 "ldb address_dst(rd),imm8",8,15,0x00,
 #endif
 "ldb",OPC_ldb,0,{CLASS_X+(ARG_RD),CLASS_IMM+(ARG_IMM8),},
-	{CLASS_BIT+4,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+5,CLASS_ADDRESS+(ARG_DST),CLASS_IMM+(ARG_IMM8),CLASS_IMM+(ARG_IMM8),0,0,},2,6,69},
+	{CLASS_BIT+4,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+5,CLASS_ADDRESS+(ARG_DST),CLASS_IMM+(ARG_IMM8),CLASS_IMM+(ARG_IMM8),0,0,},2,6,74},
 
 /* 0110 1110 ddN0 ssss address_dst *** ldb address_dst(rd),rbs */
 {
@@ -1702,7 +1759,7 @@
 "ldb address_dst(rd),rbs",8,12,0x00,
 #endif
 "ldb",OPC_ldb,0,{CLASS_X+(ARG_RD),CLASS_REG_BYTE+(ARG_RS),},
-	{CLASS_BIT+6,CLASS_BIT+0xe,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,69},
+	{CLASS_BIT+6,CLASS_BIT+0xe,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,74},
 
 /* 0100 1100 0000 0101 address_dst imm8 imm8 *** ldb address_dst,imm8 */
 {
@@ -1710,7 +1767,7 @@
 "ldb address_dst,imm8",8,14,0x00,
 #endif
 "ldb",OPC_ldb,0,{CLASS_DA+(ARG_DST),CLASS_IMM+(ARG_IMM8),},
-	{CLASS_BIT+4,CLASS_BIT+0xc,CLASS_BIT+0,CLASS_BIT+5,CLASS_ADDRESS+(ARG_DST),CLASS_IMM+(ARG_IMM8),CLASS_IMM+(ARG_IMM8),0,0,},2,6,69},
+	{CLASS_BIT+4,CLASS_BIT+0xc,CLASS_BIT+0,CLASS_BIT+5,CLASS_ADDRESS+(ARG_DST),CLASS_IMM+(ARG_IMM8),CLASS_IMM+(ARG_IMM8),0,0,},2,6,74},
 
 /* 0110 1110 0000 ssss address_dst *** ldb address_dst,rbs */
 {
@@ -1718,7 +1775,7 @@
 "ldb address_dst,rbs",8,11,0x00,
 #endif
 "ldb",OPC_ldb,0,{CLASS_DA+(ARG_DST),CLASS_REG_BYTE+(ARG_RS),},
-	{CLASS_BIT+6,CLASS_BIT+0xe,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,69},
+	{CLASS_BIT+6,CLASS_BIT+0xe,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,74},
 
 /* 0010 0000 ssN0 dddd *** ldb rbd,@rs */
 {
@@ -1726,7 +1783,7 @@
 "ldb rbd,@rs",8,7,0x00,
 #endif
 "ldb",OPC_ldb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IR+(ARG_RS),},
-	{CLASS_BIT+2,CLASS_BIT+0,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,69},
+	{CLASS_BIT+2,CLASS_BIT+0,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,74},
 
 /* 0110 0000 0000 dddd address_src *** ldb rbd,address_src */
 {
@@ -1734,7 +1791,7 @@
 "ldb rbd,address_src",8,9,0x00,
 #endif
 "ldb",OPC_ldb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_DA+(ARG_SRC),},
-	{CLASS_BIT+6,CLASS_BIT+0,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,69},
+	{CLASS_BIT+6,CLASS_BIT+0,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,74},
 
 /* 0110 0000 ssN0 dddd address_src *** ldb rbd,address_src(rs) */
 {
@@ -1742,7 +1799,15 @@
 "ldb rbd,address_src(rs)",8,10,0x00,
 #endif
 "ldb",OPC_ldb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_X+(ARG_RS),},
-	{CLASS_BIT+6,CLASS_BIT+0,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,69},
+	{CLASS_BIT+6,CLASS_BIT+0,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,74},
+
+/* 0010 0000 0000 dddd imm8 imm8 *** ldb rbd,imm8 */
+{
+#ifdef NICENAMES
+"ldb rbd,imm8",8,7,0x00,
+#endif
+"ldb",OPC_ldb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM+(ARG_IMM8),},
+	{CLASS_BIT+2,CLASS_BIT+0,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM8),CLASS_IMM+(ARG_IMM8),0,0,0,},2,4,74},
 
 /* 1100 dddd imm8 *** ldb rbd,imm8 */
 {
@@ -1750,7 +1815,7 @@
 "ldb rbd,imm8",8,5,0x00,
 #endif
 "ldb",OPC_ldb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM+(ARG_IMM8),},
-	{CLASS_BIT+0xc,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},2,2,69},
+	{CLASS_BIT+0xc,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},2,2,74},
 
 /* 1010 0000 ssss dddd *** ldb rbd,rbs */
 {
@@ -1758,7 +1823,7 @@
 "ldb rbd,rbs",8,3,0x00,
 #endif
 "ldb",OPC_ldb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_REG_BYTE+(ARG_RS),},
-	{CLASS_BIT+0xa,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,69},
+	{CLASS_BIT+0xa,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,74},
 
 /* 0011 0000 ssN0 dddd imm16 *** ldb rbd,rs(imm16) */
 {
@@ -1766,7 +1831,7 @@
 "ldb rbd,rs(imm16)",8,14,0x00,
 #endif
 "ldb",OPC_ldb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_BA+(ARG_RS),},
-	{CLASS_BIT+3,CLASS_BIT+0,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,69},
+	{CLASS_BIT+3,CLASS_BIT+0,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,74},
 
 /* 0111 0000 ssN0 dddd 0000 xxxx 0000 0000 *** ldb rbd,rs(rx) */
 {
@@ -1774,7 +1839,7 @@
 "ldb rbd,rs(rx)",8,14,0x00,
 #endif
 "ldb",OPC_ldb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_BX+(ARG_RS),},
-	{CLASS_BIT+7,CLASS_BIT+0,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_BIT+0,CLASS_REG+(ARG_RX),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,69},
+	{CLASS_BIT+7,CLASS_BIT+0,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_BIT+0,CLASS_REG+(ARG_RX),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,74},
 
 /* 0011 0010 ddN0 ssss imm16 *** ldb rd(imm16),rbs */
 {
@@ -1782,7 +1847,7 @@
 "ldb rd(imm16),rbs",8,14,0x00,
 #endif
 "ldb",OPC_ldb,0,{CLASS_BA+(ARG_RD),CLASS_REG_BYTE+(ARG_RS),},
-	{CLASS_BIT+3,CLASS_BIT+2,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,69},
+	{CLASS_BIT+3,CLASS_BIT+2,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,74},
 
 /* 0111 0010 ddN0 ssss 0000 xxxx 0000 0000 *** ldb rd(rx),rbs */
 {
@@ -1790,7 +1855,7 @@
 "ldb rd(rx),rbs",8,14,0x00,
 #endif
 "ldb",OPC_ldb,0,{CLASS_BX+(ARG_RD),CLASS_REG_BYTE+(ARG_RS),},
-	{CLASS_BIT+7,CLASS_BIT+2,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_REG+(ARG_RX),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,69},
+	{CLASS_BIT+7,CLASS_BIT+2,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_REG+(ARG_RX),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,74},
 
 /* 0111 1101 ssss 1ccc *** ldctl ctrl,rs */
 {
@@ -1798,7 +1863,7 @@
 "ldctl ctrl,rs",32,7,0x00,
 #endif
 "ldctl",OPC_ldctl,0,{CLASS_CTRL,CLASS_REG_WORD+(ARG_RS),},
-	{CLASS_BIT+7,CLASS_BIT+0xd,CLASS_REG+(ARG_RS),CLASS_1CCC,0,0,0,0,0,},2,2,70},
+	{CLASS_BIT+7,CLASS_BIT+0xd,CLASS_REG+(ARG_RS),CLASS_1CCC,0,0,0,0,0,},2,2,75},
 
 /* 0111 1101 dddd 0ccc *** ldctl rd,ctrl */
 {
@@ -1806,7 +1871,7 @@
 "ldctl rd,ctrl",32,7,0x00,
 #endif
 "ldctl",OPC_ldctl,0,{CLASS_REG_WORD+(ARG_RD),CLASS_CTRL,},
-	{CLASS_BIT+7,CLASS_BIT+0xd,CLASS_REG+(ARG_RD),CLASS_0CCC,0,0,0,0,0,},2,2,70},
+	{CLASS_BIT+7,CLASS_BIT+0xd,CLASS_REG+(ARG_RD),CLASS_0CCC,0,0,0,0,0,},2,2,75},
 
 /* 1000 1100 ssss 1001 *** ldctlb ctrl,rbs */
 {
@@ -1814,7 +1879,7 @@
 "ldctlb ctrl,rbs",32,7,0x3f,
 #endif
 "ldctlb",OPC_ldctlb,0,{CLASS_CTRL,CLASS_REG_BYTE+(ARG_RS),},
-	{CLASS_BIT+8,CLASS_BIT+0xc,CLASS_REG+(ARG_RS),CLASS_BIT+9,0,0,0,0,0,},2,2,71},
+	{CLASS_BIT+8,CLASS_BIT+0xc,CLASS_REG+(ARG_RS),CLASS_BIT+9,0,0,0,0,0,},2,2,76},
 
 /* 1000 1100 dddd 0001 *** ldctlb rbd,ctrl */
 {
@@ -1822,7 +1887,7 @@
 "ldctlb rbd,ctrl",32,7,0x00,
 #endif
 "ldctlb",OPC_ldctlb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_CTRL,},
-	{CLASS_BIT+8,CLASS_BIT+0xc,CLASS_REG+(ARG_RD),CLASS_BIT+1,0,0,0,0,0,},2,2,71},
+	{CLASS_BIT+8,CLASS_BIT+0xc,CLASS_REG+(ARG_RD),CLASS_BIT+1,0,0,0,0,0,},2,2,76},
 
 /* 1011 1011 ssN0 1001 0000 rrrr ddN0 1000 *** ldd @rd,@rs,rr */
 {
@@ -1830,7 +1895,7 @@
 "ldd @rd,@rs,rr",16,11,0x04,
 #endif
 "ldd",OPC_ldd,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RR),},
-	{CLASS_BIT+0xb,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,72},
+	{CLASS_BIT+0xb,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,77},
 
 /* 1011 1010 ssN0 1001 0000 rrrr ddN0 1000 *** lddb @rd,@rs,rr */
 {
@@ -1838,7 +1903,7 @@
 "lddb @rd,@rs,rr",8,11,0x04,
 #endif
 "lddb",OPC_lddb,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RR),},
-	{CLASS_BIT+0xb,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,73},
+	{CLASS_BIT+0xb,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,78},
 
 /* 1011 1011 ssN0 1001 0000 rrrr ddN0 0000 *** lddr @rd,@rs,rr */
 {
@@ -1846,7 +1911,7 @@
 "lddr @rd,@rs,rr",16,11,0x04,
 #endif
 "lddr",OPC_lddr,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RR),},
-	{CLASS_BIT+0xb,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_BIT+0,0,},3,4,74},
+	{CLASS_BIT+0xb,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_BIT+0,0,},3,4,79},
 
 /* 1011 1010 ssN0 1001 0000 rrrr ddN0 0000 *** lddrb @rd,@rs,rr */
 {
@@ -1854,7 +1919,7 @@
 "lddrb @rd,@rs,rr",8,11,0x04,
 #endif
 "lddrb",OPC_lddrb,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RR),},
-	{CLASS_BIT+0xb,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_BIT+0,0,},3,4,75},
+	{CLASS_BIT+0xb,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_BIT+0,0,},3,4,80},
 
 /* 1011 1011 ssN0 0001 0000 rrrr ddN0 1000 *** ldi @rd,@rs,rr */
 {
@@ -1862,7 +1927,7 @@
 "ldi @rd,@rs,rr",16,11,0x04,
 #endif
 "ldi",OPC_ldi,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RR),},
-	{CLASS_BIT+0xb,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,76},
+	{CLASS_BIT+0xb,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,81},
 
 /* 1011 1010 ssN0 0001 0000 rrrr ddN0 1000 *** ldib @rd,@rs,rr */
 {
@@ -1870,7 +1935,7 @@
 "ldib @rd,@rs,rr",8,11,0x04,
 #endif
 "ldib",OPC_ldib,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RR),},
-	{CLASS_BIT+0xb,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,77},
+	{CLASS_BIT+0xb,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,82},
 
 /* 1011 1011 ssN0 0001 0000 rrrr ddN0 0000 *** ldir @rd,@rs,rr */
 {
@@ -1878,7 +1943,7 @@
 "ldir @rd,@rs,rr",16,11,0x04,
 #endif
 "ldir",OPC_ldir,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RR),},
-	{CLASS_BIT+0xb,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_BIT+0,0,},3,4,78},
+	{CLASS_BIT+0xb,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_BIT+0,0,},3,4,83},
 
 /* 1011 1010 ssN0 0001 0000 rrrr ddN0 0000 *** ldirb @rd,@rs,rr */
 {
@@ -1886,7 +1951,7 @@
 "ldirb @rd,@rs,rr",8,11,0x04,
 #endif
 "ldirb",OPC_ldirb,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RR),},
-	{CLASS_BIT+0xb,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_BIT+0,0,},3,4,79},
+	{CLASS_BIT+0xb,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_BIT+0,0,},3,4,84},
 
 /* 1011 1101 dddd imm4 *** ldk rd,imm4 */
 {
@@ -1894,7 +1959,7 @@
 "ldk rd,imm4",16,5,0x00,
 #endif
 "ldk",OPC_ldk,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IMM +(ARG_IMM4),},
-	{CLASS_BIT+0xb,CLASS_BIT+0xd,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM4),0,0,0,0,0,},2,2,80},
+	{CLASS_BIT+0xb,CLASS_BIT+0xd,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM4),0,0,0,0,0,},2,2,85},
 
 /* 0001 1101 ddN0 ssss *** ldl @rd,rrs */
 {
@@ -1902,7 +1967,7 @@
 "ldl @rd,rrs",32,11,0x00,
 #endif
 "ldl",OPC_ldl,0,{CLASS_IR+(ARG_RD),CLASS_REG_LONG+(ARG_RS),},
-	{CLASS_BIT+1,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),0,0,0,0,0,},2,2,81},
+	{CLASS_BIT+1,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),0,0,0,0,0,},2,2,86},
 
 /* 0101 1101 ddN0 ssss address_dst *** ldl address_dst(rd),rrs */
 {
@@ -1910,7 +1975,7 @@
 "ldl address_dst(rd),rrs",32,14,0x00,
 #endif
 "ldl",OPC_ldl,0,{CLASS_X+(ARG_RD),CLASS_REG_LONG+(ARG_RS),},
-	{CLASS_BIT+5,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,81},
+	{CLASS_BIT+5,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,86},
 
 /* 0101 1101 0000 ssss address_dst *** ldl address_dst,rrs */
 {
@@ -1918,7 +1983,7 @@
 "ldl address_dst,rrs",32,15,0x00,
 #endif
 "ldl",OPC_ldl,0,{CLASS_DA+(ARG_DST),CLASS_REG_LONG+(ARG_RS),},
-	{CLASS_BIT+5,CLASS_BIT+0xd,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,81},
+	{CLASS_BIT+5,CLASS_BIT+0xd,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,86},
 
 /* 0011 0111 ddN0 ssss imm16 *** ldl rd(imm16),rrs */
 {
@@ -1926,7 +1991,7 @@
 "ldl rd(imm16),rrs",32,17,0x00,
 #endif
 "ldl",OPC_ldl,0,{CLASS_BA+(ARG_RD),CLASS_REG_LONG+(ARG_RS),},
-	{CLASS_BIT+3,CLASS_BIT+7,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,81},
+	{CLASS_BIT+3,CLASS_BIT+7,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,86},
 
 /* 0111 0111 ddN0 ssss 0000 xxxx 0000 0000 *** ldl rd(rx),rrs */
 {
@@ -1934,7 +1999,7 @@
 "ldl rd(rx),rrs",32,17,0x00,
 #endif
 "ldl",OPC_ldl,0,{CLASS_BX+(ARG_RD),CLASS_REG_LONG+(ARG_RS),},
-	{CLASS_BIT+7,CLASS_BIT+7,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_REG+(ARG_RX),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,81},
+	{CLASS_BIT+7,CLASS_BIT+7,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_REG+(ARG_RX),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,86},
 
 /* 0001 0100 ssN0 dddd *** ldl rrd,@rs */
 {
@@ -1942,7 +2007,7 @@
 "ldl rrd,@rs",32,11,0x00,
 #endif
 "ldl",OPC_ldl,0,{CLASS_REG_LONG+(ARG_RD),CLASS_IR+(ARG_RS),},
-	{CLASS_BIT+1,CLASS_BIT+4,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,81},
+	{CLASS_BIT+1,CLASS_BIT+4,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,86},
 
 /* 0101 0100 0000 dddd address_src *** ldl rrd,address_src */
 {
@@ -1950,7 +2015,7 @@
 "ldl rrd,address_src",32,12,0x00,
 #endif
 "ldl",OPC_ldl,0,{CLASS_REG_LONG+(ARG_RD),CLASS_DA+(ARG_SRC),},
-	{CLASS_BIT+5,CLASS_BIT+4,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,81},
+	{CLASS_BIT+5,CLASS_BIT+4,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,86},
 
 /* 0101 0100 ssN0 dddd address_src *** ldl rrd,address_src(rs) */
 {
@@ -1958,7 +2023,7 @@
 "ldl rrd,address_src(rs)",32,13,0x00,
 #endif
 "ldl",OPC_ldl,0,{CLASS_REG_LONG+(ARG_RD),CLASS_X+(ARG_RS),},
-	{CLASS_BIT+5,CLASS_BIT+4,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,81},
+	{CLASS_BIT+5,CLASS_BIT+4,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,86},
 
 /* 0001 0100 0000 dddd imm32 *** ldl rrd,imm32 */
 {
@@ -1966,7 +2031,7 @@
 "ldl rrd,imm32",32,11,0x00,
 #endif
 "ldl",OPC_ldl,0,{CLASS_REG_LONG+(ARG_RD),CLASS_IMM+(ARG_IMM32),},
-	{CLASS_BIT+1,CLASS_BIT+4,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM32),0,0,0,0,},2,6,81},
+	{CLASS_BIT+1,CLASS_BIT+4,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM32),0,0,0,0,},2,6,86},
 
 /* 1001 0100 ssss dddd *** ldl rrd,rrs */
 {
@@ -1974,7 +2039,7 @@
 "ldl rrd,rrs",32,5,0x00,
 #endif
 "ldl",OPC_ldl,0,{CLASS_REG_LONG+(ARG_RD),CLASS_REG_LONG+(ARG_RS),},
-	{CLASS_BIT+9,CLASS_BIT+4,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,81},
+	{CLASS_BIT+9,CLASS_BIT+4,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,86},
 
 /* 0011 0101 ssN0 dddd imm16 *** ldl rrd,rs(imm16) */
 {
@@ -1982,7 +2047,7 @@
 "ldl rrd,rs(imm16)",32,17,0x00,
 #endif
 "ldl",OPC_ldl,0,{CLASS_REG_LONG+(ARG_RD),CLASS_BA+(ARG_RS),},
-	{CLASS_BIT+3,CLASS_BIT+5,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,81},
+	{CLASS_BIT+3,CLASS_BIT+5,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,86},
 
 /* 0111 0101 ssN0 dddd 0000 xxxx 0000 0000 *** ldl rrd,rs(rx) */
 {
@@ -1990,7 +2055,7 @@
 "ldl rrd,rs(rx)",32,17,0x00,
 #endif
 "ldl",OPC_ldl,0,{CLASS_REG_LONG+(ARG_RD),CLASS_BX+(ARG_RS),},
-	{CLASS_BIT+7,CLASS_BIT+5,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_BIT+0,CLASS_REG+(ARG_RX),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,81},
+	{CLASS_BIT+7,CLASS_BIT+5,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_BIT+0,CLASS_REG+(ARG_RX),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,86},
 
 /* 0001 1100 ddN0 1001 0000 ssss 0000 imm4m1 *** ldm @rd,rs,n */
 {
@@ -1998,7 +2063,7 @@
 "ldm @rd,rs,n",16,11,0x00,
 #endif
 "ldm",OPC_ldm,0,{CLASS_IR+(ARG_RD),CLASS_REG_WORD+(ARG_RS),CLASS_IMM + (ARG_IMM4M1),},
-	{CLASS_BIT+1,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_IMM+(ARG_IMM4M1),0,},3,4,82},
+	{CLASS_BIT+1,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_IMM+(ARG_IMM4M1),0,},3,4,87},
 
 /* 0101 1100 ddN0 1001 0000 ssss 0000 imm4m1 address_dst *** ldm address_dst(rd),rs,n */
 {
@@ -2006,7 +2071,7 @@
 "ldm address_dst(rd),rs,n",16,15,0x00,
 #endif
 "ldm",OPC_ldm,0,{CLASS_X+(ARG_RD),CLASS_REG_WORD+(ARG_RS),CLASS_IMM + (ARG_IMM4M1),},
-	{CLASS_BIT+5,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_IMM+(ARG_IMM4M1),CLASS_ADDRESS+(ARG_DST),},3,6,82},
+	{CLASS_BIT+5,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_IMM+(ARG_IMM4M1),CLASS_ADDRESS+(ARG_DST),},3,6,87},
 
 /* 0101 1100 0000 1001 0000 ssss 0000 imm4m1 address_dst *** ldm address_dst,rs,n */
 {
@@ -2014,7 +2079,7 @@
 "ldm address_dst,rs,n",16,14,0x00,
 #endif
 "ldm",OPC_ldm,0,{CLASS_DA+(ARG_DST),CLASS_REG_WORD+(ARG_RS),CLASS_IMM + (ARG_IMM4M1),},
-	{CLASS_BIT+5,CLASS_BIT+0xc,CLASS_BIT+0,CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_IMM+(ARG_IMM4M1),CLASS_ADDRESS+(ARG_DST),},3,6,82},
+	{CLASS_BIT+5,CLASS_BIT+0xc,CLASS_BIT+0,CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_IMM+(ARG_IMM4M1),CLASS_ADDRESS+(ARG_DST),},3,6,87},
 
 /* 0001 1100 ssN0 0001 0000 dddd 0000 imm4m1 *** ldm rd,@rs,n */
 {
@@ -2022,7 +2087,7 @@
 "ldm rd,@rs,n",16,11,0x00,
 #endif
 "ldm",OPC_ldm,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_IMM + (ARG_IMM4M1),},
-	{CLASS_BIT+1,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RS),CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_BIT+0,CLASS_IMM+(ARG_IMM4M1),0,},3,4,82},
+	{CLASS_BIT+1,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RS),CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_BIT+0,CLASS_IMM+(ARG_IMM4M1),0,},3,4,87},
 
 /* 0101 1100 ssN0 0001 0000 dddd 0000 imm4m1 address_src *** ldm rd,address_src(rs),n */
 {
@@ -2030,7 +2095,7 @@
 "ldm rd,address_src(rs),n",16,15,0x00,
 #endif
 "ldm",OPC_ldm,0,{CLASS_REG_WORD+(ARG_RD),CLASS_X+(ARG_RS),CLASS_IMM + (ARG_IMM4M1),},
-	{CLASS_BIT+5,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RS),CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_BIT+0,CLASS_IMM+(ARG_IMM4M1),CLASS_ADDRESS+(ARG_SRC),},3,6,82},
+	{CLASS_BIT+5,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RS),CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_BIT+0,CLASS_IMM+(ARG_IMM4M1),CLASS_ADDRESS+(ARG_SRC),},3,6,87},
 
 /* 0101 1100 0000 0001 0000 dddd 0000 imm4m1 address_src *** ldm rd,address_src,n */
 {
@@ -2038,7 +2103,7 @@
 "ldm rd,address_src,n",16,14,0x00,
 #endif
 "ldm",OPC_ldm,0,{CLASS_REG_WORD+(ARG_RD),CLASS_DA+(ARG_SRC),CLASS_IMM + (ARG_IMM4M1),},
-	{CLASS_BIT+5,CLASS_BIT+0xc,CLASS_BIT+0,CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_BIT+0,CLASS_IMM+(ARG_IMM4M1),CLASS_ADDRESS+(ARG_SRC),},3,6,82},
+	{CLASS_BIT+5,CLASS_BIT+0xc,CLASS_BIT+0,CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_BIT+0,CLASS_IMM+(ARG_IMM4M1),CLASS_ADDRESS+(ARG_SRC),},3,6,87},
 
 /* 0011 1001 ssN0 0000 *** ldps @rs */
 {
@@ -2046,7 +2111,7 @@
 "ldps @rs",16,12,0x3f,
 #endif
 "ldps",OPC_ldps,0,{CLASS_IR+(ARG_RS),},
-	{CLASS_BIT+3,CLASS_BIT+9,CLASS_REGN0+(ARG_RS),CLASS_BIT+0,0,0,0,0,0,},1,2,83},
+	{CLASS_BIT+3,CLASS_BIT+9,CLASS_REGN0+(ARG_RS),CLASS_BIT+0,0,0,0,0,0,},1,2,88},
 
 /* 0111 1001 0000 0000 address_src *** ldps address_src */
 {
@@ -2054,7 +2119,7 @@
 "ldps address_src",16,16,0x3f,
 #endif
 "ldps",OPC_ldps,0,{CLASS_DA+(ARG_SRC),},
-	{CLASS_BIT+7,CLASS_BIT+9,CLASS_BIT+0,CLASS_BIT+0,CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},1,4,83},
+	{CLASS_BIT+7,CLASS_BIT+9,CLASS_BIT+0,CLASS_BIT+0,CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},1,4,88},
 
 /* 0111 1001 ssN0 0000 address_src *** ldps address_src(rs) */
 {
@@ -2062,7 +2127,7 @@
 "ldps address_src(rs)",16,17,0x3f,
 #endif
 "ldps",OPC_ldps,0,{CLASS_X+(ARG_RS),},
-	{CLASS_BIT+7,CLASS_BIT+9,CLASS_REGN0+(ARG_RS),CLASS_BIT+0,CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},1,4,83},
+	{CLASS_BIT+7,CLASS_BIT+9,CLASS_REGN0+(ARG_RS),CLASS_BIT+0,CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},1,4,88},
 
 /* 0011 0011 0000 ssss disp16 *** ldr disp16,rs */
 {
@@ -2070,7 +2135,7 @@
 "ldr disp16,rs",16,14,0x00,
 #endif
 "ldr",OPC_ldr,0,{CLASS_DISP,CLASS_REG_WORD+(ARG_RS),},
-	{CLASS_BIT+3,CLASS_BIT+3,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_DISP+(ARG_DISP16),0,0,0,0,},2,4,84},
+	{CLASS_BIT+3,CLASS_BIT+3,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_DISP+(ARG_DISP16),0,0,0,0,},2,4,89},
 
 /* 0011 0001 0000 dddd disp16 *** ldr rd,disp16 */
 {
@@ -2078,7 +2143,7 @@
 "ldr rd,disp16",16,14,0x00,
 #endif
 "ldr",OPC_ldr,0,{CLASS_REG_WORD+(ARG_RD),CLASS_DISP,},
-	{CLASS_BIT+3,CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_DISP+(ARG_DISP16),0,0,0,0,},2,4,84},
+	{CLASS_BIT+3,CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_DISP+(ARG_DISP16),0,0,0,0,},2,4,89},
 
 /* 0011 0010 0000 ssss disp16 *** ldrb disp16,rbs */
 {
@@ -2086,7 +2151,7 @@
 "ldrb disp16,rbs",8,14,0x00,
 #endif
 "ldrb",OPC_ldrb,0,{CLASS_DISP,CLASS_REG_BYTE+(ARG_RS),},
-	{CLASS_BIT+3,CLASS_BIT+2,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_DISP+(ARG_DISP16),0,0,0,0,},2,4,85},
+	{CLASS_BIT+3,CLASS_BIT+2,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_DISP+(ARG_DISP16),0,0,0,0,},2,4,90},
 
 /* 0011 0000 0000 dddd disp16 *** ldrb rbd,disp16 */
 {
@@ -2094,7 +2159,7 @@
 "ldrb rbd,disp16",8,14,0x00,
 #endif
 "ldrb",OPC_ldrb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_DISP,},
-	{CLASS_BIT+3,CLASS_BIT+0,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_DISP+(ARG_DISP16),0,0,0,0,},2,4,85},
+	{CLASS_BIT+3,CLASS_BIT+0,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_DISP+(ARG_DISP16),0,0,0,0,},2,4,90},
 
 /* 0011 0111 0000 ssss disp16 *** ldrl disp16,rrs */
 {
@@ -2102,7 +2167,7 @@
 "ldrl disp16,rrs",32,17,0x00,
 #endif
 "ldrl",OPC_ldrl,0,{CLASS_DISP,CLASS_REG_LONG+(ARG_RS),},
-	{CLASS_BIT+3,CLASS_BIT+7,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_DISP+(ARG_DISP16),0,0,0,0,},2,4,86},
+	{CLASS_BIT+3,CLASS_BIT+7,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_DISP+(ARG_DISP16),0,0,0,0,},2,4,91},
 
 /* 0011 0101 0000 dddd disp16 *** ldrl rrd,disp16 */
 {
@@ -2110,7 +2175,7 @@
 "ldrl rrd,disp16",32,17,0x00,
 #endif
 "ldrl",OPC_ldrl,0,{CLASS_REG_LONG+(ARG_RD),CLASS_DISP,},
-	{CLASS_BIT+3,CLASS_BIT+5,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_DISP+(ARG_DISP16),0,0,0,0,},2,4,86},
+	{CLASS_BIT+3,CLASS_BIT+5,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_DISP+(ARG_DISP16),0,0,0,0,},2,4,91},
 
 /* 0111 1011 0000 1010 *** mbit */
 {
@@ -2118,7 +2183,7 @@
 "mbit",16,7,0x38,
 #endif
 "mbit",OPC_mbit,0,{0},
-	{CLASS_BIT+7,CLASS_BIT+0xb,CLASS_BIT+0,CLASS_BIT+0xa,0,0,0,0,0,},0,2,87},
+	{CLASS_BIT+7,CLASS_BIT+0xb,CLASS_BIT+0,CLASS_BIT+0xa,0,0,0,0,0,},0,2,92},
 
 /* 0111 1011 dddd 1101 *** mreq rd */
 {
@@ -2126,7 +2191,7 @@
 "mreq rd",16,12,0x18,
 #endif
 "mreq",OPC_mreq,0,{CLASS_REG_WORD+(ARG_RD),},
-	{CLASS_BIT+7,CLASS_BIT+0xb,CLASS_REG+(ARG_RD),CLASS_BIT+0xd,0,0,0,0,0,},1,2,88},
+	{CLASS_BIT+7,CLASS_BIT+0xb,CLASS_REG+(ARG_RD),CLASS_BIT+0xd,0,0,0,0,0,},1,2,93},
 
 /* 0111 1011 0000 1001 *** mres */
 {
@@ -2134,7 +2199,7 @@
 "mres",16,5,0x00,
 #endif
 "mres",OPC_mres,0,{0},
-	{CLASS_BIT+7,CLASS_BIT+0xb,CLASS_BIT+0,CLASS_BIT+9,0,0,0,0,0,},0,2,89},
+	{CLASS_BIT+7,CLASS_BIT+0xb,CLASS_BIT+0,CLASS_BIT+9,0,0,0,0,0,},0,2,94},
 
 /* 0111 1011 0000 1000 *** mset */
 {
@@ -2142,7 +2207,7 @@
 "mset",16,5,0x00,
 #endif
 "mset",OPC_mset,0,{0},
-	{CLASS_BIT+7,CLASS_BIT+0xb,CLASS_BIT+0,CLASS_BIT+8,0,0,0,0,0,},0,2,90},
+	{CLASS_BIT+7,CLASS_BIT+0xb,CLASS_BIT+0,CLASS_BIT+8,0,0,0,0,0,},0,2,95},
 
 /* 0001 1001 ssN0 dddd *** mult rrd,@rs */
 {
@@ -2150,7 +2215,7 @@
 "mult rrd,@rs",16,70,0x3c,
 #endif
 "mult",OPC_mult,0,{CLASS_REG_LONG+(ARG_RD),CLASS_IR+(ARG_RS),},
-	{CLASS_BIT+1,CLASS_BIT+9,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,91},
+	{CLASS_BIT+1,CLASS_BIT+9,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,96},
 
 /* 0101 1001 0000 dddd address_src *** mult rrd,address_src */
 {
@@ -2158,7 +2223,7 @@
 "mult rrd,address_src",16,70,0x3c,
 #endif
 "mult",OPC_mult,0,{CLASS_REG_LONG+(ARG_RD),CLASS_DA+(ARG_SRC),},
-	{CLASS_BIT+5,CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,91},
+	{CLASS_BIT+5,CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,96},
 
 /* 0101 1001 ssN0 dddd address_src *** mult rrd,address_src(rs) */
 {
@@ -2166,7 +2231,7 @@
 "mult rrd,address_src(rs)",16,70,0x3c,
 #endif
 "mult",OPC_mult,0,{CLASS_REG_LONG+(ARG_RD),CLASS_X+(ARG_RS),},
-	{CLASS_BIT+5,CLASS_BIT+9,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,91},
+	{CLASS_BIT+5,CLASS_BIT+9,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,96},
 
 /* 0001 1001 0000 dddd imm16 *** mult rrd,imm16 */
 {
@@ -2174,7 +2239,7 @@
 "mult rrd,imm16",16,70,0x3c,
 #endif
 "mult",OPC_mult,0,{CLASS_REG_LONG+(ARG_RD),CLASS_IMM+(ARG_IMM16),},
-	{CLASS_BIT+1,CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,91},
+	{CLASS_BIT+1,CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,96},
 
 /* 1001 1001 ssss dddd *** mult rrd,rs */
 {
@@ -2182,7 +2247,7 @@
 "mult rrd,rs",16,70,0x3c,
 #endif
 "mult",OPC_mult,0,{CLASS_REG_LONG+(ARG_RD),CLASS_REG_WORD+(ARG_RS),},
-	{CLASS_BIT+9,CLASS_BIT+9,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,91},
+	{CLASS_BIT+9,CLASS_BIT+9,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,96},
 
 /* 0001 1000 ssN0 dddd *** multl rqd,@rs */
 {
@@ -2190,7 +2255,7 @@
 "multl rqd,@rs",32,282,0x3c,
 #endif
 "multl",OPC_multl,0,{CLASS_REG_QUAD+(ARG_RD),CLASS_IR+(ARG_RS),},
-	{CLASS_BIT+1,CLASS_BIT+8,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,92},
+	{CLASS_BIT+1,CLASS_BIT+8,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,97},
 
 /* 0101 1000 0000 dddd address_src *** multl rqd,address_src */
 {
@@ -2198,7 +2263,7 @@
 "multl rqd,address_src",32,282,0x3c,
 #endif
 "multl",OPC_multl,0,{CLASS_REG_QUAD+(ARG_RD),CLASS_DA+(ARG_SRC),},
-	{CLASS_BIT+5,CLASS_BIT+8,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,92},
+	{CLASS_BIT+5,CLASS_BIT+8,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,97},
 
 /* 0101 1000 ssN0 dddd address_src *** multl rqd,address_src(rs) */
 {
@@ -2206,7 +2271,7 @@
 "multl rqd,address_src(rs)",32,282,0x3c,
 #endif
 "multl",OPC_multl,0,{CLASS_REG_QUAD+(ARG_RD),CLASS_X+(ARG_RS),},
-	{CLASS_BIT+5,CLASS_BIT+8,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,92},
+	{CLASS_BIT+5,CLASS_BIT+8,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,97},
 
 /* 0001 1000 0000 dddd imm32 *** multl rqd,imm32 */
 {
@@ -2214,7 +2279,7 @@
 "multl rqd,imm32",32,282,0x3c,
 #endif
 "multl",OPC_multl,0,{CLASS_REG_QUAD+(ARG_RD),CLASS_IMM+(ARG_IMM32),},
-	{CLASS_BIT+1,CLASS_BIT+8,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM32),0,0,0,0,},2,6,92},
+	{CLASS_BIT+1,CLASS_BIT+8,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM32),0,0,0,0,},2,6,97},
 
 /* 1001 1000 ssss dddd *** multl rqd,rrs */
 {
@@ -2222,7 +2287,7 @@
 "multl rqd,rrs",32,282,0x3c,
 #endif
 "multl",OPC_multl,0,{CLASS_REG_QUAD+(ARG_RD),CLASS_REG_LONG+(ARG_RS),},
-	{CLASS_BIT+9,CLASS_BIT+8,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,92},
+	{CLASS_BIT+9,CLASS_BIT+8,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,97},
 
 /* 0000 1101 ddN0 0010 *** neg @rd */
 {
@@ -2230,7 +2295,7 @@
 "neg @rd",16,12,0x3c,
 #endif
 "neg",OPC_neg,0,{CLASS_IR+(ARG_RD),},
-	{CLASS_BIT+0,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_BIT+2,0,0,0,0,0,},1,2,93},
+	{CLASS_BIT+0,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_BIT+2,0,0,0,0,0,},1,2,98},
 
 /* 0100 1101 0000 0010 address_dst *** neg address_dst */
 {
@@ -2238,7 +2303,7 @@
 "neg address_dst",16,15,0x3c,
 #endif
 "neg",OPC_neg,0,{CLASS_DA+(ARG_DST),},
-	{CLASS_BIT+4,CLASS_BIT+0xd,CLASS_BIT+0,CLASS_BIT+2,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,93},
+	{CLASS_BIT+4,CLASS_BIT+0xd,CLASS_BIT+0,CLASS_BIT+2,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,98},
 
 /* 0100 1101 ddN0 0010 address_dst *** neg address_dst(rd) */
 {
@@ -2246,7 +2311,7 @@
 "neg address_dst(rd)",16,16,0x3c,
 #endif
 "neg",OPC_neg,0,{CLASS_X+(ARG_RD),},
-	{CLASS_BIT+4,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_BIT+2,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,93},
+	{CLASS_BIT+4,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_BIT+2,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,98},
 
 /* 1000 1101 dddd 0010 *** neg rd */
 {
@@ -2254,7 +2319,7 @@
 "neg rd",16,7,0x3c,
 #endif
 "neg",OPC_neg,0,{CLASS_REG_WORD+(ARG_RD),},
-	{CLASS_BIT+8,CLASS_BIT+0xd,CLASS_REG+(ARG_RD),CLASS_BIT+2,0,0,0,0,0,},1,2,93},
+	{CLASS_BIT+8,CLASS_BIT+0xd,CLASS_REG+(ARG_RD),CLASS_BIT+2,0,0,0,0,0,},1,2,98},
 
 /* 0000 1100 ddN0 0010 *** negb @rd */
 {
@@ -2262,7 +2327,7 @@
 "negb @rd",8,12,0x3c,
 #endif
 "negb",OPC_negb,0,{CLASS_IR+(ARG_RD),},
-	{CLASS_BIT+0,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+2,0,0,0,0,0,},1,2,94},
+	{CLASS_BIT+0,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+2,0,0,0,0,0,},1,2,99},
 
 /* 0100 1100 0000 0010 address_dst *** negb address_dst */
 {
@@ -2270,7 +2335,7 @@
 "negb address_dst",8,15,0x3c,
 #endif
 "negb",OPC_negb,0,{CLASS_DA+(ARG_DST),},
-	{CLASS_BIT+4,CLASS_BIT+0xc,CLASS_BIT+0,CLASS_BIT+2,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,94},
+	{CLASS_BIT+4,CLASS_BIT+0xc,CLASS_BIT+0,CLASS_BIT+2,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,99},
 
 /* 0100 1100 ddN0 0010 address_dst *** negb address_dst(rd) */
 {
@@ -2278,7 +2343,7 @@
 "negb address_dst(rd)",8,16,0x3c,
 #endif
 "negb",OPC_negb,0,{CLASS_X+(ARG_RD),},
-	{CLASS_BIT+4,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+2,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,94},
+	{CLASS_BIT+4,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+2,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,99},
 
 /* 1000 1100 dddd 0010 *** negb rbd */
 {
@@ -2286,7 +2351,7 @@
 "negb rbd",8,7,0x3c,
 #endif
 "negb",OPC_negb,0,{CLASS_REG_BYTE+(ARG_RD),},
-	{CLASS_BIT+8,CLASS_BIT+0xc,CLASS_REG+(ARG_RD),CLASS_BIT+2,0,0,0,0,0,},1,2,94},
+	{CLASS_BIT+8,CLASS_BIT+0xc,CLASS_REG+(ARG_RD),CLASS_BIT+2,0,0,0,0,0,},1,2,99},
 
 /* 1000 1101 0000 0111 *** nop */
 {
@@ -2294,7 +2359,7 @@
 "nop",16,7,0x00,
 #endif
 "nop",OPC_nop,0,{0},
-	{CLASS_BIT+8,CLASS_BIT+0xd,CLASS_BIT+0,CLASS_BIT+7,0,0,0,0,0,},0,2,95},
+	{CLASS_BIT+8,CLASS_BIT+0xd,CLASS_BIT+0,CLASS_BIT+7,0,0,0,0,0,},0,2,100},
 
 /* 0000 0101 ssN0 dddd *** or rd,@rs */
 {
@@ -2302,7 +2367,7 @@
 "or rd,@rs",16,7,0x38,
 #endif
 "or",OPC_or,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IR+(ARG_RS),},
-	{CLASS_BIT+0,CLASS_BIT+5,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,96},
+	{CLASS_BIT+0,CLASS_BIT+5,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,101},
 
 /* 0100 0101 0000 dddd address_src *** or rd,address_src */
 {
@@ -2310,7 +2375,7 @@
 "or rd,address_src",16,9,0x38,
 #endif
 "or",OPC_or,0,{CLASS_REG_WORD+(ARG_RD),CLASS_DA+(ARG_SRC),},
-	{CLASS_BIT+4,CLASS_BIT+5,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,96},
+	{CLASS_BIT+4,CLASS_BIT+5,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,101},
 
 /* 0100 0101 ssN0 dddd address_src *** or rd,address_src(rs) */
 {
@@ -2318,7 +2383,7 @@
 "or rd,address_src(rs)",16,10,0x38,
 #endif
 "or",OPC_or,0,{CLASS_REG_WORD+(ARG_RD),CLASS_X+(ARG_RS),},
-	{CLASS_BIT+4,CLASS_BIT+5,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,96},
+	{CLASS_BIT+4,CLASS_BIT+5,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,101},
 
 /* 0000 0101 0000 dddd imm16 *** or rd,imm16 */
 {
@@ -2326,7 +2391,7 @@
 "or rd,imm16",16,7,0x38,
 #endif
 "or",OPC_or,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IMM+(ARG_IMM16),},
-	{CLASS_BIT+0,CLASS_BIT+5,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,96},
+	{CLASS_BIT+0,CLASS_BIT+5,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,101},
 
 /* 1000 0101 ssss dddd *** or rd,rs */
 {
@@ -2334,7 +2399,7 @@
 "or rd,rs",16,4,0x38,
 #endif
 "or",OPC_or,0,{CLASS_REG_WORD+(ARG_RD),CLASS_REG_WORD+(ARG_RS),},
-	{CLASS_BIT+8,CLASS_BIT+5,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,96},
+	{CLASS_BIT+8,CLASS_BIT+5,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,101},
 
 /* 0000 0100 ssN0 dddd *** orb rbd,@rs */
 {
@@ -2342,7 +2407,7 @@
 "orb rbd,@rs",8,7,0x3c,
 #endif
 "orb",OPC_orb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IR+(ARG_RS),},
-	{CLASS_BIT+0,CLASS_BIT+4,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,97},
+	{CLASS_BIT+0,CLASS_BIT+4,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,102},
 
 /* 0100 0100 0000 dddd address_src *** orb rbd,address_src */
 {
@@ -2350,7 +2415,7 @@
 "orb rbd,address_src",8,9,0x3c,
 #endif
 "orb",OPC_orb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_DA+(ARG_SRC),},
-	{CLASS_BIT+4,CLASS_BIT+4,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,97},
+	{CLASS_BIT+4,CLASS_BIT+4,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,102},
 
 /* 0100 0100 ssN0 dddd address_src *** orb rbd,address_src(rs) */
 {
@@ -2358,7 +2423,7 @@
 "orb rbd,address_src(rs)",8,10,0x3c,
 #endif
 "orb",OPC_orb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_X+(ARG_RS),},
-	{CLASS_BIT+4,CLASS_BIT+4,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,97},
+	{CLASS_BIT+4,CLASS_BIT+4,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,102},
 
 /* 0000 0100 0000 dddd imm8 imm8 *** orb rbd,imm8 */
 {
@@ -2366,7 +2431,7 @@
 "orb rbd,imm8",8,7,0x3c,
 #endif
 "orb",OPC_orb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM+(ARG_IMM8),},
-	{CLASS_BIT+0,CLASS_BIT+4,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM8),CLASS_IMM+(ARG_IMM8),0,0,0,},2,4,97},
+	{CLASS_BIT+0,CLASS_BIT+4,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM8),CLASS_IMM+(ARG_IMM8),0,0,0,},2,4,102},
 
 /* 1000 0100 ssss dddd *** orb rbd,rbs */
 {
@@ -2374,79 +2439,103 @@
 "orb rbd,rbs",8,4,0x3c,
 #endif
 "orb",OPC_orb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_REG_BYTE+(ARG_RS),},
-	{CLASS_BIT+8,CLASS_BIT+4,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,97},
+	{CLASS_BIT+8,CLASS_BIT+4,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,102},
 
-/* 0011 1111 ddN0 ssss *** out @rd,rs */
+/* 0011 1011 ssN0 1010 0000 aaaa dddd 0000 *** otdr @ro,@rs,ra */
 {
 #ifdef NICENAMES
-"out @rd,rs",16,0,0x04,
+"otdr @ro,@rs,ra",16,11,0x04,
 #endif
-"out",OPC_out,0,{CLASS_IR+(ARG_RD),CLASS_REG_WORD+(ARG_RS),},
-	{CLASS_BIT+3,CLASS_BIT+0xf,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),0,0,0,0,0,},2,2,98},
+"otdr",OPC_otdr,0,{CLASS_IRO+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RA),},
+	{CLASS_BIT+3,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+0xa,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REG+(ARG_RD),CLASS_BIT+0,0,},3,4,103},
+
+/* 0011 1010 ssN0 1010 0000 aaaa dddd 0000 *** otdrb @ro,@rs,ra */
+{
+#ifdef NICENAMES
+"otdrb @ro,@rs,ra",8,11,0x04,
+#endif
+"otdrb",OPC_otdrb,0,{CLASS_IRO+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RA),},
+	{CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+0xa,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REG+(ARG_RD),CLASS_BIT+0,0,},3,4,104},
+
+/* 0011 1011 ssN0 0010 0000 aaaa dddd 0000 *** otir @ro,@rs,ra */
+{
+#ifdef NICENAMES
+"otir @ro,@rs,ra",16,11,0x04,
+#endif
+"otir",OPC_otir,0,{CLASS_IRO+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RA),},
+	{CLASS_BIT+3,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+2,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REG+(ARG_RD),CLASS_BIT+0,0,},3,4,105},
+
+/* 0011 1010 ssN0 0010 0000 aaaa dddd 0000 *** otirb @ro,@rs,ra */
+{
+#ifdef NICENAMES
+"otirb @ro,@rs,ra",8,11,0x04,
+#endif
+"otirb",OPC_otirb,0,{CLASS_IRO+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RA),},
+	{CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+2,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REG+(ARG_RD),CLASS_BIT+0,0,},3,4,106},
+
+/* 0011 1111 dddd ssss *** out @ro,rs */
+{
+#ifdef NICENAMES
+"out @ro,rs",16,10,0x00,
+#endif
+"out",OPC_out,0,{CLASS_IRO+(ARG_RD),CLASS_REG_WORD+(ARG_RS),},
+	{CLASS_BIT+3,CLASS_BIT+0xf,CLASS_REG+(ARG_RD),CLASS_REG+(ARG_RS),0,0,0,0,0,},2,2,107},
 
 /* 0011 1011 ssss 0110 imm16 *** out imm16,rs */
 {
 #ifdef NICENAMES
-"out imm16,rs",16,0,0x04,
+"out imm16,rs",16,12,0x00,
 #endif
 "out",OPC_out,0,{CLASS_IMM+(ARG_IMM16),CLASS_REG_WORD+(ARG_RS),},
-	{CLASS_BIT+3,CLASS_BIT+0xb,CLASS_REG+(ARG_RS),CLASS_BIT+6,CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,98},
+	{CLASS_BIT+3,CLASS_BIT+0xb,CLASS_REG+(ARG_RS),CLASS_BIT+6,CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,107},
 
-/* 0011 1110 ddN0 ssss *** outb @rd,rbs */
+/* 0011 1110 dddd ssss *** outb @ro,rbs */
 {
 #ifdef NICENAMES
-"outb @rd,rbs",8,0,0x04,
+"outb @ro,rbs",8,10,0x00,
 #endif
-"outb",OPC_outb,0,{CLASS_IR+(ARG_RD),CLASS_REG_BYTE+(ARG_RS),},
-	{CLASS_BIT+3,CLASS_BIT+0xe,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),0,0,0,0,0,},2,2,99},
+"outb",OPC_outb,0,{CLASS_IRO+(ARG_RD),CLASS_REG_BYTE+(ARG_RS),},
+	{CLASS_BIT+3,CLASS_BIT+0xe,CLASS_REG+(ARG_RD),CLASS_REG+(ARG_RS),0,0,0,0,0,},2,2,108},
 
 /* 0011 1010 ssss 0110 imm16 *** outb imm16,rbs */
 {
 #ifdef NICENAMES
-"outb imm16,rbs",8,0,0x04,
+"outb imm16,rbs",8,12,0x00,
 #endif
 "outb",OPC_outb,0,{CLASS_IMM+(ARG_IMM16),CLASS_REG_BYTE+(ARG_RS),},
-	{CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REG+(ARG_RS),CLASS_BIT+6,CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,99},
+	{CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REG+(ARG_RS),CLASS_BIT+6,CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,108},
 
-/* 0011 1011 ssN0 1010 0000 aaaa ddN0 1000 *** outd @rd,@rs,ra */
+/* 0011 1011 ssN0 1010 0000 aaaa dddd 1000 *** outd @ro,@rs,ra */
 {
 #ifdef NICENAMES
-"outd @rd,@rs,ra",16,0,0x04,
+"outd @ro,@rs,ra",16,21,0x04,
 #endif
-"outd",OPC_outd,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RA),},
-	{CLASS_BIT+3,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+0xa,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,100},
+"outd",OPC_outd,0,{CLASS_IRO+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RA),},
+	{CLASS_BIT+3,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+0xa,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REG+(ARG_RD),CLASS_BIT+8,0,},3,4,109},
 
-/* 0011 1010 ssN0 1010 0000 aaaa ddN0 1000 *** outdb @rd,@rs,rba */
+/* 0011 1010 ssN0 1010 0000 aaaa dddd 1000 *** outdb @ro,@rs,ra */
 {
 #ifdef NICENAMES
-"outdb @rd,@rs,rba",16,0,0x04,
+"outdb @ro,@rs,ra",8,21,0x04,
 #endif
-"outdb",OPC_outdb,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_BYTE+(ARG_RA),},
-	{CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+0xa,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,101},
+"outdb",OPC_outdb,0,{CLASS_IRO+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RA),},
+	{CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+0xa,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REG+(ARG_RD),CLASS_BIT+8,0,},3,4,110},
 
-/* 0011 1011 ssN0 0010 0000 aaaa ddN0 1000 *** outi @rd,@rs,ra */
+/* 0011 1011 ssN0 0010 0000 aaaa dddd 1000 *** outi @ro,@rs,ra */
 {
 #ifdef NICENAMES
-"outi @rd,@rs,ra",16,0,0x04,
+"outi @ro,@rs,ra",16,21,0x04,
 #endif
-"outi",OPC_outi,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RA),},
-	{CLASS_BIT+3,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+2,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,102},
+"outi",OPC_outi,0,{CLASS_IRO+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RA),},
+	{CLASS_BIT+3,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+2,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REG+(ARG_RD),CLASS_BIT+8,0,},3,4,111},
 
-/* 0011 1010 ssN0 0010 0000 aaaa ddN0 1000 *** outib @rd,@rs,ra */
+/* 0011 1010 ssN0 0010 0000 aaaa dddd 1000 *** outib @ro,@rs,ra */
 {
 #ifdef NICENAMES
-"outib @rd,@rs,ra",16,0,0x04,
+"outib @ro,@rs,ra",8,21,0x04,
 #endif
-"outib",OPC_outib,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RA),},
-	{CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+2,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,103},
-
-/* 0011 1010 ssN0 0010 0000 aaaa ddN0 0000 *** outibr @rd,@rs,ra */
-{
-#ifdef NICENAMES
-"outibr @rd,@rs,ra",16,0,0x04,
-#endif
-"outibr",OPC_outibr,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RA),},
-	{CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+2,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+0,0,},3,4,104},
+"outib",OPC_outib,0,{CLASS_IRO+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RA),},
+	{CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+2,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REG+(ARG_RD),CLASS_BIT+8,0,},3,4,112},
 
 /* 0001 0111 ssN0 ddN0 *** pop @rd,@rs */
 {
@@ -2454,7 +2543,7 @@
 "pop @rd,@rs",16,12,0x00,
 #endif
 "pop",OPC_pop,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),},
-	{CLASS_BIT+1,CLASS_BIT+7,CLASS_REGN0+(ARG_RS),CLASS_REGN0+(ARG_RD),0,0,0,0,0,},2,2,105},
+	{CLASS_BIT+1,CLASS_BIT+7,CLASS_REGN0+(ARG_RS),CLASS_REGN0+(ARG_RD),0,0,0,0,0,},2,2,113},
 
 /* 0101 0111 ssN0 ddN0 address_dst *** pop address_dst(rd),@rs */
 {
@@ -2462,7 +2551,7 @@
 "pop address_dst(rd),@rs",16,16,0x00,
 #endif
 "pop",OPC_pop,0,{CLASS_X+(ARG_RD),CLASS_IR+(ARG_RS),},
-	{CLASS_BIT+5,CLASS_BIT+7,CLASS_REGN0+(ARG_RS),CLASS_REGN0+(ARG_RD),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,105},
+	{CLASS_BIT+5,CLASS_BIT+7,CLASS_REGN0+(ARG_RS),CLASS_REGN0+(ARG_RD),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,113},
 
 /* 0101 0111 ssN0 0000 address_dst *** pop address_dst,@rs */
 {
@@ -2470,7 +2559,7 @@
 "pop address_dst,@rs",16,16,0x00,
 #endif
 "pop",OPC_pop,0,{CLASS_DA+(ARG_DST),CLASS_IR+(ARG_RS),},
-	{CLASS_BIT+5,CLASS_BIT+7,CLASS_REGN0+(ARG_RS),CLASS_BIT+0,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,105},
+	{CLASS_BIT+5,CLASS_BIT+7,CLASS_REGN0+(ARG_RS),CLASS_BIT+0,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,113},
 
 /* 1001 0111 ssN0 dddd *** pop rd,@rs */
 {
@@ -2478,7 +2567,7 @@
 "pop rd,@rs",16,8,0x00,
 #endif
 "pop",OPC_pop,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IR+(ARG_RS),},
-	{CLASS_BIT+9,CLASS_BIT+7,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,105},
+	{CLASS_BIT+9,CLASS_BIT+7,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,113},
 
 /* 0001 0101 ssN0 ddN0 *** popl @rd,@rs */
 {
@@ -2486,7 +2575,7 @@
 "popl @rd,@rs",32,19,0x00,
 #endif
 "popl",OPC_popl,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),},
-	{CLASS_BIT+1,CLASS_BIT+5,CLASS_REGN0+(ARG_RS),CLASS_REGN0+(ARG_RD),0,0,0,0,0,},2,2,106},
+	{CLASS_BIT+1,CLASS_BIT+5,CLASS_REGN0+(ARG_RS),CLASS_REGN0+(ARG_RD),0,0,0,0,0,},2,2,114},
 
 /* 0101 0101 ssN0 ddN0 address_dst *** popl address_dst(rd),@rs */
 {
@@ -2494,7 +2583,7 @@
 "popl address_dst(rd),@rs",32,23,0x00,
 #endif
 "popl",OPC_popl,0,{CLASS_X+(ARG_RD),CLASS_IR+(ARG_RS),},
-	{CLASS_BIT+5,CLASS_BIT+5,CLASS_REGN0+(ARG_RS),CLASS_REGN0+(ARG_RD),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,106},
+	{CLASS_BIT+5,CLASS_BIT+5,CLASS_REGN0+(ARG_RS),CLASS_REGN0+(ARG_RD),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,114},
 
 /* 0101 0101 ssN0 0000 address_dst *** popl address_dst,@rs */
 {
@@ -2502,7 +2591,7 @@
 "popl address_dst,@rs",32,23,0x00,
 #endif
 "popl",OPC_popl,0,{CLASS_DA+(ARG_DST),CLASS_IR+(ARG_RS),},
-	{CLASS_BIT+5,CLASS_BIT+5,CLASS_REGN0+(ARG_RS),CLASS_BIT+0,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,106},
+	{CLASS_BIT+5,CLASS_BIT+5,CLASS_REGN0+(ARG_RS),CLASS_BIT+0,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,114},
 
 /* 1001 0101 ssN0 dddd *** popl rrd,@rs */
 {
@@ -2510,7 +2599,7 @@
 "popl rrd,@rs",32,12,0x00,
 #endif
 "popl",OPC_popl,0,{CLASS_REG_LONG+(ARG_RD),CLASS_IR+(ARG_RS),},
-	{CLASS_BIT+9,CLASS_BIT+5,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,106},
+	{CLASS_BIT+9,CLASS_BIT+5,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,114},
 
 /* 0001 0011 ddN0 ssN0 *** push @rd,@rs */
 {
@@ -2518,7 +2607,7 @@
 "push @rd,@rs",16,13,0x00,
 #endif
 "push",OPC_push,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),},
-	{CLASS_BIT+1,CLASS_BIT+3,CLASS_REGN0+(ARG_RD),CLASS_REGN0+(ARG_RS),0,0,0,0,0,},2,2,107},
+	{CLASS_BIT+1,CLASS_BIT+3,CLASS_REGN0+(ARG_RD),CLASS_REGN0+(ARG_RS),0,0,0,0,0,},2,2,115},
 
 /* 0101 0011 ddN0 0000 address_src *** push @rd,address_src */
 {
@@ -2526,7 +2615,7 @@
 "push @rd,address_src",16,14,0x00,
 #endif
 "push",OPC_push,0,{CLASS_IR+(ARG_RD),CLASS_DA+(ARG_SRC),},
-	{CLASS_BIT+5,CLASS_BIT+3,CLASS_REGN0+(ARG_RD),CLASS_BIT+0,CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,107},
+	{CLASS_BIT+5,CLASS_BIT+3,CLASS_REGN0+(ARG_RD),CLASS_BIT+0,CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,115},
 
 /* 0101 0011 ddN0 ssN0 address_src *** push @rd,address_src(rs) */
 {
@@ -2534,7 +2623,7 @@
 "push @rd,address_src(rs)",16,14,0x00,
 #endif
 "push",OPC_push,0,{CLASS_IR+(ARG_RD),CLASS_X+(ARG_RS),},
-	{CLASS_BIT+5,CLASS_BIT+3,CLASS_REGN0+(ARG_RD),CLASS_REGN0+(ARG_RS),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,107},
+	{CLASS_BIT+5,CLASS_BIT+3,CLASS_REGN0+(ARG_RD),CLASS_REGN0+(ARG_RS),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,115},
 
 /* 0000 1101 ddN0 1001 imm16 *** push @rd,imm16 */
 {
@@ -2542,7 +2631,7 @@
 "push @rd,imm16",16,12,0x00,
 #endif
 "push",OPC_push,0,{CLASS_IR+(ARG_RD),CLASS_IMM+(ARG_IMM16),},
-	{CLASS_BIT+0,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_BIT+9,CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,107},
+	{CLASS_BIT+0,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_BIT+9,CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,115},
 
 /* 1001 0011 ddN0 ssss *** push @rd,rs */
 {
@@ -2550,7 +2639,7 @@
 "push @rd,rs",16,9,0x00,
 #endif
 "push",OPC_push,0,{CLASS_IR+(ARG_RD),CLASS_REG_WORD+(ARG_RS),},
-	{CLASS_BIT+9,CLASS_BIT+3,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),0,0,0,0,0,},2,2,107},
+	{CLASS_BIT+9,CLASS_BIT+3,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),0,0,0,0,0,},2,2,115},
 
 /* 0001 0001 ddN0 ssN0 *** pushl @rd,@rs */
 {
@@ -2558,7 +2647,7 @@
 "pushl @rd,@rs",32,20,0x00,
 #endif
 "pushl",OPC_pushl,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),},
-	{CLASS_BIT+1,CLASS_BIT+1,CLASS_REGN0+(ARG_RD),CLASS_REGN0+(ARG_RS),0,0,0,0,0,},2,2,108},
+	{CLASS_BIT+1,CLASS_BIT+1,CLASS_REGN0+(ARG_RD),CLASS_REGN0+(ARG_RS),0,0,0,0,0,},2,2,116},
 
 /* 0101 0001 ddN0 0000 address_src *** pushl @rd,address_src */
 {
@@ -2566,7 +2655,7 @@
 "pushl @rd,address_src",32,21,0x00,
 #endif
 "pushl",OPC_pushl,0,{CLASS_IR+(ARG_RD),CLASS_DA+(ARG_SRC),},
-	{CLASS_BIT+5,CLASS_BIT+1,CLASS_REGN0+(ARG_RD),CLASS_BIT+0,CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,108},
+	{CLASS_BIT+5,CLASS_BIT+1,CLASS_REGN0+(ARG_RD),CLASS_BIT+0,CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,116},
 
 /* 0101 0001 ddN0 ssN0 address_src *** pushl @rd,address_src(rs) */
 {
@@ -2574,7 +2663,7 @@
 "pushl @rd,address_src(rs)",32,21,0x00,
 #endif
 "pushl",OPC_pushl,0,{CLASS_IR+(ARG_RD),CLASS_X+(ARG_RS),},
-	{CLASS_BIT+5,CLASS_BIT+1,CLASS_REGN0+(ARG_RD),CLASS_REGN0+(ARG_RS),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,108},
+	{CLASS_BIT+5,CLASS_BIT+1,CLASS_REGN0+(ARG_RD),CLASS_REGN0+(ARG_RS),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,116},
 
 /* 1001 0001 ddN0 ssss *** pushl @rd,rrs */
 {
@@ -2582,7 +2671,7 @@
 "pushl @rd,rrs",32,12,0x00,
 #endif
 "pushl",OPC_pushl,0,{CLASS_IR+(ARG_RD),CLASS_REG_LONG+(ARG_RS),},
-	{CLASS_BIT+9,CLASS_BIT+1,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),0,0,0,0,0,},2,2,108},
+	{CLASS_BIT+9,CLASS_BIT+1,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),0,0,0,0,0,},2,2,116},
 
 /* 0010 0011 ddN0 imm4 *** res @rd,imm4 */
 {
@@ -2590,7 +2679,7 @@
 "res @rd,imm4",16,11,0x00,
 #endif
 "res",OPC_res,0,{CLASS_IR+(ARG_RD),CLASS_IMM +(ARG_IMM4),},
-	{CLASS_BIT+2,CLASS_BIT+3,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4),0,0,0,0,0,},2,2,109},
+	{CLASS_BIT+2,CLASS_BIT+3,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4),0,0,0,0,0,},2,2,117},
 
 /* 0110 0011 ddN0 imm4 address_dst *** res address_dst(rd),imm4 */
 {
@@ -2598,7 +2687,7 @@
 "res address_dst(rd),imm4",16,14,0x00,
 #endif
 "res",OPC_res,0,{CLASS_X+(ARG_RD),CLASS_IMM +(ARG_IMM4),},
-	{CLASS_BIT+6,CLASS_BIT+3,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,109},
+	{CLASS_BIT+6,CLASS_BIT+3,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,117},
 
 /* 0110 0011 0000 imm4 address_dst *** res address_dst,imm4 */
 {
@@ -2606,7 +2695,7 @@
 "res address_dst,imm4",16,13,0x00,
 #endif
 "res",OPC_res,0,{CLASS_DA+(ARG_DST),CLASS_IMM +(ARG_IMM4),},
-	{CLASS_BIT+6,CLASS_BIT+3,CLASS_BIT+0,CLASS_IMM+(ARG_IMM4),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,109},
+	{CLASS_BIT+6,CLASS_BIT+3,CLASS_BIT+0,CLASS_IMM+(ARG_IMM4),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,117},
 
 /* 1010 0011 dddd imm4 *** res rd,imm4 */
 {
@@ -2614,7 +2703,7 @@
 "res rd,imm4",16,4,0x00,
 #endif
 "res",OPC_res,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IMM +(ARG_IMM4),},
-	{CLASS_BIT+0xa,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM4),0,0,0,0,0,},2,2,109},
+	{CLASS_BIT+0xa,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM4),0,0,0,0,0,},2,2,117},
 
 /* 0010 0011 0000 ssss 0000 dddd 0000 0000 *** res rd,rs */
 {
@@ -2622,7 +2711,7 @@
 "res rd,rs",16,10,0x00,
 #endif
 "res",OPC_res,0,{CLASS_REG_WORD+(ARG_RD),CLASS_REG_WORD+(ARG_RS),},
-	{CLASS_BIT+2,CLASS_BIT+3,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,109},
+	{CLASS_BIT+2,CLASS_BIT+3,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,117},
 
 /* 0010 0010 ddN0 imm4 *** resb @rd,imm4 */
 {
@@ -2630,7 +2719,7 @@
 "resb @rd,imm4",8,11,0x00,
 #endif
 "resb",OPC_resb,0,{CLASS_IR+(ARG_RD),CLASS_IMM +(ARG_IMM4),},
-	{CLASS_BIT+2,CLASS_BIT+2,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4),0,0,0,0,0,},2,2,110},
+	{CLASS_BIT+2,CLASS_BIT+2,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4),0,0,0,0,0,},2,2,118},
 
 /* 0110 0010 ddN0 imm4 address_dst *** resb address_dst(rd),imm4 */
 {
@@ -2638,7 +2727,7 @@
 "resb address_dst(rd),imm4",8,14,0x00,
 #endif
 "resb",OPC_resb,0,{CLASS_X+(ARG_RD),CLASS_IMM +(ARG_IMM4),},
-	{CLASS_BIT+6,CLASS_BIT+2,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,110},
+	{CLASS_BIT+6,CLASS_BIT+2,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,118},
 
 /* 0110 0010 0000 imm4 address_dst *** resb address_dst,imm4 */
 {
@@ -2646,7 +2735,7 @@
 "resb address_dst,imm4",8,13,0x00,
 #endif
 "resb",OPC_resb,0,{CLASS_DA+(ARG_DST),CLASS_IMM +(ARG_IMM4),},
-	{CLASS_BIT+6,CLASS_BIT+2,CLASS_BIT+0,CLASS_IMM+(ARG_IMM4),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,110},
+	{CLASS_BIT+6,CLASS_BIT+2,CLASS_BIT+0,CLASS_IMM+(ARG_IMM4),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,118},
 
 /* 1010 0010 dddd imm4 *** resb rbd,imm4 */
 {
@@ -2654,7 +2743,7 @@
 "resb rbd,imm4",8,4,0x00,
 #endif
 "resb",OPC_resb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM +(ARG_IMM4),},
-	{CLASS_BIT+0xa,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM4),0,0,0,0,0,},2,2,110},
+	{CLASS_BIT+0xa,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM4),0,0,0,0,0,},2,2,118},
 
 /* 0010 0010 0000 ssss 0000 dddd 0000 0000 *** resb rbd,rs */
 {
@@ -2662,7 +2751,7 @@
 "resb rbd,rs",8,10,0x00,
 #endif
 "resb",OPC_resb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_REG_WORD+(ARG_RS),},
-	{CLASS_BIT+2,CLASS_BIT+2,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,110},
+	{CLASS_BIT+2,CLASS_BIT+2,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,118},
 
 /* 1000 1101 flags 0011 *** resflg flags */
 {
@@ -2670,7 +2759,7 @@
 "resflg flags",16,7,0x3c,
 #endif
 "resflg",OPC_resflg,0,{CLASS_FLAGS,},
-	{CLASS_BIT+8,CLASS_BIT+0xd,CLASS_FLAGS,CLASS_BIT+3,0,0,0,0,0,},1,2,111},
+	{CLASS_BIT+8,CLASS_BIT+0xd,CLASS_FLAGS,CLASS_BIT+3,0,0,0,0,0,},1,2,119},
 
 /* 1001 1110 0000 cccc *** ret cc */
 {
@@ -2678,7 +2767,7 @@
 "ret cc",16,10,0x00,
 #endif
 "ret",OPC_ret,0,{CLASS_CC,},
-	{CLASS_BIT+9,CLASS_BIT+0xe,CLASS_BIT+0,CLASS_CC,0,0,0,0,0,},1,2,112},
+	{CLASS_BIT+9,CLASS_BIT+0xe,CLASS_BIT+0,CLASS_CC,0,0,0,0,0,},1,2,120},
 
 /* 1011 0011 dddd 00I0 *** rl rd,imm1or2 */
 {
@@ -2686,7 +2775,7 @@
 "rl rd,imm1or2",16,6,0x3c,
 #endif
 "rl",OPC_rl,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IMM+(ARG_IMM1OR2),},
-	{CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT_1OR2+0,0,0,0,0,0,},2,2,113},
+	{CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT_1OR2+0,0,0,0,0,0,},2,2,121},
 
 /* 1011 0010 dddd 00I0 *** rlb rbd,imm1or2 */
 {
@@ -2694,7 +2783,7 @@
 "rlb rbd,imm1or2",8,6,0x3c,
 #endif
 "rlb",OPC_rlb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM+(ARG_IMM1OR2),},
-	{CLASS_BIT+0xb,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_BIT_1OR2+0,0,0,0,0,0,},2,2,114},
+	{CLASS_BIT+0xb,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_BIT_1OR2+0,0,0,0,0,0,},2,2,122},
 
 /* 1011 0011 dddd 10I0 *** rlc rd,imm1or2 */
 {
@@ -2702,7 +2791,7 @@
 "rlc rd,imm1or2",16,6,0x3c,
 #endif
 "rlc",OPC_rlc,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IMM+(ARG_IMM1OR2),},
-	{CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT_1OR2+8,0,0,0,0,0,},2,2,115},
+	{CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT_1OR2+8,0,0,0,0,0,},2,2,123},
 
 /* 1011 0010 dddd 10I0 *** rlcb rbd,imm1or2 */
 {
@@ -2710,7 +2799,7 @@
 "rlcb rbd,imm1or2",8,9,0x10,
 #endif
 "rlcb",OPC_rlcb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM+(ARG_IMM1OR2),},
-	{CLASS_BIT+0xb,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_BIT_1OR2+8,0,0,0,0,0,},2,2,116},
+	{CLASS_BIT+0xb,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_BIT_1OR2+8,0,0,0,0,0,},2,2,124},
 
 /* 1011 1110 aaaa bbbb *** rldb rbb,rba */
 {
@@ -2718,7 +2807,7 @@
 "rldb rbb,rba",8,9,0x10,
 #endif
 "rldb",OPC_rldb,0,{CLASS_REG_BYTE+(ARG_RB),CLASS_REG_BYTE+(ARG_RA),},
-	{CLASS_BIT+0xb,CLASS_BIT+0xe,CLASS_REG+(ARG_RA),CLASS_REG+(ARG_RB),0,0,0,0,0,},2,2,117},
+	{CLASS_BIT+0xb,CLASS_BIT+0xe,CLASS_REG+(ARG_RA),CLASS_REG+(ARG_RB),0,0,0,0,0,},2,2,125},
 
 /* 1011 0011 dddd 01I0 *** rr rd,imm1or2 */
 {
@@ -2726,7 +2815,7 @@
 "rr rd,imm1or2",16,6,0x3c,
 #endif
 "rr",OPC_rr,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IMM+(ARG_IMM1OR2),},
-	{CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT_1OR2+4,0,0,0,0,0,},2,2,118},
+	{CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT_1OR2+4,0,0,0,0,0,},2,2,126},
 
 /* 1011 0010 dddd 01I0 *** rrb rbd,imm1or2 */
 {
@@ -2734,7 +2823,7 @@
 "rrb rbd,imm1or2",8,6,0x3c,
 #endif
 "rrb",OPC_rrb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM+(ARG_IMM1OR2),},
-	{CLASS_BIT+0xb,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_BIT_1OR2+4,0,0,0,0,0,},2,2,119},
+	{CLASS_BIT+0xb,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_BIT_1OR2+4,0,0,0,0,0,},2,2,127},
 
 /* 1011 0011 dddd 11I0 *** rrc rd,imm1or2 */
 {
@@ -2742,7 +2831,7 @@
 "rrc rd,imm1or2",16,6,0x3c,
 #endif
 "rrc",OPC_rrc,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IMM+(ARG_IMM1OR2),},
-	{CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT_1OR2+0xc,0,0,0,0,0,},2,2,120},
+	{CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT_1OR2+0xc,0,0,0,0,0,},2,2,128},
 
 /* 1011 0010 dddd 11I0 *** rrcb rbd,imm1or2 */
 {
@@ -2750,7 +2839,7 @@
 "rrcb rbd,imm1or2",8,9,0x10,
 #endif
 "rrcb",OPC_rrcb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM+(ARG_IMM1OR2),},
-	{CLASS_BIT+0xb,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_BIT_1OR2+0xc,0,0,0,0,0,},2,2,121},
+	{CLASS_BIT+0xb,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_BIT_1OR2+0xc,0,0,0,0,0,},2,2,129},
 
 /* 1011 1100 aaaa bbbb *** rrdb rbb,rba */
 {
@@ -2758,7 +2847,7 @@
 "rrdb rbb,rba",8,9,0x10,
 #endif
 "rrdb",OPC_rrdb,0,{CLASS_REG_BYTE+(ARG_RB),CLASS_REG_BYTE+(ARG_RA),},
-	{CLASS_BIT+0xb,CLASS_BIT+0xc,CLASS_REG+(ARG_RA),CLASS_REG+(ARG_RB),0,0,0,0,0,},2,2,122},
+	{CLASS_BIT+0xb,CLASS_BIT+0xc,CLASS_REG+(ARG_RA),CLASS_REG+(ARG_RB),0,0,0,0,0,},2,2,130},
 
 /* 0011 0110 imm8 *** rsvd36 */
 {
@@ -2766,7 +2855,7 @@
 "rsvd36",8,10,0x00,
 #endif
 "rsvd36",OPC_rsvd36,0,{0},
-	{CLASS_BIT+3,CLASS_BIT+6,CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},0,2,123},
+	{CLASS_BIT+3,CLASS_BIT+6,CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},0,2,131},
 
 /* 0011 1000 imm8 *** rsvd38 */
 {
@@ -2774,7 +2863,7 @@
 "rsvd38",8,10,0x00,
 #endif
 "rsvd38",OPC_rsvd38,0,{0},
-	{CLASS_BIT+3,CLASS_BIT+8,CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},0,2,124},
+	{CLASS_BIT+3,CLASS_BIT+8,CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},0,2,132},
 
 /* 0111 1000 imm8 *** rsvd78 */
 {
@@ -2782,7 +2871,7 @@
 "rsvd78",8,10,0x00,
 #endif
 "rsvd78",OPC_rsvd78,0,{0},
-	{CLASS_BIT+7,CLASS_BIT+8,CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},0,2,125},
+	{CLASS_BIT+7,CLASS_BIT+8,CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},0,2,133},
 
 /* 0111 1110 imm8 *** rsvd7e */
 {
@@ -2790,7 +2879,7 @@
 "rsvd7e",8,10,0x00,
 #endif
 "rsvd7e",OPC_rsvd7e,0,{0},
-	{CLASS_BIT+7,CLASS_BIT+0xe,CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},0,2,126},
+	{CLASS_BIT+7,CLASS_BIT+0xe,CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},0,2,134},
 
 /* 1001 1101 imm8 *** rsvd9d */
 {
@@ -2798,7 +2887,7 @@
 "rsvd9d",8,10,0x00,
 #endif
 "rsvd9d",OPC_rsvd9d,0,{0},
-	{CLASS_BIT+9,CLASS_BIT+0xd,CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},0,2,127},
+	{CLASS_BIT+9,CLASS_BIT+0xd,CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},0,2,135},
 
 /* 1001 1111 imm8 *** rsvd9f */
 {
@@ -2806,7 +2895,7 @@
 "rsvd9f",8,10,0x00,
 #endif
 "rsvd9f",OPC_rsvd9f,0,{0},
-	{CLASS_BIT+9,CLASS_BIT+0xf,CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},0,2,128},
+	{CLASS_BIT+9,CLASS_BIT+0xf,CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},0,2,136},
 
 /* 1011 1001 imm8 *** rsvdb9 */
 {
@@ -2814,7 +2903,7 @@
 "rsvdb9",8,10,0x00,
 #endif
 "rsvdb9",OPC_rsvdb9,0,{0},
-	{CLASS_BIT+0xb,CLASS_BIT+9,CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},0,2,129},
+	{CLASS_BIT+0xb,CLASS_BIT+9,CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},0,2,137},
 
 /* 1011 1111 imm8 *** rsvdbf */
 {
@@ -2822,7 +2911,7 @@
 "rsvdbf",8,10,0x00,
 #endif
 "rsvdbf",OPC_rsvdbf,0,{0},
-	{CLASS_BIT+0xb,CLASS_BIT+0xf,CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},0,2,130},
+	{CLASS_BIT+0xb,CLASS_BIT+0xf,CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},0,2,138},
 
 /* 1011 0111 ssss dddd *** sbc rd,rs */
 {
@@ -2830,7 +2919,7 @@
 "sbc rd,rs",16,5,0x3c,
 #endif
 "sbc",OPC_sbc,0,{CLASS_REG_WORD+(ARG_RD),CLASS_REG_WORD+(ARG_RS),},
-	{CLASS_BIT+0xb,CLASS_BIT+7,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,131},
+	{CLASS_BIT+0xb,CLASS_BIT+7,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,139},
 
 /* 1011 0110 ssss dddd *** sbcb rbd,rbs */
 {
@@ -2838,7 +2927,7 @@
 "sbcb rbd,rbs",8,5,0x3f,
 #endif
 "sbcb",OPC_sbcb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_REG_BYTE+(ARG_RS),},
-	{CLASS_BIT+0xb,CLASS_BIT+6,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,132},
+	{CLASS_BIT+0xb,CLASS_BIT+6,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,140},
 
 /* 0111 1111 imm8 *** sc imm8 */
 {
@@ -2846,7 +2935,7 @@
 "sc imm8",8,33,0x3f,
 #endif
 "sc",OPC_sc,0,{CLASS_IMM+(ARG_IMM8),},
-	{CLASS_BIT+7,CLASS_BIT+0xf,CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},1,2,133},
+	{CLASS_BIT+7,CLASS_BIT+0xf,CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},1,2,141},
 
 /* 1011 0011 dddd 1011 0000 ssss 0000 0000 *** sda rd,rs */
 {
@@ -2854,7 +2943,7 @@
 "sda rd,rs",16,15,0x3c,
 #endif
 "sda",OPC_sda,0,{CLASS_REG_WORD+(ARG_RD),CLASS_REG_WORD+(ARG_RS),},
-	{CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+0xb,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,134},
+	{CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+0xb,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,142},
 
 /* 1011 0010 dddd 1011 0000 ssss 0000 0000 *** sdab rbd,rs */
 {
@@ -2862,7 +2951,7 @@
 "sdab rbd,rs",8,15,0x3c,
 #endif
 "sdab",OPC_sdab,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_REG_WORD+(ARG_RS),},
-	{CLASS_BIT+0xb,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_BIT+0xb,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,135},
+	{CLASS_BIT+0xb,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_BIT+0xb,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,143},
 
 /* 1011 0011 dddd 1111 0000 ssss 0000 0000 *** sdal rrd,rs */
 {
@@ -2870,7 +2959,7 @@
 "sdal rrd,rs",32,15,0x3c,
 #endif
 "sdal",OPC_sdal,0,{CLASS_REG_LONG+(ARG_RD),CLASS_REG_WORD+(ARG_RS),},
-	{CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+0xf,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,136},
+	{CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+0xf,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,144},
 
 /* 1011 0011 dddd 0011 0000 ssss 0000 0000 *** sdl rd,rs */
 {
@@ -2878,7 +2967,7 @@
 "sdl rd,rs",16,15,0x38,
 #endif
 "sdl",OPC_sdl,0,{CLASS_REG_WORD+(ARG_RD),CLASS_REG_WORD+(ARG_RS),},
-	{CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+3,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,137},
+	{CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+3,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,145},
 
 /* 1011 0010 dddd 0011 0000 ssss 0000 0000 *** sdlb rbd,rs */
 {
@@ -2886,7 +2975,7 @@
 "sdlb rbd,rs",8,15,0x38,
 #endif
 "sdlb",OPC_sdlb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_REG_WORD+(ARG_RS),},
-	{CLASS_BIT+0xb,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_BIT+3,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,138},
+	{CLASS_BIT+0xb,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_BIT+3,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,146},
 
 /* 1011 0011 dddd 0111 0000 ssss 0000 0000 *** sdll rrd,rs */
 {
@@ -2894,7 +2983,7 @@
 "sdll rrd,rs",32,15,0x38,
 #endif
 "sdll",OPC_sdll,0,{CLASS_REG_LONG+(ARG_RD),CLASS_REG_WORD+(ARG_RS),},
-	{CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+7,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,139},
+	{CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+7,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,147},
 
 /* 0010 0101 ddN0 imm4 *** set @rd,imm4 */
 {
@@ -2902,7 +2991,7 @@
 "set @rd,imm4",16,11,0x00,
 #endif
 "set",OPC_set,0,{CLASS_IR+(ARG_RD),CLASS_IMM +(ARG_IMM4),},
-	{CLASS_BIT+2,CLASS_BIT+5,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4),0,0,0,0,0,},2,2,140},
+	{CLASS_BIT+2,CLASS_BIT+5,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4),0,0,0,0,0,},2,2,148},
 
 /* 0110 0101 ddN0 imm4 address_dst *** set address_dst(rd),imm4 */
 {
@@ -2910,7 +2999,7 @@
 "set address_dst(rd),imm4",16,14,0x00,
 #endif
 "set",OPC_set,0,{CLASS_X+(ARG_RD),CLASS_IMM +(ARG_IMM4),},
-	{CLASS_BIT+6,CLASS_BIT+5,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,140},
+	{CLASS_BIT+6,CLASS_BIT+5,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,148},
 
 /* 0110 0101 0000 imm4 address_dst *** set address_dst,imm4 */
 {
@@ -2918,7 +3007,7 @@
 "set address_dst,imm4",16,13,0x00,
 #endif
 "set",OPC_set,0,{CLASS_DA+(ARG_DST),CLASS_IMM +(ARG_IMM4),},
-	{CLASS_BIT+6,CLASS_BIT+5,CLASS_BIT+0,CLASS_IMM+(ARG_IMM4),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,140},
+	{CLASS_BIT+6,CLASS_BIT+5,CLASS_BIT+0,CLASS_IMM+(ARG_IMM4),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,148},
 
 /* 1010 0101 dddd imm4 *** set rd,imm4 */
 {
@@ -2926,7 +3015,7 @@
 "set rd,imm4",16,4,0x00,
 #endif
 "set",OPC_set,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IMM +(ARG_IMM4),},
-	{CLASS_BIT+0xa,CLASS_BIT+5,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM4),0,0,0,0,0,},2,2,140},
+	{CLASS_BIT+0xa,CLASS_BIT+5,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM4),0,0,0,0,0,},2,2,148},
 
 /* 0010 0101 0000 ssss 0000 dddd 0000 0000 *** set rd,rs */
 {
@@ -2934,7 +3023,7 @@
 "set rd,rs",16,10,0x00,
 #endif
 "set",OPC_set,0,{CLASS_REG_WORD+(ARG_RD),CLASS_REG_WORD+(ARG_RS),},
-	{CLASS_BIT+2,CLASS_BIT+5,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,140},
+	{CLASS_BIT+2,CLASS_BIT+5,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,148},
 
 /* 0010 0100 ddN0 imm4 *** setb @rd,imm4 */
 {
@@ -2942,7 +3031,7 @@
 "setb @rd,imm4",8,11,0x00,
 #endif
 "setb",OPC_setb,0,{CLASS_IR+(ARG_RD),CLASS_IMM +(ARG_IMM4),},
-	{CLASS_BIT+2,CLASS_BIT+4,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4),0,0,0,0,0,},2,2,141},
+	{CLASS_BIT+2,CLASS_BIT+4,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4),0,0,0,0,0,},2,2,149},
 
 /* 0110 0100 ddN0 imm4 address_dst *** setb address_dst(rd),imm4 */
 {
@@ -2950,7 +3039,7 @@
 "setb address_dst(rd),imm4",8,14,0x00,
 #endif
 "setb",OPC_setb,0,{CLASS_X+(ARG_RD),CLASS_IMM +(ARG_IMM4),},
-	{CLASS_BIT+6,CLASS_BIT+4,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,141},
+	{CLASS_BIT+6,CLASS_BIT+4,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,149},
 
 /* 0110 0100 0000 imm4 address_dst *** setb address_dst,imm4 */
 {
@@ -2958,7 +3047,7 @@
 "setb address_dst,imm4",8,13,0x00,
 #endif
 "setb",OPC_setb,0,{CLASS_DA+(ARG_DST),CLASS_IMM +(ARG_IMM4),},
-	{CLASS_BIT+6,CLASS_BIT+4,CLASS_BIT+0,CLASS_IMM+(ARG_IMM4),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,141},
+	{CLASS_BIT+6,CLASS_BIT+4,CLASS_BIT+0,CLASS_IMM+(ARG_IMM4),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,149},
 
 /* 1010 0100 dddd imm4 *** setb rbd,imm4 */
 {
@@ -2966,7 +3055,7 @@
 "setb rbd,imm4",8,4,0x00,
 #endif
 "setb",OPC_setb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM +(ARG_IMM4),},
-	{CLASS_BIT+0xa,CLASS_BIT+4,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM4),0,0,0,0,0,},2,2,141},
+	{CLASS_BIT+0xa,CLASS_BIT+4,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM4),0,0,0,0,0,},2,2,149},
 
 /* 0010 0100 0000 ssss 0000 dddd 0000 0000 *** setb rbd,rs */
 {
@@ -2974,7 +3063,7 @@
 "setb rbd,rs",8,10,0x00,
 #endif
 "setb",OPC_setb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_REG_WORD+(ARG_RS),},
-	{CLASS_BIT+2,CLASS_BIT+4,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,141},
+	{CLASS_BIT+2,CLASS_BIT+4,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,149},
 
 /* 1000 1101 flags 0001 *** setflg flags */
 {
@@ -2982,55 +3071,87 @@
 "setflg flags",16,7,0x3c,
 #endif
 "setflg",OPC_setflg,0,{CLASS_FLAGS,},
-	{CLASS_BIT+8,CLASS_BIT+0xd,CLASS_FLAGS,CLASS_BIT+1,0,0,0,0,0,},1,2,142},
+	{CLASS_BIT+8,CLASS_BIT+0xd,CLASS_FLAGS,CLASS_BIT+1,0,0,0,0,0,},1,2,150},
 
 /* 0011 1011 dddd 0101 imm16 *** sin rd,imm16 */
 {
 #ifdef NICENAMES
-"sin rd,imm16",8,0,0x00,
+"sin rd,imm16",16,12,0x00,
 #endif
 "sin",OPC_sin,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IMM+(ARG_IMM16),},
-	{CLASS_BIT+3,CLASS_BIT+0xb,CLASS_REG+(ARG_RD),CLASS_BIT+5,CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,143},
+	{CLASS_BIT+3,CLASS_BIT+0xb,CLASS_REG+(ARG_RD),CLASS_BIT+5,CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,151},
 
 /* 0011 1010 dddd 0101 imm16 *** sinb rbd,imm16 */
 {
 #ifdef NICENAMES
-"sinb rbd,imm16",8,0,0x00,
+"sinb rbd,imm16",8,10,0x00,
 #endif
 "sinb",OPC_sinb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM+(ARG_IMM16),},
-	{CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REG+(ARG_RD),CLASS_BIT+5,CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,144},
+	{CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REG+(ARG_RD),CLASS_BIT+5,CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,152},
 
-/* 0011 1011 ssN0 1000 0001 aaaa ddN0 1000 *** sind @rd,@rs,ra */
+/* 0011 1011 ssss 1001 0000 aaaa ddN0 1000 *** sind @rd,@ri,ra */
 {
 #ifdef NICENAMES
-"sind @rd,@rs,ra",16,0,0x00,
+"sind @rd,@ri,ra",16,21,0x04,
 #endif
-"sind",OPC_sind,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RA),},
-	{CLASS_BIT+3,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+8,CLASS_BIT+1,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,145},
+"sind",OPC_sind,0,{CLASS_IR+(ARG_RD),CLASS_IRO+(ARG_RS),CLASS_REG_WORD+(ARG_RA),},
+	{CLASS_BIT+3,CLASS_BIT+0xb,CLASS_REG+(ARG_RS),CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,153},
 
-/* 0011 1010 ssN0 1000 0001 aaaa ddN0 1000 *** sindb @rd,@rs,rba */
+/* 0011 1010 ssss 1001 0000 aaaa ddN0 1000 *** sindb @rd,@ri,ra */
 {
 #ifdef NICENAMES
-"sindb @rd,@rs,rba",8,0,0x00,
+"sindb @rd,@ri,ra",8,21,0x04,
 #endif
-"sindb",OPC_sindb,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_BYTE+(ARG_RA),},
-	{CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+8,CLASS_BIT+1,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,146},
+"sindb",OPC_sindb,0,{CLASS_IR+(ARG_RD),CLASS_IRO+(ARG_RS),CLASS_REG_WORD+(ARG_RA),},
+	{CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REG+(ARG_RS),CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,154},
 
-/* 0011 1010 ssN0 0001 0000 aaaa ddN0 1000 *** sinib @rd,@rs,ra */
+/* 0011 1011 ssss 1001 0000 aaaa ddN0 0000 *** sindr @rd,@ri,ra */
 {
 #ifdef NICENAMES
-"sinib @rd,@rs,ra",8,0,0x00,
+"sindr @rd,@ri,ra",16,11,0x04,
 #endif
-"sinib",OPC_sinib,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RA),},
-	{CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,147},
+"sindr",OPC_sindr,0,{CLASS_IR+(ARG_RD),CLASS_IRO+(ARG_RS),CLASS_REG_WORD+(ARG_RA),},
+	{CLASS_BIT+3,CLASS_BIT+0xb,CLASS_REG+(ARG_RS),CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+0,0,},3,4,155},
 
-/* 0011 1010 ssN0 0001 0000 aaaa ddN0 0000 *** sinibr @rd,@rs,ra */
+/* 0011 1010 ssss 1001 0000 aaaa ddN0 0000 *** sindrb @rd,@ri,ra */
 {
 #ifdef NICENAMES
-"sinibr @rd,@rs,ra",16,0,0x00,
+"sindrb @rd,@ri,ra",8,11,0x04,
 #endif
-"sinibr",OPC_sinibr,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RA),},
-	{CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+0,0,},3,4,148},
+"sindrb",OPC_sindrb,0,{CLASS_IR+(ARG_RD),CLASS_IRO+(ARG_RS),CLASS_REG_WORD+(ARG_RA),},
+	{CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REG+(ARG_RS),CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+0,0,},3,4,156},
+
+/* 0011 1011 ssss 0001 0000 aaaa ddN0 1000 *** sini @rd,@ri,ra */
+{
+#ifdef NICENAMES
+"sini @rd,@ri,ra",16,21,0x04,
+#endif
+"sini",OPC_sini,0,{CLASS_IR+(ARG_RD),CLASS_IRO+(ARG_RS),CLASS_REG_WORD+(ARG_RA),},
+	{CLASS_BIT+3,CLASS_BIT+0xb,CLASS_REG+(ARG_RS),CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,157},
+
+/* 0011 1010 ssss 0001 0000 aaaa ddN0 1000 *** sinib @rd,@ri,ra */
+{
+#ifdef NICENAMES
+"sinib @rd,@ri,ra",8,21,0x04,
+#endif
+"sinib",OPC_sinib,0,{CLASS_IR+(ARG_RD),CLASS_IRO+(ARG_RS),CLASS_REG_WORD+(ARG_RA),},
+	{CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REG+(ARG_RS),CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,158},
+
+/* 0011 1011 ssss 0001 0000 aaaa ddN0 0000 *** sinir @rd,@ri,ra */
+{
+#ifdef NICENAMES
+"sinir @rd,@ri,ra",16,11,0x04,
+#endif
+"sinir",OPC_sinir,0,{CLASS_IR+(ARG_RD),CLASS_IRO+(ARG_RS),CLASS_REG_WORD+(ARG_RA),},
+	{CLASS_BIT+3,CLASS_BIT+0xb,CLASS_REG+(ARG_RS),CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+0,0,},3,4,159},
+
+/* 0011 1010 ssss 0001 0000 aaaa ddN0 0000 *** sinirb @rd,@ri,ra */
+{
+#ifdef NICENAMES
+"sinirb @rd,@ri,ra",8,11,0x04,
+#endif
+"sinirb",OPC_sinirb,0,{CLASS_IR+(ARG_RD),CLASS_IRO+(ARG_RS),CLASS_REG_WORD+(ARG_RA),},
+	{CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REG+(ARG_RS),CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+0,0,},3,4,160},
 
 /* 1011 0011 dddd 1001 0000 0000 imm8 *** sla rd,imm8 */
 {
@@ -3038,7 +3159,7 @@
 "sla rd,imm8",16,13,0x3c,
 #endif
 "sla",OPC_sla,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IMM+(ARG_IMM8),},
-	{CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+9,CLASS_BIT+0,CLASS_BIT+0,CLASS_IMM+(ARG_IMM8),0,0,},2,4,149},
+	{CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+9,CLASS_BIT+0,CLASS_BIT+0,CLASS_IMM+(ARG_IMM8),0,0,},2,4,161},
 
 /* 1011 0010 dddd 1001 iiii iiii 0000 imm4 *** slab rbd,imm4 */
 {
@@ -3046,7 +3167,7 @@
 "slab rbd,imm4",8,13,0x3c,
 #endif
 "slab",OPC_slab,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM +(ARG_IMM4),},
-	{CLASS_BIT+0xb,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_BIT+9,CLASS_IGNORE,CLASS_IGNORE,CLASS_BIT+0,CLASS_IMM+(ARG_IMM4),0,},2,4,150},
+	{CLASS_BIT+0xb,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_BIT+9,CLASS_IGNORE,CLASS_IGNORE,CLASS_BIT+0,CLASS_IMM+(ARG_IMM4),0,},2,4,162},
 
 /* 1011 0011 dddd 1101 0000 0000 imm8 *** slal rrd,imm8 */
 {
@@ -3054,7 +3175,7 @@
 "slal rrd,imm8",32,13,0x3c,
 #endif
 "slal",OPC_slal,0,{CLASS_REG_LONG+(ARG_RD),CLASS_IMM+(ARG_IMM8),},
-	{CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+0xd,CLASS_BIT+0,CLASS_BIT+0,CLASS_IMM+(ARG_IMM8),0,0,},2,4,151},
+	{CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+0xd,CLASS_BIT+0,CLASS_BIT+0,CLASS_IMM+(ARG_IMM8),0,0,},2,4,163},
 
 /* 1011 0011 dddd 0001 0000 0000 imm8 *** sll rd,imm8 */
 {
@@ -3062,7 +3183,7 @@
 "sll rd,imm8",16,13,0x38,
 #endif
 "sll",OPC_sll,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IMM+(ARG_IMM8),},
-	{CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+1,CLASS_BIT+0,CLASS_BIT+0,CLASS_IMM+(ARG_IMM8),0,0,},2,4,152},
+	{CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+1,CLASS_BIT+0,CLASS_BIT+0,CLASS_IMM+(ARG_IMM8),0,0,},2,4,164},
 
 /* 1011 0010 dddd 0001 iiii iiii 0000 imm4 *** sllb rbd,imm4 */
 {
@@ -3070,7 +3191,7 @@
 "sllb rbd,imm4",8,13,0x38,
 #endif
 "sllb",OPC_sllb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM +(ARG_IMM4),},
-	{CLASS_BIT+0xb,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_BIT+1,CLASS_IGNORE,CLASS_IGNORE,CLASS_BIT+0,CLASS_IMM+(ARG_IMM4),0,},2,4,153},
+	{CLASS_BIT+0xb,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_BIT+1,CLASS_IGNORE,CLASS_IGNORE,CLASS_BIT+0,CLASS_IMM+(ARG_IMM4),0,},2,4,165},
 
 /* 1011 0011 dddd 0101 0000 0000 imm8 *** slll rrd,imm8 */
 {
@@ -3078,55 +3199,87 @@
 "slll rrd,imm8",32,13,0x38,
 #endif
 "slll",OPC_slll,0,{CLASS_REG_LONG+(ARG_RD),CLASS_IMM+(ARG_IMM8),},
-	{CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+5,CLASS_BIT+0,CLASS_BIT+0,CLASS_IMM+(ARG_IMM8),0,0,},2,4,154},
+	{CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+5,CLASS_BIT+0,CLASS_BIT+0,CLASS_IMM+(ARG_IMM8),0,0,},2,4,166},
 
-/* 0011 1011 ssss 0111 imm16 *** sout imm16,rs */
+/* 0011 1011 ssN0 1011 0000 aaaa dddd 0000 *** sotdr @ro,@rs,ra */
 {
 #ifdef NICENAMES
-"sout imm16,rs",16,0,0x00,
+"sotdr @ro,@rs,ra",16,11,0x04,
+#endif
+"sotdr",OPC_sotdr,0,{CLASS_IRO+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RA),},
+	{CLASS_BIT+3,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+0xb,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REG+(ARG_RD),CLASS_BIT+0,0,},3,4,167},
+
+/* 0011 1010 ssN0 1011 0000 aaaa dddd 0000 *** sotdrb @ro,@rs,ra */
+{
+#ifdef NICENAMES
+"sotdrb @ro,@rs,ra",8,11,0x04,
+#endif
+"sotdrb",OPC_sotdrb,0,{CLASS_IRO+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RA),},
+	{CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+0xb,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REG+(ARG_RD),CLASS_BIT+0,0,},3,4,168},
+
+/* 0011 1011 ssN0 0011 0000 aaaa dddd 0000 *** sotir @ro,@rs,ra */
+{
+#ifdef NICENAMES
+"sotir @ro,@rs,ra",16,11,0x04,
+#endif
+"sotir",OPC_sotir,0,{CLASS_IRO+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RA),},
+	{CLASS_BIT+3,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+3,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REG+(ARG_RD),CLASS_BIT+0,0,},3,4,169},
+
+/* 0011 1010 ssN0 0011 0000 aaaa dddd 0000 *** sotirb @ro,@rs,ra */
+{
+#ifdef NICENAMES
+"sotirb @ro,@rs,ra",8,11,0x04,
+#endif
+"sotirb",OPC_sotirb,0,{CLASS_IRO+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RA),},
+	{CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+3,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REG+(ARG_RD),CLASS_BIT+0,0,},3,4,170},
+
+/* 0011 1011 ssss 0110 imm16 *** sout imm16,rs */
+{
+#ifdef NICENAMES
+"sout imm16,rs",16,12,0x00,
 #endif
 "sout",OPC_sout,0,{CLASS_IMM+(ARG_IMM16),CLASS_REG_WORD+(ARG_RS),},
-	{CLASS_BIT+3,CLASS_BIT+0xb,CLASS_REG+(ARG_RS),CLASS_BIT+7,CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,155},
+	{CLASS_BIT+3,CLASS_BIT+0xb,CLASS_REG+(ARG_RS),CLASS_BIT+6,CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,171},
 
-/* 0011 1010 ssss 0111 imm16 *** soutb imm16,rbs */
+/* 0011 1010 ssss 0110 imm16 *** soutb imm16,rbs */
 {
 #ifdef NICENAMES
-"soutb imm16,rbs",8,0,0x00,
+"soutb imm16,rbs",8,12,0x00,
 #endif
 "soutb",OPC_soutb,0,{CLASS_IMM+(ARG_IMM16),CLASS_REG_BYTE+(ARG_RS),},
-	{CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REG+(ARG_RS),CLASS_BIT+7,CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,156},
+	{CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REG+(ARG_RS),CLASS_BIT+6,CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,172},
 
-/* 0011 1011 ssN0 1011 0000 aaaa ddN0 1000 *** soutd @rd,@rs,ra */
+/* 0011 1011 ssN0 1011 0000 aaaa dddd 1000 *** soutd @ro,@rs,ra */
 {
 #ifdef NICENAMES
-"soutd @rd,@rs,ra",16,0,0x00,
+"soutd @ro,@rs,ra",16,21,0x04,
 #endif
-"soutd",OPC_soutd,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RA),},
-	{CLASS_BIT+3,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+0xb,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,157},
+"soutd",OPC_soutd,0,{CLASS_IRO+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RA),},
+	{CLASS_BIT+3,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+0xb,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REG+(ARG_RD),CLASS_BIT+8,0,},3,4,173},
 
-/* 0011 1010 ssN0 1011 0000 aaaa ddN0 1000 *** soutdb @rd,@rs,rba */
+/* 0011 1010 ssN0 1011 0000 aaaa dddd 1000 *** soutdb @ro,@rs,ra */
 {
 #ifdef NICENAMES
-"soutdb @rd,@rs,rba",8,0,0x00,
+"soutdb @ro,@rs,ra",8,21,0x04,
 #endif
-"soutdb",OPC_soutdb,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_BYTE+(ARG_RA),},
-	{CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+0xb,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,158},
+"soutdb",OPC_soutdb,0,{CLASS_IRO+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RA),},
+	{CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+0xb,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REG+(ARG_RD),CLASS_BIT+8,0,},3,4,174},
 
-/* 0011 1010 ssN0 0011 0000 aaaa ddN0 1000 *** soutib @rd,@rs,ra */
+/* 0011 1011 ssN0 0011 0000 aaaa dddd 1000 *** souti @ro,@rs,ra */
 {
 #ifdef NICENAMES
-"soutib @rd,@rs,ra",8,0,0x00,
+"souti @ro,@rs,ra",16,21,0x04,
 #endif
-"soutib",OPC_soutib,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RA),},
-	{CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+3,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,159},
+"souti",OPC_souti,0,{CLASS_IRO+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RA),},
+	{CLASS_BIT+3,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+3,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REG+(ARG_RD),CLASS_BIT+8,0,},3,4,175},
 
-/* 0011 1010 ssN0 0011 0000 aaaa ddN0 0000 *** soutibr @rd,@rs,ra */
+/* 0011 1010 ssN0 0011 0000 aaaa dddd 1000 *** soutib @ro,@rs,ra */
 {
 #ifdef NICENAMES
-"soutibr @rd,@rs,ra",16,0,0x00,
+"soutib @ro,@rs,ra",8,21,0x04,
 #endif
-"soutibr",OPC_soutibr,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RA),},
-	{CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+3,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+0,0,},3,4,160},
+"soutib",OPC_soutib,0,{CLASS_IRO+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RA),},
+	{CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+3,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REG+(ARG_RD),CLASS_BIT+8,0,},3,4,176},
 
 /* 1011 0011 dddd 1001 1111 1111 nim8 *** sra rd,imm8 */
 {
@@ -3134,7 +3287,7 @@
 "sra rd,imm8",16,13,0x3c,
 #endif
 "sra",OPC_sra,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IMM+(ARG_IMM8),},
-	{CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+9,CLASS_BIT+0xf,CLASS_BIT+0xf,CLASS_IMM+(ARG_NIM8),0,0,},2,4,161},
+	{CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+9,CLASS_BIT+0xf,CLASS_BIT+0xf,CLASS_IMM+(ARG_NIM8),0,0,},2,4,177},
 
 /* 1011 0010 dddd 1001 iiii iiii 1111 nim4 *** srab rbd,imm4 */
 {
@@ -3142,7 +3295,7 @@
 "srab rbd,imm4",8,13,0x3c,
 #endif
 "srab",OPC_srab,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM +(ARG_IMM4),},
-	{CLASS_BIT+0xb,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_BIT+9,CLASS_IGNORE,CLASS_IGNORE,CLASS_BIT+0xf,CLASS_IMM+(ARG_NIM4),0,},2,4,162},
+	{CLASS_BIT+0xb,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_BIT+9,CLASS_IGNORE,CLASS_IGNORE,CLASS_BIT+0xf,CLASS_IMM+(ARG_NIM4),0,},2,4,178},
 
 /* 1011 0011 dddd 1101 1111 1111 nim8 *** sral rrd,imm8 */
 {
@@ -3150,7 +3303,7 @@
 "sral rrd,imm8",32,13,0x3c,
 #endif
 "sral",OPC_sral,0,{CLASS_REG_LONG+(ARG_RD),CLASS_IMM+(ARG_IMM8),},
-	{CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+0xd,CLASS_BIT+0xf,CLASS_BIT+0xf,CLASS_IMM+(ARG_NIM8),0,0,},2,4,163},
+	{CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+0xd,CLASS_BIT+0xf,CLASS_BIT+0xf,CLASS_IMM+(ARG_NIM8),0,0,},2,4,179},
 
 /* 1011 0011 dddd 0001 1111 1111 nim8 *** srl rd,imm8 */
 {
@@ -3158,7 +3311,7 @@
 "srl rd,imm8",16,13,0x3c,
 #endif
 "srl",OPC_srl,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IMM+(ARG_IMM8),},
-	{CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+1,CLASS_BIT+0xf,CLASS_BIT+0xf,CLASS_IMM+(ARG_NIM8),0,0,},2,4,164},
+	{CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+1,CLASS_BIT+0xf,CLASS_BIT+0xf,CLASS_IMM+(ARG_NIM8),0,0,},2,4,180},
 
 /* 1011 0010 dddd 0001 iiii iiii 1111 nim4 *** srlb rbd,imm4 */
 {
@@ -3166,7 +3319,7 @@
 "srlb rbd,imm4",8,13,0x3c,
 #endif
 "srlb",OPC_srlb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM +(ARG_IMM4),},
-	{CLASS_BIT+0xb,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_BIT+1,CLASS_IGNORE,CLASS_IGNORE,CLASS_BIT+0xf,CLASS_IMM+(ARG_NIM4),0,},2,4,165},
+	{CLASS_BIT+0xb,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_BIT+1,CLASS_IGNORE,CLASS_IGNORE,CLASS_BIT+0xf,CLASS_IMM+(ARG_NIM4),0,},2,4,181},
 
 /* 1011 0011 dddd 0101 1111 1111 nim8 *** srll rrd,imm8 */
 {
@@ -3174,7 +3327,7 @@
 "srll rrd,imm8",32,13,0x3c,
 #endif
 "srll",OPC_srll,0,{CLASS_REG_LONG+(ARG_RD),CLASS_IMM+(ARG_IMM8),},
-	{CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+5,CLASS_BIT+0xf,CLASS_BIT+0xf,CLASS_IMM+(ARG_NIM8),0,0,},2,4,166},
+	{CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+5,CLASS_BIT+0xf,CLASS_BIT+0xf,CLASS_IMM+(ARG_NIM8),0,0,},2,4,182},
 
 /* 0000 0011 ssN0 dddd *** sub rd,@rs */
 {
@@ -3182,7 +3335,7 @@
 "sub rd,@rs",16,7,0x3c,
 #endif
 "sub",OPC_sub,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IR+(ARG_RS),},
-	{CLASS_BIT+0,CLASS_BIT+3,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,167},
+	{CLASS_BIT+0,CLASS_BIT+3,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,183},
 
 /* 0100 0011 0000 dddd address_src *** sub rd,address_src */
 {
@@ -3190,7 +3343,7 @@
 "sub rd,address_src",16,9,0x3c,
 #endif
 "sub",OPC_sub,0,{CLASS_REG_WORD+(ARG_RD),CLASS_DA+(ARG_SRC),},
-	{CLASS_BIT+4,CLASS_BIT+3,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,167},
+	{CLASS_BIT+4,CLASS_BIT+3,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,183},
 
 /* 0100 0011 ssN0 dddd address_src *** sub rd,address_src(rs) */
 {
@@ -3198,7 +3351,7 @@
 "sub rd,address_src(rs)",16,10,0x3c,
 #endif
 "sub",OPC_sub,0,{CLASS_REG_WORD+(ARG_RD),CLASS_X+(ARG_RS),},
-	{CLASS_BIT+4,CLASS_BIT+3,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,167},
+	{CLASS_BIT+4,CLASS_BIT+3,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,183},
 
 /* 0000 0011 0000 dddd imm16 *** sub rd,imm16 */
 {
@@ -3206,7 +3359,7 @@
 "sub rd,imm16",16,7,0x3c,
 #endif
 "sub",OPC_sub,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IMM+(ARG_IMM16),},
-	{CLASS_BIT+0,CLASS_BIT+3,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,167},
+	{CLASS_BIT+0,CLASS_BIT+3,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,183},
 
 /* 1000 0011 ssss dddd *** sub rd,rs */
 {
@@ -3214,7 +3367,7 @@
 "sub rd,rs",16,4,0x3c,
 #endif
 "sub",OPC_sub,0,{CLASS_REG_WORD+(ARG_RD),CLASS_REG_WORD+(ARG_RS),},
-	{CLASS_BIT+8,CLASS_BIT+3,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,167},
+	{CLASS_BIT+8,CLASS_BIT+3,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,183},
 
 /* 0000 0010 ssN0 dddd *** subb rbd,@rs */
 {
@@ -3222,7 +3375,7 @@
 "subb rbd,@rs",8,7,0x3f,
 #endif
 "subb",OPC_subb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IR+(ARG_RS),},
-	{CLASS_BIT+0,CLASS_BIT+2,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,168},
+	{CLASS_BIT+0,CLASS_BIT+2,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,184},
 
 /* 0100 0010 0000 dddd address_src *** subb rbd,address_src */
 {
@@ -3230,7 +3383,7 @@
 "subb rbd,address_src",8,9,0x3f,
 #endif
 "subb",OPC_subb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_DA+(ARG_SRC),},
-	{CLASS_BIT+4,CLASS_BIT+2,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,168},
+	{CLASS_BIT+4,CLASS_BIT+2,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,184},
 
 /* 0100 0010 ssN0 dddd address_src *** subb rbd,address_src(rs) */
 {
@@ -3238,7 +3391,7 @@
 "subb rbd,address_src(rs)",8,10,0x3f,
 #endif
 "subb",OPC_subb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_X+(ARG_RS),},
-	{CLASS_BIT+4,CLASS_BIT+2,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,168},
+	{CLASS_BIT+4,CLASS_BIT+2,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,184},
 
 /* 0000 0010 0000 dddd imm8 imm8 *** subb rbd,imm8 */
 {
@@ -3246,7 +3399,7 @@
 "subb rbd,imm8",8,7,0x3f,
 #endif
 "subb",OPC_subb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM+(ARG_IMM8),},
-	{CLASS_BIT+0,CLASS_BIT+2,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM8),CLASS_IMM+(ARG_IMM8),0,0,0,},2,4,168},
+	{CLASS_BIT+0,CLASS_BIT+2,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM8),CLASS_IMM+(ARG_IMM8),0,0,0,},2,4,184},
 
 /* 1000 0010 ssss dddd *** subb rbd,rbs */
 {
@@ -3254,7 +3407,7 @@
 "subb rbd,rbs",8,4,0x3f,
 #endif
 "subb",OPC_subb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_REG_BYTE+(ARG_RS),},
-	{CLASS_BIT+8,CLASS_BIT+2,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,168},
+	{CLASS_BIT+8,CLASS_BIT+2,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,184},
 
 /* 0001 0010 ssN0 dddd *** subl rrd,@rs */
 {
@@ -3262,7 +3415,7 @@
 "subl rrd,@rs",32,14,0x3c,
 #endif
 "subl",OPC_subl,0,{CLASS_REG_LONG+(ARG_RD),CLASS_IR+(ARG_RS),},
-	{CLASS_BIT+1,CLASS_BIT+2,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,169},
+	{CLASS_BIT+1,CLASS_BIT+2,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,185},
 
 /* 0101 0010 0000 dddd address_src *** subl rrd,address_src */
 {
@@ -3270,7 +3423,7 @@
 "subl rrd,address_src",32,15,0x3c,
 #endif
 "subl",OPC_subl,0,{CLASS_REG_LONG+(ARG_RD),CLASS_DA+(ARG_SRC),},
-	{CLASS_BIT+5,CLASS_BIT+2,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,169},
+	{CLASS_BIT+5,CLASS_BIT+2,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,185},
 
 /* 0101 0010 ssN0 dddd address_src *** subl rrd,address_src(rs) */
 {
@@ -3278,7 +3431,7 @@
 "subl rrd,address_src(rs)",32,16,0x3c,
 #endif
 "subl",OPC_subl,0,{CLASS_REG_LONG+(ARG_RD),CLASS_X+(ARG_RS),},
-	{CLASS_BIT+5,CLASS_BIT+2,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,169},
+	{CLASS_BIT+5,CLASS_BIT+2,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,185},
 
 /* 0001 0010 0000 dddd imm32 *** subl rrd,imm32 */
 {
@@ -3286,7 +3439,7 @@
 "subl rrd,imm32",32,14,0x3c,
 #endif
 "subl",OPC_subl,0,{CLASS_REG_LONG+(ARG_RD),CLASS_IMM+(ARG_IMM32),},
-	{CLASS_BIT+1,CLASS_BIT+2,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM32),0,0,0,0,},2,6,169},
+	{CLASS_BIT+1,CLASS_BIT+2,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM32),0,0,0,0,},2,6,185},
 
 /* 1001 0010 ssss dddd *** subl rrd,rrs */
 {
@@ -3294,7 +3447,7 @@
 "subl rrd,rrs",32,8,0x3c,
 #endif
 "subl",OPC_subl,0,{CLASS_REG_LONG+(ARG_RD),CLASS_REG_LONG+(ARG_RS),},
-	{CLASS_BIT+9,CLASS_BIT+2,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,169},
+	{CLASS_BIT+9,CLASS_BIT+2,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,185},
 
 /* 1010 1111 dddd cccc *** tcc cc,rd */
 {
@@ -3302,7 +3455,7 @@
 "tcc cc,rd",16,5,0x00,
 #endif
 "tcc",OPC_tcc,0,{CLASS_CC,CLASS_REG_WORD+(ARG_RD),},
-	{CLASS_BIT+0xa,CLASS_BIT+0xf,CLASS_REG+(ARG_RD),CLASS_CC,0,0,0,0,0,},2,2,170},
+	{CLASS_BIT+0xa,CLASS_BIT+0xf,CLASS_REG+(ARG_RD),CLASS_CC,0,0,0,0,0,},2,2,186},
 
 /* 1010 1110 dddd cccc *** tccb cc,rbd */
 {
@@ -3310,7 +3463,7 @@
 "tccb cc,rbd",8,5,0x00,
 #endif
 "tccb",OPC_tccb,0,{CLASS_CC,CLASS_REG_BYTE+(ARG_RD),},
-	{CLASS_BIT+0xa,CLASS_BIT+0xe,CLASS_REG+(ARG_RD),CLASS_CC,0,0,0,0,0,},2,2,171},
+	{CLASS_BIT+0xa,CLASS_BIT+0xe,CLASS_REG+(ARG_RD),CLASS_CC,0,0,0,0,0,},2,2,187},
 
 /* 0000 1101 ddN0 0100 *** test @rd */
 {
@@ -3318,7 +3471,7 @@
 "test @rd",16,8,0x18,
 #endif
 "test",OPC_test,0,{CLASS_IR+(ARG_RD),},
-	{CLASS_BIT+0,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_BIT+4,0,0,0,0,0,},1,2,172},
+	{CLASS_BIT+0,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_BIT+4,0,0,0,0,0,},1,2,188},
 
 /* 0100 1101 0000 0100 address_dst *** test address_dst */
 {
@@ -3326,7 +3479,7 @@
 "test address_dst",16,11,0x00,
 #endif
 "test",OPC_test,0,{CLASS_DA+(ARG_DST),},
-	{CLASS_BIT+4,CLASS_BIT+0xd,CLASS_BIT+0,CLASS_BIT+4,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,172},
+	{CLASS_BIT+4,CLASS_BIT+0xd,CLASS_BIT+0,CLASS_BIT+4,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,188},
 
 /* 0100 1101 ddN0 0100 address_dst *** test address_dst(rd) */
 {
@@ -3334,7 +3487,7 @@
 "test address_dst(rd)",16,12,0x00,
 #endif
 "test",OPC_test,0,{CLASS_X+(ARG_RD),},
-	{CLASS_BIT+4,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_BIT+4,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,172},
+	{CLASS_BIT+4,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_BIT+4,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,188},
 
 /* 1000 1101 dddd 0100 *** test rd */
 {
@@ -3342,7 +3495,7 @@
 "test rd",16,7,0x00,
 #endif
 "test",OPC_test,0,{CLASS_REG_WORD+(ARG_RD),},
-	{CLASS_BIT+8,CLASS_BIT+0xd,CLASS_REG+(ARG_RD),CLASS_BIT+4,0,0,0,0,0,},1,2,172},
+	{CLASS_BIT+8,CLASS_BIT+0xd,CLASS_REG+(ARG_RD),CLASS_BIT+4,0,0,0,0,0,},1,2,188},
 
 /* 0000 1100 ddN0 0100 *** testb @rd */
 {
@@ -3350,7 +3503,7 @@
 "testb @rd",8,8,0x1c,
 #endif
 "testb",OPC_testb,0,{CLASS_IR+(ARG_RD),},
-	{CLASS_BIT+0,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+4,0,0,0,0,0,},1,2,173},
+	{CLASS_BIT+0,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+4,0,0,0,0,0,},1,2,189},
 
 /* 0100 1100 0000 0100 address_dst *** testb address_dst */
 {
@@ -3358,7 +3511,7 @@
 "testb address_dst",8,11,0x1c,
 #endif
 "testb",OPC_testb,0,{CLASS_DA+(ARG_DST),},
-	{CLASS_BIT+4,CLASS_BIT+0xc,CLASS_BIT+0,CLASS_BIT+4,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,173},
+	{CLASS_BIT+4,CLASS_BIT+0xc,CLASS_BIT+0,CLASS_BIT+4,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,189},
 
 /* 0100 1100 ddN0 0100 address_dst *** testb address_dst(rd) */
 {
@@ -3366,7 +3519,7 @@
 "testb address_dst(rd)",8,12,0x1c,
 #endif
 "testb",OPC_testb,0,{CLASS_X+(ARG_RD),},
-	{CLASS_BIT+4,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+4,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,173},
+	{CLASS_BIT+4,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+4,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,189},
 
 /* 1000 1100 dddd 0100 *** testb rbd */
 {
@@ -3374,7 +3527,7 @@
 "testb rbd",8,7,0x1c,
 #endif
 "testb",OPC_testb,0,{CLASS_REG_BYTE+(ARG_RD),},
-	{CLASS_BIT+8,CLASS_BIT+0xc,CLASS_REG+(ARG_RD),CLASS_BIT+4,0,0,0,0,0,},1,2,173},
+	{CLASS_BIT+8,CLASS_BIT+0xc,CLASS_REG+(ARG_RD),CLASS_BIT+4,0,0,0,0,0,},1,2,189},
 
 /* 0001 1100 ddN0 1000 *** testl @rd */
 {
@@ -3382,7 +3535,7 @@
 "testl @rd",32,13,0x18,
 #endif
 "testl",OPC_testl,0,{CLASS_IR+(ARG_RD),},
-	{CLASS_BIT+1,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,0,0,0,0,},1,2,174},
+	{CLASS_BIT+1,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,0,0,0,0,},1,2,190},
 
 /* 0101 1100 0000 1000 address_dst *** testl address_dst */
 {
@@ -3390,7 +3543,7 @@
 "testl address_dst",32,16,0x18,
 #endif
 "testl",OPC_testl,0,{CLASS_DA+(ARG_DST),},
-	{CLASS_BIT+5,CLASS_BIT+0xc,CLASS_BIT+0,CLASS_BIT+8,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,174},
+	{CLASS_BIT+5,CLASS_BIT+0xc,CLASS_BIT+0,CLASS_BIT+8,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,190},
 
 /* 0101 1100 ddN0 1000 address_dst *** testl address_dst(rd) */
 {
@@ -3398,7 +3551,7 @@
 "testl address_dst(rd)",32,17,0x18,
 #endif
 "testl",OPC_testl,0,{CLASS_X+(ARG_RD),},
-	{CLASS_BIT+5,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+8,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,174},
+	{CLASS_BIT+5,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+8,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,190},
 
 /* 1001 1100 dddd 1000 *** testl rrd */
 {
@@ -3406,7 +3559,7 @@
 "testl rrd",32,13,0x18,
 #endif
 "testl",OPC_testl,0,{CLASS_REG_LONG+(ARG_RD),},
-	{CLASS_BIT+9,CLASS_BIT+0xc,CLASS_REG+(ARG_RD),CLASS_BIT+8,0,0,0,0,0,},1,2,174},
+	{CLASS_BIT+9,CLASS_BIT+0xc,CLASS_REG+(ARG_RD),CLASS_BIT+8,0,0,0,0,0,},1,2,190},
 
 /* 1011 1000 ddN0 1000 0000 aaaa ssN0 0000 *** trdb @rd,@rs,rba */
 {
@@ -3414,7 +3567,7 @@
 "trdb @rd,@rs,rba",8,25,0x1c,
 #endif
 "trdb",OPC_trdb,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_BYTE+(ARG_RA),},
-	{CLASS_BIT+0xb,CLASS_BIT+8,CLASS_REGN0+(ARG_RD),CLASS_BIT+8,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RS),CLASS_BIT+0,0,},3,4,175},
+	{CLASS_BIT+0xb,CLASS_BIT+8,CLASS_REGN0+(ARG_RD),CLASS_BIT+8,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RS),CLASS_BIT+0,0,},3,4,191},
 
 /* 1011 1000 ddN0 1100 0000 aaaa ssN0 0000 *** trdrb @rd,@rs,rba */
 {
@@ -3422,7 +3575,7 @@
 "trdrb @rd,@rs,rba",8,25,0x1c,
 #endif
 "trdrb",OPC_trdrb,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_BYTE+(ARG_RA),},
-	{CLASS_BIT+0xb,CLASS_BIT+8,CLASS_REGN0+(ARG_RD),CLASS_BIT+0xc,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RS),CLASS_BIT+0,0,},3,4,176},
+	{CLASS_BIT+0xb,CLASS_BIT+8,CLASS_REGN0+(ARG_RD),CLASS_BIT+0xc,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RS),CLASS_BIT+0,0,},3,4,192},
 
 /* 1011 1000 ddN0 0000 0000 rrrr ssN0 0000 *** trib @rd,@rs,rbr */
 {
@@ -3430,7 +3583,7 @@
 "trib @rd,@rs,rbr",8,25,0x1c,
 #endif
 "trib",OPC_trib,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_BYTE+(ARG_RR),},
-	{CLASS_BIT+0xb,CLASS_BIT+8,CLASS_REGN0+(ARG_RD),CLASS_BIT+0,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RS),CLASS_BIT+0,0,},3,4,177},
+	{CLASS_BIT+0xb,CLASS_BIT+8,CLASS_REGN0+(ARG_RD),CLASS_BIT+0,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RS),CLASS_BIT+0,0,},3,4,193},
 
 /* 1011 1000 ddN0 0100 0000 rrrr ssN0 0000 *** trirb @rd,@rs,rbr */
 {
@@ -3438,7 +3591,7 @@
 "trirb @rd,@rs,rbr",8,25,0x1c,
 #endif
 "trirb",OPC_trirb,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_BYTE+(ARG_RR),},
-	{CLASS_BIT+0xb,CLASS_BIT+8,CLASS_REGN0+(ARG_RD),CLASS_BIT+4,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RS),CLASS_BIT+0,0,},3,4,178},
+	{CLASS_BIT+0xb,CLASS_BIT+8,CLASS_REGN0+(ARG_RD),CLASS_BIT+4,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RS),CLASS_BIT+0,0,},3,4,194},
 
 /* 1011 1000 aaN0 1010 0000 rrrr bbN0 0000 *** trtdb @ra,@rb,rbr */
 {
@@ -3446,7 +3599,7 @@
 "trtdb @ra,@rb,rbr",8,25,0x1c,
 #endif
 "trtdb",OPC_trtdb,0,{CLASS_IR+(ARG_RA),CLASS_IR+(ARG_RB),CLASS_REG_BYTE+(ARG_RR),},
-	{CLASS_BIT+0xb,CLASS_BIT+8,CLASS_REGN0+(ARG_RA),CLASS_BIT+0xa,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RB),CLASS_BIT+0,0,},3,4,179},
+	{CLASS_BIT+0xb,CLASS_BIT+8,CLASS_REGN0+(ARG_RA),CLASS_BIT+0xa,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RB),CLASS_BIT+0,0,},3,4,195},
 
 /* 1011 1000 aaN0 1110 0000 rrrr bbN0 1110 *** trtdrb @ra,@rb,rbr */
 {
@@ -3454,7 +3607,7 @@
 "trtdrb @ra,@rb,rbr",8,25,0x1c,
 #endif
 "trtdrb",OPC_trtdrb,0,{CLASS_IR+(ARG_RA),CLASS_IR+(ARG_RB),CLASS_REG_BYTE+(ARG_RR),},
-	{CLASS_BIT+0xb,CLASS_BIT+8,CLASS_REGN0+(ARG_RA),CLASS_BIT+0xe,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RB),CLASS_BIT+0xe,0,},3,4,180},
+	{CLASS_BIT+0xb,CLASS_BIT+8,CLASS_REGN0+(ARG_RA),CLASS_BIT+0xe,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RB),CLASS_BIT+0xe,0,},3,4,196},
 
 /* 1011 1000 aaN0 0010 0000 rrrr bbN0 0000 *** trtib @ra,@rb,rbr */
 {
@@ -3462,7 +3615,7 @@
 "trtib @ra,@rb,rbr",8,25,0x1c,
 #endif
 "trtib",OPC_trtib,0,{CLASS_IR+(ARG_RA),CLASS_IR+(ARG_RB),CLASS_REG_BYTE+(ARG_RR),},
-	{CLASS_BIT+0xb,CLASS_BIT+8,CLASS_REGN0+(ARG_RA),CLASS_BIT+2,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RB),CLASS_BIT+0,0,},3,4,181},
+	{CLASS_BIT+0xb,CLASS_BIT+8,CLASS_REGN0+(ARG_RA),CLASS_BIT+2,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RB),CLASS_BIT+0,0,},3,4,197},
 
 /* 1011 1000 aaN0 0110 0000 rrrr bbN0 1110 *** trtirb @ra,@rb,rbr */
 {
@@ -3470,7 +3623,7 @@
 "trtirb @ra,@rb,rbr",8,25,0x1c,
 #endif
 "trtirb",OPC_trtirb,0,{CLASS_IR+(ARG_RA),CLASS_IR+(ARG_RB),CLASS_REG_BYTE+(ARG_RR),},
-	{CLASS_BIT+0xb,CLASS_BIT+8,CLASS_REGN0+(ARG_RA),CLASS_BIT+6,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RB),CLASS_BIT+0xe,0,},3,4,182},
+	{CLASS_BIT+0xb,CLASS_BIT+8,CLASS_REGN0+(ARG_RA),CLASS_BIT+6,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RB),CLASS_BIT+0xe,0,},3,4,198},
 
 /* 1011 1000 aaN0 1010 0000 rrrr bbN0 0000 *** trtrb @ra,@rb,rbr */
 {
@@ -3478,7 +3631,7 @@
 "trtrb @ra,@rb,rbr",8,25,0x1c,
 #endif
 "trtrb",OPC_trtrb,0,{CLASS_IR+(ARG_RA),CLASS_IR+(ARG_RB),CLASS_REG_BYTE+(ARG_RR),},
-	{CLASS_BIT+0xb,CLASS_BIT+8,CLASS_REGN0+(ARG_RA),CLASS_BIT+0xa,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RB),CLASS_BIT+0,0,},3,4,183},
+	{CLASS_BIT+0xb,CLASS_BIT+8,CLASS_REGN0+(ARG_RA),CLASS_BIT+0xa,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RB),CLASS_BIT+0,0,},3,4,199},
 
 /* 0000 1101 ddN0 0110 *** tset @rd */
 {
@@ -3486,7 +3639,7 @@
 "tset @rd",16,11,0x08,
 #endif
 "tset",OPC_tset,0,{CLASS_IR+(ARG_RD),},
-	{CLASS_BIT+0,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_BIT+6,0,0,0,0,0,},1,2,184},
+	{CLASS_BIT+0,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_BIT+6,0,0,0,0,0,},1,2,200},
 
 /* 0100 1101 0000 0110 address_dst *** tset address_dst */
 {
@@ -3494,7 +3647,7 @@
 "tset address_dst",16,14,0x08,
 #endif
 "tset",OPC_tset,0,{CLASS_DA+(ARG_DST),},
-	{CLASS_BIT+4,CLASS_BIT+0xd,CLASS_BIT+0,CLASS_BIT+6,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,184},
+	{CLASS_BIT+4,CLASS_BIT+0xd,CLASS_BIT+0,CLASS_BIT+6,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,200},
 
 /* 0100 1101 ddN0 0110 address_dst *** tset address_dst(rd) */
 {
@@ -3502,7 +3655,7 @@
 "tset address_dst(rd)",16,15,0x08,
 #endif
 "tset",OPC_tset,0,{CLASS_X+(ARG_RD),},
-	{CLASS_BIT+4,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_BIT+6,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,184},
+	{CLASS_BIT+4,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_BIT+6,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,200},
 
 /* 1000 1101 dddd 0110 *** tset rd */
 {
@@ -3510,7 +3663,7 @@
 "tset rd",16,7,0x08,
 #endif
 "tset",OPC_tset,0,{CLASS_REG_WORD+(ARG_RD),},
-	{CLASS_BIT+8,CLASS_BIT+0xd,CLASS_REG+(ARG_RD),CLASS_BIT+6,0,0,0,0,0,},1,2,184},
+	{CLASS_BIT+8,CLASS_BIT+0xd,CLASS_REG+(ARG_RD),CLASS_BIT+6,0,0,0,0,0,},1,2,200},
 
 /* 0000 1100 ddN0 0110 *** tsetb @rd */
 {
@@ -3518,7 +3671,7 @@
 "tsetb @rd",8,11,0x08,
 #endif
 "tsetb",OPC_tsetb,0,{CLASS_IR+(ARG_RD),},
-	{CLASS_BIT+0,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+6,0,0,0,0,0,},1,2,185},
+	{CLASS_BIT+0,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+6,0,0,0,0,0,},1,2,201},
 
 /* 0100 1100 0000 0110 address_dst *** tsetb address_dst */
 {
@@ -3526,7 +3679,7 @@
 "tsetb address_dst",8,14,0x08,
 #endif
 "tsetb",OPC_tsetb,0,{CLASS_DA+(ARG_DST),},
-	{CLASS_BIT+4,CLASS_BIT+0xc,CLASS_BIT+0,CLASS_BIT+6,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,185},
+	{CLASS_BIT+4,CLASS_BIT+0xc,CLASS_BIT+0,CLASS_BIT+6,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,201},
 
 /* 0100 1100 ddN0 0110 address_dst *** tsetb address_dst(rd) */
 {
@@ -3534,7 +3687,7 @@
 "tsetb address_dst(rd)",8,15,0x08,
 #endif
 "tsetb",OPC_tsetb,0,{CLASS_X+(ARG_RD),},
-	{CLASS_BIT+4,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+6,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,185},
+	{CLASS_BIT+4,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+6,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,201},
 
 /* 1000 1100 dddd 0110 *** tsetb rbd */
 {
@@ -3542,7 +3695,7 @@
 "tsetb rbd",8,7,0x08,
 #endif
 "tsetb",OPC_tsetb,0,{CLASS_REG_BYTE+(ARG_RD),},
-	{CLASS_BIT+8,CLASS_BIT+0xc,CLASS_REG+(ARG_RD),CLASS_BIT+6,0,0,0,0,0,},1,2,185},
+	{CLASS_BIT+8,CLASS_BIT+0xc,CLASS_REG+(ARG_RD),CLASS_BIT+6,0,0,0,0,0,},1,2,201},
 
 /* 0000 1001 ssN0 dddd *** xor rd,@rs */
 {
@@ -3550,7 +3703,7 @@
 "xor rd,@rs",16,7,0x18,
 #endif
 "xor",OPC_xor,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IR+(ARG_RS),},
-	{CLASS_BIT+0,CLASS_BIT+9,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,186},
+	{CLASS_BIT+0,CLASS_BIT+9,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,202},
 
 /* 0100 1001 0000 dddd address_src *** xor rd,address_src */
 {
@@ -3558,7 +3711,7 @@
 "xor rd,address_src",16,9,0x18,
 #endif
 "xor",OPC_xor,0,{CLASS_REG_WORD+(ARG_RD),CLASS_DA+(ARG_SRC),},
-	{CLASS_BIT+4,CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,186},
+	{CLASS_BIT+4,CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,202},
 
 /* 0100 1001 ssN0 dddd address_src *** xor rd,address_src(rs) */
 {
@@ -3566,7 +3719,7 @@
 "xor rd,address_src(rs)",16,10,0x18,
 #endif
 "xor",OPC_xor,0,{CLASS_REG_WORD+(ARG_RD),CLASS_X+(ARG_RS),},
-	{CLASS_BIT+4,CLASS_BIT+9,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,186},
+	{CLASS_BIT+4,CLASS_BIT+9,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,202},
 
 /* 0000 1001 0000 dddd imm16 *** xor rd,imm16 */
 {
@@ -3574,7 +3727,7 @@
 "xor rd,imm16",16,7,0x18,
 #endif
 "xor",OPC_xor,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IMM+(ARG_IMM16),},
-	{CLASS_BIT+0,CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,186},
+	{CLASS_BIT+0,CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,202},
 
 /* 1000 1001 ssss dddd *** xor rd,rs */
 {
@@ -3582,7 +3735,7 @@
 "xor rd,rs",16,4,0x18,
 #endif
 "xor",OPC_xor,0,{CLASS_REG_WORD+(ARG_RD),CLASS_REG_WORD+(ARG_RS),},
-	{CLASS_BIT+8,CLASS_BIT+9,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,186},
+	{CLASS_BIT+8,CLASS_BIT+9,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,202},
 
 /* 0000 1000 ssN0 dddd *** xorb rbd,@rs */
 {
@@ -3590,7 +3743,7 @@
 "xorb rbd,@rs",8,7,0x1c,
 #endif
 "xorb",OPC_xorb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IR+(ARG_RS),},
-	{CLASS_BIT+0,CLASS_BIT+8,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,187},
+	{CLASS_BIT+0,CLASS_BIT+8,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,203},
 
 /* 0100 1000 0000 dddd address_src *** xorb rbd,address_src */
 {
@@ -3598,7 +3751,7 @@
 "xorb rbd,address_src",8,9,0x1c,
 #endif
 "xorb",OPC_xorb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_DA+(ARG_SRC),},
-	{CLASS_BIT+4,CLASS_BIT+8,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,187},
+	{CLASS_BIT+4,CLASS_BIT+8,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,203},
 
 /* 0100 1000 ssN0 dddd address_src *** xorb rbd,address_src(rs) */
 {
@@ -3606,7 +3759,7 @@
 "xorb rbd,address_src(rs)",8,10,0x1c,
 #endif
 "xorb",OPC_xorb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_X+(ARG_RS),},
-	{CLASS_BIT+4,CLASS_BIT+8,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,187},
+	{CLASS_BIT+4,CLASS_BIT+8,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,203},
 
 /* 0000 1000 0000 dddd imm8 imm8 *** xorb rbd,imm8 */
 {
@@ -3614,7 +3767,7 @@
 "xorb rbd,imm8",8,7,0x1c,
 #endif
 "xorb",OPC_xorb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM+(ARG_IMM8),},
-	{CLASS_BIT+0,CLASS_BIT+8,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM8),CLASS_IMM+(ARG_IMM8),0,0,0,},2,4,187},
+	{CLASS_BIT+0,CLASS_BIT+8,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM8),CLASS_IMM+(ARG_IMM8),0,0,0,},2,4,203},
 
 /* 1000 1000 ssss dddd *** xorb rbd,rbs */
 {
@@ -3622,7 +3775,7 @@
 "xorb rbd,rbs",8,4,0x1c,
 #endif
 "xorb",OPC_xorb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_REG_BYTE+(ARG_RS),},
-	{CLASS_BIT+8,CLASS_BIT+8,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,187},
+	{CLASS_BIT+8,CLASS_BIT+8,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,203},
 
 /* 1000 1000 ssss dddd *** xorb rbd,rbs */
 {
@@ -3630,7 +3783,7 @@
 "xorb rbd,rbs",8,4,0x01,
 #endif
 "xorb",OPC_xorb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_REG_BYTE+(ARG_RS),},
-	{CLASS_BIT+8,CLASS_BIT+8,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,187},
+	{CLASS_BIT+8,CLASS_BIT+8,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,203},
 
 /* end marker */
 {
diff --git a/opcodes/z8kgen.c b/opcodes/z8kgen.c
index efce2cf..df72791 100644
--- a/opcodes/z8kgen.c
+++ b/opcodes/z8kgen.c
@@ -1,4 +1,4 @@
-/* Copyright 2001, 2002 Free Software Foundation, Inc.
+/* Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
 
    This file is part of GNU Binutils.
 
@@ -17,7 +17,7 @@
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
    USA.  */
 
-/* This program generates z8k-opc.h.  */
+/* This program generates z8k-opc.h.  Compile with -fwritable-strings.  */
 
 #include <stdio.h>
 #include "sysdep.h"
@@ -38,6 +38,10 @@
 #define iswhite(x) ((x) == ' ' || (x) == '\t')
 struct op opt[] =
 {
+  {"------", 2,  8, "0011 0110 0000 0000", "bpt", 0},   /* Breakpoint used by the simulator.  */
+  {"------", 10, 8, "0000 1111 0000 1100", "brk", 0},   /* Breakpoint used by real hardware.
+                                                           (ext0f #0x0c).  */
+
   {"------", 10, 8, "0000 1110 imm8", "ext0e imm8", 0},
   {"------", 10, 8, "0000 1111 imm8", "ext0f imm8", 0},
   {"------", 10, 8, "1000 1110 imm8", "ext8e imm8", 0},
@@ -79,7 +83,6 @@
   {"CZSV--", 11, 16, "1011 1011 ssN0 0110 0000 rrrr ddN0 cccc", "cpsir @rd,@rs,rr,cc", 0},
   {"CZSV--", 11, 8, "1011 1010 ssN0 0110 0000 rrrr ddN0 cccc", "cpsirb @rd,@rs,rr,cc", 0},
 
-  {"------", 2, 8, "0011 0110 0000 0000", "bpt", 0},
   {"CZSV--", 5, 16, "1011 0101 ssss dddd", "adc rd,rs", 0},
   {"CZSVDH", 5, 8, "1011 0100 ssss dddd", "adcb rbd,rbs", 0},
   {"CZSV--", 7, 16, "0000 0001 ssN0 dddd", "add rd,@rs", 0},
@@ -209,8 +212,8 @@
   {"------", 11, 32, "1011 0001 dddd 0111", "extsl rqd", 0},
 
   {"------", 8, 16, "0111 1010 0000 0000", "halt", 0},
-  {"------", 10, 16, "0011 1101 ssN0 dddd", "in rd,@rs", 0},
-  {"------", 12, 8, "0011 1100 ssN0 dddd", "inb rbd,@rs", 0},
+  {"------", 10, 16, "0011 1101 ssss dddd", "in rd,@ri", 0},
+  {"------", 12, 8, "0011 1100 ssss dddd", "inb rbd,@ri", 0},
   {"------", 12, 16, "0011 1011 dddd 0100 imm16", "in rd,imm16", 0},
   {"------", 10, 8, "0011 1010 dddd 0100 imm16", "inb rbd,imm16", 0},
   {"-ZSV--", 11, 16, "0010 1001 ddN0 imm4m1", "inc @rd,imm4m1", 0},
@@ -221,10 +224,14 @@
   {"-ZSV--", 14, 8, "0110 1000 ddN0 imm4m1 address_dst", "incb address_dst(rd),imm4m1", 0},
   {"-ZSV--", 13, 8, "0110 1000 0000 imm4m1 address_dst", "incb address_dst,imm4m1", 0},
   {"-ZSV--", 4, 8, "1010 1000 dddd imm4m1", "incb rbd,imm4m1", 0},
-  {"---V--", 21, 16, "0011 1011 ssN0 1000 0000 aaaa ddN0 1000", "ind @rd,@rs,ra", 0},
-  {"---V--", 21, 8, "0011 1010 ssN0 1000 0000 aaaa ddN0 1000", "indb @rd,@rs,rba", 0},
-  {"---V--", 21, 8, "0011 1010 ssN0 0000 0000 aaaa ddN0 1000", "inib @rd,@rs,ra", 0},
-  {"---V--", 21, 16, "0011 1010 ssN0 0000 0000 aaaa ddN0 0000", "inibr @rd,@rs,ra", 0},
+  {"---V--", 21, 16, "0011 1011 ssss 1000 0000 aaaa ddN0 1000", "ind @rd,@ri,ra", 0},
+  {"---V--", 21, 8, "0011 1010 ssss 1000 0000 aaaa ddN0 1000", "indb @rd,@ri,ra", 0},
+  {"---V--", 11, 16, "0011 1011 ssss 1000 0000 aaaa ddN0 0000", "indr @rd,@ri,ra", 0},
+  {"---V--", 11, 8, "0011 1010 ssss 1000 0000 aaaa ddN0 0000", "indrb @rd,@ri,ra", 0},
+  {"---V--", 21, 16, "0011 1011 ssss 0000 0000 aaaa ddN0 1000", "ini @rd,@ri,ra", 0},
+  {"---V--", 21, 8, "0011 1010 ssss 0000 0000 aaaa ddN0 1000", "inib @rd,@ri,ra", 0},
+  {"---V--", 11, 16, "0011 1011 ssss 0000 0000 aaaa ddN0 0000", "inir @rd,@ri,ra", 0},
+  {"---V--", 11, 8, "0011 1010 ssss 0000 0000 aaaa ddN0 0000", "inirb @rd,@ri,ra", 0},
   {"CZSVDH", 13, 16, "0111 1011 0000 0000", "iret", 0},
   {"------", 10, 16, "0001 1110 ddN0 cccc", "jp cc,@rd", 0},
   {"------", 7, 16, "0101 1110 0000 cccc address_dst", "jp cc,address_dst", 0},
@@ -258,6 +265,7 @@
   {"------", 7, 8, "0010 0000 ssN0 dddd", "ldb rbd,@rs", 0},
   {"------", 9, 8, "0110 0000 0000 dddd address_src", "ldb rbd,address_src", 0},
   {"------", 10, 8, "0110 0000 ssN0 dddd address_src", "ldb rbd,address_src(rs)", 0},
+  {"------", 7, 8, "0010 0000 0000 dddd imm8 imm8", "ldb rbd,imm8", 0},
   {"------", 5, 8, "1100 dddd imm8", "ldb rbd,imm8", 0},
   {"------", 3, 8, "1010 0000 ssss dddd", "ldb rbd,rbs", 0},
   {"------", 14, 8, "0011 0000 ssN0 dddd imm16", "ldb rbd,rs(imm16)", 0},
@@ -342,15 +350,18 @@
   {"CZSP--", 7, 8, "0000 0100 0000 dddd imm8 imm8", "orb rbd,imm8", 0},
   {"CZSP--", 4, 8, "1000 0100 ssss dddd", "orb rbd,rbs", 0},
 
-  {"---V--", 0, 16, "0011 1111 ddN0 ssss", "out @rd,rs", 0},
-  {"---V--", 0, 16, "0011 1011 ssss 0110 imm16", "out imm16,rs", 0},
-  {"---V--", 0, 8, "0011 1110 ddN0 ssss", "outb @rd,rbs", 0},
-  {"---V--", 0, 8, "0011 1010 ssss 0110 imm16", "outb imm16,rbs", 0},
-  {"---V--", 0, 16, "0011 1011 ssN0 1010 0000 aaaa ddN0 1000", "outd @rd,@rs,ra", 0},
-  {"---V--", 0, 16, "0011 1010 ssN0 1010 0000 aaaa ddN0 1000", "outdb @rd,@rs,rba", 0},
-  {"---V--", 0, 16, "0011 1011 ssN0 0010 0000 aaaa ddN0 1000", "outi @rd,@rs,ra", 0},
-  {"---V--", 0, 16, "0011 1010 ssN0 0010 0000 aaaa ddN0 1000", "outib @rd,@rs,ra", 0},
-  {"---V--", 0, 16, "0011 1010 ssN0 0010 0000 aaaa ddN0 0000", "outibr @rd,@rs,ra", 0},
+  {"------", 10, 16, "0011 1111 dddd ssss", "out @ro,rs", 0},
+  {"------", 12, 16, "0011 1011 ssss 0110 imm16", "out imm16,rs", 0},
+  {"------", 10, 8, "0011 1110 dddd ssss", "outb @ro,rbs", 0},
+  {"------", 12, 8, "0011 1010 ssss 0110 imm16", "outb imm16,rbs", 0},
+  {"---V--", 21, 16, "0011 1011 ssN0 1010 0000 aaaa dddd 1000", "outd @ro,@rs,ra", 0},
+  {"---V--", 21, 8, "0011 1010 ssN0 1010 0000 aaaa dddd 1000", "outdb @ro,@rs,ra", 0},
+  {"---V--", 11, 16, "0011 1011 ssN0 1010 0000 aaaa dddd 0000", "otdr @ro,@rs,ra", 0},
+  {"---V--", 11, 8, "0011 1010 ssN0 1010 0000 aaaa dddd 0000", "otdrb @ro,@rs,ra", 0},
+  {"---V--", 21, 16, "0011 1011 ssN0 0010 0000 aaaa dddd 1000", "outi @ro,@rs,ra", 0},
+  {"---V--", 21, 8, "0011 1010 ssN0 0010 0000 aaaa dddd 1000", "outib @ro,@rs,ra", 0},
+  {"---V--", 11, 16, "0011 1011 ssN0 0010 0000 aaaa dddd 0000", "otir @ro,@rs,ra", 0},
+  {"---V--", 11, 8, "0011 1010 ssN0 0010 0000 aaaa dddd 0000", "otirb @ro,@rs,ra", 0},
 
   {"------", 12, 16, "0001 0111 ssN0 ddN0", "pop @rd,@rs", 0},
   {"------", 16, 16, "0101 0111 ssN0 ddN0 address_dst", "pop address_dst(rd),@rs", 0},
@@ -427,12 +438,16 @@
 
   {"CZSV--", 7, 16, "1000 1101 flags 0001", "setflg flags", 0},
 
-  {"------", 0, 8, "0011 1010 dddd 0101 imm16", "sinb rbd,imm16", 0},
-  {"------", 0, 8, "0011 1011 dddd 0101 imm16", "sin rd,imm16", 0},
-  {"------", 0, 16, "0011 1011 ssN0 1000 0001 aaaa ddN0 1000", "sind @rd,@rs,ra", 0},
-  {"------", 0, 8, "0011 1010 ssN0 1000 0001 aaaa ddN0 1000", "sindb @rd,@rs,rba", 0},
-  {"------", 0, 8, "0011 1010 ssN0 0001 0000 aaaa ddN0 1000", "sinib @rd,@rs,ra", 0},
-  {"------", 0, 16, "0011 1010 ssN0 0001 0000 aaaa ddN0 0000", "sinibr @rd,@rs,ra", 0},
+  {"------", 12, 16, "0011 1011 dddd 0101 imm16", "sin rd,imm16", 0},
+  {"------", 10, 8, "0011 1010 dddd 0101 imm16", "sinb rbd,imm16", 0},
+  {"---V--", 21, 16, "0011 1011 ssss 1001 0000 aaaa ddN0 1000", "sind @rd,@ri,ra", 0},
+  {"---V--", 21, 8, "0011 1010 ssss 1001 0000 aaaa ddN0 1000", "sindb @rd,@ri,ra", 0},
+  {"---V--", 11, 16, "0011 1011 ssss 1001 0000 aaaa ddN0 0000", "sindr @rd,@ri,ra", 0},
+  {"---V--", 11, 8, "0011 1010 ssss 1001 0000 aaaa ddN0 0000", "sindrb @rd,@ri,ra", 0},
+  {"---V--", 21, 16, "0011 1011 ssss 0001 0000 aaaa ddN0 1000", "sini @rd,@ri,ra", 0},
+  {"---V--", 21, 8, "0011 1010 ssss 0001 0000 aaaa ddN0 1000", "sinib @rd,@ri,ra", 0},
+  {"---V--", 11, 16, "0011 1011 ssss 0001 0000 aaaa ddN0 0000", "sinir @rd,@ri,ra", 0},
+  {"---V--", 11, 8, "0011 1010 ssss 0001 0000 aaaa ddN0 0000", "sinirb @rd,@ri,ra", 0},
 
   {"CZSV--", 13, 16, "1011 0011 dddd 1001 0000 0000 imm8", "sla rd,imm8", 0},
   {"CZSV--", 13, 8, "1011 0010 dddd 1001 iiii iiii 0000 imm4", "slab rbd,imm4", 0},
@@ -442,12 +457,16 @@
   {"CZS---", 13, 8, "1011 0010 dddd 0001 iiii iiii 0000 imm4", "sllb rbd,imm4", 0},
   {"CZS---", 13, 32, "1011 0011 dddd 0101 0000 0000 imm8", "slll rrd,imm8", 0},
 
-  {"------", 0, 16, "0011 1011 ssss 0111 imm16", "sout imm16,rs", 0},
-  {"------", 0, 8, "0011 1010 ssss 0111 imm16", "soutb imm16,rbs", 0},
-  {"------", 0, 16, "0011 1011 ssN0 1011 0000 aaaa ddN0 1000", "soutd @rd,@rs,ra", 0},
-  {"------", 0, 8, "0011 1010 ssN0 1011 0000 aaaa ddN0 1000", "soutdb @rd,@rs,rba", 0},
-  {"------", 0, 8, "0011 1010 ssN0 0011 0000 aaaa ddN0 1000", "soutib @rd,@rs,ra", 0},
-  {"------", 0, 16, "0011 1010 ssN0 0011 0000 aaaa ddN0 0000", "soutibr @rd,@rs,ra", 0},
+  {"------", 12, 16, "0011 1011 ssss 0110 imm16", "sout imm16,rs", 0},
+  {"------", 12, 8, "0011 1010 ssss 0110 imm16", "soutb imm16,rbs", 0},
+  {"---V--", 21, 16, "0011 1011 ssN0 1011 0000 aaaa dddd 1000", "soutd @ro,@rs,ra", 0},
+  {"---V--", 21, 8, "0011 1010 ssN0 1011 0000 aaaa dddd 1000", "soutdb @ro,@rs,ra", 0},
+  {"---V--", 11, 16, "0011 1011 ssN0 1011 0000 aaaa dddd 0000", "sotdr @ro,@rs,ra", 0},
+  {"---V--", 11, 8, "0011 1010 ssN0 1011 0000 aaaa dddd 0000", "sotdrb @ro,@rs,ra", 0},
+  {"---V--", 21, 16, "0011 1011 ssN0 0011 0000 aaaa dddd 1000", "souti @ro,@rs,ra", 0},
+  {"---V--", 21, 8, "0011 1010 ssN0 0011 0000 aaaa dddd 1000", "soutib @ro,@rs,ra", 0},
+  {"---V--", 11, 16, "0011 1011 ssN0 0011 0000 aaaa dddd 0000", "sotir @ro,@rs,ra", 0},
+  {"---V--", 11, 8, "0011 1010 ssN0 0011 0000 aaaa dddd 0000", "sotirb @ro,@rs,ra", 0},
 
   {"CZSV--", 13, 16, "1011 0011 dddd 1001 1111 1111 nim8", "sra rd,imm8", 0},
   {"CZSV--", 13, 8, "1011 0010 dddd 1001 iiii iiii 1111 nim4", "srab rbd,imm4", 0},
@@ -532,7 +551,7 @@
   {"*", 0, 0, 0, 0, 0}
 };
 
-int
+static int
 count ()
 {
   struct op *p = opt;
@@ -547,8 +566,7 @@
 
 }
 
-static
-int
+static int
 func (a, b)
      struct op *a;
      struct op *b;
@@ -565,7 +583,6 @@
 
 struct tok_struct
 {
-
   char *match;
   char *token;
   int length;
@@ -573,7 +590,6 @@
 
 struct tok_struct args[] =
 {
-
   {"address_src(rs)", "CLASS_X+(ARG_RS)",},
   {"address_dst(rd)", "CLASS_X+(ARG_RD)",},
 
@@ -616,6 +632,8 @@
   {"@ra", "CLASS_IR+(ARG_RA)",},
   {"@rb", "CLASS_IR+(ARG_RB)",},
   {"@rs", "CLASS_IR+(ARG_RS)",},
+  {"@ri", "CLASS_IRO+(ARG_RS)",},
+  {"@ro", "CLASS_IRO+(ARG_RD)",},
 
   {"imm8", "CLASS_IMM+(ARG_IMM8)",},
   {"i2", "CLASS_IMM+(ARG_IMM2)",},
@@ -741,7 +759,7 @@
   return x;
 }
 
-void
+static void
 chewbits (bits, length)
      char *bits;
      int *length;
@@ -769,9 +787,7 @@
   printf ("}");
 }
 
-
-static
-int
+static int
 chewname (name)
      char **name;
 {
@@ -813,8 +829,7 @@
   return nargs;
 }
 
-static
-void
+static void
 sub (x, c)
      char *x;
      char c;
@@ -835,6 +850,7 @@
 #if 0
 #define D(x) ((x) == '1' || (x) =='0')
 #define M(y) (strncmp(y,x,4)==0)
+static void
 printmangled (x)
      char *x;
 {
@@ -866,10 +882,10 @@
     }
 
 }
-
 #endif
+
 /*#define WORK_TYPE*/
-void
+static void
 print_type (n)
      struct op *n;
 {
@@ -896,8 +912,7 @@
 #endif
 }
 
-
-void
+static void
 internal ()
 {
   int c = count ();
@@ -905,15 +920,13 @@
   struct op *p = opt;
   memcpy (new, p, c * sizeof (struct op));
 
-  /* sort all names in table alphabetically */
+  /* Sort all names in table alphabetically.  */
   qsort (new, c, sizeof (struct op), func);
 
   p = new;
-  while (p->flags[0] != '*')
+  while (p->flags && p->flags[0] != '*')
   {
-    /* If there are any @rs, sub the ssss into a ssn0,
-       (rs), (ssn0)
-       */
+    /* If there are any @rs, sub the ssss into a ssn0, (rs), (ssn0).  */
     int loop = 1;
 
     printf ("\"%s\",%2d, ", p->flags, p->cycles);
@@ -928,7 +941,7 @@
 	{
 	  char c;
 
-	  /* skip the r and sub the string */
+	  /* Skip the r and sub the string.  */
 	  s++;
 	  c = s[1];
 	  sub (p->bits, c);
@@ -952,8 +965,7 @@
   }
 }
 
-static
-void
+static void
 gas ()
 {
   int c = count ();
@@ -964,7 +976,7 @@
 
   memcpy (new, p, c * sizeof (struct op));
 
-  /* sort all names in table alphabetically */
+  /* Sort all names in table alphabetically.  */
   qsort (new, c, sizeof (struct op), func);
 
   printf ("/* DO NOT EDIT!  -*- buffer-read-only: t -*-\n");
@@ -981,6 +993,7 @@
   printf ("#define ARG_RB 0x04\n");
   printf ("#define ARG_RR 0x05\n");
   printf ("#define ARG_RX 0x06\n");
+
   printf ("#define ARG_IMM4 0x01\n");
   printf ("#define ARG_IMM8 0x02\n");
   printf ("#define ARG_IMM16 0x03\n");
@@ -998,7 +1011,7 @@
   printf ("#define ARG_NIM4 0x0c\n");
   printf ("#define ARG_DISP8 0x0c\n");
   printf ("#define ARG_IMM4M1 0x0d\n");
-  printf ("#define CLASS_MASK 0x1fff0\n");
+
   printf ("#define CLASS_X 0x10\n");
   printf ("#define CLASS_BA 0x20\n");
   printf ("#define CLASS_DA 0x30\n");
@@ -1018,9 +1031,10 @@
   printf ("#define CLASS_BIT 0x500\n");
   printf ("#define CLASS_FLAGS 0x600\n");
   printf ("#define CLASS_IR 0x700\n");
-  printf ("#define CLASS_DISP8 0x800\n");
+  printf ("#define CLASS_IRO       0x800\n");
+  printf ("#define CLASS_DISP8     0x900\n");
 
-  printf ("#define CLASS_BIT_1OR2 0x900\n");
+  printf ("#define CLASS_BIT_1OR2  0xa00\n");
   printf ("#define CLASS_REG 0x7000\n");
   printf ("#define CLASS_REG_BYTE 0x2000\n");
   printf ("#define CLASS_REG_WORD 0x3000\n");
@@ -1028,6 +1042,7 @@
   printf ("#define CLASS_REG_LONG 0x5000\n");
   printf ("#define CLASS_REGN0 0x8000\n");
   printf ("#define CLASS_PR 0x10000\n");
+  printf ("#define CLASS_MASK     0x1fff0\n");
 
   printf ("#define OPC_adc 0\n");
   printf ("#define OPC_adcb 1\n");
@@ -1085,139 +1100,155 @@
   printf ("#define OPC_incb 53\n");
   printf ("#define OPC_ind 54\n");
   printf ("#define OPC_indb 55\n");
-  printf ("#define OPC_inib 56\n");
-  printf ("#define OPC_inibr 57\n");
-  printf ("#define OPC_iret 58\n");
-  printf ("#define OPC_jp 59\n");
-  printf ("#define OPC_jr 60\n");
-  printf ("#define OPC_ld 61\n");
-  printf ("#define OPC_lda 62\n");
-  printf ("#define OPC_ldar 63\n");
-  printf ("#define OPC_ldb 64\n");
-  printf ("#define OPC_ldctl 65\n");
-  printf ("#define OPC_ldir 66\n");
-  printf ("#define OPC_ldirb 67\n");
-  printf ("#define OPC_ldk 68\n");
-  printf ("#define OPC_ldl 69\n");
-  printf ("#define OPC_ldm 70\n");
-  printf ("#define OPC_ldps 71\n");
-  printf ("#define OPC_ldr 72\n");
-  printf ("#define OPC_ldrb 73\n");
-  printf ("#define OPC_ldrl 74\n");
-  printf ("#define OPC_mbit 75\n");
-  printf ("#define OPC_mreq 76\n");
-  printf ("#define OPC_mres 77\n");
-  printf ("#define OPC_mset 78\n");
-  printf ("#define OPC_mult 79\n");
-  printf ("#define OPC_multl 80\n");
-  printf ("#define OPC_neg 81\n");
-  printf ("#define OPC_negb 82\n");
-  printf ("#define OPC_nop 83\n");
-  printf ("#define OPC_or 84\n");
-  printf ("#define OPC_orb 85\n");
-  printf ("#define OPC_out 86\n");
-  printf ("#define OPC_outb 87\n");
-  printf ("#define OPC_outd 88\n");
-  printf ("#define OPC_outdb 89\n");
-  printf ("#define OPC_outib 90\n");
-  printf ("#define OPC_outibr 91\n");
-  printf ("#define OPC_pop 92\n");
-  printf ("#define OPC_popl 93\n");
-  printf ("#define OPC_push 94\n");
-  printf ("#define OPC_pushl 95\n");
-  printf ("#define OPC_res 96\n");
-  printf ("#define OPC_resb 97\n");
-  printf ("#define OPC_resflg 98\n");
-  printf ("#define OPC_ret 99\n");
-  printf ("#define OPC_rl 100\n");
-  printf ("#define OPC_rlb 101\n");
-  printf ("#define OPC_rlc 102\n");
-  printf ("#define OPC_rlcb 103\n");
-  printf ("#define OPC_rldb 104\n");
-  printf ("#define OPC_rr 105\n");
-  printf ("#define OPC_rrb 106\n");
-  printf ("#define OPC_rrc 107\n");
-  printf ("#define OPC_rrcb 108\n");
-  printf ("#define OPC_rrdb 109\n");
-  printf ("#define OPC_sbc 110\n");
-  printf ("#define OPC_sbcb 111\n");
-  printf ("#define OPC_sda 112\n");
-  printf ("#define OPC_sdab 113\n");
-  printf ("#define OPC_sdal 114\n");
-  printf ("#define OPC_sdl 115\n");
-  printf ("#define OPC_sdlb 116\n");
-  printf ("#define OPC_sdll 117\n");
-  printf ("#define OPC_set 118\n");
-  printf ("#define OPC_setb 119\n");
-  printf ("#define OPC_setflg 120\n");
-  printf ("#define OPC_sinb 121\n");
-  printf ("#define OPC_sind 122\n");
-  printf ("#define OPC_sindb 123\n");
-  printf ("#define OPC_sinib 124\n");
-  printf ("#define OPC_sinibr 125\n");
-  printf ("#define OPC_sla 126\n");
-  printf ("#define OPC_slab 127\n");
-  printf ("#define OPC_slal 128\n");
-  printf ("#define OPC_sll 129\n");
-  printf ("#define OPC_sllb 130\n");
-  printf ("#define OPC_slll 131\n");
-  printf ("#define OPC_sout 132\n");
-  printf ("#define OPC_soutb 133\n");
-  printf ("#define OPC_soutd 134\n");
-  printf ("#define OPC_soutdb 135\n");
-  printf ("#define OPC_soutib 136\n");
-  printf ("#define OPC_soutibr 137\n");
-  printf ("#define OPC_sra 138\n");
-  printf ("#define OPC_srab 139\n");
-  printf ("#define OPC_sral 140\n");
-  printf ("#define OPC_srl 141\n");
-  printf ("#define OPC_srlb 142\n");
-  printf ("#define OPC_srll 143\n");
-  printf ("#define OPC_sub 144\n");
-  printf ("#define OPC_subb 145\n");
-  printf ("#define OPC_subl 146\n");
-  printf ("#define OPC_tcc 147\n");
-  printf ("#define OPC_tccb 148\n");
-  printf ("#define OPC_test 149\n");
-  printf ("#define OPC_testb 150\n");
-  printf ("#define OPC_testl 151\n");
-  printf ("#define OPC_trdb 152\n");
-  printf ("#define OPC_trdrb 153\n");
-  printf ("#define OPC_trib 154\n");
-  printf ("#define OPC_trirb 155\n");
-  printf ("#define OPC_trtdrb 156\n");
-  printf ("#define OPC_trtib 157\n");
-  printf ("#define OPC_trtirb 158\n");
-  printf ("#define OPC_trtrb 159\n");
-  printf ("#define OPC_tset 160\n");
-  printf ("#define OPC_tsetb 161\n");
-  printf ("#define OPC_xor 162\n");
-  printf ("#define OPC_xorb 163\n");
+  printf ("#define OPC_indr    56\n");
+  printf ("#define OPC_indrb   57\n");
+  printf ("#define OPC_ini     58\n");
+  printf ("#define OPC_inib    59\n");
+  printf ("#define OPC_inir    60\n");
+  printf ("#define OPC_inirb   61\n");
+  printf ("#define OPC_iret    62\n");
+  printf ("#define OPC_jp      63\n");
+  printf ("#define OPC_jr      64\n");
+  printf ("#define OPC_ld      65\n");
+  printf ("#define OPC_lda     66\n");
+  printf ("#define OPC_ldar    67\n");
+  printf ("#define OPC_ldb     68\n");
+  printf ("#define OPC_ldctl   69\n");
+  printf ("#define OPC_ldir    70\n");
+  printf ("#define OPC_ldirb   71\n");
+  printf ("#define OPC_ldk     72\n");
+  printf ("#define OPC_ldl     73\n");
+  printf ("#define OPC_ldm     74\n");
+  printf ("#define OPC_ldps    75\n");
+  printf ("#define OPC_ldr     76\n");
+  printf ("#define OPC_ldrb    77\n");
+  printf ("#define OPC_ldrl    78\n");
+  printf ("#define OPC_mbit    79\n");
+  printf ("#define OPC_mreq    80\n");
+  printf ("#define OPC_mres    81\n");
+  printf ("#define OPC_mset    82\n");
+  printf ("#define OPC_mult    83\n");
+  printf ("#define OPC_multl   84\n");
+  printf ("#define OPC_neg     85\n");
+  printf ("#define OPC_negb    86\n");
+  printf ("#define OPC_nop     87\n");
+  printf ("#define OPC_or      88\n");
+  printf ("#define OPC_orb     89\n");
+  printf ("#define OPC_otdr    90\n");
+  printf ("#define OPC_otdrb   91\n");
+  printf ("#define OPC_otir    92\n");
+  printf ("#define OPC_otirb   93\n");
+  printf ("#define OPC_out     94\n");
+  printf ("#define OPC_outb    95\n");
+  printf ("#define OPC_outd    96\n");
+  printf ("#define OPC_outdb   97\n");
+  printf ("#define OPC_outi    98\n");
+  printf ("#define OPC_outib   99\n");
+  printf ("#define OPC_pop    100\n");
+  printf ("#define OPC_popl   101\n");
+  printf ("#define OPC_push   102\n");
+  printf ("#define OPC_pushl  103\n");
+  printf ("#define OPC_res    104\n");
+  printf ("#define OPC_resb   105\n");
+  printf ("#define OPC_resflg 106\n");
+  printf ("#define OPC_ret    107\n");
+  printf ("#define OPC_rl     108\n");
+  printf ("#define OPC_rlb    109\n");
+  printf ("#define OPC_rlc    110\n");
+  printf ("#define OPC_rlcb   111\n");
+  printf ("#define OPC_rldb   112\n");
+  printf ("#define OPC_rr     113\n");
+  printf ("#define OPC_rrb    114\n");
+  printf ("#define OPC_rrc    115\n");
+  printf ("#define OPC_rrcb   116\n");
+  printf ("#define OPC_rrdb   117\n");
+  printf ("#define OPC_sbc    118\n");
+  printf ("#define OPC_sbcb   119\n");
+  printf ("#define OPC_sda    120\n");
+  printf ("#define OPC_sdab   121\n");
+  printf ("#define OPC_sdal   122\n");
+  printf ("#define OPC_sdl    123\n");
+  printf ("#define OPC_sdlb   124\n");
+  printf ("#define OPC_sdll   125\n");
+  printf ("#define OPC_set    126\n");
+  printf ("#define OPC_setb   127\n");
+  printf ("#define OPC_setflg 128\n");
+  printf ("#define OPC_sin    129\n");
+  printf ("#define OPC_sinb   130\n");
+  printf ("#define OPC_sind   131\n");
+  printf ("#define OPC_sindb  132\n");
+  printf ("#define OPC_sindr  133\n");
+  printf ("#define OPC_sindrb 134\n");
+  printf ("#define OPC_sini   135\n");
+  printf ("#define OPC_sinib  136\n");
+  printf ("#define OPC_sinir  137\n");
+  printf ("#define OPC_sinirb 138\n");
+  printf ("#define OPC_sla    139\n");
+  printf ("#define OPC_slab   140\n");
+  printf ("#define OPC_slal   141\n");
+  printf ("#define OPC_sll    142\n");
+  printf ("#define OPC_sllb   143\n");
+  printf ("#define OPC_slll   144\n");
+  printf ("#define OPC_sotdr  145\n");
+  printf ("#define OPC_sotdrb 146\n");
+  printf ("#define OPC_sotir  147\n");
+  printf ("#define OPC_sotirb 148\n");
+  printf ("#define OPC_sout   149\n");
+  printf ("#define OPC_soutb  150\n");
+  printf ("#define OPC_soutd  151\n");
+  printf ("#define OPC_soutdb 152\n");
+  printf ("#define OPC_souti  153\n");
+  printf ("#define OPC_soutib 154\n");
+  printf ("#define OPC_sra    155\n");
+  printf ("#define OPC_srab   156\n");
+  printf ("#define OPC_sral   157\n");
+  printf ("#define OPC_srl    158\n");
+  printf ("#define OPC_srlb   159\n");
+  printf ("#define OPC_srll   160\n");
+  printf ("#define OPC_sub    161\n");
+  printf ("#define OPC_subb   162\n");
+  printf ("#define OPC_subl   163\n");
+  printf ("#define OPC_tcc    164\n");
+  printf ("#define OPC_tccb   165\n");
+  printf ("#define OPC_test   166\n");
+  printf ("#define OPC_testb  167\n");
+  printf ("#define OPC_testl  168\n");
+  printf ("#define OPC_trdb   169\n");
+  printf ("#define OPC_trdrb  170\n");
+  printf ("#define OPC_trib   171\n");
+  printf ("#define OPC_trirb  172\n");
+  printf ("#define OPC_trtdrb 173\n");
+  printf ("#define OPC_trtib  174\n");
+  printf ("#define OPC_trtirb 175\n");
+  printf ("#define OPC_trtrb  176\n");
+  printf ("#define OPC_tset   177\n");
+  printf ("#define OPC_tsetb  178\n");
+  printf ("#define OPC_xor    179\n");
+  printf ("#define OPC_xorb   180\n");
 
-  printf ("#define OPC_ldd  164 \n");
-  printf ("#define OPC_lddb  165 \n");
-  printf ("#define OPC_lddr  166 \n");
-  printf ("#define OPC_lddrb 167  \n");
-  printf ("#define OPC_ldi  168 \n");
-  printf ("#define OPC_ldib 169  \n");
-  printf ("#define OPC_sc   170\n");
-  printf ("#define OPC_bpt   171\n");
-  printf ("#define OPC_ext0e 172\n");
-  printf ("#define OPC_ext0f 172\n");
-  printf ("#define OPC_ext8e 172\n");
-  printf ("#define OPC_ext8f 172\n");
-  printf ("#define OPC_rsvd36 172\n");
-  printf ("#define OPC_rsvd38 172\n");
-  printf ("#define OPC_rsvd78 172\n");
-  printf ("#define OPC_rsvd7e 172\n");
-  printf ("#define OPC_rsvd9d 172\n");
-  printf ("#define OPC_rsvd9f 172\n");
-  printf ("#define OPC_rsvdb9 172\n");
-  printf ("#define OPC_rsvdbf 172\n");
-  printf ("#define OPC_outi 173\n");
-  printf ("#define OPC_ldctlb 174\n");
-  printf ("#define OPC_sin 175\n");
-  printf ("#define OPC_trtdb 176\n");
+  printf ("#define OPC_ldd    181\n");
+  printf ("#define OPC_lddb   182\n");
+  printf ("#define OPC_lddr   183\n");
+  printf ("#define OPC_lddrb  184\n");
+  printf ("#define OPC_ldi    185\n");
+  printf ("#define OPC_ldib   186\n");
+  printf ("#define OPC_sc     187\n");
+  printf ("#define OPC_bpt    188\n");
+  printf ("#define OPC_ext0e  188\n");
+  printf ("#define OPC_ext0f  188\n");
+  printf ("#define OPC_ext8e  188\n");
+  printf ("#define OPC_ext8f  188\n");
+  printf ("#define OPC_rsvd36 188\n");
+  printf ("#define OPC_rsvd38 188\n");
+  printf ("#define OPC_rsvd78 188\n");
+  printf ("#define OPC_rsvd7e 188\n");
+  printf ("#define OPC_rsvd9d 188\n");
+  printf ("#define OPC_rsvd9f 188\n");
+  printf ("#define OPC_rsvdb9 188\n");
+  printf ("#define OPC_rsvdbf 188\n");
+  printf ("#define OPC_ldctlb 189\n");
+  printf ("#define OPC_trtdb  190\n");
+  printf ("#define OPC_brk    191\n");
 #if 0
   for (i = 0; toks[i].token; i++)
     printf ("#define %s\t0x%x\n", toks[i].token, i * 16);
@@ -1290,7 +1321,6 @@
   printf ("#endif\n");
 }
 
-
 int
 main (ac, av)
      int ac;
@@ -1315,16 +1345,11 @@
     {
       gas ();
     }
-  else if (ac == 2 && strcmp (av[1], "-d") == 0)
-    {
-      /*dis();*/
-    }
   else
     {
       printf ("Usage: %s -t\n", av[0]);
-      printf ("-t : generate new z8.c internal table\n");
+      printf ("-t : generate new internal table\n");
       printf ("-a : generate new table for gas\n");
-      printf ("-d : generate new table for disassemble\n");
       printf ("-h : generate new table for humans\n");
     }
   return 0;
diff --git a/readline/ChangeLog.gdb b/readline/ChangeLog.gdb
index 3cb58e2..affba35 100644
--- a/readline/ChangeLog.gdb
+++ b/readline/ChangeLog.gdb
@@ -1,3 +1,8 @@
+2003-06-14  H.J. Lu <hongjiu.lu@intel.com>
+ 
+	* support/config.guess: Update to 2003-06-12 version.
+	* support/config.sub: Update to 2003-06-13 version.
+
 2003-05-25  Mark Kettenis  <kettenis@gnu.org>
 
 	* aclocal.m4: Don't add wcwidth.o if we don't have wchar.h.
diff --git a/readline/support/config.guess b/readline/support/config.guess
index 6bdac8d..fa58459 100755
--- a/readline/support/config.guess
+++ b/readline/support/config.guess
@@ -3,7 +3,7 @@
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
 #   2000, 2001, 2002, 2003 Free Software Foundation, Inc.
 
-timestamp='2003-05-09'
+timestamp='2003-06-12'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -106,6 +106,7 @@
 : ${TMPDIR=/tmp} ;
  { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
  { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
  { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
 dummy=$tmp/dummy ;
 tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
@@ -282,6 +283,9 @@
 	# 1.2 uses "1.2" for uname -r.
 	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
 	exit 0 ;;
+    Alpha*:OpenVMS:*:*)
+	echo alpha-hp-vms
+	exit 0 ;;
     Alpha\ *:Windows_NT*:*)
 	# How do we know it's Interix rather than the generic POSIX subsystem?
 	# Should we change UNAME_MACHINE based on the output of uname instead
@@ -320,6 +324,9 @@
     NILE*:*:*:dcosx)
 	echo pyramid-pyramid-svr4
 	exit 0 ;;
+    DRS?6000:unix:4.0:6*)
+	echo sparc-icl-nx6
+	exit 0 ;;
     DRS?6000:UNIX_SV:4.2*:7*)
 	case `/usr/bin/uname -p` in
 	    sparc) echo sparc-icl-nx7 && exit 0 ;;
@@ -767,8 +774,8 @@
     i*:PW*:*)
 	echo ${UNAME_MACHINE}-pc-pw32
 	exit 0 ;;
-    x86:Interix*:3*)
-	echo i586-pc-interix3
+    x86:Interix*:[34]*)
+	echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
 	exit 0 ;;
     [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
 	echo i${UNAME_MACHINE}-pc-mks
@@ -797,6 +804,9 @@
     arm*:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit 0 ;;
+    cris:Linux:*:*)
+	echo cris-axis-linux-gnu
+	exit 0 ;;
     ia64:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit 0 ;;
diff --git a/readline/support/config.sub b/readline/support/config.sub
index fe4f1ed..725707f 100755
--- a/readline/support/config.sub
+++ b/readline/support/config.sub
@@ -3,7 +3,7 @@
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
 #   2000, 2001, 2002, 2003 Free Software Foundation, Inc.
 
-timestamp='2003-05-09'
+timestamp='2003-06-13'
 
 # This file is (in principle) common to ALL GNU software.
 # The presence of a machine in this file suggests that SOME GNU software
@@ -229,7 +229,7 @@
 	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
 	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
 	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
-	| clipper \
+	| c4x | clipper \
 	| d10v | d30v | dlx | dsp16xx \
 	| fr30 | frv \
 	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
@@ -261,7 +261,7 @@
 	| sh64 | sh64le \
 	| sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \
 	| strongarm \
-	| tahoe | thumb | tic80 | tron \
+	| tahoe | thumb | tic4x | tic80 | tron \
 	| v850 | v850e \
 	| we32k \
 	| x86 | xscale | xstormy16 | xtensa \
@@ -771,18 +771,24 @@
 	pentiumpro | p6 | 6x86 | athlon | athlon_*)
 		basic_machine=i686-pc
 		;;
-	pentiumii | pentium2)
+	pentiumii | pentium2 | pentiumiii | pentium3)
 		basic_machine=i686-pc
 		;;
+	pentium4)
+		basic_machine=i786-pc
+		;;
 	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
 		basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
 	pentiumpro-* | p6-* | 6x86-* | athlon-*)
 		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
-	pentiumii-* | pentium2-*)
+	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
 		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
+	pentium4-*)
+		basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
 	pn)
 		basic_machine=pn-gould
 		;;
@@ -922,10 +928,6 @@
 		basic_machine=t90-cray
 		os=-unicos
 		;;
-        tic4x | c4x*)
-		basic_machine=tic4x-unknown
-		os=-coff
-		;;
 	tic54x | c54x*)
 		basic_machine=tic54x-unknown
 		os=-coff
@@ -1131,7 +1133,7 @@
 	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
 	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
 	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
-	      | -powermax* | -dnix*)
+	      | -powermax* | -dnix* | -nx6 | -nx7)
 	# Remember, each alternative MUST END IN *, to match a version number.
 		;;
 	-qnx*)
@@ -1277,6 +1279,9 @@
 	arm*-semi)
 		os=-aout
 		;;
+    c4x-* | tic4x-*)
+        os=-coff
+        ;;
 	# This must come before the *-dec entry.
 	pdp10-*)
 		os=-tops20
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index 71c3c38..9417d32 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,3 +1,18 @@
+2003-06-22  Andrew Cagney  <cagney@redhat.com>
+
+	From matthew green <mrg@redhat.com>:
+        * sim-fpu.h: Update copyright.
+	(sim_fpu_fraction, sim_fpu_guard): New prototypes.
+        * sim-fpu.c: Update copyright.
+	(sim_fpu_fraction, sim_fpu_guard): New inline functions.
+
+2003-06-17  Frank Ch. Eigler  <fche@redhat.com>
+
+	From Doug Evans <dje@sebabeach.org>:
+	* cgen-trace.h (sim_disasm_read_memory): Update args to be compatible
+	with disassemble_info:read_memory_func.
+	* cgen-trace.c (sim_disasm_read_memory): Ditto.
+
 2003-06-04  Michael Snyder  <msnyder@redhat.com>
 
 	* common/run.c (main): Remove SIM_H8300 ifdef.
diff --git a/sim/common/cgen-trace.c b/sim/common/cgen-trace.c
index 765ab57..d978d3e 100644
--- a/sim/common/cgen-trace.c
+++ b/sim/common/cgen-trace.c
@@ -322,12 +322,12 @@
 /* Memory read support for an opcodes disassembler.  */
 
 int
-sim_disasm_read_memory (bfd_vma memaddr, bfd_byte *myaddr, int length,
+sim_disasm_read_memory (bfd_vma memaddr, bfd_byte *myaddr, unsigned int length,
 			struct disassemble_info *info)
 {
   SIM_CPU *cpu = (SIM_CPU *) info->application_data;
   SIM_DESC sd = CPU_STATE (cpu);
-  int length_read;
+  unsigned length_read;
 
   length_read = sim_core_read_buffer (sd, cpu, read_map, myaddr, memaddr,
 				      length);
diff --git a/sim/common/cgen-trace.h b/sim/common/cgen-trace.h
index be1dd1d..623fc1e 100644
--- a/sim/common/cgen-trace.h
+++ b/sim/common/cgen-trace.h
@@ -81,7 +81,7 @@
 #ifdef __BFD_H_SEEN__
 struct disassemble_info;
 extern int
-sim_disasm_read_memory (bfd_vma memaddr_, bfd_byte *myaddr_, int length_,
+sim_disasm_read_memory (bfd_vma memaddr_, bfd_byte *myaddr_, unsigned int length_,
 			struct disassemble_info *info_);
 extern void
 sim_disasm_perror_memory (int status_, bfd_vma memaddr_,
diff --git a/sim/common/sim-fpu.c b/sim/common/sim-fpu.c
index 14505f6..845248a 100644
--- a/sim/common/sim-fpu.c
+++ b/sim/common/sim-fpu.c
@@ -2,7 +2,7 @@
    of the floating point routines in libgcc1.c for targets without
    hardware floating point.  */
 
-/* Copyright (C) 1994,1997-1998 Free Software Foundation, Inc.
+/* Copyright 1994, 1997, 1998, 2003 Free Software Foundation, Inc.
 
 This file is free software; you can redistribute it and/or modify it
 under the terms of the GNU General Public License as published by the
@@ -2188,6 +2188,22 @@
 }
 
 
+INLINE_SIM_FPU (unsigned64)
+sim_fpu_fraction (const sim_fpu *d)
+{
+  return d->fraction;
+}
+
+
+INLINE_SIM_FPU (unsigned64)
+sim_fpu_guard (const sim_fpu *d, int is_double)
+{
+  unsigned64 rv;
+  unsigned64 guardmask = LSMASK64 (NR_GUARDS - 1, 0);
+  rv = (d->fraction & guardmask) >> NR_PAD;
+  return rv;
+}
+
 
 INLINE_SIM_FPU (int)
 sim_fpu_is (const sim_fpu *d)
diff --git a/sim/common/sim-fpu.h b/sim/common/sim-fpu.h
index 72323f5..579fbaa 100644
--- a/sim/common/sim-fpu.h
+++ b/sim/common/sim-fpu.h
@@ -1,5 +1,7 @@
 /* Simulator Floating-point support.
-   Copyright (C) 1997, 1998, 2002 Free Software Foundation, Inc.
+
+   Copyright 1997, 1998, 2002, 2003 Free Software Foundation, Inc.
+
    Contributed by Cygnus Support.
 
 This file is part of GDB, the GNU debugger.
@@ -316,6 +318,8 @@
 
 INLINE_SIM_FPU (int) sim_fpu_sign (const sim_fpu *s);
 INLINE_SIM_FPU (int) sim_fpu_exp (const sim_fpu *s);
+INLINE_SIM_FPU (unsigned64) sim_fpu_fraction (const sim_fpu *s);
+INLINE_SIM_FPU (unsigned64) sim_fpu_guard (const sim_fpu *s, int is_double);
 
 
 
diff --git a/sim/d10v/ChangeLog b/sim/d10v/ChangeLog
index 3256284..f8e70a5 100644
--- a/sim/d10v/ChangeLog
+++ b/sim/d10v/ChangeLog
@@ -1,3 +1,8 @@
+2003-06-22  Andrew Cagney  <cagney@redhat.com>
+
+	* interp.c (xfer_mem): Simplify.  Only do a single partial
+	transfer.  Problem reported by Tom Rix.
+
 2003-05-07  Andrew Cagney  <cagney@redhat.com>
 
 	* interp.c (sim_d10v_translate_addr): Add "regcache" parameter.
diff --git a/sim/d10v/interp.c b/sim/d10v/interp.c
index 30239ab..284a4e1 100644
--- a/sim/d10v/interp.c
+++ b/sim/d10v/interp.c
@@ -720,49 +720,39 @@
 	  int size,
 	  int write_p)
 {
-  int xfered = 0;
+  uint8 *memory;
+  unsigned long phys;
+  int phys_size;
+  phys_size = sim_d10v_translate_addr (virt, size, &phys, NULL,
+				       dmap_register, imap_register);
+  if (phys_size == 0)
+    return 0;
 
-  while (0 < size)
-    {
-      uint8 *memory;
-      unsigned long phys;
-      int phys_size;
-      phys_size = sim_d10v_translate_addr (virt, size, &phys, NULL,
-					   dmap_register, imap_register);
-      if (phys_size == 0)
-	return xfered;
-
-      memory = map_memory (phys);
+  memory = map_memory (phys);
 
 #ifdef DEBUG
-      if ((d10v_debug & DEBUG_INSTRUCTION) != 0)
-	{
-	  (*d10v_callback->printf_filtered)
-	    (d10v_callback,
-	     "sim_%s %d bytes: 0x%08lx (%s) -> 0x%08lx (%s) -> 0x%08lx (%s)\n",
+  if ((d10v_debug & DEBUG_INSTRUCTION) != 0)
+    {
+      (*d10v_callback->printf_filtered)
+	(d10v_callback,
+	 "sim_%s %d bytes: 0x%08lx (%s) -> 0x%08lx (%s) -> 0x%08lx (%s)\n",
 	     (write_p ? "write" : "read"),
-	     phys_size, virt, last_from,
-	     phys, last_to,
-	     (long) memory, last_segname);
-	}
+	 phys_size, virt, last_from,
+	 phys, last_to,
+	 (long) memory, last_segname);
+    }
 #endif
 
-      if (write_p)
-	{
-	  memcpy (memory, buffer, phys_size);
-	}
-      else
-	{
-	  memcpy (buffer, memory, phys_size);
-	}
-
-      virt += phys_size;
-      buffer += phys_size;
-      xfered += phys_size;
-      size -= phys_size;
+  if (write_p)
+    {
+      memcpy (memory, buffer, phys_size);
     }
-
-  return xfered;
+  else
+    {
+      memcpy (buffer, memory, phys_size);
+    }
+  
+  return phys_size;
 }
 
 
diff --git a/sim/h8300/ChangeLog b/sim/h8300/ChangeLog
index e35d2b7..cd81e6e 100644
--- a/sim/h8300/ChangeLog
+++ b/sim/h8300/ChangeLog
@@ -1,8 +1,32 @@
+2003-06-18  Michael Snyder  <msnyder@redhat.com>
+
+	* compile.c: Replace "Hitachi" with "Renesas".
+	(decode): Distinguish AV_H8S from AV_H8H.
+	(sim_resume): H8SX can use any register for TAS.
+	(decode): Add support for VECIND.
+	(sim_resume): Implement rte/l and rts/l.
+	(GETSR): New macro (actually old macro reincarnated).
+	(decode): Add handling for IMM2.
+	(sim_resume): Drop extra block around jmp, jsr, rts.
+	Add handling for trapa and rte.
+	For divxu.b, change 0xffff mask to 0xff.
+	(set_h8300h): Add bfd_mach_h8300sxn machine.
+
+2003-06-18  Corinna Vinschen  <vinschen@redhat.com>
+
+	* sim-main.h (enum h8_regnum): Turn around order of MACH, MACL
+	and SBR, VBR.
+
+2003-06-05  Michael Snyder  <msnyder@redhat.com>
+
+	* compile.c (sim_fetch_register): Handle SBR, VBR, MACH, MACL.
+	(sim_store_register): Ditto.
+
 2003-06-04  Michael Snyder  <msnyder@redhat.com>
 
 	* compile.c (sim_info): Fix typo in output.
 
-	* h8300/compile.c (set_h8300h): Replace 'flag' arguments
+	* compile.c (set_h8300h): Replace 'flag' arguments
 	with a bfd_machine argument, and decode it inline.
 	Check for bfd_mach_h8300hn and bfd_mach_h8300sn.
 
diff --git a/sim/h8300/compile.c b/sim/h8300/compile.c
index c71658e..f416695 100644
--- a/sim/h8300/compile.c
+++ b/sim/h8300/compile.c
@@ -1,5 +1,5 @@
 /*
- * Simulator for the Hitachi H8/300 architecture.
+ * Simulator for the Renesas (formerly Hitachi) H8/300 architecture.
  *
  * Written by Steve Chamberlain of Cygnus Support. sac@cygnus.com
  *
@@ -484,6 +484,18 @@
   h8_set_ccr (SD, (I << 7) | (UI << 6) | (H << 5) | (U << 4)	\
 	     | (N << 3) | (Z << 2) | (V << 1) | C)
 
+#define GETSR(SD) \
+  /* Get Status Register (flags).  */		\
+  c = (h8_get_ccr (sd) >> 0) & 1;		\
+  v = (h8_get_ccr (sd) >> 1) & 1;		\
+  nz = !((h8_get_ccr (sd) >> 2) & 1);		\
+  n = (h8_get_ccr (sd) >> 3) & 1;		\
+  u = (h8_get_ccr (sd) >> 4) & 1;		\
+  h = (h8_get_ccr (sd) >> 5) & 1;		\
+  ui = ((h8_get_ccr (sd) >> 6) & 1);		\
+  intMaskBit = (h8_get_ccr (sd) >> 7) & 1
+
+
 #ifdef __CHAR_IS_SIGNED__
 #define SEXTCHAR(x) ((char) (x))
 #endif
@@ -590,6 +602,7 @@
       unsigned int len = 0;
 
       if ((q->available == AV_H8SX && !h8300sxmode) ||
+	  (q->available == AV_H8S  && !h8300smode)  ||
 	  (q->available == AV_H8H  && !h8300hmode))
 	continue;
 
@@ -831,6 +844,12 @@
 		{
 		  cst[opnum] = data[1];
 		}
+	      else if ((looking_for & MODE) == VECIND)
+		{
+		  /* FIXME: Multiplier should be 2 for "normal" mode.  */
+		  cst[opnum] = ((data[1] & 0x7f) + 0x80) * 4;
+		  cst[opnum] += h8_get_vbr (sd); /* Add vector base reg.  */
+		}
 	      else if ((looking_for & SIZE) == L_32)
 		{
 		  int i = len / 2;
@@ -885,6 +904,10 @@
 		      cst[opnum] = data[len / 2] & 0xff;
 		    }
 		}
+	      else if ((looking_for & SIZE) == L_2)
+		{
+		  cst[opnum] = thisnib & 3;
+		}
 	      else if ((looking_for & SIZE) == L_3 ||
 		       (looking_for & SIZE) == L_3NZ)
 		{
@@ -1025,7 +1048,8 @@
 			    else
 			      p->reg = ZERO_REGNUM;;
 			  }
-			else if ((x & MODE) == MEMIND)
+			else if ((x & MODE) == MEMIND ||
+				 (x & MODE) == VECIND)
 			  {
 			    /* Size doesn't matter.  */
 			    p->type = X (OP_MEM, SB);
@@ -1104,7 +1128,7 @@
 			    p->type = OP_EXR;
 			  }
 			else
-			  printf ("Hmmmm %x...\n", x);
+			  printf ("Hmmmm 0x%x...\n", x);
 
 			args++;
 		      }
@@ -1158,7 +1182,7 @@
 		  return;
 		}
 	      else
-		printf ("Don't understand %x \n", looking_for);
+		printf ("Don't understand 0x%x \n", looking_for);
 	    }
 
 	  len++;
@@ -1893,14 +1917,7 @@
     }
 
   /* Get Status Register (flags).  */
-  c = (h8_get_ccr (sd) >> 0) & 1;
-  v = (h8_get_ccr (sd) >> 1) & 1;
-  nz = !((h8_get_ccr (sd) >> 2) & 1);
-  n = (h8_get_ccr (sd) >> 3) & 1;
-  u = (h8_get_ccr (sd) >> 4) & 1;
-  h = (h8_get_ccr (sd) >> 5) & 1;
-  ui = ((h8_get_ccr (sd) >> 6) & 1);
-  intMaskBit = (h8_get_ccr (sd) >> 7) & 1;
+  GETSR (sd);
 
   if (h8300smode)	/* Get exr.  */
     {
@@ -2197,7 +2214,7 @@
 	    goto end;
 	  goto just_flags_log32;
 
-	case O (O_MOVMD, SB):		/* movsd.b */
+	case O (O_MOVMD, SB):		/* movmd.b */
 	  ea = GET_W_REG (4);
 	  if (ea == 0)
 	    ea = 0x10000;
@@ -2212,7 +2229,7 @@
 	    }
 	  goto next;
 
-	case O (O_MOVMD, SW):		/* movsd.b */
+	case O (O_MOVMD, SW):		/* movmd.w */
 	  ea = GET_W_REG (4);
 	  if (ea == 0)
 	    ea = 0x10000;
@@ -2227,7 +2244,7 @@
 	    }
 	  goto next;
 
-	case O (O_MOVMD, SL):		/* movsd.b */
+	case O (O_MOVMD, SL):		/* movmd.l */
 	  ea = GET_W_REG (4);
 	  if (ea == 0)
 	    ea = 0x10000;
@@ -3463,36 +3480,31 @@
         case O (O_JMP, SL):
         case O (O_JMP, SB):		/* jmp */
         case O (O_JMP, SW):
-	  {
-	    fetch (sd, &code->src, &pc);
-	    goto end;
-	  }
+	  fetch (sd, &code->src, &pc);
+	  goto end;
 
 	case O (O_JSR, SN):
 	case O (O_JSR, SL):
 	case O (O_JSR, SB):		/* jsr, jump to subroutine */
 	case O (O_JSR, SW):
-	  {
-	    int tmp;
-	    if (fetch (sd, &code->src, &pc))
-	      goto end;
-	  call:
-	    tmp = h8_get_reg (sd, SP_REGNUM);
-
-	    if (h8300hmode)
-	      {
-		tmp -= 4;
-		SET_MEMORY_L (tmp, code->next_pc);
-	      }
-	    else
-	      {
-		tmp -= 2;
-		SET_MEMORY_W (tmp, code->next_pc);
-	      }
-	    h8_set_reg (sd, SP_REGNUM, tmp);
-
+	  if (fetch (sd, &code->src, &pc))
 	    goto end;
-	  }
+	call:
+	  tmp = h8_get_reg (sd, SP_REGNUM);
+
+	  if (h8300hmode)
+	    {
+	      tmp -= 4;
+	      SET_MEMORY_L (tmp, code->next_pc);
+	    }
+	  else
+	    {
+	      tmp -= 2;
+	      SET_MEMORY_W (tmp, code->next_pc);
+	    }
+	  h8_set_reg (sd, SP_REGNUM, tmp);
+
+	  goto end;
 
 	case O (O_BSR, SW):
 	case O (O_BSR, SL):
@@ -3502,26 +3514,52 @@
 	  pc = code->next_pc + res;
 	  goto call;
 
+	case O (O_RTE, SN):		/* rte, return from exception */
+	rte:
+	  /* Pops exr and ccr before pc -- otherwise identical to rts.  */
+	  tmp = h8_get_reg (sd, SP_REGNUM);
+
+	  if (h8300smode)			/* pop exr */
+	    {
+	      h8_set_exr (sd, GET_MEMORY_L (tmp));
+	      tmp += 4;
+	    }
+	  if (h8300hmode)
+	    {
+	      h8_set_ccr (sd, GET_MEMORY_L (tmp));
+	      tmp += 4;
+	      pc = GET_MEMORY_L (tmp);
+	      tmp += 4;
+	    }
+	  else
+	    {
+	      h8_set_ccr (sd, GET_MEMORY_W (tmp));
+	      tmp += 2;
+	      pc = GET_MEMORY_W (tmp);
+	      tmp += 2;
+	    }
+
+	  GETSR (sd);
+	  h8_set_reg (sd, SP_REGNUM, tmp);
+	  goto end;
+
 	case O (O_RTS, SN):		/* rts, return from subroutine */
-	  {
-	    int tmp;
+	rts:
+	  tmp = h8_get_reg (sd, SP_REGNUM);
 
-	    tmp = h8_get_reg (sd, SP_REGNUM);
+	  if (h8300hmode)
+	    {
+	      pc = GET_MEMORY_L (tmp);
+	      tmp += 4;
+	    }
+	  else
+	    {
+	      pc = GET_MEMORY_W (tmp);
+	      tmp += 2;
+	    }
 
-	    if (h8300hmode)
-	      {
-		pc = GET_MEMORY_L (tmp);
-		tmp += 4;
-	      }
-	    else
-	      {
-		pc = GET_MEMORY_W (tmp);
-		tmp += 2;
-	      }
-
-	    h8_set_reg (sd, SP_REGNUM, tmp);
-	    goto end;
-	  }
+	  h8_set_reg (sd, SP_REGNUM, tmp);
+	  goto end;
 
 	case O (O_ILL, SB):		/* illegal */
 	  sim_engine_set_run_state (sd, sim_stopped, SIGILL);
@@ -3544,6 +3582,30 @@
 	    }
 	  goto end;
 
+	case O (O_TRAPA, SB):		/* trapa */
+	  if (fetch (sd, &code->src, &res))
+	    goto end;			/* res is vector number.  */
+
+	  tmp = h8_get_reg (sd, SP_REGNUM);
+	  tmp -= 4;
+	  SET_MEMORY_L (tmp, code->next_pc);
+	  tmp -= 4; 
+	  SET_MEMORY_L (tmp, h8_get_ccr (sd));
+	  intMaskBit = 1;
+	  BUILDSR (sd);
+
+	  if (h8300smode)
+	    {
+	      tmp -= 4;
+	      SET_MEMORY_L (tmp, h8_get_exr (sd));
+	    }
+
+	  h8_set_reg (sd, SP_REGNUM, tmp);
+
+	  /* FIXME: "normal" mode should use 2-byte ptrs.  */
+	  pc = GET_MEMORY_L (0x20 + res * 4);
+	  goto end;
+
 	case O (O_BPT, SN):
 	  sim_engine_set_run_state (sd, sim_stopped, SIGTRAP);
 	  goto end;
@@ -3898,19 +3960,19 @@
 
 	  goto next;
 
-	case O (O_TAS, SB):		/* tas, (test and set?) */
-	  if (!h8300smode || code->src.type != X (OP_REG, SL))
-	    goto illegal;
-	  switch (code->src.reg)
-	    {
-	    case R0_REGNUM:
-	    case R1_REGNUM:
-	    case R4_REGNUM:
-	    case R5_REGNUM:
-	      break;
-	    default:
-	      goto illegal;
-	    }
+	case O (O_TAS, SB):		/* tas (test and set) */
+	  if (!h8300sxmode)		/* h8sx can use any register. */
+	    switch (code->src.reg)
+	      {
+	      case R0_REGNUM:
+	      case R1_REGNUM:
+	      case R4_REGNUM:
+	      case R5_REGNUM:
+		break;
+	      default:
+		goto illegal;
+	      }
+
 	  if (fetch (sd, &code->src, &res))
 	    goto end;
 	  if (store (sd, &code->src, res | 0x80))
@@ -4023,7 +4085,7 @@
 	      res = 0;
 	    }
 
-	  if (store (sd, &code->dst, (res & 0xffff) | (tmp << 8)))
+	  if (store (sd, &code->dst, (res & 0xff) | (tmp << 8)))
 	    goto end;
 	  goto next;
 
@@ -4190,25 +4252,33 @@
 	  goto next;
 
 	case O (O_LDM, SL):			/* ldm,  load from memory */
+	case O (O_RTEL, SN):			/* rte/l, ldm plus rte */
+	case O (O_RTSL, SN):			/* rts/l, ldm plus rts */
 	  {
 	    int nregs, firstreg, i;
 
-	    nregs = GET_MEMORY_B (pc + 1);
-	    nregs >>= 4;
-	    nregs &= 0xf;
-	    firstreg = code->dst.reg;
-	    firstreg &= 0xf;
+	    nregs = ((GET_MEMORY_B (pc + 1) >> 4) & 0xf);
+	    firstreg = code->dst.reg & 0xf;
 	    for (i = firstreg; i >= firstreg - nregs; i--)
 	      {
 		h8_set_reg (sd, i, GET_MEMORY_L (h8_get_reg (sd, SP_REGNUM)));
 		h8_set_reg (sd, SP_REGNUM, h8_get_reg (sd, SP_REGNUM) + 4);
 	      }
 	  }
-	  goto next;
+	  switch (code->opcode) {
+	  case O (O_RTEL, SN):
+	    goto rte;
+	  case O (O_RTSL, SN):
+	    goto rts;
+	  case O (O_LDM, SL):
+	    goto next;
+	  default:
+	    goto illegal;
+	  }
 
 	case O (O_DAA, SB):
 	  /* Decimal Adjust Addition.  This is for BCD arithmetic.  */
-	  res = GET_B_REG (code->src.reg);
+	  res = GET_B_REG (code->src.reg);	/* FIXME fetch? */
 	  if (!c && (0 <= (res >>  4) && (res >>  4) <= 9) && 
 	      !h && (0 <= (res & 0xf) && (res & 0xf) <= 9))
 	    res = res;		/* Value added == 0.  */
@@ -4274,15 +4344,7 @@
 	  code->dst.type == X (OP_CCR, SW))
 	{
 	  h8_set_ccr (sd, res);
-	  /* Get Status Register (flags).  */
-	  c = (h8_get_ccr (sd) >> 0) & 1;
-	  v = (h8_get_ccr (sd) >> 1) & 1;
-	  nz = !((h8_get_ccr (sd) >> 2) & 1);
-	  n = (h8_get_ccr (sd) >> 3) & 1;
-	  u = (h8_get_ccr (sd) >> 4) & 1;
-	  h = (h8_get_ccr (sd) >> 5) & 1;
-	  ui = ((h8_get_ccr (sd) >> 6) & 1);
-	  intMaskBit = (h8_get_ccr (sd) >> 7) & 1;
+	  GETSR (sd);
 	}
       else if (h8300smode &&
 	       (code->dst.type == X (OP_EXR, SB) ||
@@ -4592,6 +4654,18 @@
     case EXR_REGNUM:
       h8_set_exr (sd, intval);
       break;
+    case SBR_REGNUM:
+      h8_set_sbr (sd, intval);
+      break;
+    case VBR_REGNUM:
+      h8_set_vbr (sd, intval);
+      break;
+    case MACH_REGNUM:
+      h8_set_mach (sd, intval);
+      break;
+    case MACL_REGNUM:
+      h8_set_macl (sd, intval);
+      break;
     case CYCLE_REGNUM:
       h8_set_cycles (sd, longval);
       break;
@@ -4634,6 +4708,18 @@
     case PC_REGNUM:
       v = h8_get_pc (sd);
       break;
+    case SBR_REGNUM:
+      v = h8_get_sbr (sd);
+      break;
+    case VBR_REGNUM:
+      v = h8_get_vbr (sd);
+      break;
+    case MACH_REGNUM:
+      v = h8_get_mach (sd);
+      break;
+    case MACL_REGNUM:
+      v = h8_get_macl (sd);
+      break;
     case R0_REGNUM:
     case R1_REGNUM:
     case R2_REGNUM:
@@ -4754,7 +4840,7 @@
      This function being replaced by a sim_open:ARGV configuration
      option.  */
 
-  if (machine == bfd_mach_h8300sx)
+  if (machine == bfd_mach_h8300sx || machine == bfd_mach_h8300sxn)
     h8300sxmode = 1;
 
   if (machine == bfd_mach_h8300s || machine == bfd_mach_h8300sn || h8300sxmode)
diff --git a/sim/h8300/sim-main.h b/sim/h8300/sim-main.h
index 11fc320..6acf901 100644
--- a/sim/h8300/sim-main.h
+++ b/sim/h8300/sim-main.h
@@ -51,10 +51,10 @@
   EXR_REGNUM  = 11,
   INST_REGNUM = 12,
   TICK_REGNUM = 13,
-  SBR_REGNUM =  14, 
-  VBR_REGNUM =  15,
-  MACH_REGNUM = 16, 
-  MACL_REGNUM = 17,
+  MACH_REGNUM = 14,
+  MACL_REGNUM = 15,
+  SBR_REGNUM =  16,
+  VBR_REGNUM =  17,
 
   ZERO_REGNUM = 18
 };
diff --git a/sim/mips/ChangeLog b/sim/mips/ChangeLog
index 4d20a00..e5b5216 100644
--- a/sim/mips/ChangeLog
+++ b/sim/mips/ChangeLog
@@ -1,3 +1,7 @@
+2003-06-17  Richard Sandiford  <rsandifo@redhat.com>
+
+	* mips.igen (do_dmultx): Fix check for negative operands.
+
 2003-05-16  Ian Lance Taylor  <ian@airs.com>
 
 	* Makefile.in (SHELL): Make sure this is defined.
diff --git a/sim/mips/mips.igen b/sim/mips/mips.igen
index 81fb200..358c8ab 100644
--- a/sim/mips/mips.igen
+++ b/sim/mips/mips.igen
@@ -1347,12 +1347,12 @@
   sign = 0;
   if (signed_p)
     {
-      if (op1 < 0)
+      if ((signed64) op1 < 0)
 	{
 	  op1 = - op1;
 	  ++sign;
 	}
-      if (op2 < 0)
+      if ((signed64) op2 < 0)
 	{
 	  op2 = - op2;
 	  ++sign;
diff --git a/sim/ppc/ChangeLog b/sim/ppc/ChangeLog
index b7b1de5..391cfec 100644
--- a/sim/ppc/ChangeLog
+++ b/sim/ppc/ChangeLog
@@ -1,3 +1,128 @@
+2003-06-22  Andrew Cagney  <cagney@redhat.com>
+
+	Written by matthew green <mrg@redhat.com>, with fixes from Aldy
+	Hernandez <aldyh@redhat.com>, Jim Wilson <wilson@redhat.com>, and
+	Nick Clifton <nickc@redhat.com>.
+	
+	* ppc-instructions: Include altivec.igen and e500.igen.
+	(model_busy, model_data): Add vr_busy and vscr_busy.
+	(model_trace_release): Trace vr_busy and vscr_busy.
+	(model_new_cycle): Update vr_busy and vscr_busy.
+	(model_make_busy): Update vr_busy and vscr_busy.
+	* registers.c (register_description): Add Altivec and e500
+	registers.
+	* psim.c (psim_read_register, psim_read_register): Handle Altivec
+	and e500 registers.
+	* ppc-spr-table (SPEFSCR): Add VRSAVE and SPEFSCR registers.
+	* configure.in (sim_filter): When *altivec* add "av".  When *spe*
+	or *simd* add e500.
+	(sim_float): When *altivec* define WITH_ALTIVEC.  When *spe* add
+	WITH_E500.
+	* configure: Re-generate.
+	* e500.igen, altivec.igen: New files.
+	* e500_expression.h, altivec_expression.h: New files.
+	* idecode_expression.h: Update copyright.  Include
+	"e500_expression.h" and "altivec_expression.h".
+	* e500_registers.h, altivec_registers.h: New files.
+	* registers.h: Update copyright.  Include "e500_registers.h" and
+	"altivec_registers.h".
+	(registers): Add Altivec and e500 specific registers.
+	* Makefile.in (IDECODE_H): Add "idecode_e500.h" and
+	"idecode_altivec.h".
+	(REGISTERS_H): Add "e500_registers.h" and "altivec_registers.h".
+	(tmp-igen): Add dependencies on altivec.igen and e500.igen .
+
+2003-06-22  Andrew Cagney  <cagney@redhat.com>
+
+	Problems reported by Joshua LeVasseur.
+	* emul_chirp.c: Update copyright.
+	(chirp_emul_nextprop): Return the first property.
+	* hw_htab.c: Update copyright.
+	(htab_decode_hash_table): Fix check for htab size.
+
+2003-06-21  Andrew Cagney  <cagney@redhat.com>
+
+	* interrupts.c: Update copyright.
+	(external_interrupt): Fix test for already pending interrupt.
+	Problem found by Joshua LeVasseur.
+
+	* ppc-instructions: Add missing +8 line.  Found by blofeldus at
+	yahoo.com.
+	
+2003-06-21  Andrew Cagney  <cagney@redhat.com>
+
+	From Ian Lance Taylor <ian@airs.com>: * hw_nvram.c
+	(hw_nvram_init_address): Correct call to memset--swap second and
+	third arguments.
+
+2003-06-21  Andrew Cagney  <cagney@redhat.com>
+
+	* hw_com.c (hw_com_device_init_data): Check that the output, and
+	not input file opened.  Pointed out by masahino tky3.3web.ne.jp.
+
+2003-06-20  Andrew Cagney  <cagney@redhat.com>
+
+	* sim_calls.c (sim_create_inferior): Assert that
+	psim_write_register succeeded.
+	(sim_fetch_register, sim_store_register): Make "regname" constant.
+	Delete Altivec hack.  Return result from psim_read_register /
+	psim_write_register.
+	* psim.h (psim_read_register, psim_write_register): Change return
+	type to int.  Update comments.
+	* psim.c: Update copyright.
+	(psim_stack): Assert that the psim_read_register worked.
+	(psim_read_register, psim_read_register): Return the register's
+	size.  Allocate the cooked buffer dynamically.
+	* hw_register.c: Update copyright.
+	(do_register_init): Check that psim_write_register succeeded.
+	* hw_init.c: Update copyright.
+	(create_ppc_elf_stack_frame, create_ppc_aix_stack_frame): Assert
+	that the register transfer worked.
+
+2003-06-19  Andrew Cagney  <cagney@redhat.com>
+
+	* ld-insn.h: Update copyright.
+	(cache_fields): Define.
+	(insn_table_fields): Add insn_field_6 and insn_field_7.
+	(load_insn_table): Pass in the "cache_rules".
+	* ld-insn.c: Update copyright.
+	(load_insn_table): Add parameter "cache_rules".  Handle "cache",
+	"computed" and "scratch" fields.
+	(main): Pass "cache_rules" to load_insn_table.
+	* ld-cache.h: Update copyright.
+	(append_cache_table): Declare.
+	* ld-cache.c: Update copyright.
+	(append_cache_table): New function.
+	(load_cache_table): Call.
+	* gen-model.c: Include "ld-cache.h".
+	* gen-itable.c: Include "ld-cache.h".
+	* igen.c: Move #include "ld-cache.h" to earlier.  Update
+	copyright.
+	(main): Permit a NULL "cache_rules".  Pass address of
+	"cache_rules" to load_insn_table.
+	* Makefile.in (tmp-ld-insn): Add "ld-cache.o".
+	(tmp-igen): Do not include ppc-cache-rules.
+	(gen-itable.o, gen-model.o): Add "ld-cache.h".
+	* ppc-cache-rules: Delete file.
+	* ppc-instructions: Add cache rules.
+
+2003-06-19  Andrew Cagney  <cagney@redhat.com>
+
+	* Makefile.in (ICACHE_CFLAGS, SEMANTICS_CFLAGS): Delete.
+	(SIM_FPU_FLAGS): Define.
+	(icache.o): Delete explicit compile command.
+	(semantics.o, idecode.o): Delete explicit compile command.
+	(NOWARN_CFLAGS, STD_CFLAGS): Append SIM_FPU_CFLAGS.
+	* gen-support.c (gen_support_c): Generate #include of
+	"sim-inline.h" and "sim-fpu.h", but conditional on
+	HAVE_COMMON_FPU.
+	* gen-idecode.c (gen_idecode_c): Ditto.
+	* igen.c (gen_icache_c, gen_semantics_c): Wrap #include of
+	"sim-inline.h" and "sim-fpu.h" in HAVE_COMMON_FPU conditional.
+	Move to before "support.h".
+	* Makefile.in, gen-support.c, gen-idecode.c, igen.c: Update
+	copyright.
+	
 2003-05-16  Ian Lance Taylor  <ian@airs.com>
 
 	* Makefile.in (various): Use $(SHELL) whenever we invoke
diff --git a/sim/ppc/Makefile.in b/sim/ppc/Makefile.in
index 0fb8f48..015fad0 100644
--- a/sim/ppc/Makefile.in
+++ b/sim/ppc/Makefile.in
@@ -1,7 +1,7 @@
 #
 #   This file is part of the program psim.
 #
-#   Copyright (C) 1994-1997, Andrew Cagney <cagney@highland.com.au>
+#   Copyright 1994, 1995, 1996, 1997, 2003 Andrew Cagney
 #
 #   This program is free software; you can redistribute it and/or modify
 #   it under the terms of the GNU General Public License as published by
@@ -112,9 +112,10 @@
   $(STDIO_CFLAGS) \
   $(TERMIO_CFLAGS) \
   $(DEVZERO_CFLAGS)
+SIM_FPU_CFLAGS = @sim_fpu_cflags@
 
-STD_CFLAGS	= $(CFLAGS) $(INLINE_CFLAGS) $(CONFIG_CFLAGS) $(WARNING_CFLAGS) $(SIM_CFLAGS) $(HDEFINES) $(TDEFINES) $(INCLUDES) $(INTL_CFLAGS)
-NOWARN_CFLAGS	= $(CFLAGS) $(INLINE_CFLAGS) $(CONFIG_CFLAGS) $(SIM_CFLAGS) $(HDEFINES) $(TDEFINES) $(INCLUDES)
+STD_CFLAGS	= $(CFLAGS) $(INLINE_CFLAGS) $(CONFIG_CFLAGS) $(WARNING_CFLAGS) $(SIM_CFLAGS) $(HDEFINES) $(TDEFINES) $(INCLUDES) $(INTL_CFLAGS) $(SIM_FPU_CFLAGS)
+NOWARN_CFLAGS	= $(CFLAGS) $(INLINE_CFLAGS) $(CONFIG_CFLAGS) $(SIM_CFLAGS) $(HDEFINES) $(TDEFINES) $(INCLUDES)  $(SIM_FPU_CFLAGS)
 BUILD_CFLAGS	= -g -O $(INCLUDES) $(WARNING_CFLAGS)
 
 BUILD_LDFLAGS	=
@@ -147,6 +148,7 @@
 LIB_INCLUDES	= -I$(srcdir)/../../include
 BFD_INCLUDES	= -I../../bfd -I$(srcdir)/../../bfd
 GDB_INCLUDES	= -I../../gdb -I$(srcdir)/../../gdb  -I$(srcdir)/../../gdb/config -I$(srcdir)/../../mmalloc
+
 INCLUDES	= -I. -I$(srcdir) $(LIB_INCLUDES) $(BFD_INCLUDES) $(GDB_INCLUDES)
 
 LIBIBERTY_LIB	= ../../libiberty/libiberty.a
@@ -185,13 +187,15 @@
 
 IDECODE_H = \
 	idecode.h \
-	idecode_expression.h \
+	idecode_expression.h e500_expression.h altivec_expression.h \
 	idecode_branch.h \
 	idecode_fields.h \
 	icache.h
 
 REGISTERS_H = \
 	registers.h \
+	e500_registers.h \
+	altivec_registers.h \
 	spreg.h
 
 CPU_H = \
@@ -319,9 +323,6 @@
 
 GDB_OBJ = sim_calls.o @sim_callback@
 
-ICACHE_CFLAGS = @sim_fpu_cflags@
-SEMANTICS_CFLAGS = @sim_fpu_cflags@
-
 HW_SRC = @sim_hw_src@
 HW_OBJ = @sim_hw_obj@
 
@@ -367,7 +368,6 @@
 # Given that inlines are turned on now, rebuild idecode whenever
 # anything changes.
 idecode.o: idecode.c $(CPU_H) $(IDECODE_H) semantics.h $(LIB_INLINE_SRC) $(BUILT_SRC)
-	$(CC) -c $(NOWARN_CFLAGS) $<
 
 # double.o: double.c dp-bit.c
 
@@ -394,10 +394,8 @@
 cap.o: cap.c cap.h $(BASICS_H)
 
 semantics.o: semantics.c semantics.h $(CPU_H) $(IDECODE_H)
-	$(CC) -c $(SEMANTICS_CFLAGS) $(NOWARN_CFLAGS) $<
 
 icache.o: icache.c icache.h $(IDECODE_H) $(CPU_H)
-	$(CC) -c $(ICACHE_CFLAGS) $(NOWARN_CFLAGS) $<
 
 support.o: support.c support.h $(IDECODE_H) $(CPU_H)
 
@@ -463,11 +461,9 @@
 	$(SHELL) $(srcdir)/../../move-if-change tmp-spreg.c spreg.c
 	touch tmp-dgen
 
-
-tmp-igen: igen ppc-instructions $(IGEN_OPCODE_RULES) ppc-cache-rules $(srcdir)/../../move-if-change tmp-ld-decode tmp-ld-cache tmp-ld-insn tmp-filter
+tmp-igen: igen $(srcdir)/ppc-instructions $(srcdir)/altivec.igen $(srcdir)/e500.igen $(IGEN_OPCODE_RULES) $(srcdir)/../../move-if-change tmp-ld-decode tmp-ld-cache tmp-ld-insn tmp-filter
 	./igen	$(IGEN_FLAGS) \
 		-o $(srcdir)/$(IGEN_OPCODE_RULES) \
-		-k $(srcdir)/ppc-cache-rules \
 		-I $(srcdir) -i $(srcdir)/ppc-instructions \
 		-n icache.h    -hc tmp-icache.h \
 		-n icache.c    -c  tmp-icache.c \
@@ -538,12 +534,12 @@
 ld-insn.o: ld-insn.c misc.h lf.h table.h ld-insn.h ld-decode.h igen.h
 	$(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/ld-insn.c
 tmp-ld-insn: ld-insn.o misc.o lf.o table.o ld-decode.o filter_host.o filter.o
-	$(CC_FOR_BUILD) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o tmp-ld-insn -DMAIN $(srcdir)/ld-insn.c misc.o lf.o table.o ld-decode.o filter_host.o filter.o $(BUILD_LIBS)
+	$(CC_FOR_BUILD) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o tmp-ld-insn -DMAIN $(srcdir)/ld-insn.c ld-cache.o misc.o lf.o table.o ld-decode.o filter_host.o filter.o $(BUILD_LIBS)
 
-gen-model.o: gen-model.c misc.h lf.h table.h gen-model.h ld-decode.h igen.h ld-insn.h
+gen-model.o: gen-model.c misc.h lf.h table.h gen-model.h ld-decode.h igen.h ld-insn.h ld-cache.h
 	$(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/gen-model.c
 
-gen-itable.o: gen-itable.c misc.h lf.h table.h gen-itable.h ld-decode.h igen.h ld-insn.h igen.h
+gen-itable.o: gen-itable.c misc.h lf.h table.h gen-itable.h ld-decode.h igen.h ld-insn.h igen.h ld-cache.h
 	$(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/gen-itable.c
 
 gen-icache.o: gen-icache.c misc.h lf.h table.h gen-icache.h ld-decode.h igen.h ld-insn.h gen-semantics.h gen-idecode.h
diff --git a/sim/ppc/altivec.igen b/sim/ppc/altivec.igen
new file mode 100644
index 0000000..9f10b26
--- /dev/null
+++ b/sim/ppc/altivec.igen
@@ -0,0 +1,2356 @@
+# Altivec instruction set, for PSIM, the PowerPC simulator.
+
+# Copyright 2003 Free Software Foundation, Inc.
+
+# Contributed by Red Hat Inc; developed under contract from Motorola.
+# Written by matthew green <mrg@redhat.com>.
+
+# This file is part of GDB.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.  */
+
+
+#
+# Motorola AltiVec instructions.
+#
+
+:cache:av:::VS:VS:
+:cache:av::vreg *:vS:VS:(cpu_registers(processor)->altivec.vr + VS)
+:cache:av::unsigned32:VS_BITMASK:VS:(1 << VS)
+:cache:av:::VA:VA:
+:cache:av::vreg *:vA:VA:(cpu_registers(processor)->altivec.vr + VA)
+:cache:av::unsigned32:VA_BITMASK:VA:(1 << VA)
+:cache:av:::VB:VB:
+:cache:av::vreg *:vB:VB:(cpu_registers(processor)->altivec.vr + VB)
+:cache:av::unsigned32:VB_BITMASK:VB:(1 << VB)
+:cache:av:::VC:VC:
+:cache:av::vreg *:vC:VC:(cpu_registers(processor)->altivec.vr + VC)
+:cache:av::unsigned32:VC_BITMASK:VC:(1 << VC)
+
+# Flags for model.h
+::model-macro:::
+	#define PPC_INSN_INT_VR(OUT_MASK, IN_MASK, OUT_VMASK, IN_VMASK) \
+		do { \
+		  if (CURRENT_MODEL_ISSUE > 0) \
+		    ppc_insn_int_vr(MY_INDEX, cpu_model(processor), OUT_MASK, IN_MASK, OUT_VMASK, IN_VMASK); \
+		} while (0)
+
+	#define PPC_INSN_VR(OUT_VMASK, IN_VMASK) \
+		do { \
+		  if (CURRENT_MODEL_ISSUE > 0) \
+		    ppc_insn_vr(MY_INDEX, cpu_model(processor), OUT_VMASK, IN_VMASK); \
+		} while (0)
+
+	#define PPC_INSN_VR_CR(OUT_VMASK, IN_VMASK, CR_MASK) \
+		do { \
+		  if (CURRENT_MODEL_ISSUE > 0) \
+		    ppc_insn_vr_cr(MY_INDEX, cpu_model(processor), OUT_VMASK, IN_VMASK, CR_MASK); \
+		} while (0)
+
+	#define PPC_INSN_VR_VSCR(OUT_VMASK, IN_VMASK) \
+		do { \
+		  if (CURRENT_MODEL_ISSUE > 0) \
+		    ppc_insn_vr_vscr(MY_INDEX, cpu_model(processor), OUT_VMASK, IN_VMASK); \
+		} while (0)
+
+	#define PPC_INSN_FROM_VSCR(VR_MASK) \
+		do { \
+		  if (CURRENT_MODEL_ISSUE > 0) \
+		    ppc_insn_from_vscr(MY_INDEX, cpu_model(processor), VR_MASK); \
+		} while (0)
+
+	#define PPC_INSN_TO_VSCR(VR_MASK) \
+		do { \
+		  if (CURRENT_MODEL_ISSUE > 0) \
+		    ppc_insn_to_vscr(MY_INDEX, cpu_model(processor), VR_MASK); \
+		} while (0)
+
+# Trace waiting for AltiVec registers to become available
+void::model-static::model_trace_altivec_busy_p:model_data *model_ptr, unsigned32 vr_busy
+	int i;
+	if (vr_busy) {
+	  vr_busy &= model_ptr->vr_busy;
+	  for(i = 0; i < 32; i++) {
+	    if (((1 << i) & vr_busy) != 0) {
+	      TRACE(trace_model, ("Waiting for register v%d.\n", i));
+	    }
+	  }
+	}
+	if (model_ptr->vscr_busy)
+	  TRACE(trace_model, ("Waiting for VSCR\n"));
+
+# Trace making AltiVec registers busy
+void::model-static::model_trace_altivec_make_busy:model_data *model_ptr, unsigned32 vr_mask, unsigned32 cr_mask
+	int i;
+	if (vr_mask) {
+	  for(i = 0; i < 32; i++) {
+	    if (((1 << i) & vr_mask) != 0) {
+	      TRACE(trace_model, ("Register v%d is now busy.\n", i));
+	    }
+	  }
+	}
+	if (cr_mask) {
+	  for(i = 0; i < 8; i++) {
+	    if (((1 << i) & cr_mask) != 0) {
+	      TRACE(trace_model, ("Register cr%d is now busy.\n", i));
+	    }
+	  }
+	}
+
+# Schedule an AltiVec instruction that takes integer input registers and produces output registers
+void::model-function::ppc_insn_int_vr:itable_index index, model_data *model_ptr, const unsigned32 out_mask, const unsigned32 in_mask, const unsigned32 out_vmask, const unsigned32 in_vmask
+	const unsigned32 int_mask = out_mask | in_mask;
+	const unsigned32 vr_mask = out_vmask | in_vmask;
+	model_busy *busy_ptr;
+
+	if ((model_ptr->int_busy & int_mask) != 0 || (model_ptr->vr_busy & vr_mask)) {
+	  model_new_cycle(model_ptr);			/* don't count first dependency as a stall */
+
+	  while ((model_ptr->int_busy & int_mask) != 0 || (model_ptr->vr_busy & vr_mask)) {
+	    if (WITH_TRACE && ppc_trace[trace_model]) {
+	      model_trace_busy_p(model_ptr, int_mask, 0, 0, PPC_NO_SPR);
+	      model_trace_altivec_busy_p(model_ptr, vr_mask);
+	    }
+
+	    model_ptr->nr_stalls_data++;
+	    model_new_cycle(model_ptr);
+	  }
+	}
+
+	busy_ptr = model_wait_for_unit(index, model_ptr, &model_ptr->timing[index]);
+	model_ptr->int_busy |= out_mask;
+	busy_ptr->int_busy |= out_mask;
+	model_ptr->vr_busy |= out_vmask;
+	busy_ptr->vr_busy |= out_vmask;
+
+	if (out_mask)
+	  busy_ptr->nr_writebacks = (PPC_ONE_BIT_SET_P(out_vmask)) ? 1 : 2;
+
+	if (out_vmask)
+	  busy_ptr->nr_writebacks += (PPC_ONE_BIT_SET_P(out_vmask)) ? 1 : 2;
+
+	if (WITH_TRACE && ppc_trace[trace_model]) {
+	  model_trace_make_busy(model_ptr, out_mask, 0, 0);
+	  model_trace_altivec_make_busy(model_ptr, vr_mask, 0);
+	}
+
+# Schedule an AltiVec instruction that takes vector input registers and produces vector output registers
+void::model-function::ppc_insn_vr:itable_index index, model_data *model_ptr, const unsigned32 out_vmask, const unsigned32 in_vmask
+	const unsigned32 vr_mask = out_vmask | in_vmask;
+	model_busy *busy_ptr;
+
+	if (model_ptr->vr_busy & vr_mask) {
+	  model_new_cycle(model_ptr);			/* don't count first dependency as a stall */
+
+	  while (model_ptr->vr_busy & vr_mask) {
+	    if (WITH_TRACE && ppc_trace[trace_model]) {
+	      model_trace_altivec_busy_p(model_ptr, vr_mask);
+	    }
+
+	    model_ptr->nr_stalls_data++;
+	    model_new_cycle(model_ptr);
+	  }
+	}
+
+	busy_ptr = model_wait_for_unit(index, model_ptr, &model_ptr->timing[index]);
+	model_ptr->vr_busy |= out_vmask;
+	busy_ptr->vr_busy |= out_vmask;
+	if (out_vmask)
+	  busy_ptr->nr_writebacks = (PPC_ONE_BIT_SET_P(out_vmask)) ? 1 : 2;
+
+	if (WITH_TRACE && ppc_trace[trace_model]) {
+	  model_trace_altivec_make_busy(model_ptr, vr_mask, 0);
+	}
+
+# Schedule an AltiVec instruction that takes vector input registers and produces vector output registers, touches CR
+void::model-function::ppc_insn_vr_cr:itable_index index, model_data *model_ptr, const unsigned32 out_vmask, const unsigned32 in_vmask, const unsigned32 cr_mask
+	const unsigned32 vr_mask = out_vmask | in_vmask;
+	model_busy *busy_ptr;
+
+	if ((model_ptr->vr_busy & vr_mask) || (model_ptr->cr_fpscr_busy & cr_mask)) {
+	  model_new_cycle(model_ptr);			/* don't count first dependency as a stall */
+
+	  while ((model_ptr->vr_busy & vr_mask) || (model_ptr->cr_fpscr_busy & cr_mask)) {
+	    if (WITH_TRACE && ppc_trace[trace_model]) {
+	      model_trace_busy_p(model_ptr, 0, 0, cr_mask, PPC_NO_SPR);
+	      model_trace_altivec_busy_p(model_ptr, vr_mask);
+	    }
+
+	    model_ptr->nr_stalls_data++;
+	    model_new_cycle(model_ptr);
+	  }
+	}
+
+	busy_ptr = model_wait_for_unit(index, model_ptr, &model_ptr->timing[index]);
+	model_ptr->cr_fpscr_busy |= cr_mask;
+	busy_ptr->cr_fpscr_busy |= cr_mask;
+	model_ptr->vr_busy |= out_vmask;
+	busy_ptr->vr_busy |= out_vmask;
+
+	if (out_vmask)
+	  busy_ptr->nr_writebacks = (PPC_ONE_BIT_SET_P(out_vmask)) ? 1 : 2;
+
+	if (cr_mask)
+	  busy_ptr->nr_writebacks++;
+
+	if (WITH_TRACE && ppc_trace[trace_model])
+	  model_trace_altivec_make_busy(model_ptr, vr_mask, cr_mask);
+
+# Schedule an AltiVec instruction that takes vector input registers and produces vector output registers, touches VSCR
+void::model-function::ppc_insn_vr_vscr:itable_index index, model_data *model_ptr, const unsigned32 out_vmask, const unsigned32 in_vmask
+	const unsigned32 vr_mask = out_vmask | in_vmask;
+	model_busy *busy_ptr;
+
+	if ((model_ptr->vr_busy & vr_mask) != 0 || model_ptr->vscr_busy != 0) {
+	  model_new_cycle(model_ptr);			/* don't count first dependency as a stall */
+
+	  while ((model_ptr->vr_busy & vr_mask) != 0 || model_ptr->vscr_busy != 0) {
+	    if (WITH_TRACE && ppc_trace[trace_model])
+	      model_trace_altivec_busy_p(model_ptr, vr_mask);
+
+	    model_ptr->nr_stalls_data++;
+	    model_new_cycle(model_ptr);
+	  }
+	}
+
+	busy_ptr = model_wait_for_unit(index, model_ptr, &model_ptr->timing[index]);
+	model_ptr->vr_busy |= out_vmask;
+	busy_ptr->vr_busy |= out_vmask;
+	model_ptr->vscr_busy = 1;
+	busy_ptr->vscr_busy = 1;
+
+	if (out_vmask)
+	  busy_ptr->nr_writebacks = 1 + (PPC_ONE_BIT_SET_P(out_vmask)) ? 1 : 2;
+
+	if (WITH_TRACE && ppc_trace[trace_model])
+	  model_trace_altivec_make_busy(model_ptr, vr_mask, 0);
+
+# Schedule an MFVSCR instruction that VSCR input register and produces an AltiVec output register
+void::model-function::ppc_insn_from_vscr:itable_index index, model_data *model_ptr, const unsigned32 vr_mask
+	model_busy *busy_ptr;
+
+	while ((model_ptr->vr_busy & vr_mask) != 0 || model_ptr->vscr_busy != 0) {
+	  if (WITH_TRACE && ppc_trace[trace_model])
+	    model_trace_altivec_busy_p(model_ptr, vr_mask);
+
+	  model_ptr->nr_stalls_data++;
+	  model_new_cycle(model_ptr);
+	}
+	busy_ptr = model_wait_for_unit(index, model_ptr, &model_ptr->timing[index]);
+	model_ptr->cr_fpscr_busy |= vr_mask;
+	busy_ptr->cr_fpscr_busy |= vr_mask;
+
+	if (vr_mask)
+	  busy_ptr->nr_writebacks = 1;
+
+	model_ptr->vr_busy |= vr_mask;
+	if (WITH_TRACE && ppc_trace[trace_model])
+	  model_trace_altivec_make_busy(model_ptr, vr_mask, 0);
+
+# Schedule an MTVSCR instruction that one AltiVec input register and produces a vscr output register
+void::model-function::ppc_insn_to_vscr:itable_index index, model_data *model_ptr, const unsigned32 vr_mask
+	model_busy *busy_ptr;
+
+	while ((model_ptr->vr_busy & vr_mask) != 0 || model_ptr->vscr_busy != 0) {
+	  if (WITH_TRACE && ppc_trace[trace_model])
+	    model_trace_altivec_busy_p(model_ptr, vr_mask);
+
+	  model_ptr->nr_stalls_data++;
+	  model_new_cycle(model_ptr);
+	}
+	busy_ptr = model_wait_for_unit(index, model_ptr, &model_ptr->timing[index]);
+	busy_ptr ->vscr_busy = 1;
+	model_ptr->vscr_busy = 1;
+	busy_ptr->nr_writebacks = 1;
+
+	TRACE(trace_model,("Making VSCR busy.\n"));
+
+# The follow are AltiVec saturate operations
+
+signed8::model-function::altivec_signed_saturate_8:signed16 val, int *sat
+	  signed8 rv;
+	  if (val > 127) {
+	    rv = 127;
+	    *sat = 1;
+	  } else if (val < -128) {
+	    rv = -128;
+	    *sat = 1;
+	  } else {
+	    rv = val;
+	    *sat = 0;
+	  }
+	  return rv;
+
+signed16::model-function::altivec_signed_saturate_16:signed32 val, int *sat
+	  signed16 rv;
+	  if (val > 32767) {
+	    rv = 32767;
+	    *sat = 1;
+	  } else if (val < -32768) {
+	    rv = -32768;
+	    *sat = 1;
+	  } else {
+	    rv = val;
+	    *sat = 0;
+	  }
+	  return rv;
+
+signed32::model-function::altivec_signed_saturate_32:signed64 val, int *sat
+	  signed32 rv;
+	  if (val > 2147483647) {
+	    rv = 2147483647;
+	    *sat = 1;
+	  } else if (val < -2147483648LL) {
+	    rv = -2147483648LL;
+	    *sat = 1;
+	  } else {
+	    rv = val;
+	    *sat = 0;
+	  }
+	  return rv;
+
+unsigned8::model-function::altivec_unsigned_saturate_8:signed16 val, int *sat
+	  unsigned8 rv;
+	  if (val > 255) {
+	    rv = 255;
+	    *sat = 1;
+	  } else if (val < 0) {
+	    rv = 0;
+	    *sat = 1;
+	  } else {
+	    rv = val;
+	    *sat = 0;
+	  }
+	  return rv;
+
+unsigned16::model-function::altivec_unsigned_saturate_16:signed32 val, int *sat
+	  unsigned16 rv;
+	  if (val > 65535) {
+	    rv = 65535;
+	    *sat = 1;
+	  } else if (val < 0) {
+	    rv = 0;
+	    *sat = 1;
+	  } else {
+	    rv = val;
+	    *sat = 0;
+	  }
+	  return rv;
+
+unsigned32::model-function::altivec_unsigned_saturate_32:signed64 val, int *sat
+	  unsigned32 rv;
+	  if (val > 4294967295LL) {
+	    rv = 4294967295LL;
+	    *sat = 1;
+	  } else if (val < 0) {
+	    rv = 0;
+	    *sat = 1;
+	  } else {
+	    rv = val;
+	    *sat = 0;
+	  }
+	  return rv;
+
+#
+# Load instructions, 6-14 ... 6-22.
+#
+
+0.31,6.VS,11.RA,16.RB,21.7,31.0:X:av:lvebx %VD, %RA, %RB:Load Vector Element Byte Indexed
+	unsigned_word b;
+	unsigned_word EA;
+	unsigned_word eb;
+	if (RA_is_0) b = 0;
+	else         b = *rA;
+	EA = b + *rB;
+	eb = EA & 0xf;
+	(*vS).b[AV_BINDEX(eb)] = MEM(unsigned, EA, 1);
+	PPC_INSN_INT_VR(0, RA_BITMASK | RB_BITMASK, VS_BITMASK, 0);
+
+0.31,6.VS,11.RA,16.RB,21.39,31.0:X:av:lvehx %VD, %RA, %RB:Load Vector Element Half Word Indexed
+	unsigned_word b;
+	unsigned_word EA;
+	unsigned_word eb;
+	if (RA_is_0) b = 0;
+	else         b = *rA;
+	EA = (b + *rB) & ~1;
+	eb = EA & 0xf;
+	(*vS).h[AV_HINDEX(eb/2)] = MEM(unsigned, EA, 2);
+	PPC_INSN_INT_VR(0, RA_BITMASK | RB_BITMASK, VS_BITMASK, 0);
+
+0.31,6.VS,11.RA,16.RB,21.71,31.0:X:av:lvewx %VD, %RA, %RB:Load Vector Element Word Indexed
+	unsigned_word b;
+	unsigned_word EA;
+	unsigned_word eb;
+	if (RA_is_0) b = 0;
+	else         b = *rA;
+	EA = (b + *rB) & ~3;
+	eb = EA & 0xf;
+	(*vS).w[eb/4] = MEM(unsigned, EA, 4);
+	PPC_INSN_INT_VR(0, RA_BITMASK | RB_BITMASK, VS_BITMASK, 0);
+
+
+0.31,6.VS,11.RA,16.RB,21.6,31.0:X:av:lvsl %VD, %RA, %RB:Load Vector for Shift Left
+	unsigned_word b;
+	unsigned_word addr;
+	int i, j;
+	if (RA_is_0) b = 0;
+	else         b = *rA;
+	addr = b + *rB;
+	j = addr & 0xf;
+	for (i = 0; i < 16; i++)
+	  if (CURRENT_TARGET_BYTE_ORDER == BIG_ENDIAN)
+	    (*vS).b[AV_BINDEX(i)] = j++;
+	  else
+	    (*vS).b[AV_BINDEX(15 - i)] = j++;
+	PPC_INSN_INT_VR(0, RA_BITMASK | RB_BITMASK, VS_BITMASK, 0);
+
+0.31,6.VS,11.RA,16.RB,21.38,31.0:X:av:lvsr %VD, %RA, %RB:Load Vector for Shift Right
+	unsigned_word b;
+	unsigned_word addr;
+	int i, j;
+	if (RA_is_0) b = 0;
+	else         b = *rA;
+	addr = b + *rB;
+	j = 0x10 - (addr & 0xf);
+	for (i = 0; i < 16; i++)
+	  if (CURRENT_TARGET_BYTE_ORDER == BIG_ENDIAN)
+	    (*vS).b[AV_BINDEX(i)] = j++;
+	  else
+	    (*vS).b[AV_BINDEX(15 - i)] = j++;
+	PPC_INSN_INT_VR(0, RA_BITMASK | RB_BITMASK, VS_BITMASK, 0);
+
+
+0.31,6.VS,11.RA,16.RB,21.103,31.0:X:av:lvx %VD, %RA, %RB:Load Vector Indexed
+	unsigned_word b;
+	unsigned_word EA;
+	if (RA_is_0) b = 0;
+	else         b = *rA;
+	EA = (b + *rB) & ~0xf;
+	if (CURRENT_TARGET_BYTE_ORDER == BIG_ENDIAN) {
+	  (*vS).w[0] = MEM(unsigned, EA + 0, 4);
+	  (*vS).w[1] = MEM(unsigned, EA + 4, 4);
+	  (*vS).w[2] = MEM(unsigned, EA + 8, 4);
+	  (*vS).w[3] = MEM(unsigned, EA + 12, 4);
+	} else {
+	  (*vS).w[0] = MEM(unsigned, EA + 12, 4);
+	  (*vS).w[1] = MEM(unsigned, EA + 8, 4);
+	  (*vS).w[2] = MEM(unsigned, EA + 4, 4);
+	  (*vS).w[3] = MEM(unsigned, EA + 0, 4);
+	}
+	PPC_INSN_INT_VR(0, RA_BITMASK | RB_BITMASK, VS_BITMASK, 0);
+
+0.31,6.VS,11.RA,16.RB,21.359,31.0:X:av:lvxl %VD, %RA, %RB:Load Vector Indexed LRU
+	unsigned_word b;
+	unsigned_word EA;
+	if (RA_is_0) b = 0;
+	else         b = *rA;
+	EA = (b + *rB) & ~0xf;
+	if (CURRENT_TARGET_BYTE_ORDER == BIG_ENDIAN) {
+	  (*vS).w[0] = MEM(unsigned, EA + 0, 4);
+	  (*vS).w[1] = MEM(unsigned, EA + 4, 4);
+	  (*vS).w[2] = MEM(unsigned, EA + 8, 4);
+	  (*vS).w[3] = MEM(unsigned, EA + 12, 4);
+	} else {
+	  (*vS).w[0] = MEM(unsigned, EA + 12, 4);
+	  (*vS).w[1] = MEM(unsigned, EA + 8, 4);
+	  (*vS).w[2] = MEM(unsigned, EA + 4, 4);
+	  (*vS).w[3] = MEM(unsigned, EA + 0, 4);
+	}
+	PPC_INSN_INT_VR(0, RA_BITMASK | RB_BITMASK, VS_BITMASK, 0);
+
+#
+# Move to/from VSCR instructions, 6-23 & 6-24.
+#
+
+0.4,6.VS,11.0,16.0,21.1540:VX:av:mfvscr %VS:Move from Vector Status and Control Register
+	(*vS).w[0] = 0;
+	(*vS).w[1] = 0;
+	(*vS).w[2] = 0;
+	(*vS).w[3] = VSCR;
+	PPC_INSN_FROM_VSCR(VS_BITMASK);
+
+0.4,6.0,11.0,16.VB,21.1604:VX:av:mtvscr %VB:Move to Vector Status and Control Register
+	VSCR = (*vB).w[3];
+	PPC_INSN_TO_VSCR(VB_BITMASK);
+
+#
+# Store instructions, 6-25 ... 6-29.
+#
+
+0.31,6.VS,11.RA,16.RB,21.135,31.0:X:av:stvebx %VD, %RA, %RB:Store Vector Element Byte Indexed
+	unsigned_word b;
+	unsigned_word EA;
+	unsigned_word eb;
+	if (RA_is_0) b = 0;
+	else         b = *rA;
+	EA = b + *rB;
+	eb = EA & 0xf;
+	if (CURRENT_TARGET_BYTE_ORDER == BIG_ENDIAN)
+	  STORE(EA, 1, (*vS).b[eb]);
+	else
+	  STORE(EA, 1, (*vS).b[15-eb]);
+	PPC_INSN_INT_VR(0, RA_BITMASK | RB_BITMASK, VS_BITMASK, 0);
+
+0.31,6.VS,11.RA,16.RB,21.167,31.0:X:av:stvehx %VD, %RA, %RB:Store Vector Element Half Word Indexed
+	unsigned_word b;
+	unsigned_word EA;
+	unsigned_word eb;
+	if (RA_is_0) b = 0;
+	else         b = *rA;
+	EA = (b + *rB) & ~1;
+	eb = EA & 0xf;
+	if (CURRENT_TARGET_BYTE_ORDER == BIG_ENDIAN)
+	  STORE(EA, 2, (*vS).h[eb/2]);
+	else
+	  STORE(EA, 2, (*vS).h[7-eb]);
+	PPC_INSN_INT_VR(0, RA_BITMASK | RB_BITMASK, VS_BITMASK, 0);
+
+0.31,6.VS,11.RA,16.RB,21.199,31.0:X:av:stvewx %VD, %RA, %RB:Store Vector Element Word Indexed
+	unsigned_word b;
+	unsigned_word EA;
+	unsigned_word eb;
+	if (RA_is_0) b = 0;
+	else         b = *rA;
+	EA = (b + *rB) & ~3;
+	eb = EA & 0xf;
+	if (CURRENT_TARGET_BYTE_ORDER == BIG_ENDIAN)
+	  STORE(EA, 4, (*vS).w[eb/4]);
+	else
+	  STORE(EA, 4, (*vS).w[3-(eb/4)]);
+	PPC_INSN_INT_VR(0, RA_BITMASK | RB_BITMASK, VS_BITMASK, 0);
+
+0.31,6.VS,11.RA,16.RB,21.231,31.0:X:av:stvx %VD, %RA, %RB:Store Vector Indexed
+	unsigned_word b;
+	unsigned_word EA;
+	if (RA_is_0) b = 0;
+	else         b = *rA;
+	EA = (b + *rB) & ~0xf;
+	if (CURRENT_TARGET_BYTE_ORDER == BIG_ENDIAN) {
+	  STORE(EA + 0, 4, (*vS).w[0]);
+	  STORE(EA + 4, 4, (*vS).w[1]);
+	  STORE(EA + 8, 4, (*vS).w[2]);
+	  STORE(EA + 12, 4, (*vS).w[3]);
+	} else {
+	  STORE(EA + 12, 4, (*vS).w[0]);
+	  STORE(EA + 8, 4, (*vS).w[1]);
+	  STORE(EA + 4, 4, (*vS).w[2]);
+	  STORE(EA + 0, 4, (*vS).w[3]);
+	}
+	PPC_INSN_INT_VR(0, RA_BITMASK | RB_BITMASK, VS_BITMASK, 0);
+
+0.31,6.VS,11.RA,16.RB,21.487,31.0:X:av:stvxl %VD, %RA, %RB:Store Vector Indexed LRU
+	unsigned_word b;
+	unsigned_word EA;
+	if (RA_is_0) b = 0;
+	else         b = *rA;
+	EA = (b + *rB) & ~0xf;
+	if (CURRENT_TARGET_BYTE_ORDER == BIG_ENDIAN) {
+	  STORE(EA + 0, 4, (*vS).w[0]);
+	  STORE(EA + 4, 4, (*vS).w[1]);
+	  STORE(EA + 8, 4, (*vS).w[2]);
+	  STORE(EA + 12, 4, (*vS).w[3]);
+	} else {
+	  STORE(EA + 12, 4, (*vS).w[0]);
+	  STORE(EA + 8, 4, (*vS).w[1]);
+	  STORE(EA + 4, 4, (*vS).w[2]);
+	  STORE(EA + 0, 4, (*vS).w[3]);
+	}
+	PPC_INSN_INT_VR(0, RA_BITMASK | RB_BITMASK, VS_BITMASK, 0);
+
+#
+# Vector Add instructions, 6-30 ... 6-40.
+#
+
+0.4,6.VS,11.VA,16.VB,21.384:VX:av:vaddcuw %VD, %VA, %VB:Vector Add Carryout Unsigned Word
+	unsigned64 temp;
+	int i;
+	for (i = 0; i < 4; i++) {
+	  temp = (unsigned64)(*vA).w[i] + (unsigned64)(*vB).w[i];
+	  (*vS).w[i] = temp >> 32;
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.10:VX:av:vaddfp %VD, %VA, %VB:Vector Add Floating Point
+	int i;
+	unsigned32 f;
+	sim_fpu a, b, d;
+	for (i = 0; i < 4; i++) {
+	  sim_fpu_32to (&a, (*vA).w[i]);
+	  sim_fpu_32to (&b, (*vB).w[i]);
+	  sim_fpu_add (&d, &a, &b);
+	  sim_fpu_to32 (&f, &d);
+	  (*vS).w[i] = f;
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+	
+0.4,6.VS,11.VA,16.VB,21.768:VX:av:vaddsbs %VD, %VA, %VB:Vector Add Signed Byte Saturate
+	int i, sat, tempsat;
+	signed16 temp;
+	for (i = 0; i < 16; i++) {
+	  temp = (signed16)(signed8)(*vA).b[i] + (signed16)(signed8)(*vB).b[i];
+	  (*vS).b[i] = altivec_signed_saturate_8(temp, &tempsat);
+	  sat |= tempsat;
+	}
+	ALTIVEC_SET_SAT(sat);
+	PPC_INSN_VR_VSCR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.832:VX:av:vaddshs %VD, %VA, %VB:Vector Add Signed Half Word Saturate
+	int i, sat, tempsat;
+	signed32 temp, a, b;
+	for (i = 0; i < 8; i++) {
+	  a = (signed32)(signed16)(*vA).h[i];
+	  b = (signed32)(signed16)(*vB).h[i];
+	  temp = a + b;
+	  (*vS).h[i] = altivec_signed_saturate_16(temp, &tempsat);
+	  sat |= tempsat;
+	}
+	ALTIVEC_SET_SAT(sat);
+	PPC_INSN_VR_VSCR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.896:VX:av:vaddsws %VD, %VA, %VB:Vector Add Signed Word Saturate
+	int i, sat, tempsat;
+	signed64 temp;
+	for (i = 0; i < 4; i++) {
+	  temp = (signed64)(signed32)(*vA).w[i] + (signed64)(signed32)(*vB).w[i];
+	  (*vS).w[i] = altivec_signed_saturate_32(temp, &tempsat);
+	  sat |= tempsat;
+	}
+	ALTIVEC_SET_SAT(sat);
+	PPC_INSN_VR_VSCR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.0:VX:av:vaddubm %VD, %VA, %VB:Vector Add Unsigned Byte Modulo
+	int i;
+	for (i = 0; i < 16; i++)
+	  (*vS).b[i] = ((*vA).b[i] + (*vB).b[i]) & 0xff;
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.512:VX:av:vaddubs %VD, %VA, %VB:Vector Add Unsigned Byte Saturate
+	int i, sat, tempsat;
+	signed16 temp;
+	sat = 0;
+	for (i = 0; i < 16; i++) {
+	  temp = (signed16)(unsigned8)(*vA).b[i] + (signed16)(unsigned8)(*vB).b[i];
+	  (*vS).b[i] = altivec_unsigned_saturate_8(temp, &tempsat);
+	  sat |= tempsat;
+	}
+	ALTIVEC_SET_SAT(sat);
+	PPC_INSN_VR_VSCR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.64:VX:av:vadduhm %VD, %VA, %VB:Vector Add Unsigned Half Word Modulo
+	int i;
+	for (i = 0; i < 8; i++)
+	  (*vS).h[i] = ((*vA).h[i] + (*vB).h[i]) & 0xffff;
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.576:VX:av:vadduhs %VD, %VA, %VB:Vector Add Unsigned Half Word Saturate
+	int i, sat, tempsat;
+	signed32 temp;
+	for (i = 0; i < 8; i++) {
+	  temp = (signed32)(unsigned16)(*vA).h[i] + (signed32)(unsigned16)(*vB).h[i];
+	  (*vS).h[i] = altivec_unsigned_saturate_16(temp, &tempsat);
+	  sat |= tempsat;
+	}
+	ALTIVEC_SET_SAT(sat);
+	PPC_INSN_VR_VSCR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.128:VX:av:vadduwm %VD, %VA, %VB:Vector Add Unsigned Word Modulo
+	int i;
+	for (i = 0; i < 4; i++)
+	  (*vS).w[i] = (*vA).w[i] + (*vB).w[i];
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.640:VX:av:vadduws %VD, %VA, %VB:Vector Add Unsigned Word Saturate
+	int i, sat, tempsat;
+	signed64 temp;
+	for (i = 0; i < 4; i++) {
+	  temp = (signed64)(unsigned32)(*vA).w[i] + (signed64)(unsigned32)(*vB).w[i];
+	  (*vS).w[i] = altivec_unsigned_saturate_32(temp, &tempsat);
+	  sat |= tempsat;
+	}
+	ALTIVEC_SET_SAT(sat);
+	PPC_INSN_VR_VSCR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+#
+# Vector AND instructions, 6-41, 6-42
+#
+
+0.4,6.VS,11.VA,16.VB,21.1028:VX:av:vand %VD, %VA, %VB:Vector Logical AND
+	int i;
+	for (i = 0; i < 4; i++)
+	  (*vS).w[i] = (*vA).w[i] & (*vB).w[i];
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.1092:VX:av:vandc %VD, %VA, %VB:Vector Logical AND with Compliment
+	int i;
+	for (i = 0; i < 4; i++)
+	  (*vS).w[i] = (*vA).w[i] & ~((*vB).w[i]);
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+
+#
+# Vector Average instructions, 6-43, 6-48
+#
+
+0.4,6.VS,11.VA,16.VB,21.1282:VX:av:vavgsb %VD, %VA, %VB:Vector Average Signed Byte
+	int i;
+	signed16 temp, a, b;
+	for (i = 0; i < 16; i++) {
+	  a = (signed16)(signed8)(*vA).b[i];
+	  b = (signed16)(signed8)(*vB).b[i];
+	  temp = a + b + 1;
+	  (*vS).b[i] = (temp >> 1) & 0xff;
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.1346:VX:av:vavgsh %VD, %VA, %VB:Vector Average Signed Half Word
+	int i;
+	signed32 temp, a, b;
+	for (i = 0; i < 8; i++) {
+	  a = (signed32)(signed16)(*vA).h[i];
+	  b = (signed32)(signed16)(*vB).h[i];
+	  temp = a + b + 1;
+	  (*vS).h[i] = (temp >> 1) & 0xffff;
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.1410:VX:av:vavgsw %VD, %VA, %VB:Vector Average Signed Word
+	int i;
+	signed64 temp, a, b;
+	for (i = 0; i < 4; i++) {
+	  a = (signed64)(signed32)(*vA).w[i];
+	  b = (signed64)(signed32)(*vB).w[i];
+	  temp = a + b + 1;
+	  (*vS).w[i] = (temp >> 1) & 0xffffffff;
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.1026:VX:av:vavgub %VD, %VA, %VB:Vector Average Unsigned Byte
+	int i;
+	unsigned16 temp, a, b;
+	for (i = 0; i < 16; i++) {
+	  a = (*vA).b[i];
+	  b = (*vB).b[i];
+	  temp = a + b + 1;
+	  (*vS).b[i] = (temp >> 1) & 0xff;
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.1090:VX:av:vavguh %VD, %VA, %VB:Vector Average Unsigned Half Word
+	int i;
+	unsigned32 temp, a, b;
+	for (i = 0; i < 8; i++) {
+	  a = (*vA).h[i];
+	  b = (*vB).h[i];
+	  temp = a + b + 1;
+	  (*vS).h[i] = (temp >> 1) & 0xffff;
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.1154:VX:av:vavguw %VD, %VA, %VB:Vector Average Unsigned Word
+	int i;
+	unsigned64 temp, a, b;
+	for (i = 0; i < 4; i++) {
+	  a = (*vA).w[i];
+	  b = (*vB).w[i];
+	  temp = a + b + 1;
+	  (*vS).w[i] = (temp >> 1) & 0xffffffff;
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+#
+# Vector Fixed Point Convert instructions, 6-49, 6-50
+#
+
+0.4,6.VS,11.UIMM,16.VB,21.842:VX:av:vcfsx %VD, %VB, %UIMM:Vector Convert From Signed Fixed-Point Word
+	int i;
+	unsigned32 f;
+	sim_fpu b, div, d;
+	for (i = 0; i < 4; i++) {
+	  sim_fpu_32to (&b, (*vB).w[i]);
+	  sim_fpu_u32to (&div, 2 << UIMM, sim_fpu_round_default);
+	  sim_fpu_div (&d, &b, &div);
+	  sim_fpu_to32 (&f, &d);
+	  (*vS).w[i] = f;
+	}
+	PPC_INSN_VR(VS_BITMASK, VB_BITMASK);
+
+0.4,6.VS,11.UIMM,16.VB,21.778:VX:av:vcfux %VD, %VA, %UIMM:Vector Convert From Unsigned Fixed-Point Word
+	int i;
+	unsigned32 f;
+	sim_fpu b, d, div;
+	for (i = 0; i < 4; i++) {
+	  sim_fpu_32to (&b, (*vB).w[i]);
+	  sim_fpu_u32to (&div, 2 << UIMM, sim_fpu_round_default);
+	  sim_fpu_div (&d, &b, &div);
+	  sim_fpu_to32u (&f, &d, sim_fpu_round_default);
+	  (*vS).w[i] = f;
+	}
+	PPC_INSN_VR(VS_BITMASK, VB_BITMASK);
+
+#
+# Vector Compare instructions, 6-51 ... 6-64
+#
+
+0.4,6.VS,11.VA,16.VB,21.RC,22.966:VXR:av:vcmpbpfpx %VD, %VA, %VB:Vector Compare Bounds Floating Point
+	int i, le, ge;
+	sim_fpu a, b, d;
+	for (i = 0; i < 4; i++) {
+	  sim_fpu_32to (&a, (*vA).w[i]);
+	  sim_fpu_32to (&b, (*vB).w[i]);
+	  le = sim_fpu_is_le(&a, &b);
+	  ge = sim_fpu_is_ge(&a, &b);
+	  (*vS).w[i] = (le ? 0 : 1 << 31) | (ge ? 0 : 1 << 30);
+	}
+	if (RC)
+	  ALTIVEC_SET_CR6(vS, 0);
+	PPC_INSN_VR_CR(VS_BITMASK, VA_BITMASK | VB_BITMASK, RC ? 0x000000f0 : 0);
+
+0.4,6.VS,11.VA,16.VB,21.RC,22.198:VXR:av:vcmpeqfpx %VD, %VA, %VB:Vector Compare Equal-to-Floating Point
+	int i;
+	sim_fpu a, b;
+	for (i = 0; i < 4; i++) {
+	  sim_fpu_32to (&a, (*vA).w[i]);
+	  sim_fpu_32to (&b, (*vB).w[i]);
+	  if (sim_fpu_is_eq(&a, &b))
+	    (*vS).w[i] = 0xffffffff;
+	  else
+	    (*vS).w[i] = 0;
+	}
+	if (RC)
+	  ALTIVEC_SET_CR6(vS, 1);
+	PPC_INSN_VR_CR(VS_BITMASK, VA_BITMASK | VB_BITMASK, RC ? 0x000000f0 : 0);
+
+0.4,6.VS,11.VA,16.VB,21.RC,22.6:VXR:av:vcmpequbx %VD, %VA, %VB:Vector Compare Equal-to Unsigned Byte
+	int i;
+	for (i = 0; i < 16; i++)
+	  if ((*vA).b[i] == (*vB).b[i])
+	    (*vS).b[i] = 0xff;
+	  else
+	    (*vS).b[i] = 0;
+	if (RC)
+	  ALTIVEC_SET_CR6(vS, 1);
+	PPC_INSN_VR_CR(VS_BITMASK, VA_BITMASK | VB_BITMASK, RC ? 0x000000f0 : 0);
+
+0.4,6.VS,11.VA,16.VB,21.RC,22.70:VXR:av:vcmpequhx %VD, %VA, %VB:Vector Compare Equal-to Unsigned Half Word
+	int i;
+	for (i = 0; i < 8; i++)
+	  if ((*vA).h[i] == (*vB).h[i])
+	    (*vS).h[i] = 0xffff;
+	  else
+	    (*vS).h[i] = 0;
+	if (RC)
+	  ALTIVEC_SET_CR6(vS, 1);
+	PPC_INSN_VR_CR(VS_BITMASK, VA_BITMASK | VB_BITMASK, RC ? 0x000000f0 : 0);
+
+0.4,6.VS,11.VA,16.VB,21.RC,22.134:VXR:av:vcmpequwx %VD, %VA, %VB:Vector Compare Equal-to Unsigned Word
+	int i;
+	for (i = 0; i < 4; i++)
+	  if ((*vA).w[i] == (*vB).w[i])
+	    (*vS).w[i] = 0xffffffff;
+	  else
+	    (*vS).w[i] = 0;
+	if (RC)
+	  ALTIVEC_SET_CR6(vS, 1);
+	PPC_INSN_VR_CR(VS_BITMASK, VA_BITMASK | VB_BITMASK, RC ? 0x000000f0 : 0);
+
+0.4,6.VS,11.VA,16.VB,21.RC,22.454:VXR:av:vcmpgefpx %VD, %VA, %VB:Vector Compare Greater-Than-or-Equal-to Floating Point
+	int i;
+	sim_fpu a, b;
+	for (i = 0; i < 4; i++) {
+	  sim_fpu_32to (&a, (*vA).w[i]);
+	  sim_fpu_32to (&b, (*vB).w[i]);
+	  if (sim_fpu_is_ge(&a, &b))
+	    (*vS).w[i] = 0xffffffff;
+	  else
+	    (*vS).w[i] = 0;
+	}
+	if (RC)
+	  ALTIVEC_SET_CR6(vS, 1);
+	PPC_INSN_VR_CR(VS_BITMASK, VA_BITMASK | VB_BITMASK, RC ? 0x000000f0 : 0);
+
+0.4,6.VS,11.VA,16.VB,21.RC,22.710:VXR:av:vcmpgtfpx %VD, %VA, %VB:Vector Compare Greater-Than Floating Point
+	int i;
+	sim_fpu a, b;
+	for (i = 0; i < 4; i++) {
+	  sim_fpu_32to (&a, (*vA).w[i]);
+	  sim_fpu_32to (&b, (*vB).w[i]);
+	  if (sim_fpu_is_gt(&a, &b))
+	    (*vS).w[i] = 0xffffffff;
+	  else
+	    (*vS).w[i] = 0;
+	}
+	if (RC)
+	  ALTIVEC_SET_CR6(vS, 1);
+	PPC_INSN_VR_CR(VS_BITMASK, VA_BITMASK | VB_BITMASK, RC ? 0x000000f0 : 0);
+
+0.4,6.VS,11.VA,16.VB,21.RC,22.774:VXR:av:vcmpgtsbx %VD, %VA, %VB:Vector Compare Greater-Than Signed Byte
+	int i;
+	signed8 a, b;
+	for (i = 0; i < 16; i++) {
+	  a = (*vA).b[i];
+	  b = (*vB).b[i];
+	  if (a > b)
+	    (*vS).b[i] = 0xff;
+	  else
+	    (*vS).b[i] = 0;
+	}
+	if (RC)
+	  ALTIVEC_SET_CR6(vS, 1);
+	PPC_INSN_VR_CR(VS_BITMASK, VA_BITMASK | VB_BITMASK, RC ? 0x000000f0 : 0);
+
+0.4,6.VS,11.VA,16.VB,21.RC,22.838:VXR:av:vcmpgtshx %VD, %VA, %VB:Vector Compare Greater-Than Signed Half Word
+	int i;
+	signed16 a, b;
+	for (i = 0; i < 8; i++) {
+	  a = (*vA).h[i];
+	  b = (*vB).h[i];
+	  if (a > b)
+	    (*vS).h[i] = 0xffff;
+	  else
+	    (*vS).h[i] = 0;
+	}
+	if (RC)
+	  ALTIVEC_SET_CR6(vS, 1);
+	PPC_INSN_VR_CR(VS_BITMASK, VA_BITMASK | VB_BITMASK, RC ? 0x000000f0 : 0);
+
+0.4,6.VS,11.VA,16.VB,21.RC,22.902:VXR:av:vcmpgtswx %VD, %VA, %VB:Vector Compare Greater-Than Signed Word
+	int i;
+	signed32 a, b;
+	for (i = 0; i < 4; i++) {
+	  a = (*vA).w[i];
+	  b = (*vB).w[i];
+	  if (a > b)
+	    (*vS).w[i] = 0xffffffff;
+	  else
+	    (*vS).w[i] = 0;
+	}
+	if (RC)
+	  ALTIVEC_SET_CR6(vS, 1);
+	PPC_INSN_VR_CR(VS_BITMASK, VA_BITMASK | VB_BITMASK, RC ? 0x000000f0 : 0);
+
+0.4,6.VS,11.VA,16.VB,21.RC,22.518:VXR:av:vcmpgtubx %VD, %VA, %VB:Vector Compare Greater-Than Unsigned Byte
+	int i;
+	unsigned8 a, b;
+	for (i = 0; i < 16; i++) {
+	  a = (*vA).b[i];
+	  b = (*vB).b[i];
+	  if (a > b)
+	    (*vS).b[i] = 0xff;
+	  else
+	    (*vS).b[i] = 0;
+	}
+	if (RC)
+	  ALTIVEC_SET_CR6(vS, 1);
+	PPC_INSN_VR_CR(VS_BITMASK, VA_BITMASK | VB_BITMASK, RC ? 0x000000f0 : 0);
+
+0.4,6.VS,11.VA,16.VB,21.RC,22.582:VXR:av:vcmpgtuhx %VD, %VA, %VB:Vector Compare Greater-Than Unsigned Half Word
+	int i;
+	unsigned16 a, b;
+	for (i = 0; i < 8; i++) {
+	  a = (*vA).h[i];
+	  b = (*vB).h[i];
+	  if (a > b)
+	    (*vS).h[i] = 0xffff;
+	  else
+	    (*vS).h[i] = 0;
+	}
+	if (RC)
+	  ALTIVEC_SET_CR6(vS, 1);
+	PPC_INSN_VR_CR(VS_BITMASK, VA_BITMASK | VB_BITMASK, RC ? 0x000000f0 : 0);
+
+0.4,6.VS,11.VA,16.VB,21.RC,22.646:VXR:av:vcmpgtuwx %VD, %VA, %VB:Vector Compare Greater-Than Unsigned Word
+	int i;
+	unsigned32 a, b;
+	for (i = 0; i < 4; i++) {
+	  a = (*vA).w[i];
+	  b = (*vB).w[i];
+	  if (a > b)
+	    (*vS).w[i] = 0xffffffff;
+	  else
+	    (*vS).w[i] = 0;
+	}
+	if (RC)
+	  ALTIVEC_SET_CR6(vS, 1);
+	PPC_INSN_VR_CR(VS_BITMASK, VA_BITMASK | VB_BITMASK, RC ? 0x000000f0 : 0);
+
+#
+# Vector Convert instructions, 6-65, 6-66.
+#
+
+0.4,6.VS,11.UIMM,16.VB,21.970:VX:av:vctsxs %VD, %VB, %UIMM:Vector Convert to Signed Fixed-Point Word Saturate
+	int i, sat, tempsat;
+	signed64 temp;
+	sim_fpu a, b, m;
+	sat = 0;
+	for (i = 0; i < 4; i++) {
+	  sim_fpu_32to (&b, (*vB).w[i]);
+	  sim_fpu_u32to (&m, 2 << UIMM, sim_fpu_round_default);
+	  sim_fpu_mul (&a, &b, &m);
+	  sim_fpu_to64i (&temp, &a, sim_fpu_round_default);
+	  (*vS).w[i] = altivec_signed_saturate_32(temp, &tempsat);
+	  sat |= tempsat;
+	}
+	ALTIVEC_SET_SAT(sat);
+	PPC_INSN_VR_VSCR(VS_BITMASK, VB_BITMASK);
+
+0.4,6.VS,11.UIMM,16.VB,21.906:VX:av:vctuxs %VD, %VB, %UIMM:Vector Convert to Unsigned Fixed-Point Word Saturate
+	int i, sat, tempsat;
+	signed64 temp;
+	sim_fpu a, b, m;
+	sat = 0;
+	for (i = 0; i < 4; i++) {
+	  sim_fpu_32to (&b, (*vB).w[i]);
+	  sim_fpu_u32to (&m, 2 << UIMM, sim_fpu_round_default);
+	  sim_fpu_mul (&a, &b, &m);
+	  sim_fpu_to64u (&temp, &a, sim_fpu_round_default);
+	  (*vS).w[i] = altivec_unsigned_saturate_32(temp, &tempsat);
+	  sat |= tempsat;
+	}
+	ALTIVEC_SET_SAT(sat);
+	PPC_INSN_VR_VSCR(VS_BITMASK, VB_BITMASK);
+
+#
+# Vector Estimate instructions, 6-67 ... 6-70.
+#
+
+0.4,6.VS,11.0,16.VB,21.394:VX:av:vexptefp %VD, %VB:Vector 2 Raised to the Exponent Estimate Floating Point
+	int i;
+	unsigned32 f;
+	signed32 bi;
+	sim_fpu b, d;
+	for (i = 0; i < 4; i++) {
+	  /*HACK!*/
+	  sim_fpu_32to (&b, (*vB).w[i]);
+	  sim_fpu_to32i (&bi, &b, sim_fpu_round_default);
+	  bi = 2 ^ bi;
+	  sim_fpu_32to (&d, bi);
+	  sim_fpu_to32 (&f, &d);
+	  (*vS).w[i] = f;
+	}
+	PPC_INSN_VR_VSCR(VS_BITMASK, VB_BITMASK);
+
+0.4,6.VS,11.0,16.VB,21.458:VX:av:vlogefp %VD, %VB:Vector Log2 Estimate Floating Point
+	int i;
+	unsigned32 c, u, f;
+	sim_fpu b, cfpu, d;
+	for (i = 0; i < 4; i++) {
+	  /*HACK!*/
+	  sim_fpu_32to (&b, (*vB).w[i]);
+	  sim_fpu_to32u (&u, &b, sim_fpu_round_default);
+	  for (c = 0; (u /= 2) > 1; c++)
+	    ;
+	  sim_fpu_32to (&cfpu, c);
+	  sim_fpu_add (&d, &b, &cfpu);
+	  sim_fpu_to32 (&f, &d);
+	  (*vS).w[i] = f;
+	}
+	PPC_INSN_VR_VSCR(VS_BITMASK, VB_BITMASK);
+
+#
+# Vector Multiply Add instruction, 6-71
+#
+
+0.4,6.VS,11.VA,16.VB,21.VC,26.46:VAX:av:vmaddfp %VD, %VA, %VB, %VC:Vector Multiply Add Floating Point
+	int i;
+	unsigned32 f;
+	sim_fpu a, b, c, d, e;
+	for (i = 0; i < 4; i++) {
+	  sim_fpu_32to (&a, (*vA).w[i]);
+	  sim_fpu_32to (&b, (*vB).w[i]);
+	  sim_fpu_32to (&c, (*vC).w[i]);
+	  sim_fpu_mul (&e, &a, &c);
+	  sim_fpu_add (&d, &e, &b);
+	  sim_fpu_to32 (&f, &d);
+	  (*vS).w[i] = f;
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK | VC_BITMASK);
+
+
+#
+# Vector Maximum instructions, 6-72 ... 6-78.
+#
+
+0.4,6.VS,11.VA,16.VB,21.1034:VX:av:vmaxfp %VD, %VA, %VB:Vector Maximum Floating Point
+	int i;
+	unsigned32 f;
+	sim_fpu a, b, d;
+	for (i = 0; i < 4; i++) {
+	  sim_fpu_32to (&a, (*vA).w[i]);
+	  sim_fpu_32to (&b, (*vB).w[i]);
+	  sim_fpu_max (&d, &a, &b);
+	  sim_fpu_to32 (&f, &d);
+	  (*vS).w[i] = f;
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.258:VX:av:vmaxsb %VD, %VA, %VB:Vector Maximum Signed Byte
+	int i;
+	signed8 a, b;
+	for (i = 0; i < 16; i++) {
+	  a = (*vA).b[i];
+	  b = (*vB).b[i];
+	  if (a > b)
+	    (*vS).b[i] = a;
+	  else
+	    (*vS).b[i] = b;
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.322:VX:av:vmaxsh %VD, %VA, %VB:Vector Maximum Signed Half Word
+	int i;
+	signed16 a, b;
+	for (i = 0; i < 8; i++) {
+	  a = (*vA).h[i];
+	  b = (*vB).h[i];
+	  if (a > b)
+	    (*vS).h[i] = a;
+	  else
+	    (*vS).h[i] = b;
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.386:VX:av:vmaxsw %VD, %VA, %VB:Vector Maximum Signed Word
+	int i;
+	signed32 a, b;
+	for (i = 0; i < 4; i++) {
+	  a = (*vA).w[i];
+	  b = (*vB).w[i];
+	  if (a > b)
+	    (*vS).w[i] = a;
+	  else
+	    (*vS).w[i] = b;
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.2:VX:av:vmaxub %VD, %VA, %VB:Vector Maximum Unsigned Byte
+	int i;
+	unsigned8 a, b;
+	for (i = 0; i < 16; i++) {
+	  a = (*vA).b[i];
+	  b = (*vB).b[i];
+	  if (a > b)
+	    (*vS).b[i] = a;
+	  else
+	    (*vS).b[i] = b;
+	};
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.66:VX:av:vmaxus %VD, %VA, %VB:Vector Maximum Unsigned Half Word
+	int i;
+	unsigned16 a, b;
+	for (i = 0; i < 8; i++) {
+	  a = (*vA).h[i];
+	  b = (*vB).h[i];
+	  if (a > b)
+	    (*vS).h[i] = a;
+	  else
+	    (*vS).h[i] = b;
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.130:VX:av:vmaxuw %VD, %VA, %VB:Vector Maximum Unsigned Word
+	int i;
+	unsigned32 a, b;
+	for (i = 0; i < 4; i++) {
+	  a = (*vA).w[i];
+	  b = (*vB).w[i];
+	  if (a > b)
+	    (*vS).w[i] = a;
+	  else
+	    (*vS).w[i] = b;
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+
+#
+# Vector Multiple High instructions, 6-79, 6-80.
+#
+
+0.4,6.VS,11.VA,16.VB,21.VC,26.32:VAX:av:vmhaddshs %VD, %VA, %VB, %VC:Vector Multiple High and Add Signed Half Word Saturate
+	int i, sat, tempsat;
+	signed16 a, b;
+	signed32 prod, temp, c;
+	for (i = 0; i < 8; i++) {
+	  a = (*vA).h[i];
+	  b = (*vB).h[i];
+	  c = (signed32)(signed16)(*vC).h[i];
+	  prod = (signed32)a * (signed32)b;
+	  temp = (prod >> 15) + c;
+	  (*vS).h[i] = altivec_signed_saturate_16(temp, &tempsat);
+	  sat |= tempsat;
+	}
+	ALTIVEC_SET_SAT(sat);
+	PPC_INSN_VR_VSCR(VS_BITMASK, VA_BITMASK | VB_BITMASK | VC_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.VC,26.33:VAX:av:vmhraddshs %VD, %VA, %VB, %VC:Vector Multiple High Round and Add Signed Half Word Saturate
+	int i, sat, tempsat;
+	signed16 a, b;
+	signed32 prod, temp, c;
+	for (i = 0; i < 8; i++) {
+	  a = (*vA).h[i];
+	  b = (*vB).h[i];
+	  c = (signed32)(signed16)(*vC).h[i];
+	  prod = (signed32)a * (signed32)b;
+	  prod += 0x4000;
+	  temp = (prod >> 15) + c;
+	  (*vS).h[i] = altivec_signed_saturate_16(temp, &tempsat);
+	  sat |= tempsat;
+	}
+	ALTIVEC_SET_SAT(sat);
+	PPC_INSN_VR_VSCR(VS_BITMASK, VA_BITMASK | VB_BITMASK | VC_BITMASK);
+
+
+#
+# Vector Minimum instructions, 6-81 ... 6-87
+#
+
+0.4,6.VS,11.VA,16.VB,21.1098:VX:av:vminfp %VD, %VA, %VB:Vector Minimum Floating Point
+	int i;
+	unsigned32 f;
+	sim_fpu a, b, d;
+	for (i = 0; i < 4; i++) {
+	  sim_fpu_32to (&a, (*vA).w[i]);
+	  sim_fpu_32to (&b, (*vB).w[i]);
+	  sim_fpu_min (&d, &a, &b);
+	  sim_fpu_to32 (&f, &d);
+	  (*vS).w[i] = f;
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.770:VX:av:vminsb %VD, %VA, %VB:Vector Minimum Signed Byte
+	int i;
+	signed8 a, b;
+	for (i = 0; i < 16; i++) {
+	  a = (*vA).b[i];
+	  b = (*vB).b[i];
+	  if (a < b)
+	    (*vS).b[i] = a;
+	  else
+	    (*vS).b[i] = b;
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.834:VX:av:vminsh %VD, %VA, %VB:Vector Minimum Signed Half Word
+	int i;
+	signed16 a, b;
+	for (i = 0; i < 8; i++) {
+	  a = (*vA).h[i];
+	  b = (*vB).h[i];
+	  if (a < b)
+	    (*vS).h[i] = a;
+	  else
+	    (*vS).h[i] = b;
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.898:VX:av:vminsw %VD, %VA, %VB:Vector Minimum Signed Word
+	int i;
+	signed32 a, b;
+	for (i = 0; i < 4; i++) {
+	  a = (*vA).w[i];
+	  b = (*vB).w[i];
+	  if (a < b)
+	    (*vS).w[i] = a;
+	  else
+	    (*vS).w[i] = b;
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.514:VX:av:vminub %VD, %VA, %VB:Vector Minimum Unsigned Byte
+	int i;
+	unsigned8 a, b;
+	for (i = 0; i < 16; i++) {
+	  a = (*vA).b[i];
+	  b = (*vB).b[i];
+	  if (a < b)
+	    (*vS).b[i] = a;
+	  else
+	    (*vS).b[i] = b;
+	};
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.578:VX:av:vminuh %VD, %VA, %VB:Vector Minimum Unsigned Half Word
+	int i;
+	unsigned16 a, b;
+	for (i = 0; i < 8; i++) {
+	  a = (*vA).h[i];
+	  b = (*vB).h[i];
+	  if (a < b)
+	    (*vS).h[i] = a;
+	  else
+	    (*vS).h[i] = b;
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.642:VX:av:vminuw %VD, %VA, %VB:Vector Minimum Unsigned Word
+	int i;
+	unsigned32 a, b;
+	for (i = 0; i < 4; i++) {
+	  a = (*vA).w[i];
+	  b = (*vB).w[i];
+	  if (a < b)
+	    (*vS).w[i] = a;
+	  else
+	    (*vS).w[i] = b;
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+
+#
+# Vector Multiply Low instruction, 6-88
+#
+
+0.4,6.VS,11.VA,16.VB,21.VC,26.34:VAX:av:vmladduhm %VD, %VA, %VB, %VC:Vector Multiply Low and Add Unsigned Half Word Modulo
+	int i;
+	unsigned16 a, b, c;
+	unsigned32 prod;
+	for (i = 0; i < 8; i++) {
+	  a = (*vA).h[i];
+	  b = (*vB).h[i];
+	  c = (*vC).h[i];
+	  prod = (unsigned32)a * (unsigned32)b;
+	  (*vS).h[i] = (prod + c) & 0xffff;
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK | VC_BITMASK);
+
+
+#
+# Vector Merge instructions, 6-89 ... 6-94
+#
+
+0.4,6.VS,11.VA,16.VB,21.12:VX:av:vmrghb %VD, %VA, %VB:Vector Merge High Byte
+	int i;
+	for (i = 0; i < 16; i += 2) {
+	  (*vS).b[AV_BINDEX(i)] = (*vA).b[AV_BINDEX(i/2)];
+	  (*vS).b[AV_BINDEX(i+1)] = (*vB).b[AV_BINDEX(i/2)]; 
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.76:VX:av:vmrghh %VD, %VA, %VB:Vector Merge High Half Word
+	int i;
+	for (i = 0; i < 8; i += 2) {
+	  (*vS).h[AV_HINDEX(i)] = (*vA).h[AV_HINDEX(i/2)];
+	  (*vS).h[AV_HINDEX(i+1)] = (*vB).h[AV_HINDEX(i/2)]; 
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.140:VX:av:vmrghw %VD, %VA, %VB:Vector Merge High Word
+	int i;
+	for (i = 0; i < 4; i += 2) {
+	  (*vS).w[i] = (*vA).w[i/2];
+	  (*vS).w[i+1] = (*vB).w[i/2]; 
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.268:VX:av:vmrglb %VD, %VA, %VB:Vector Merge Low Byte
+	int i;
+	for (i = 0; i < 16; i += 2) {
+	  (*vS).b[AV_BINDEX(i)] = (*vA).b[AV_BINDEX((i/2) + 8)];
+	  (*vS).b[AV_BINDEX(i+1)] = (*vB).b[AV_BINDEX((i/2) + 8)]; 
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.332:VX:av:vmrglh %VD, %VA, %VB:Vector Merge Low Half Word
+	int i;
+	for (i = 0; i < 8; i += 2) {
+	  (*vS).h[AV_HINDEX(i)] = (*vA).h[AV_HINDEX((i/2) + 4)];
+	  (*vS).h[AV_HINDEX(i+1)] = (*vB).h[AV_HINDEX((i/2) + 4)]; 
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.396:VX:av:vmrglw %VD, %VA, %VB:Vector Merge Low Word
+	int i;
+	for (i = 0; i < 4; i += 2) {
+	  (*vS).w[i] = (*vA).w[(i/2) + 2];
+	  (*vS).w[i+1] = (*vB).w[(i/2) + 2]; 
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+
+#
+# Vector Multiply Sum instructions, 6-95 ... 6-100
+#
+
+0.4,6.VS,11.VA,16.VB,21.VC,26.37:VAX:av:vmsummbm %VD, %VA, %VB, %VC:Vector Multiply Sum Mixed-Sign Byte Modulo
+	int i, j;
+	signed32 temp;
+	signed16 prod, a;
+	unsigned16 b;
+	for (i = 0; i < 4; i++) {
+	  temp = (*vC).w[i];
+	  for (j = 0; j < 4; j++) {
+	    a = (signed16)(signed8)(*vA).b[i*4+j]; 
+	    b = (*vB).b[i*4+j];
+	    prod = a * b;
+	    temp += (signed32)prod;
+	  }
+	  (*vS).w[i] = temp;
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK | VC_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.VC,26.40:VAX:av:vmsumshm %VD, %VA, %VB, %VC:Vector Multiply Sum Signed Half Word Modulo
+	int i, j;
+	signed32 temp, prod, a, b;
+	for (i = 0; i < 4; i++) {
+	  temp = (*vC).w[i];
+	  for (j = 0; j < 2; j++) {
+	    a = (signed32)(signed16)(*vA).h[i*2+j]; 
+	    b = (signed32)(signed16)(*vB).h[i*2+j];
+	    prod = a * b;
+	    temp += prod;
+	  }
+	  (*vS).w[i] = temp;
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK | VC_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.VC,26.41:VAX:av:vmsumshs %VD, %VA, %VB, %VC:Vector Multiply Sum Signed Half Word Saturate
+	int i, j, sat, tempsat;
+	signed64 temp;
+	signed32 prod, a, b;
+	sat = 0;
+	for (i = 0; i < 4; i++) {
+	  temp = (signed64)(signed32)(*vC).w[i];
+	  for (j = 0; j < 2; j++) {
+	    a = (signed32)(signed16)(*vA).h[i*2+j]; 
+	    b = (signed32)(signed16)(*vB).h[i*2+j];
+	    prod = a * b;
+	    temp += (signed64)prod;
+	  }
+	  (*vS).w[i] = altivec_signed_saturate_32(temp, &tempsat);
+	  sat |= tempsat;
+	}
+	ALTIVEC_SET_SAT(sat);
+	PPC_INSN_VR_VSCR(VS_BITMASK, VA_BITMASK | VB_BITMASK | VC_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.VC,26.36:VAX:av:vmsumubm %VD, %VA, %VB, %VC:Vector Multiply Sum Unsigned Byte Modulo
+	int i, j;
+	unsigned32 temp;
+	unsigned16 prod, a, b;
+	for (i = 0; i < 4; i++) {
+	  temp = (*vC).w[i];
+	  for (j = 0; j < 4; j++) {
+	    a = (*vA).b[i*4+j]; 
+	    b = (*vB).b[i*4+j];
+	    prod = a * b;
+	    temp += prod;
+	  }
+	  (*vS).w[i] = temp;
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK | VC_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.VC,26.38:VAX:av:vmsumuhm %VD, %VA, %VB, %VC:Vector Multiply Sum Unsigned Half Word Modulo
+	int i, j;
+	unsigned32 temp, prod, a, b;
+	for (i = 0; i < 4; i++) {
+	  temp = (*vC).w[i];
+	  for (j = 0; j < 2; j++) {
+	    a = (*vA).h[i*2+j]; 
+	    b = (*vB).h[i*2+j];
+	    prod = a * b;
+	    temp += prod;
+	  }
+	  (*vS).w[i] = temp;
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK | VC_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.VC,26.39:VAX:av:vmsumuhs %VD, %VA, %VB, %VC:Vector Multiply Sum Unsigned Half Word Saturate
+	int i, j, sat, tempsat;
+	unsigned32 temp, prod, a, b;
+	sat = 0;
+	for (i = 0; i < 4; i++) {
+	  temp = (*vC).w[i];
+	  for (j = 0; j < 2; j++) {
+	    a = (*vA).h[i*2+j]; 
+	    b = (*vB).h[i*2+j];
+	    prod = a * b;
+	    temp += prod;
+	  }
+	  (*vS).w[i] = altivec_unsigned_saturate_32(temp, &tempsat);
+	  sat |= tempsat;
+	}
+	ALTIVEC_SET_SAT(sat);
+	PPC_INSN_VR_VSCR(VS_BITMASK, VA_BITMASK | VB_BITMASK | VC_BITMASK);
+
+
+#
+# Vector Multiply Even/Odd instructions, 6-101 ... 6-108
+#
+
+0.4,6.VS,11.VA,16.VB,21.776:VX:av:vmulesb %VD, %VA, %VB:Vector Multiply Even Signed Byte
+	int i;
+	signed8 a, b;
+	signed16 prod;
+	for (i = 0; i < 8; i++) {
+	  a = (*vA).b[AV_BINDEX(i*2)]; 
+	  b = (*vB).b[AV_BINDEX(i*2)];
+	  prod = a * b;
+	  (*vS).h[AV_HINDEX(i)] = prod;
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.840:VX:av:vmulesh %VD, %VA, %VB:Vector Multiply Even Signed Half Word
+	int i;
+	signed16 a, b;
+	signed32 prod;
+	for (i = 0; i < 4; i++) {
+	  a = (*vA).h[AV_HINDEX(i*2)]; 
+	  b = (*vB).h[AV_HINDEX(i*2)];
+	  prod = a * b;
+	  (*vS).w[i] = prod;
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.520:VX:av:vmuleub %VD, %VA, %VB:Vector Multiply Even Unsigned Byte
+	int i;
+	unsigned8 a, b;
+	unsigned16 prod;
+	for (i = 0; i < 8; i++) {
+	  a = (*vA).b[AV_BINDEX(i*2)]; 
+	  b = (*vB).b[AV_BINDEX(i*2)];
+	  prod = a * b;
+	  (*vS).h[AV_HINDEX(i)] = prod;
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.584:VX:av:vmuleuh %VD, %VA, %VB:Vector Multiply Even Unsigned Half Word
+	int i;
+	unsigned16 a, b;
+	unsigned32 prod;
+	for (i = 0; i < 4; i++) {
+	  a = (*vA).h[AV_HINDEX(i*2)]; 
+	  b = (*vB).h[AV_HINDEX(i*2)];
+	  prod = a * b;
+	  (*vS).w[i] = prod;
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.264:VX:av:vmulosb %VD, %VA, %VB:Vector Multiply Odd Signed Byte
+	int i;
+	signed8 a, b;
+	signed16 prod;
+	for (i = 0; i < 8; i++) {
+	  a = (*vA).b[AV_BINDEX((i*2)+1)]; 
+	  b = (*vB).b[AV_BINDEX((i*2)+1)];
+	  prod = a * b;
+	  (*vS).h[AV_HINDEX(i)] = prod;
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.328:VX:av:vmulosh %VD, %VA, %VB:Vector Multiply Odd Signed Half Word
+	int i;
+	signed16 a, b;
+	signed32 prod;
+	for (i = 0; i < 4; i++) {
+	  a = (*vA).h[AV_HINDEX((i*2)+1)]; 
+	  b = (*vB).h[AV_HINDEX((i*2)+1)];
+	  prod = a * b;
+	  (*vS).w[i] = prod;
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.8:VX:av:vmuloub %VD, %VA, %VB:Vector Multiply Odd Unsigned Byte
+	int i;
+	unsigned8 a, b;
+	unsigned16 prod;
+	for (i = 0; i < 8; i++) {
+	  a = (*vA).b[AV_BINDEX((i*2)+1)]; 
+	  b = (*vB).b[AV_BINDEX((i*2)+1)];
+	  prod = a * b;
+	  (*vS).h[AV_HINDEX(i)] = prod;
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.72:VX:av:vmulouh %VD, %VA, %VB:Vector Multiply Odd Unsigned Half Word
+	int i;
+	unsigned16 a, b;
+	unsigned32 prod;
+	for (i = 0; i < 4; i++) {
+	  a = (*vA).h[AV_HINDEX((i*2)+1)]; 
+	  b = (*vB).h[AV_HINDEX((i*2)+1)];
+	  prod = a * b;
+	  (*vS).w[i] = prod;
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+
+#
+# Vector Negative Multiply-Subtract instruction, 6-109
+#
+
+0.4,6.VS,11.VA,16.VB,21.VC,26.47:VX:av:vnmsubfp %VD, %VA, %VB, %VC:Vector Negative Multiply-Subtract Floating Point
+	int i;
+	unsigned32 f;
+	sim_fpu a, b, c, d, i1, i2;
+	for (i = 0; i < 4; i++) {
+	  sim_fpu_32to (&a, (*vA).w[i]);
+	  sim_fpu_32to (&b, (*vB).w[i]);
+	  sim_fpu_32to (&c, (*vC).w[i]);
+	  sim_fpu_mul (&i1, &a, &c);
+	  sim_fpu_sub (&i2, &i1, &b);
+	  sim_fpu_neg (&d, &i2);
+	  sim_fpu_to32 (&f, &d);
+	  (*vS).w[i] = f;
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK | VC_BITMASK);
+
+
+#
+# Vector Logical OR instructions, 6-110, 6-111, 6-177
+#
+
+0.4,6.VS,11.VA,16.VB,21.1284:VX:av:vnor %VD, %VA, %VB:Vector Logical NOR
+	int i;
+	for (i = 0; i < 4; i++)
+	  (*vS).w[i] = ~((*vA).w[i] | (*vB).w[i]);
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.1156:VX:av:vor %VD, %VA, %VB:Vector Logical OR
+	int i;
+	for (i = 0; i < 4; i++)
+	  (*vS).w[i] = (*vA).w[i] | (*vB).w[i];
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.1220:VX:av:vxor %VD, %VA, %VB:Vector Logical XOR
+	int i;
+	for (i = 0; i < 4; i++)
+	  (*vS).w[i] = (*vA).w[i] ^ (*vB).w[i];
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+
+#
+# Vector Permute instruction, 6-112
+#
+
+0.4,6.VS,11.VA,16.VB,21.VC,26.43:VX:av:vperm %VD, %VA, %VB, %VC:Vector Permute
+	int i, who;
+	for (i = 0; i < 16; i++) {
+	  who = (*vC).b[AV_BINDEX(i)] & 0x1f;
+	  if (who & 0x10)
+	    (*vS).b[AV_BINDEX(i)] = (*vB).b[AV_BINDEX(who & 0xf)];
+	  else
+	    (*vS).b[AV_BINDEX(i)] = (*vA).b[AV_BINDEX(who & 0xf)];
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK | VC_BITMASK);
+
+
+#
+# Vector Pack instructions, 6-113 ... 6-121
+#
+
+0.4,6.VS,11.VA,16.VB,21.782:VX:av:vpkpx %VD, %VA, %VB:Vector Pack Pixel32
+	int i;
+	for (i = 0; i < 4; i++) {
+	  (*vS).h[AV_HINDEX(i+4)] = ((((*vB).w[i]) >> 9) & 0xfc00)
+	               | ((((*vB).w[i]) >> 6) & 0x03e0)
+	               | ((((*vB).w[i]) >> 3) & 0x001f);
+	  (*vS).h[AV_HINDEX(i)] = ((((*vA).w[i]) >> 9) & 0xfc00)
+	             | ((((*vA).w[i]) >> 6) & 0x03e0)
+	             | ((((*vA).w[i]) >> 3) & 0x001f);
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.398:VX:av:vpkshss %VD, %VA, %VB:Vector Pack Signed Half Word Signed Saturate
+	int i, sat, tempsat;
+	signed16 temp;
+	sat = 0;
+	for (i = 0; i < 16; i++) {
+	  if (i < 8)
+	    temp = (*vA).h[AV_HINDEX(i)];
+	  else
+	    temp = (*vB).h[AV_HINDEX(i-8)];
+	  (*vS).b[AV_BINDEX(i)] = altivec_signed_saturate_8(temp, &tempsat);
+	  sat |= tempsat;
+	}
+	ALTIVEC_SET_SAT(sat);
+	PPC_INSN_VR_VSCR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.270:VX:av:vpkshus %VD, %VA, %VB:Vector Pack Signed Half Word Unsigned Saturate
+	int i, sat, tempsat;
+	signed16 temp;
+	sat = 0;
+	for (i = 0; i < 16; i++) {
+	  if (i < 8)
+	    temp = (*vA).h[AV_HINDEX(i)];
+	  else
+	    temp = (*vB).h[AV_HINDEX(i-8)];
+	  (*vS).b[AV_BINDEX(i)] = altivec_unsigned_saturate_8(temp, &tempsat);
+	  sat |= tempsat;
+	}
+	ALTIVEC_SET_SAT(sat);
+	PPC_INSN_VR_VSCR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.462:VX:av:vpkswss %VD, %VA, %VB:Vector Pack Signed Word Signed Saturate
+	int i, sat, tempsat;
+	signed32 temp;
+	sat = 0;
+	for (i = 0; i < 8; i++) {
+	  if (i < 4)
+	    temp = (*vA).w[i];
+	  else
+	    temp = (*vB).w[i-4];
+	  (*vS).h[AV_HINDEX(i)] = altivec_signed_saturate_16(temp, &tempsat);
+	  sat |= tempsat;
+	}
+	ALTIVEC_SET_SAT(sat);
+	PPC_INSN_VR_VSCR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.334:VX:av:vpkswus %VD, %VA, %VB:Vector Pack Signed Word Unsigned Saturate
+	int i, sat, tempsat;
+	signed32 temp;
+	sat = 0;
+	for (i = 0; i < 8; i++) {
+	  if (i < 4)
+	    temp = (*vA).w[i];
+	  else
+	    temp = (*vB).w[i-4];
+	  (*vS).h[AV_HINDEX(i)] = altivec_unsigned_saturate_16(temp, &tempsat);
+	  sat |= tempsat;
+	}
+	ALTIVEC_SET_SAT(sat);
+	PPC_INSN_VR_VSCR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.14:VX:av:vpkuhum %VD, %VA, %VB:Vector Pack Unsigned Half Word Unsigned Modulo
+	int i;
+	for (i = 0; i < 16; i++)
+	  if (i < 8)
+	    (*vS).b[AV_BINDEX(i)] = (*vA).h[AV_HINDEX(i)];
+	  else
+	    (*vS).b[AV_BINDEX(i)] = (*vB).h[AV_HINDEX(i-8)];
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.142:VX:av:vpkuhus %VD, %VA, %VB:Vector Pack Unsigned Half Word Unsigned Saturate
+	int i, sat, tempsat;
+	signed16 temp;
+	sat = 0;
+	for (i = 0; i < 16; i++) {
+	  if (i < 8)
+	    temp = (*vA).h[AV_HINDEX(i)];
+	  else
+	    temp = (*vB).h[AV_HINDEX(i-8)];
+	  /* force positive in signed16, ok as we'll toss the bit away anyway */
+	  temp &= ~0x8000;
+	  (*vS).b[AV_BINDEX(i)] = altivec_unsigned_saturate_8(temp, &tempsat);
+	  sat |= tempsat;
+	}
+	ALTIVEC_SET_SAT(sat);
+	PPC_INSN_VR_VSCR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.78:VX:av:vpkuwum %VD, %VA, %VB:Vector Pack Unsigned Word Unsigned Modulo
+	int i;
+	for (i = 0; i < 8; i++)
+	  if (i < 8)
+	    (*vS).h[AV_HINDEX(i)] = (*vA).w[i];
+	  else
+	    (*vS).h[AV_HINDEX(i)] = (*vB).w[i-8];
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.206:VX:av:vpkuwus %VD, %VA, %VB:Vector Pack Unsigned Word Unsigned Saturate
+	int i, sat, tempsat;
+	signed32 temp;
+	sat = 0;
+	for (i = 0; i < 8; i++) {
+	  if (i < 4)
+	    temp = (*vA).w[i];
+	  else
+	    temp = (*vB).w[i-4];
+	  /* force positive in signed32, ok as we'll toss the bit away anyway */
+	  temp &= ~0x80000000;
+	  (*vS).h[AV_HINDEX(i)] = altivec_unsigned_saturate_16(temp, &tempsat);
+	  sat |= tempsat;
+	}
+	ALTIVEC_SET_SAT(sat);
+	PPC_INSN_VR_VSCR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+
+#
+# Vector Reciprocal instructions, 6-122, 6-123, 6-131
+#
+
+0.4,6.VS,11.0,16.VB,21.266:VX:av:vrefp %VD, %VB:Vector Reciprocal Estimate Floating Point
+	int i;
+	unsigned32 f;
+	sim_fpu op, d;
+	for (i = 0; i < 4; i++) {
+	  sim_fpu_32to (&op, (*vB).w[i]);
+	  sim_fpu_div (&d, &sim_fpu_one, &op);
+	  sim_fpu_to32 (&f, &d);
+	  (*vS).w[i] = f;
+	}
+	PPC_INSN_VR(VS_BITMASK, VB_BITMASK);
+
+0.4,6.VS,11.0,16.VB,21.330:VX:av:vrsqrtefp %VD, %VB:Vector Reciprocal Square Root Estimate Floating Point
+	int i;
+	unsigned32 f;
+	sim_fpu op, i1, one, d;
+	for (i = 0; i < 4; i++) {
+	  sim_fpu_32to (&op, (*vB).w[i]);
+	  sim_fpu_sqrt (&i1, &op);
+	  sim_fpu_div (&d, &sim_fpu_one, &i1);
+	  sim_fpu_to32 (&f, &d);
+	  (*vS).w[i] = f;
+	}
+	PPC_INSN_VR(VS_BITMASK, VB_BITMASK);
+
+
+#
+# Vector Round instructions, 6-124 ... 6-127
+#
+
+0.4,6.VS,11.0,16.VB,21.714:VX:av:vrfim %VD, %VB:Vector Round to Floating-Point Integer towards Minus Infinity
+	int i;
+	unsigned32 f;
+	sim_fpu op;
+	for (i = 0; i < 4; i++) {
+	  sim_fpu_32to (&op, (*vB).w[i]);
+	  sim_fpu_round_32(&op, sim_fpu_round_down, sim_fpu_denorm_default);
+	  sim_fpu_to32 (&f, &op);
+	  (*vS).w[i] = f;
+	}
+	PPC_INSN_VR(VS_BITMASK, VB_BITMASK);
+
+0.4,6.VS,11.0,16.VB,21.522:VX:av:vrfin %VD, %VB:Vector Round to Floating-Point Integer Nearest
+	int i;
+	unsigned32 f;
+	sim_fpu op;
+	for (i = 0; i < 4; i++) {
+	  sim_fpu_32to (&op, (*vB).w[i]);
+	  sim_fpu_round_32(&op, sim_fpu_round_near, sim_fpu_denorm_default);
+	  sim_fpu_to32 (&f, &op);
+	  (*vS).w[i] = f;
+	}
+	PPC_INSN_VR(VS_BITMASK, VB_BITMASK);
+
+0.4,6.VS,11.0,16.VB,21.650:VX:av:vrfip %VD, %VB:Vector Round to Floating-Point Integer towards Plus Infinity
+	int i;
+	unsigned32 f;
+	sim_fpu op;
+	for (i = 0; i < 4; i++) {
+	  sim_fpu_32to (&op, (*vB).w[i]);
+	  sim_fpu_round_32(&op, sim_fpu_round_up, sim_fpu_denorm_default);
+	  sim_fpu_to32 (&f, &op);
+	  (*vS).w[i] = f;
+	}
+	PPC_INSN_VR(VS_BITMASK, VB_BITMASK);
+
+0.4,6.VS,11.0,16.VB,21.586:VX:av:vrfiz %VD, %VB:Vector Round to Floating-Point Integer towards Zero
+	int i;
+	unsigned32 f;
+	sim_fpu op;
+	for (i = 0; i < 4; i++) {
+	  sim_fpu_32to (&op, (*vB).w[i]);
+	  sim_fpu_round_32(&op, sim_fpu_round_zero, sim_fpu_denorm_default);
+	  sim_fpu_to32 (&f, &op);
+	  (*vS).w[i] = f;
+	}
+	PPC_INSN_VR(VS_BITMASK, VB_BITMASK);
+
+
+#
+# Vector Rotate Left instructions, 6-128 ... 6-130
+#
+
+0.4,6.VS,11.VA,16.VB,21.4:VX:av:vrlb %VD, %VA, %VB:Vector Rotate Left Integer Byte
+	int i;
+	unsigned16 temp;
+	for (i = 0; i < 16; i++) {
+	  temp = (unsigned16)(*vA).b[i] << (((*vB).b[i]) & 7);
+	  (*vS).b[i] = (temp & 0xff) | ((temp >> 8) & 0xff);
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.68:VX:av:vrlh %VD, %VA, %VB:Vector Rotate Left Integer Half Word
+	int i;
+	unsigned32 temp;
+	for (i = 0; i < 8; i++) {
+	  temp = (unsigned32)(*vA).h[i] << (((*vB).h[i]) & 0xf);
+	  (*vS).h[i] = (temp & 0xffff) | ((temp >> 16) & 0xffff);
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.132:VX:av:vrlw %VD, %VA, %VB:Vector Rotate Left Integer Word
+	int i;
+	unsigned64 temp;
+	for (i = 0; i < 4; i++) {
+	  temp = (unsigned64)(*vA).w[i] << (((*vB).w[i]) & 0x1f);
+	  (*vS).w[i] = (temp & 0xffffffff) | ((temp >> 32) & 0xffffffff);
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+
+#
+# Vector Conditional Select instruction, 6-133
+#
+
+0.4,6.VS,11.VA,16.VB,21.VC,26.42:VAX:av:vsel %VD, %VA, %VB, %VC:Vector Conditional Select
+	int i;
+	unsigned32 c;
+	for (i = 0; i < 4; i++) {
+	  c = (*vC).w[i];
+	  (*vS).w[i] = ((*vB).w[i] & c) | ((*vA).w[i] & ~c);
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK | VC_BITMASK);
+
+#
+# Vector Shift Left instructions, 6-134 ... 6-139
+#
+
+0.4,6.VS,11.VA,16.VB,21.452:VX:av:vsl %VD, %VA, %VB:Vector Shift Left
+	int sh, i, j, carry, new_carry;
+	sh = (*vB).b[0] & 7;	/* don't bother checking everything */
+	carry = 0;
+	for (j = 3; j >= 0; j--) {
+	  if (CURRENT_TARGET_BYTE_ORDER == BIG_ENDIAN)
+	    i = j;
+	  else
+	    i = (j + 2) % 4;
+	  new_carry = (*vA).w[i] >> (32 - sh);
+	  (*vS).w[i] = ((*vA).w[i] << sh) | carry;
+	  carry = new_carry;
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.260:VX:av:vslb %VD, %VA, %VB:Vector Shift Left Integer Byte
+	int i, sh;
+	for (i = 0; i < 16; i++) {
+	  sh = ((*vB).b[i]) & 7;
+	  (*vS).b[i] = (*vA).b[i] << sh;
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.0,22.SH,26.44:VX:av:vsldol %VD, %VA, %VB:Vector Shift Left Double by Octet Immediate
+	int i, j;
+	for (j = 0, i = SH; i < 16; i++)
+	  (*vS).b[j++] = (*vA).b[i];
+	for (i = 0; i < SH; i++)
+	  (*vS).b[j++] = (*vB).b[i];
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.324:VX:av:vslh %VD, %VA, %VB:Vector Shift Left Half Word
+	int i, sh;
+	for (i = 0; i < 8; i++) {
+	  sh = ((*vB).h[i]) & 0xf;
+	  (*vS).h[i] = (*vA).h[i] << sh;
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.1036:VX:av:vslo %VD, %VA, %VB:Vector Shift Left by Octet
+	int i, sh;
+	if (CURRENT_TARGET_BYTE_ORDER == BIG_ENDIAN)
+	  sh = ((*vB).b[AV_BINDEX(15)] >> 3) & 0xf;
+	else
+	  sh = ((*vB).b[AV_BINDEX(0)] >> 3) & 0xf;
+	for (i = 0; i < 16; i++) {
+	  if (15 - i > sh)
+	    (*vS).b[AV_BINDEX(i)] = (*vA).b[AV_BINDEX(i + sh)];
+	  else
+	    (*vS).b[AV_BINDEX(i)] = 0;
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.388:VX:av:vslw %VD, %VA, %VB:Vector Shift Left Integer Word
+	int i, sh;
+	for (i = 0; i < 4; i++) {
+	  sh = ((*vB).w[i]) & 0x1f;
+	  (*vS).w[i] = (*vA).w[i] << sh;
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+
+#
+# Vector Splat instructions, 6-140 ... 6-145
+#
+
+0.4,6.VS,11.UIMM,16.VB,21.524:VX:av:vspltb %VD, %VB, %UIMM:Vector Splat Byte
+	int i;
+	unsigned8 b;
+	b = (*vB).b[AV_BINDEX(UIMM & 0xf)];
+	for (i = 0; i < 16; i++)
+	  (*vS).b[i] = b;
+	PPC_INSN_VR(VS_BITMASK, VB_BITMASK);
+
+0.4,6.VS,11.UIMM,16.VB,21.588:VX:av:vsplth %VD, %VB, %UIMM:Vector Splat Half Word
+	int i;
+	unsigned16 h;
+	h = (*vB).h[AV_HINDEX(UIMM & 0x7)];
+	for (i = 0; i < 8; i++)
+	  (*vS).h[i] = h;
+	PPC_INSN_VR(VS_BITMASK, VB_BITMASK);
+
+0.4,6.VS,11.SIMM,16.0,21.780:VX:av:vspltisb %VD, %SIMM:Vector Splat Immediate Signed Byte
+	int i;
+	signed8 b = SIMM;
+	/* manual 5-bit signed extension */
+	if (b & 0x10)
+	  b -= 0x20;
+	for (i = 0; i < 16; i++)
+	  (*vS).b[i] = b;
+	PPC_INSN_VR(VS_BITMASK, 0);
+
+0.4,6.VS,11.SIMM,16.0,21.844:VX:av:vspltish %VD, %SIMM:Vector Splat Immediate Signed Half Word
+	int i;
+	signed16 h = SIMM;
+	/* manual 5-bit signed extension */
+	if (h & 0x10)
+	  h -= 0x20;
+	for (i = 0; i < 8; i++)
+	  (*vS).h[i] = h;
+	PPC_INSN_VR(VS_BITMASK, 0);
+
+0.4,6.VS,11.SIMM,16.0,21.908:VX:av:vspltisw %VD, %SIMM:Vector Splat Immediate Signed Word
+	int i;
+	signed32 w = SIMM;
+	/* manual 5-bit signed extension */
+	if (w & 0x10)
+	  w -= 0x20;
+	for (i = 0; i < 4; i++)
+	  (*vS).w[i] = w;
+	PPC_INSN_VR(VS_BITMASK, 0);
+
+0.4,6.VS,11.UIMM,16.VB,21.652:VX:av:vspltw %VD, %VB, %UIMM:Vector Splat Word
+	int i;
+	unsigned32 w;
+	w = (*vB).w[UIMM & 0x3];
+	for (i = 0; i < 4; i++)
+	  (*vS).w[i] = w;
+	PPC_INSN_VR(VS_BITMASK, VB_BITMASK);
+
+
+#
+# Vector Shift Right instructions, 6-146 ... 6-154
+#
+
+0.4,6.VS,11.VA,16.VB,21.708:VX:av:vsr %VD, %VA, %VB:Vector Shift Right
+	int sh, i, j, carry, new_carry;
+	sh = (*vB).b[0] & 7;	/* don't bother checking everything */
+	carry = 0;
+	for (j = 0; j < 4; j++) {
+	  if (CURRENT_TARGET_BYTE_ORDER == BIG_ENDIAN)
+	    i = j;
+	  else
+	    i = (j + 2) % 4;
+	  new_carry = (*vA).w[i] << (32 - sh);
+	  (*vS).w[i] = ((*vA).w[i] >> sh) | carry;
+	  carry = new_carry;
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.772:VX:av:vsrab %VD, %VA, %VB:Vector Shift Right Algebraic Byte
+	int i, sh;
+	signed16 a;
+	for (i = 0; i < 16; i++) {
+	  sh = ((*vB).b[i]) & 7;
+	  a = (signed16)(signed8)(*vA).b[i];
+	  (*vS).b[i] = (a >> sh) & 0xff;
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.836:VX:av:vsrah %VD, %VA, %VB:Vector Shift Right Algebraic Half Word
+	int i, sh;
+	signed32 a;
+	for (i = 0; i < 8; i++) {
+	  sh = ((*vB).h[i]) & 0xf;
+	  a = (signed32)(signed16)(*vA).h[i];
+	  (*vS).h[i] = (a >> sh) & 0xffff;
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.900:VX:av:vsraw %VD, %VA, %VB:Vector Shift Right Algebraic Word
+	int i, sh;
+	signed64 a;
+	for (i = 0; i < 4; i++) {
+	  sh = ((*vB).w[i]) & 0xf;
+	  a = (signed64)(signed32)(*vA).w[i];
+	  (*vS).w[i] = (a >> sh) & 0xffffffff;
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.516:VX:av:vsrb %VD, %VA, %VB:Vector Shift Right Byte
+	int i, sh;
+	for (i = 0; i < 16; i++) {
+	  sh = ((*vB).b[i]) & 7;
+	  (*vS).b[i] = (*vA).b[i] >> sh;
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.580:VX:av:vsrh %VD, %VA, %VB:Vector Shift Right Half Word
+	int i, sh;
+	for (i = 0; i < 8; i++) {
+	  sh = ((*vB).h[i]) & 0xf;
+	  (*vS).h[i] = (*vA).h[i] >> sh;
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.1100:VX:av:vsro %VD, %VA, %VB:Vector Shift Right Octet
+	int i, sh;
+	if (CURRENT_TARGET_BYTE_ORDER == BIG_ENDIAN)
+	  sh = ((*vB).b[AV_BINDEX(15)] >> 3) & 0xf;
+	else
+	  sh = ((*vB).b[AV_BINDEX(0)] >> 3) & 0xf;
+	for (i = 0; i < 16; i++) {
+	  if (i < sh)
+	    (*vS).b[AV_BINDEX(i)] = 0;
+	  else
+	    (*vS).b[AV_BINDEX(i)] = (*vA).b[AV_BINDEX(i - sh)];
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.644:VX:av:vsrw %VD, %VA, %VB:Vector Shift Right Word
+	int i, sh;
+	for (i = 0; i < 4; i++) {
+	  sh = ((*vB).w[i]) & 0x1f;
+	  (*vS).w[i] = (*vA).w[i] >> sh;
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+
+#
+# Vector Subtract instructions, 6-155 ... 6-165
+#
+
+0.4,6.VS,11.VA,16.VB,21.1408:VX:av:vsubcuw %VD, %VA, %VB:Vector Subtract Carryout Unsigned Word
+	int i;
+	signed64 temp, a, b;
+	for (i = 0; i < 4; i++) {
+	  a = (signed64)(unsigned32)(*vA).w[i];
+	  b = (signed64)(unsigned32)(*vB).w[i];
+	  temp = a - b;
+	  (*vS).w[i] = ~(temp >> 32) & 1;
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.74:VX:av:vsubfp %VD, %VA, %VB:Vector Subtract Floating Point
+	int i;
+	unsigned32 f;
+	sim_fpu a, b, d;
+	for (i = 0; i < 4; i++) {
+	  sim_fpu_32to (&a, (*vA).w[i]);
+	  sim_fpu_32to (&b, (*vB).w[i]);
+	  sim_fpu_sub (&d, &a, &b);
+	  sim_fpu_to32 (&f, &d);
+	  (*vS).w[i] = f;
+	}
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.1792:VX:av:vsubsbs %VD, %VA, %VB:Vector Subtract Signed Byte Saturate
+	int i, sat, tempsat;
+	signed16 temp;
+	sat = 0;
+	for (i = 0; i < 16; i++) {
+	  temp = (signed16)(signed8)(*vA).b[i] - (signed16)(signed8)(*vB).b[i];
+	  (*vS).b[i] = altivec_signed_saturate_8(temp, &tempsat);
+	  sat |= tempsat;
+	}
+	ALTIVEC_SET_SAT(sat);
+	PPC_INSN_VR_VSCR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.1856:VX:av:vsubshs %VD, %VA, %VB:Vector Subtract Signed Half Word Saturate
+	int i, sat, tempsat;
+	signed32 temp;
+	sat = 0;
+	for (i = 0; i < 8; i++) {
+	  temp = (signed32)(signed16)(*vA).h[i] - (signed32)(signed16)(*vB).h[i];
+	  (*vS).h[i] = altivec_signed_saturate_16(temp, &tempsat);
+	  sat |= tempsat;
+	}
+	ALTIVEC_SET_SAT(sat);
+	PPC_INSN_VR_VSCR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.1920:VX:av:vsubsws %VD, %VA, %VB:Vector Subtract Signed Word Saturate
+	int i, sat, tempsat;
+	signed64 temp;
+	sat = 0;
+	for (i = 0; i < 4; i++) {
+	  temp = (signed64)(signed32)(*vA).w[i] - (signed64)(signed32)(*vB).w[i];
+	  (*vS).w[i] = altivec_signed_saturate_32(temp, &tempsat);
+	  sat |= tempsat;
+	}
+	ALTIVEC_SET_SAT(sat);
+	PPC_INSN_VR_VSCR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.1024:VX:av:vsububm %VD, %VA, %VB:Vector Subtract Unsigned Byte Modulo
+	int i;
+	for (i = 0; i < 16; i++)
+	  (*vS).b[i] = (*vA).b[i] - (*vB).b[i];
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.1536:VX:av:vsububs %VD, %VA, %VB:Vector Subtract Unsigned Byte Saturate
+	int i, sat, tempsat;
+	signed16 temp;
+	sat = 0;
+	for (i = 0; i < 16; i++) {
+	  temp = (signed16)(unsigned8)(*vA).b[i] - (signed16)(unsigned8)(*vB).b[i];
+	  (*vS).b[i] = altivec_unsigned_saturate_8(temp, &tempsat);
+	  sat |= tempsat;
+	}
+	ALTIVEC_SET_SAT(sat);
+	PPC_INSN_VR_VSCR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.1088:VX:av:vsubuhm %VD, %VA, %VB:Vector Subtract Unsigned Half Word Modulo
+	int i;
+	for (i = 0; i < 8; i++)
+	  (*vS).h[i] = ((*vA).h[i] - (*vB).h[i]) & 0xffff;
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.1600:VX:av:vsubuhs %VD, %VA, %VB:Vector Subtract Unsigned Half Word Saturate
+	int i, sat, tempsat;
+	signed32 temp;
+	for (i = 0; i < 8; i++) {
+	  temp = (signed32)(unsigned16)(*vA).h[i] - (signed32)(unsigned16)(*vB).h[i];
+	  (*vS).h[i] = altivec_unsigned_saturate_16(temp, &tempsat);
+	  sat |= tempsat;
+	}
+	ALTIVEC_SET_SAT(sat);
+	PPC_INSN_VR_VSCR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.1152:VX:av:vsubuwm %VD, %VA, %VB:Vector Subtract Unsigned Word Modulo
+	int i;
+	for (i = 0; i < 4; i++)
+	  (*vS).w[i] = (*vA).w[i] - (*vB).w[i];
+	PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.1664:VX:av:vsubuws %VD, %VA, %VB:Vector Subtract Unsigned Word Saturate
+	int i, sat, tempsat;
+	signed64 temp;
+	for (i = 0; i < 4; i++) {
+	  temp = (signed64)(unsigned32)(*vA).w[i] - (signed64)(unsigned32)(*vB).w[i];
+	  (*vS).w[i] = altivec_unsigned_saturate_32(temp, &tempsat);
+	  sat |= tempsat;
+	}
+	ALTIVEC_SET_SAT(sat);
+	PPC_INSN_VR_VSCR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+
+#
+# Vector Sum instructions, 6-166 ... 6-170
+#
+
+0.4,6.VS,11.VA,16.VB,21.1928:VX:av:vsumsws %VD, %VA, %VB:Vector Sum Across Signed Word Saturate
+	int i, sat;
+	signed64 temp;
+	temp = (signed64)(signed32)(*vB).w[3];
+	for (i = 0; i < 4; i++)
+	  temp += (signed64)(signed32)(*vA).w[i];
+	(*vS).w[3] = altivec_signed_saturate_32(temp, &sat);
+	(*vS).w[0] = (*vS).w[1] = (*vS).w[2] = 0;
+	ALTIVEC_SET_SAT(sat);
+	PPC_INSN_VR_VSCR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.1672:VX:av:vsum2sws %VD, %VA, %VB:Vector Sum Across Partial (1/2) Signed Word Saturate
+	int i, j, sat, tempsat;
+	signed64 temp;
+	for (j = 0; j < 4; j += 2) {
+	  temp = (signed64)(signed32)(*vB).w[j+1];
+	  temp += (signed64)(signed32)(*vA).w[j] + (signed64)(signed32)(*vA).w[j+1];
+	  (*vS).w[j+1] = altivec_signed_saturate_32(temp, &tempsat);
+	  sat |= tempsat;
+	}
+	(*vS).w[0] = (*vS).w[2] = 0;
+	ALTIVEC_SET_SAT(sat);
+	PPC_INSN_VR_VSCR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.1800:VX:av:vsum4sbs %VD, %VA, %VB:Vector Sum Across Partial (1/4) Signed Byte Saturate
+	int i, j, sat, tempsat;
+	signed64 temp;
+	for (j = 0; j < 4; j++) {
+	  temp = (signed64)(signed32)(*vB).w[j];
+	  for (i = 0; i < 4; i++)
+	    temp += (signed64)(signed8)(*vA).b[i+(j*4)];
+	  (*vS).w[j] = altivec_signed_saturate_32(temp, &tempsat);
+	  sat |= tempsat;
+	}
+	ALTIVEC_SET_SAT(sat);
+	PPC_INSN_VR_VSCR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.1608:VX:av:vsum4shs %VD, %VA, %VB:Vector Sum Across Partial (1/4) Signed Half Word Saturate
+	int i, j, sat, tempsat;
+	signed64 temp;
+	for (j = 0; j < 4; j++) {
+	  temp = (signed64)(signed32)(*vB).w[j];
+	  for (i = 0; i < 2; i++)
+	    temp += (signed64)(signed16)(*vA).h[i+(j*2)];
+	  (*vS).w[j] = altivec_signed_saturate_32(temp, &tempsat);
+	  sat |= tempsat;
+	}
+	ALTIVEC_SET_SAT(sat);
+	PPC_INSN_VR_VSCR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+0.4,6.VS,11.VA,16.VB,21.1544:VX:av:vsum4ubs %VD, %VA, %VB:Vector Sum Across Partial (1/4) Unsigned Byte Saturate
+	int i, j, sat, tempsat;
+	signed64 utemp;
+	signed64 temp;
+	for (j = 0; j < 4; j++) {
+	  utemp = (signed64)(unsigned32)(*vB).w[j];
+	  for (i = 0; i < 4; i++)
+	    utemp += (signed64)(unsigned16)(*vA).b[i+(j*4)];
+	  temp = utemp;
+	  (*vS).w[j] = altivec_unsigned_saturate_32(temp, &tempsat);
+	  sat |= tempsat;
+	}
+	ALTIVEC_SET_SAT(sat);
+	PPC_INSN_VR_VSCR(VS_BITMASK, VA_BITMASK | VB_BITMASK);
+
+
+#
+# Vector Unpack instructions, 6-171 ... 6-176
+#
+
+0.4,6.VS,11.0,16.VB,21.846:VX:av:vupkhpx %VD, %VB:Vector Unpack High Pixel16
+	int i;
+	unsigned16 h;
+	for (i = 0; i < 4; i++) {
+	  h = (*vB).h[AV_HINDEX(i)];
+	  (*vS).w[i] = ((h & 0x8000) ? 0xff000000 : 0)
+		     | ((h & 0x7c00) << 6)
+		     | ((h & 0x03e0) << 3)
+		     | ((h & 0x001f));
+	}
+	PPC_INSN_VR(VS_BITMASK, VB_BITMASK);
+
+0.4,6.VS,11.0,16.VB,21.526:VX:av:vupkhsb %VD, %VB:Vector Unpack High Signed Byte
+	int i;
+	for (i = 0; i < 8; i++)
+	  (*vS).h[AV_HINDEX(i)] = (signed16)(signed8)(*vB).b[AV_BINDEX(i)];
+	PPC_INSN_VR(VS_BITMASK, VB_BITMASK);
+
+0.4,6.VS,11.0,16.VB,21.590:VX:av:vupkhsh %VD, %VB:Vector Unpack High Signed Half Word
+	int i;
+	for (i = 0; i < 4; i++)
+	  (*vS).w[i] = (signed32)(signed16)(*vB).h[AV_HINDEX(i)];
+	PPC_INSN_VR(VS_BITMASK, VB_BITMASK);
+
+0.4,6.VS,11.0,16.VB,21.974:VX:av:vupklpx %VD, %VB:Vector Unpack Low Pixel16
+	int i;
+	unsigned16 h;
+	for (i = 0; i < 4; i++) {
+	  h = (*vB).h[AV_HINDEX(i + 4)];
+	  (*vS).w[i] = ((h & 0x8000) ? 0xff000000 : 0)
+		     | ((h & 0x7c00) << 6)
+		     | ((h & 0x03e0) << 3)
+		     | ((h & 0x001f));
+	}
+	PPC_INSN_VR(VS_BITMASK, VB_BITMASK);
+
+0.4,6.VS,11.0,16.VB,21.654:VX:av:vupklsb %VD, %VB:Vector Unpack Low Signed Byte
+	int i;
+	for (i = 0; i < 8; i++)
+	  (*vS).h[AV_HINDEX(i)] = (signed16)(signed8)(*vB).b[AV_BINDEX(i + 8)];
+	PPC_INSN_VR(VS_BITMASK, VB_BITMASK);
+
+0.4,6.VS,11.0,16.VB,21.718:VX:av:vupklsh %VD, %VB:Vector Unpack Low Signed Half Word
+	int i;
+	for (i = 0; i < 4; i++)
+	  (*vS).w[i] = (signed32)(signed16)(*vB).h[AV_HINDEX(i + 4)];
+	PPC_INSN_VR(VS_BITMASK, VB_BITMASK);
diff --git a/sim/ppc/altivec_expression.h b/sim/ppc/altivec_expression.h
new file mode 100644
index 0000000..6cf2e76
--- /dev/null
+++ b/sim/ppc/altivec_expression.h
@@ -0,0 +1,50 @@
+/* Altivec expression macros, for PSIM, the PowerPC simulator.
+
+   Copyright 2003 Free Software Foundation, Inc.
+
+   Contributed by Red Hat Inc; developed under contract from Motorola.
+   Written by matthew green <mrg@redhat.com>.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+/* AltiVec macro helpers.  */
+
+#define ALTIVEC_SET_CR6(vS, checkone) \
+do { \
+  if (checkone && ((*vS).w[0] == 0xffffffff && \
+		   (*vS).w[1] == 0xffffffff && \
+		   (*vS).w[2] == 0xffffffff && \
+		   (*vS).w[3] == 0xffffffff)) \
+    CR_SET(6, 1 << 3); \
+  else if ((*vS).w[0] == 0 && \
+           (*vS).w[1] == 0 && \
+           (*vS).w[2] == 0 && \
+           (*vS).w[3] == 0) \
+    CR_SET(6, 1 << 1); \
+  else \
+    CR_SET(6, 0); \
+} while (0)
+
+#define	VSCR_SAT	0x00000001
+#define	VSCR_NJ		0x00010000
+
+#define ALTIVEC_SET_SAT(sat) \
+do { \
+  if (sat) \
+    VSCR |= VSCR_SAT; \
+} while (0)
diff --git a/sim/ppc/altivec_registers.h b/sim/ppc/altivec_registers.h
new file mode 100644
index 0000000..923f5c4
--- /dev/null
+++ b/sim/ppc/altivec_registers.h
@@ -0,0 +1,63 @@
+/* Altivec registers, for PSIM, the PowerPC simulator.
+
+   Copyright 2003 Free Software Foundation, Inc.
+
+   Contributed by Red Hat Inc; developed under contract from Motorola.
+   Written by matthew green <mrg@redhat.com>.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+/* Manage this as 4 32-bit entities, 8 16-bit entities or 16 8-bit
+   entities.  */
+typedef union
+{
+  unsigned8 b[16];
+  unsigned16 h[8];
+  unsigned32 w[4];
+} vreg;
+
+typedef unsigned32 vscreg;
+
+struct altivec_regs {
+  /* AltiVec Registers */
+  vreg vr[32];
+  vscreg vscr;
+};
+
+/* AltiVec registers */
+#define VR(N)		cpu_registers(processor)->altivec.vr[N]
+
+/* AltiVec vector status and control register */
+#define VSCR		cpu_registers(processor)->altivec.vscr
+
+/* AltiVec endian helpers, wrong endian hosts vs targets need to be
+   sure to get the right bytes/halfs/words when the order matters.
+   Note that many AltiVec instructions do not depend on byte order and
+   work on N independant bits of data.  This is only for the
+   instructions that actually move data around.  */
+
+#if (WITH_HOST_BYTE_ORDER == BIG_ENDIAN)
+#define AV_BINDEX(x)	((x) & 15)
+#define AV_HINDEX(x)	((x) & 7)
+#else
+static char endian_b2l_bindex[16] = { 3, 2, 1, 0, 7, 6, 5, 4,
+			     11, 10, 9, 8, 15, 14, 13, 12 };
+static char endian_b2l_hindex[16] = { 1, 0, 3, 2, 5, 4, 7, 6 };
+#define AV_BINDEX(x)	endian_b2l_bindex[(x) & 15]
+#define AV_HINDEX(x)	endian_b2l_hindex[(x) & 7]
+#endif
diff --git a/sim/ppc/configure b/sim/ppc/configure
index c6f7063..a48a831 100755
--- a/sim/ppc/configure
+++ b/sim/ppc/configure
@@ -163,7 +163,7 @@
 ac_help="$ac_help
   --enable-sim-filter=rule		Specify filter rules."
 ac_help="$ac_help
-  --enable-sim-float			Specify whether to use host floating point or simulate."
+  --enable-sim-float			Specify whether the target has hard, soft, altivec or e500 floating point."
 ac_help="$ac_help
   --enable-sim-hardware=list		Specify the hardware to be included in the build."
 ac_help="$ac_help
@@ -3036,13 +3036,21 @@
   case "${enableval}" in
   yes | hard)	sim_float="-DWITH_FLOATING_POINT=HARD_FLOATING_POINT";;
   no | soft)	sim_float="-DWITH_FLOATING_POINT=SOFT_FLOATING_POINT";;
+  altivec)      sim_float="-DWITH_ALTIVEC" ; sim_filter="${sim_filter},av" ;;
+  *spe*|*simd*) sim_float="-DWITH_E500" ; sim_filter="${sim_filter},e500" ;;
   *)		{ echo "configure: error: "Unknown value $enableval passed to --enable-sim-float"" 1>&2; exit 1; }; sim_float="";;
 esac
 if test x"$silent" != x"yes" && test x"$sim_float" != x""; then
   echo "Setting float flags = $sim_float" 6>&1
 fi
 else
-  sim_float=""
+  
+case "${target}" in
+  *altivec*) sim_float="-DWITH_ALTIVEC" ; sim_filter="${sim_filter},av" ;;
+  *spe*|*simd*)	sim_float="-DWITH_E500" ; sim_filter="${sim_filter},e500" ;;
+  *) sim_float=""
+esac
+
 fi
 
 
@@ -3103,14 +3111,14 @@
   
 if test "x$cross_compiling" = "xno"; then
   echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
-echo "configure:3107: checking whether byte ordering is bigendian" >&5
+echo "configure:3115: checking whether byte ordering is bigendian" >&5
 if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_cv_c_bigendian=unknown
 # See if sys/param.h defines the BYTE_ORDER macro.
 cat > conftest.$ac_ext <<EOF
-#line 3114 "configure"
+#line 3122 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/param.h>
@@ -3121,11 +3129,11 @@
 #endif
 ; return 0; }
 EOF
-if { (eval echo configure:3125: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3133: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   # It does; now see whether it defined to BIG_ENDIAN or not.
 cat > conftest.$ac_ext <<EOF
-#line 3129 "configure"
+#line 3137 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/param.h>
@@ -3136,7 +3144,7 @@
 #endif
 ; return 0; }
 EOF
-if { (eval echo configure:3140: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3148: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_bigendian=yes
 else
@@ -3156,7 +3164,7 @@
     { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 3160 "configure"
+#line 3168 "configure"
 #include "confdefs.h"
 main () {
   /* Are we little or big endian?  From Harbison&Steele.  */
@@ -3169,7 +3177,7 @@
   exit (u.c[sizeof (long) - 1] == 1);
 }
 EOF
-if { (eval echo configure:3173: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3181: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_c_bigendian=no
 else
@@ -3623,7 +3631,7 @@
 fi
 
 echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:3627: checking host system type" >&5
+echo "configure:3635: checking host system type" >&5
 
 host_alias=$host
 case "$host_alias" in
@@ -3644,7 +3652,7 @@
 echo "$ac_t""$host" 1>&6
 
 echo $ac_n "checking target system type""... $ac_c" 1>&6
-echo "configure:3648: checking target system type" >&5
+echo "configure:3656: checking target system type" >&5
 
 target_alias=$target
 case "$target_alias" in
@@ -3662,7 +3670,7 @@
 echo "$ac_t""$target" 1>&6
 
 echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:3666: checking build system type" >&5
+echo "configure:3674: checking build system type" >&5
 
 build_alias=$build
 case "$build_alias" in
@@ -3709,12 +3717,12 @@
 
 
 echo $ac_n "checking for st_blksize in struct stat""... $ac_c" 1>&6
-echo "configure:3713: checking for st_blksize in struct stat" >&5
+echo "configure:3721: checking for st_blksize in struct stat" >&5
 if eval "test \"`echo '$''{'ac_cv_struct_st_blksize'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3718 "configure"
+#line 3726 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -3722,7 +3730,7 @@
 struct stat s; s.st_blksize;
 ; return 0; }
 EOF
-if { (eval echo configure:3726: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3734: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_struct_st_blksize=yes
 else
@@ -3743,12 +3751,12 @@
 fi
 
 echo $ac_n "checking for st_blocks in struct stat""... $ac_c" 1>&6
-echo "configure:3747: checking for st_blocks in struct stat" >&5
+echo "configure:3755: checking for st_blocks in struct stat" >&5
 if eval "test \"`echo '$''{'ac_cv_struct_st_blocks'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3752 "configure"
+#line 3760 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -3756,7 +3764,7 @@
 struct stat s; s.st_blocks;
 ; return 0; }
 EOF
-if { (eval echo configure:3760: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3768: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_struct_st_blocks=yes
 else
@@ -3779,12 +3787,12 @@
 fi
 
 echo $ac_n "checking for st_rdev in struct stat""... $ac_c" 1>&6
-echo "configure:3783: checking for st_rdev in struct stat" >&5
+echo "configure:3791: checking for st_rdev in struct stat" >&5
 if eval "test \"`echo '$''{'ac_cv_struct_st_rdev'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3788 "configure"
+#line 3796 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -3792,7 +3800,7 @@
 struct stat s; s.st_rdev;
 ; return 0; }
 EOF
-if { (eval echo configure:3796: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3804: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_struct_st_rdev=yes
 else
@@ -3813,12 +3821,12 @@
 fi
 
 echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6
-echo "configure:3817: checking whether struct tm is in sys/time.h or time.h" >&5
+echo "configure:3825: checking whether struct tm is in sys/time.h or time.h" >&5
 if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3822 "configure"
+#line 3830 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <time.h>
@@ -3826,7 +3834,7 @@
 struct tm *tp; tp->tm_sec;
 ; return 0; }
 EOF
-if { (eval echo configure:3830: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3838: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_struct_tm=time.h
 else
@@ -3847,12 +3855,12 @@
 fi
 
 echo $ac_n "checking for tm_zone in struct tm""... $ac_c" 1>&6
-echo "configure:3851: checking for tm_zone in struct tm" >&5
+echo "configure:3859: checking for tm_zone in struct tm" >&5
 if eval "test \"`echo '$''{'ac_cv_struct_tm_zone'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3856 "configure"
+#line 3864 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <$ac_cv_struct_tm>
@@ -3860,7 +3868,7 @@
 struct tm tm; tm.tm_zone;
 ; return 0; }
 EOF
-if { (eval echo configure:3864: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3872: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_struct_tm_zone=yes
 else
@@ -3880,12 +3888,12 @@
 
 else
   echo $ac_n "checking for tzname""... $ac_c" 1>&6
-echo "configure:3884: checking for tzname" >&5
+echo "configure:3892: checking for tzname" >&5
 if eval "test \"`echo '$''{'ac_cv_var_tzname'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3889 "configure"
+#line 3897 "configure"
 #include "confdefs.h"
 #include <time.h>
 #ifndef tzname /* For SGI.  */
@@ -3895,7 +3903,7 @@
 atoi(*tzname);
 ; return 0; }
 EOF
-if { (eval echo configure:3899: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3907: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_var_tzname=yes
 else
@@ -3918,12 +3926,12 @@
 
 
 echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6
-echo "configure:3922: checking for uid_t in sys/types.h" >&5
+echo "configure:3930: checking for uid_t in sys/types.h" >&5
 if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3927 "configure"
+#line 3935 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 EOF
@@ -3952,7 +3960,7 @@
 fi
 
 echo $ac_n "checking type of array argument to getgroups""... $ac_c" 1>&6
-echo "configure:3956: checking type of array argument to getgroups" >&5
+echo "configure:3964: checking type of array argument to getgroups" >&5
 if eval "test \"`echo '$''{'ac_cv_type_getgroups'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3960,7 +3968,7 @@
   ac_cv_type_getgroups=cross
 else
   cat > conftest.$ac_ext <<EOF
-#line 3964 "configure"
+#line 3972 "configure"
 #include "confdefs.h"
 
 /* Thanks to Mike Rendell for this test.  */
@@ -3985,7 +3993,7 @@
 }
 
 EOF
-if { (eval echo configure:3989: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3997: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
     ac_cv_type_getgroups=gid_t
 else
@@ -3999,7 +4007,7 @@
 
 if test $ac_cv_type_getgroups = cross; then
         cat > conftest.$ac_ext <<EOF
-#line 4003 "configure"
+#line 4011 "configure"
 #include "confdefs.h"
 #include <unistd.h>
 EOF
@@ -4023,12 +4031,12 @@
 
 
 echo $ac_n "checking for mode_t""... $ac_c" 1>&6
-echo "configure:4027: checking for mode_t" >&5
+echo "configure:4035: checking for mode_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_mode_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4032 "configure"
+#line 4040 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -4056,12 +4064,12 @@
 fi
 
 echo $ac_n "checking for off_t""... $ac_c" 1>&6
-echo "configure:4060: checking for off_t" >&5
+echo "configure:4068: checking for off_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4065 "configure"
+#line 4073 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -4089,12 +4097,12 @@
 fi
 
 echo $ac_n "checking for pid_t""... $ac_c" 1>&6
-echo "configure:4093: checking for pid_t" >&5
+echo "configure:4101: checking for pid_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4098 "configure"
+#line 4106 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -4122,12 +4130,12 @@
 fi
 
 echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
-echo "configure:4126: checking return type of signal handlers" >&5
+echo "configure:4134: checking return type of signal handlers" >&5
 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4131 "configure"
+#line 4139 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <signal.h>
@@ -4144,7 +4152,7 @@
 int i;
 ; return 0; }
 EOF
-if { (eval echo configure:4148: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4156: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_type_signal=void
 else
@@ -4163,12 +4171,12 @@
 
 
 echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:4167: checking for size_t" >&5
+echo "configure:4175: checking for size_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4172 "configure"
+#line 4180 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -4196,12 +4204,12 @@
 fi
 
 echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6
-echo "configure:4200: checking for uid_t in sys/types.h" >&5
+echo "configure:4208: checking for uid_t in sys/types.h" >&5
 if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4205 "configure"
+#line 4213 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 EOF
@@ -4233,12 +4241,12 @@
 for ac_func in access cfgetispeed cfgetospeed cfsetispeed cfsetospeed chdir chmod chown dup dup2 fchmod fchown fcntl fstat fstatfs getdirentries getegid geteuid getgid getpid getppid getrusage gettimeofday getuid ioctl kill link lseek lstat mkdir pipe readlink rmdir setreuid setregid stat sigprocmask stat symlink tcgetattr tcsetattr tcsendbreak tcdrain tcflush tcflow tcgetpgrp tcsetpgrp time umask unlink
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4237: checking for $ac_func" >&5
+echo "configure:4245: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4242 "configure"
+#line 4250 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -4261,7 +4269,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:4265: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4273: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -4290,17 +4298,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4294: checking for $ac_hdr" >&5
+echo "configure:4302: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4299 "configure"
+#line 4307 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4304: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4312: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -4331,12 +4339,12 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6
-echo "configure:4335: checking for $ac_hdr that defines DIR" >&5
+echo "configure:4343: checking for $ac_hdr that defines DIR" >&5
 if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4340 "configure"
+#line 4348 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <$ac_hdr>
@@ -4344,7 +4352,7 @@
 DIR *dirp = 0;
 ; return 0; }
 EOF
-if { (eval echo configure:4348: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4356: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   eval "ac_cv_header_dirent_$ac_safe=yes"
 else
@@ -4369,7 +4377,7 @@
 # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
 if test $ac_header_dirent = dirent.h; then
 echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6
-echo "configure:4373: checking for opendir in -ldir" >&5
+echo "configure:4381: checking for opendir in -ldir" >&5
 ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4377,7 +4385,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-ldir  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4381 "configure"
+#line 4389 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -4388,7 +4396,7 @@
 opendir()
 ; return 0; }
 EOF
-if { (eval echo configure:4392: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4400: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4410,7 +4418,7 @@
 
 else
 echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6
-echo "configure:4414: checking for opendir in -lx" >&5
+echo "configure:4422: checking for opendir in -lx" >&5
 ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4418,7 +4426,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lx  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4422 "configure"
+#line 4430 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -4429,7 +4437,7 @@
 opendir()
 ; return 0; }
 EOF
-if { (eval echo configure:4433: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4441: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4454,12 +4462,12 @@
 
 sim_termio=""
 echo $ac_n "checking for struct termios""... $ac_c" 1>&6
-echo "configure:4458: checking for struct termios" >&5
+echo "configure:4466: checking for struct termios" >&5
 if eval "test \"`echo '$''{'ac_cv_termios_struct'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4463 "configure"
+#line 4471 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/termios.h>
@@ -4472,7 +4480,7 @@
  x.c_cc[NCCS] = 0;
 ; return 0; }
 EOF
-if { (eval echo configure:4476: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4484: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_termios_struct=yes
 else
@@ -4491,12 +4499,12 @@
 
 if test "$ac_cv_termios_struct" = "yes"; then
   echo $ac_n "checking for c_line field in struct termios""... $ac_c" 1>&6
-echo "configure:4495: checking for c_line field in struct termios" >&5
+echo "configure:4503: checking for c_line field in struct termios" >&5
   if eval "test \"`echo '$''{'ac_cv_termios_cline'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4500 "configure"
+#line 4508 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/termios.h>
@@ -4504,7 +4512,7 @@
 static struct termios x; x.c_line = 0;
 ; return 0; }
 EOF
-if { (eval echo configure:4508: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4516: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_termios_cline=yes
 else
@@ -4527,12 +4535,12 @@
 
 if test "$ac_cv_termios_struct" != "yes"; then
   echo $ac_n "checking for struct termio""... $ac_c" 1>&6
-echo "configure:4531: checking for struct termio" >&5
+echo "configure:4539: checking for struct termio" >&5
   if eval "test \"`echo '$''{'ac_cv_termio_struct'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4536 "configure"
+#line 4544 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/termio.h>
@@ -4545,7 +4553,7 @@
  x.c_cc[NCC] = 0;
 ; return 0; }
 EOF
-if { (eval echo configure:4549: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4557: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_termio_struct=yes
 else
@@ -4567,12 +4575,12 @@
 
 if test "$ac_cv_termio_struct" = "yes"; then
   echo $ac_n "checking for c_line field in struct termio""... $ac_c" 1>&6
-echo "configure:4571: checking for c_line field in struct termio" >&5
+echo "configure:4579: checking for c_line field in struct termio" >&5
   if eval "test \"`echo '$''{'ac_cv_termio_cline'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4576 "configure"
+#line 4584 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/termio.h>
@@ -4580,7 +4588,7 @@
 static struct termio x; x.c_line = 0;
 ; return 0; }
 EOF
-if { (eval echo configure:4584: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4592: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_termio_cline=yes
 else
@@ -4603,7 +4611,7 @@
 
 sim_devzero=""
 echo $ac_n "checking for /dev/zero""... $ac_c" 1>&6
-echo "configure:4607: checking for /dev/zero" >&5
+echo "configure:4615: checking for /dev/zero" >&5
 if eval "test \"`echo '$''{'ac_cv_devzero'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4611,7 +4619,7 @@
   ac_cv_devzero=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 4615 "configure"
+#line 4623 "configure"
 #include "confdefs.h"
 #include <fcntl.h>
 main () {
@@ -4630,7 +4638,7 @@
   return 0;
 }
 EOF
-if { (eval echo configure:4634: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4642: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_devzero=yes
 else
@@ -4652,7 +4660,7 @@
 fi
 
 echo $ac_n "checking for common simulator directory""... $ac_c" 1>&6
-echo "configure:4656: checking for common simulator directory" >&5
+echo "configure:4664: checking for common simulator directory" >&5
 if test -f "${srcdir}/../common/callback.c"; then
   echo "$ac_t""yes" 1>&6
   sim_callback="callback.o targ-map.o"
@@ -4664,7 +4672,7 @@
 fi
 
 echo $ac_n "checking for common simulator directory fpu implementation""... $ac_c" 1>&6
-echo "configure:4668: checking for common simulator directory fpu implementation" >&5
+echo "configure:4676: checking for common simulator directory fpu implementation" >&5
 if test -f "${srcdir}/../common/sim-fpu.c"; then
   echo "$ac_t""yes" 1>&6
   sim_fpu_cflags="-DHAVE_COMMON_FPU -I${srcdir}/../common"
@@ -4676,12 +4684,12 @@
 fi
 
 echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
-echo "configure:4680: checking for Cygwin environment" >&5
+echo "configure:4688: checking for Cygwin environment" >&5
 if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4685 "configure"
+#line 4693 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -4692,7 +4700,7 @@
 return __CYGWIN__;
 ; return 0; }
 EOF
-if { (eval echo configure:4696: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4704: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_cygwin=yes
 else
@@ -4709,19 +4717,19 @@
 CYGWIN=
 test "$ac_cv_cygwin" = yes && CYGWIN=yes
 echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6
-echo "configure:4713: checking for mingw32 environment" >&5
+echo "configure:4721: checking for mingw32 environment" >&5
 if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4718 "configure"
+#line 4726 "configure"
 #include "confdefs.h"
 
 int main() {
 return __MINGW32__;
 ; return 0; }
 EOF
-if { (eval echo configure:4725: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4733: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_mingw32=yes
 else
@@ -4740,7 +4748,7 @@
 
 
 echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
-echo "configure:4744: checking for executable suffix" >&5
+echo "configure:4752: checking for executable suffix" >&5
 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4750,7 +4758,7 @@
   rm -f conftest*
   echo 'int main () { return 0; }' > conftest.$ac_ext
   ac_cv_exeext=
-  if { (eval echo configure:4754: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+  if { (eval echo configure:4762: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
     for file in conftest.*; do
       case $file in
       *.c | *.o | *.obj | *.ilk | *.pdb) ;;
@@ -4779,7 +4787,7 @@
 # Extract the first word of "ranlib", so it can be a program name with args.
 set dummy ranlib; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4783: checking for $ac_word" >&5
+echo "configure:4791: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
diff --git a/sim/ppc/configure.in b/sim/ppc/configure.in
index e130b3a..0d7a094 100644
--- a/sim/ppc/configure.in
+++ b/sim/ppc/configure.in
@@ -190,15 +190,23 @@
 
 
 AC_ARG_ENABLE(sim-float,
-[  --enable-sim-float			Specify whether to use host floating point or simulate.],
+[  --enable-sim-float			Specify whether the target has hard, soft, altivec or e500 floating point.],
 [case "${enableval}" in
   yes | hard)	sim_float="-DWITH_FLOATING_POINT=HARD_FLOATING_POINT";;
   no | soft)	sim_float="-DWITH_FLOATING_POINT=SOFT_FLOATING_POINT";;
+  altivec)      sim_float="-DWITH_ALTIVEC" ; sim_filter="${sim_filter},av" ;;
+  *spe*|*simd*) sim_float="-DWITH_E500" ; sim_filter="${sim_filter},e500" ;;
   *)		AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-float"); sim_float="";;
 esac
 if test x"$silent" != x"yes" && test x"$sim_float" != x""; then
   echo "Setting float flags = $sim_float" 6>&1
-fi],[sim_float=""])dnl
+fi],[
+case "${target}" in
+  *altivec*) sim_float="-DWITH_ALTIVEC" ; sim_filter="${sim_filter},av" ;;
+  *spe*|*simd*)	sim_float="-DWITH_E500" ; sim_filter="${sim_filter},e500" ;;
+  *) sim_float=""
+esac
+])dnl
 
 
 AC_ARG_ENABLE(sim-hardware,
diff --git a/sim/ppc/e500.igen b/sim/ppc/e500.igen
new file mode 100644
index 0000000..f4ebfc7
--- /dev/null
+++ b/sim/ppc/e500.igen
@@ -0,0 +1,3348 @@
+# e500 core instructions, for PSIM, the PowerPC simulator.
+
+# Copyright 2003  Free Software Foundation, Inc.
+
+# Contributed by Red Hat Inc; developed under contract from Motorola.
+# Written by matthew green <mrg@redhat.com>.
+
+# This file is part of GDB.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with This program; see the file COPYING.  If not, write to
+# the Free Software Foundation, 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+#
+# e500 Core Complex Instructions
+#
+
+:cache:e500::signed_word *:rAh:RA:(cpu_registers(processor)->e500.gprh + RA)
+:cache:e500::signed_word *:rSh:RS:(cpu_registers(processor)->e500.gprh + RS)
+:cache:e500::signed_word *:rBh:RB:(cpu_registers(processor)->e500.gprh + RB)
+
+# Flags for model.h
+::model-macro:::
+	#define PPC_INSN_INT_SPR(OUT_MASK, IN_MASK, SPR) \
+		do { \
+		  if (CURRENT_MODEL_ISSUE > 0) \
+		    ppc_insn_int_spr(MY_INDEX, cpu_model(processor), OUT_MASK, IN_MASK, SPR); \
+		} while (0)
+
+# Schedule an instruction that takes 2 integer register and produces a special purpose output register plus an integer output register
+void::model-function::ppc_insn_int_spr:itable_index index, model_data *model_ptr, const unsigned32 out_mask, const unsigned32 in_mask, const unsigned nSPR
+	const unsigned32 int_mask = out_mask | in_mask;
+	model_busy *busy_ptr;
+
+	while ((model_ptr->int_busy & int_mask) != 0 || model_ptr->spr_busy[nSPR] != 0) {
+	  if (WITH_TRACE && ppc_trace[trace_model])
+	    model_trace_busy_p(model_ptr, int_mask, 0, 0, nSPR);
+
+	  model_ptr->nr_stalls_data++;
+	  model_new_cycle(model_ptr);
+	}
+
+	busy_ptr = model_wait_for_unit(index, model_ptr, &model_ptr->timing[index]);
+	busy_ptr->int_busy |= out_mask;
+	model_ptr->int_busy |= out_mask;
+	busy_ptr->spr_busy = nSPR;
+	model_ptr->spr_busy[nSPR] = 1;
+	busy_ptr->nr_writebacks = (PPC_ONE_BIT_SET_P(out_mask)) ? 3 : 2;
+	TRACE(trace_model,("Making register %s busy.\n", spr_name(nSPR)));
+
+#
+# SPE Modulo Fractional Multiplication handling support
+#
+:function:e500::unsigned64:ev_multiply16_smf:signed16 a, signed16 b, int *sat
+	signed32 a32 = a, b32 = b, rv32;
+	rv32 = a * b;
+	*sat = (rv32 & (3<<30)) == (3<<30);
+	return (signed64)rv32 << 1;
+
+:function:e500::unsigned64:ev_multiply32_smf:signed32 a, signed32 b, int *sat
+	signed64 rv64, a64 = a, b64 = b;
+	rv64 = a64 * b64;
+	*sat = (rv64 & ((signed64)3<<62)) == ((signed64)3<<62);
+	/* Loses top sign bit.  */
+	return rv64 << 1;
+#
+# SPE Saturation handling support
+#
+:function:e500::signed32:ev_multiply16_ssf:signed16 a, signed16 b, int *sat
+	signed32 rv32;
+	if (a == 0xffff8000 && b == 0xffff8000)
+	  {
+	    rv32 = 0x7fffffffL;
+	    * sat = 1;
+	    return rv32;
+	  }
+	else
+	  {
+	    signed32 a32 = a, b32 = b;
+	    
+	    rv32 = a * b;
+	    * sat = (rv32 & (3<<30)) == (3<<30);
+	    return (signed64)rv32 << 1;
+	  }
+
+:function:e500::signed64:ev_multiply32_ssf:signed32 a, signed32 b, int *sat
+	signed64 rv64;
+	if (a == 0x80000000 && b == 0x80000000)
+	  {
+	    rv64 = 0x7fffffffffffffffLL;
+	    * sat = 1;
+	    return rv64;
+	  }
+	else
+	  {
+	    signed64 a64 = a, b64 = b;
+	    rv64 = a64 * b64;
+	    *sat = (rv64 & ((signed64)3<<62)) == ((signed64)3<<62);
+	    /* Loses top sign bit.  */
+	    return rv64 << 1;
+	  }
+
+#
+# SPE FP handling support
+#
+
+:function:e500::void:ev_check_guard:sim_fpu *a, int fg, int fx, cpu *processor
+	unsigned64 guard;
+	guard = sim_fpu_guard(a, 0);
+	if (guard & 1)
+	  EV_SET_SPEFSCR_BITS(fg);
+	if (guard & ~1)
+	  EV_SET_SPEFSCR_BITS(fx);
+
+:function:e500::void:booke_sim_fpu_32to:sim_fpu *dst, unsigned32 packed
+	sim_fpu_32to (dst, packed);
+
+	/* Set normally unused fields to allow booke arithmetic.  */
+	if (dst->class == sim_fpu_class_infinity)
+	  {
+	    dst->normal_exp = 128;
+	    dst->fraction = ((unsigned64)1 << 60);
+	  }
+	else if (dst->class == sim_fpu_class_qnan
+		 || dst->class == sim_fpu_class_snan)
+	  {
+	    dst->normal_exp = 128;
+	    /* This is set, but without the implicit bit, so we have to or
+	       in the implicit bit.  */
+	    dst->fraction |= ((unsigned64)1 << 60);
+	  }
+
+:function:e500::int:booke_sim_fpu_add:sim_fpu *d, sim_fpu *a, sim_fpu *b, int inv, int over, int under, cpu *processor
+	int invalid_operand, overflow_result, underflow_result;
+	int dest_exp;
+
+	invalid_operand = 0;
+	overflow_result = 0;
+	underflow_result = 0;
+
+	/* Treat NaN, Inf, and denorm like normal numbers, and signal invalid
+	   operand if it hasn't already been done.  */
+	if (EV_IS_INFDENORMNAN (a))
+	  {
+	    a->class = sim_fpu_class_number;
+
+	    EV_SET_SPEFSCR_BITS (inv);
+	    invalid_operand = 1;
+	  }
+	if (EV_IS_INFDENORMNAN (b))
+	  {
+	    b->class = sim_fpu_class_number;
+
+	    if (! invalid_operand)
+	      {
+		EV_SET_SPEFSCR_BITS (inv);
+		invalid_operand = 1;
+	      }
+	  }
+
+	sim_fpu_add (d, a, b);
+
+	dest_exp = booke_sim_fpu_exp (d);
+	/* If this is a denorm, force to zero, and signal underflow if
+	   we haven't already indicated invalid operand.  */
+	if (dest_exp <= -127)
+	  {
+	    int sign = d->sign;
+
+	    *d = sim_fpu_zero;
+	    d->sign = sign;
+	    if (! invalid_operand)
+	      {
+		EV_SET_SPEFSCR_BITS (under);
+		underflow_result = 1;
+	      }
+	  }
+	/* If this is Inf/NaN, force to pmax/nmax, and signal overflow if
+	   we haven't already indicated invalid operand.  */
+	else if (dest_exp >= 127)
+	  {
+	    int sign = d->sign;
+
+	    *d = sim_fpu_max32;
+	    d->sign = sign;
+	    if (! invalid_operand)
+	      {
+		EV_SET_SPEFSCR_BITS (over);
+		overflow_result = 1;
+	      }
+	  }
+	/* Destination sign is sign of operand with larger magnitude, or
+	   the sign of the first operand if operands have the same
+	   magnitude.  Thus if the result is zero, we force it to have
+	   the sign of the first operand.  */
+	else if (d->fraction == 0)
+	  d->sign = a->sign;
+
+	return invalid_operand || overflow_result || underflow_result;
+
+:function:e500::unsigned32:ev_fs_add:unsigned32 aa, unsigned32 bb, int inv, int over, int under, int fg, int fx, cpu *processor
+	sim_fpu a, b, d;
+	unsigned32 w;
+	int exception;
+
+	booke_sim_fpu_32to (&a, aa);
+	booke_sim_fpu_32to (&b, bb);
+
+	exception = booke_sim_fpu_add (&d, &a, &b, inv, over, under,
+				       processor);
+
+	sim_fpu_to32 (&w, &d);
+	if (! exception)
+	  ev_check_guard(&d, fg, fx, processor);
+	return w;
+
+:function:e500::unsigned32:ev_fs_sub:unsigned32 aa, unsigned32 bb, int inv, int over, int under, int fg, int fx, cpu *processor
+	sim_fpu a, b, d;
+	unsigned32 w;
+	int exception;
+
+	booke_sim_fpu_32to (&a, aa);
+	booke_sim_fpu_32to (&b, bb);
+
+	/* Invert sign of second operand, and add.  */
+	b.sign = ! b.sign;
+	exception = booke_sim_fpu_add (&d, &a, &b, inv, over, under,
+				       processor);
+
+	sim_fpu_to32 (&w, &d);
+	if (! exception)
+	  ev_check_guard(&d, fg, fx, processor);
+	return w;
+
+# sim_fpu_exp leaves the normal_exp field undefined for Inf and NaN.
+# The booke algorithms require exp values, so we fake them here.
+# fixme: It also apparently does the same for zero, but should not.
+:function:e500::unsigned32:booke_sim_fpu_exp:sim_fpu *x
+	int y = sim_fpu_is (x);
+	if (y == SIM_FPU_IS_PZERO || y == SIM_FPU_IS_NZERO)
+	  return 0;
+	else if (y == SIM_FPU_IS_SNAN || y == SIM_FPU_IS_QNAN
+		 || y == SIM_FPU_IS_NINF || y == SIM_FPU_IS_PINF)
+	  return 128;
+	else
+	  return sim_fpu_exp (x);
+
+:function:e500::unsigned32:ev_fs_mul:unsigned32 aa, unsigned32 bb, int inv, int over, int under, int fg, int fx, cpu *processor
+	sim_fpu a, b, d;
+	unsigned32 w;
+	int sa, sb, ea, eb, ei;
+	sim_fpu_32to (&a, aa);
+	sim_fpu_32to (&b, bb);
+	sa = sim_fpu_sign(&a);
+	sb = sim_fpu_sign(&b);
+	ea = booke_sim_fpu_exp(&a);
+	eb = booke_sim_fpu_exp(&b);
+	ei = ea + eb + 127;
+	if (sim_fpu_is_zero (&a) || sim_fpu_is_zero (&b))
+	  w = 0;
+	else if (sa == sb) {
+	  if (ei >= 254) {
+	    w = EV_PMAX;
+	    EV_SET_SPEFSCR_BITS(over);
+	  } else if (ei < 1) {
+	    d = sim_fpu_zero;
+	    sim_fpu_to32 (&w, &d);
+	    w &= 0x7fffffff;	/* Clear sign bit.  */
+	  } else {
+	    goto normal_mul;
+	  }
+	} else {
+	  if (ei >= 254) {
+	    w = EV_NMAX;
+	    EV_SET_SPEFSCR_BITS(over);
+	  } else if (ei < 1) {
+	    d = sim_fpu_zero;
+	    sim_fpu_to32 (&w, &d);
+	    w |= 0x80000000;	/* Set sign bit.  */
+	  } else {
+	normal_mul:
+	    if (EV_IS_INFDENORMNAN(&a) || EV_IS_INFDENORMNAN(&b))
+	      EV_SET_SPEFSCR_BITS(inv);
+	    sim_fpu_mul (&d, &a, &b);
+	    sim_fpu_to32 (&w, &d);
+	  }
+	}
+	return w;
+
+:function:e500::unsigned32:ev_fs_div:unsigned32 aa, unsigned32 bb, int inv, int over, int under, int dbz, int fg, int fx, cpu *processor
+	sim_fpu a, b, d;
+	unsigned32 w;
+	int sa, sb, ea, eb, ei;
+	
+	sim_fpu_32to (&a, aa);
+	sim_fpu_32to (&b, bb);
+	sa = sim_fpu_sign(&a);
+	sb = sim_fpu_sign(&b);
+	ea = booke_sim_fpu_exp(&a);
+	eb = booke_sim_fpu_exp(&b);
+	ei = ea - eb + 127;
+
+	/* Special cases to handle behaviour of e500 hardware.
+	   cf case 107543.  */
+	if (sim_fpu_is_nan (&a) || sim_fpu_is_nan (&b)
+	  || sim_fpu_is_zero (&a) || sim_fpu_is_zero (&b))
+	{
+	  if (sim_fpu_is_snan (&a) || sim_fpu_is_snan (&b))
+	    {
+	      if (bb == 0x3f800000)
+	        w = EV_PMAX;
+	      else if (aa == 0x7fc00001)
+	        w = 0x3fbffffe;
+	      else
+	        goto normal_div;
+	    }
+	  else
+	    goto normal_div;
+	}
+	else if (sim_fpu_is_infinity (&a) && sim_fpu_is_infinity (&b))
+	{
+	  if (sa == sb)
+	    sim_fpu_32to (&d, 0x3f800000);
+	  else
+	    sim_fpu_32to (&d, 0xbf800000);
+	  sim_fpu_to32 (&w, &d);
+	}
+	else if (sa == sb) {
+	  if (ei > 254) {
+	    w = EV_PMAX;
+	    EV_SET_SPEFSCR_BITS(over);
+	  } else if (ei <= 1) {
+	    d = sim_fpu_zero;
+	    sim_fpu_to32 (&w, &d);
+	    w &= 0x7fffffff;	/* Clear sign bit.  */
+	  } else {
+	    goto normal_div;
+	  }
+	} else {
+	  if (ei > 254) {
+	    w = EV_NMAX;
+	    EV_SET_SPEFSCR_BITS(over);
+	  } else if (ei <= 1) {
+	    d = sim_fpu_zero;
+	    sim_fpu_to32 (&w, &d);
+	    w |= 0x80000000;	/* Set sign bit.  */
+	  } else {
+	normal_div:
+	    if (EV_IS_INFDENORMNAN(&a) || EV_IS_INFDENORMNAN(&b))
+	      EV_SET_SPEFSCR_BITS(inv);
+	    if (sim_fpu_is_zero (&b))
+	      {
+	        if (sim_fpu_is_zero (&a))
+	          EV_SET_SPEFSCR_BITS(dbz);
+	        else 
+	          EV_SET_SPEFSCR_BITS(inv);
+	        w = sa ? EV_NMAX : EV_PMAX;
+	      }
+	    else
+	      {
+	        sim_fpu_div (&d, &a, &b);
+	        sim_fpu_to32 (&w, &d);
+	        ev_check_guard(&d, fg, fx, processor);
+	      }
+	  }
+	}
+	return w;
+	
+
+#
+# A.2.7 Integer SPE Simple Instructions
+#
+
+0.4,6.RS,11.RA,16.RB,21.512:X:e500:evaddw %RS,%RA,%RB:Vector Add Word
+	unsigned32 w1, w2;
+	w1 = *rBh + *rAh;
+	w2 = *rB + *rA;
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+		//printf("evaddw: *rSh = %08x; *rS = %08x; w1 = %08x w2 = %08x\n", *rSh, *rS, w1, w2);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.IMM,16.RB,21.514:X:e500:evaddiw %RS,%RB,%IMM:Vector Add Immediate Word
+	unsigned32 w1, w2;
+	w1 = *rBh + IMM;
+	w2 = *rB + IMM;
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+		//printf("evaddiw: *rSh = %08x; *rS = %08x; w1 = %08x w2 = %08x\n", *rSh, *rS, w1, w2);
+	PPC_INSN_INT(RS_BITMASK, RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.516:X:e500:evsubfw %RS,%RA,%RB:Vector Subtract from Word
+	unsigned32 w1, w2;
+	w1 = *rBh - *rAh;
+	w2 = *rB - *rA;
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+		//printf("evsubfw: *rSh = %08x; *rS = %08x; w1 = %08x w2 = %08x\n", *rSh, *rS, w1, w2);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.IMM,16.RB,21.518:X:e500:evsubifw %RS,%RB,%IMM:Vector Subtract Immediate from Word
+	unsigned32 w1, w2;
+	w1 = *rBh - IMM;
+	w2 = *rB - IMM;
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+		//printf("evsubifw: *rSh = %08x; *rS = %08x; IMM = %d\n", *rSh, *rS, IMM);
+	PPC_INSN_INT(RS_BITMASK, RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.0,21.520:X:e500:evabs %RS,%RA:Vector Absolute Value
+	signed32 w1, w2;
+	w1 = *rAh;
+	if (w1 < 0 && w1 != 0x80000000)
+	  w1 = -w1;
+	w2 = *rA;
+	if (w2 < 0 && w2 != 0x80000000)
+	  w2 = -w2;
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.0,21.521:X:e500:evneg %RS,%RA:Vector Negate
+	signed32 w1, w2;
+	w1 = *rAh;
+	/* the negative most negative number is the most negative number */
+	if (w1 != 0x80000000)
+	  w1 = -w1;
+	w2 = *rA;
+	if (w2 != 0x80000000)
+	  w2 = -w2;
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.0,21.522:X:e500:evextsb %RS,%RA:Vector Extend Signed Byte
+	unsigned64 w1, w2;
+	w1 = *rAh & 0xff;
+	if (w1 & 0x80)
+	  w1 |= 0xffffff00;
+	w2 = *rA & 0xff;
+	if (w2 & 0x80)
+	  w2 |= 0xffffff00;
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK , 0);
+
+0.4,6.RS,11.RA,16.0,21.523:X:e500:evextsb %RS,%RA:Vector Extend Signed Half Word
+	unsigned64 w1, w2;
+	w1 = *rAh & 0xffff;
+	if (w1 & 0x8000)
+	  w1 |= 0xffff0000;
+	w2 = *rA & 0xffff;
+	if (w2 & 0x8000)
+	  w2 |= 0xffff0000;
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.529:X:e500:evand %RS,%RA,%RB:Vector AND
+	unsigned32 w1, w2;
+	w1 = *rBh & *rAh;
+	w2 = *rB & *rA;
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.535:X:e500:evor %RS,%RA,%RB:Vector OR
+	unsigned32 w1, w2;
+	w1 = *rBh | *rAh;
+	w2 = *rB | *rA;
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.534:X:e500:evxor %RS,%RA,%RB:Vector XOR
+	unsigned32 w1, w2;
+	w1 = *rBh ^ *rAh;
+	w2 = *rB ^ *rA;
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.542:X:e500:evnand %RS,%RA,%RB:Vector NAND
+	unsigned32 w1, w2;
+	w1 = ~(*rBh & *rAh);
+	w2 = ~(*rB & *rA);
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.536:X:e500:evnor %RS,%RA,%RB:Vector NOR
+	unsigned32 w1, w2;
+	w1 = ~(*rBh | *rAh);
+	w2 = ~(*rB | *rA);
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.537:X:e500:eveqv %RS,%RA,%RB:Vector Equivalent
+	unsigned32 w1, w2;
+	w1 = (~*rBh) ^ *rAh;
+	w2 = (~*rB) ^ *rA;
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.530:X:e500:evandc %RS,%RA,%RB:Vector AND with Compliment
+	unsigned32 w1, w2;
+	w1 = (~*rBh) & *rAh;
+	w2 = (~*rB) & *rA;
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+		//printf("evandc: *rSh = %08x; *rS = %08x\n", *rSh, *rS);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.539:X:e500:evorc %RS,%RA,%RB:Vector OR with Compliment
+	unsigned32 w1, w2;
+	w1 = (~*rBh) | *rAh;
+	w2 = (~*rB) | *rA;
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+		//printf("evorc: *rSh = %08x; *rS = %08x\n", *rSh, *rS);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.552:X:e500:evrlw %RS,%RA,%RB:Vector Rotate Left Word
+	unsigned32 nh, nl, w1, w2;
+	nh = *rBh & 0x1f;
+	nl = *rB & 0x1f;
+	w1 = ((unsigned32)*rAh) << nh | ((unsigned32)*rAh) >> (32 - nh);
+	w2 = ((unsigned32)*rA) << nl | ((unsigned32)*rA) >> (32 - nl);
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+		//printf("evrlw: nh %d nl %d *rSh = %08x; *rS = %08x\n", nh, nl, *rSh, *rS);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.UIMM,21.554:X:e500:evrlwi %RS,%RA,%UIMM:Vector Rotate Left Word Immediate
+	unsigned32 w1, w2, imm;
+	imm = (unsigned32)UIMM;
+	w1 = ((unsigned32)*rAh) << imm | ((unsigned32)*rAh) >> (32 - imm);
+	w2 = ((unsigned32)*rA) << imm | ((unsigned32)*rA) >> (32 - imm);
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.548:X:e500:evslw %RS,%RA,%RB:Vector Shift Left Word
+	unsigned32 nh, nl, w1, w2;
+	nh = *rBh & 0x1f;
+	nl = *rB & 0x1f;
+	w1 = ((unsigned32)*rAh) << nh;
+	w2 = ((unsigned32)*rA) << nl;
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.UIMM,21.550:X:e500:evslwi %RS,%RA,%UIMM:Vector Shift Left Word Immediate
+	unsigned32 w1, w2, imm = UIMM;
+	w1 = ((unsigned32)*rAh) << imm;
+	w2 = ((unsigned32)*rA) << imm;
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.545:X:e500:evsrws %RS,%RA,%RB:Vector Shift Right Word Signed
+	signed32 w1, w2;
+	unsigned32 nh, nl;
+	nh = *rBh & 0x1f;
+	nl = *rB & 0x1f;
+	w1 = ((signed32)*rAh) >> nh;
+	w2 = ((signed32)*rA) >> nl;
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+		//printf("evsrws: nh %d nl %d *rSh = %08x; *rS = %08x\n", nh, nl, *rSh, *rS);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.544:X:e500:evsrwu %RS,%RA,%RB:Vector Shift Right Word Unsigned
+	unsigned32 w1, w2, nh, nl;
+	nh = *rBh & 0x1f;
+	nl = *rB & 0x1f;
+	w1 = ((unsigned32)*rAh) >> nh;
+	w2 = ((unsigned32)*rA) >> nl;
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.UIMM,21.547:X:e500:evsrwis %RS,%RA,%UIMM:Vector Shift Right Word Immediate Signed
+	signed32 w1, w2;
+	unsigned32 imm = UIMM;
+	w1 = ((signed32)*rAh) >> imm;
+	w2 = ((signed32)*rA) >> imm;
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.UIMM,21.546:X:e500:evsrwiu %RS,%RA,%UIMM:Vector Shift Right Word Immediate Unsigned
+	unsigned32 w1, w2, imm = UIMM;
+	w1 = ((unsigned32)*rAh) >> imm;
+	w2 = ((unsigned32)*rA) >> imm;
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.0,21.525:X:e500:evcntlzw %RS,%RA:Vector Count Leading Zeros Word
+	unsigned32 w1, w2, mask, c1, c2;
+	for (c1 = 0, mask = 0x80000000, w1 = *rAh;
+	      !(w1 & mask) && mask != 0; mask >>= 1)
+	  c1++;
+	for (c2 = 0, mask = 0x80000000, w2 = *rA;
+	      !(w2 & mask) && mask != 0; mask >>= 1)
+	  c2++;
+	EV_SET_REG2(*rSh, *rS, c1, c2);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.0,21.526:X:e500:evcntlsw %RS,%RA:Vector Count Leading Sign Bits Word
+	unsigned32 w1, w2, mask, sign_bit, c1, c2;
+	for (c1 = 0, mask = 0x80000000, w1 = *rAh, sign_bit = w1 & mask;
+	     ((w1 & mask) == sign_bit) && mask != 0;
+	     mask >>= 1, sign_bit >>= 1)
+	  c1++;
+	for (c2 = 0, mask = 0x80000000, w2 = *rA, sign_bit = w2 & mask;
+	     ((w2 & mask) == sign_bit) && mask != 0;
+	     mask >>= 1, sign_bit >>= 1)
+	  c2++;
+	EV_SET_REG2(*rSh, *rS, c1, c2);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.0,21.524:X:e500:evrndw %RS,%RA:Vector Round Word
+	unsigned32 w1, w2;
+	w1 = ((unsigned32)*rAh + 0x8000) & 0xffff0000;
+	w2 = ((unsigned32)*rA + 0x8000) & 0xffff0000;
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+		//printf("evrndw: *rSh = %08x; *rS = %08x\n", *rSh, *rS);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.556:X:e500:evmergehi %RS,%RA,%RB:Vector Merge Hi
+	unsigned32 w1, w2;
+	w1 = *rAh;
+	w2 = *rBh;
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.557:X:e500:evmergelo %RS,%RA,%RB:Vector Merge Low
+	unsigned32 w1, w2;
+	w1 = *rA;
+	w2 = *rB;
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.559:X:e500:evmergelohi %RS,%RA,%RB:Vector Merge Low Hi
+	unsigned32 w1, w2;
+	w1 = *rA;
+	w2 = *rBh;
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.558:X:e500:evmergehilo %RS,%RA,%RB:Vector Merge Hi Low
+	unsigned32 w1, w2;
+	w1 = *rAh;
+	w2 = *rB;
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.SIMM,16.0,21.553:X:e500:evsplati %RS,%SIMM:Vector Splat Immediate
+	unsigned32 w;
+	w = SIMM & 0x1f;
+	if (w & 0x10)
+	  w |= 0xffffffe0;
+	EV_SET_REG2(*rSh, *rS, w, w);
+	PPC_INSN_INT(RS_BITMASK, 0, 0);
+
+0.4,6.RS,11.SIMM,16.0,21.555:X:e500:evsplatfi %RS,%SIMM:Vector Splat Fractional Immediate
+	unsigned32 w;
+	w = SIMM << 27;
+	EV_SET_REG2(*rSh, *rS, w, w);
+	PPC_INSN_INT(RS_BITMASK, 0, 0);
+
+0.4,6.BF,9.0,11.RA,16.RB,21.561:X:e500:evcmpgts %BF,%RA,%RB:Vector Compare Greater Than Signed
+	signed32 ah, al, bh, bl;
+	int w, ch, cl;
+	ah = *rAh;
+	al = *rA;
+	bh = *rBh;
+	bl = *rB;
+	if (ah > bh)
+	  ch = 1;
+	else
+	  ch = 0;
+	if (al > bl)
+	  cl = 1;
+	else
+	  cl = 0;
+	w = ch << 3 | cl << 2 | (ch | cl) << 1 | (ch & cl);
+	CR_SET(BF, w);
+	PPC_INSN_INT_CR(0, RA_BITMASK | RB_BITMASK, BF_BITMASK);
+
+0.4,6.BF,9.0,11.RA,16.RB,21.560:X:e500:evcmpgtu %BF,%RA,%RB:Vector Compare Greater Than Unsigned
+	unsigned32 ah, al, bh, bl;
+	int w, ch, cl;
+	ah = *rAh;
+	al = *rA;
+	bh = *rBh;
+	bl = *rB;
+	if (ah > bh)
+	  ch = 1;
+	else
+	  ch = 0;
+	if (al > bl)
+	  cl = 1;
+	else
+	  cl = 0;
+	w = ch << 3 | cl << 2 | (ch | cl) << 1 | (ch & cl);
+	CR_SET(BF, w);
+	PPC_INSN_INT_CR(0, RA_BITMASK | RB_BITMASK, BF_BITMASK);
+
+0.4,6.BF,9.0,11.RA,16.RB,21.563:X:e500:evcmplts %BF,%RA,%RB:Vector Compare Less Than Signed
+	signed32 ah, al, bh, bl;
+	int w, ch, cl;
+	ah = *rAh;
+	al = *rA;
+	bh = *rBh;
+	bl = *rB;
+	if (ah < bh)
+	  ch = 1;
+	else
+	  ch = 0;
+	if (al < bl)
+	  cl = 1;
+	else
+	  cl = 0;
+	w = ch << 3 | cl << 2 | (ch | cl) << 1 | (ch & cl);
+	CR_SET(BF, w);
+	PPC_INSN_INT_CR(0, RA_BITMASK | RB_BITMASK, BF_BITMASK);
+
+0.4,6.BF,9.0,11.RA,16.RB,21.562:X:e500:evcmpltu %BF,%RA,%RB:Vector Compare Less Than Unsigned
+	unsigned32 ah, al, bh, bl;
+	int w, ch, cl;
+	ah = *rAh;
+	al = *rA;
+	bh = *rBh;
+	bl = *rB;
+	if (ah < bh)
+	  ch = 1;
+	else
+	  ch = 0;
+	if (al < bl)
+	  cl = 1;
+	else
+	  cl = 0;
+	w = ch << 3 | cl << 2 | (ch | cl) << 1 | (ch & cl);
+	CR_SET(BF, w);
+	PPC_INSN_INT_CR(0, RA_BITMASK | RB_BITMASK, BF_BITMASK);
+
+0.4,6.BF,9.0,11.RA,16.RB,21.564:X:e500:evcmpeq %BF,%RA,%RB:Vector Compare Equal
+	unsigned32 ah, al, bh, bl;
+	int w, ch, cl;
+	ah = *rAh;
+	al = *rA;
+	bh = *rBh;
+	bl = *rB;
+	if (ah == bh)
+	  ch = 1;
+	else
+	  ch = 0;
+	if (al == bl)
+	  cl = 1;
+	else
+	  cl = 0;
+	w = ch << 3 | cl << 2 | (ch | cl) << 1 | (ch & cl);
+	CR_SET(BF, w);
+		//printf("evcmpeq: ch %d cl %d BF %d, CR is now %08x\n", ch, cl, BF, CR);
+	PPC_INSN_INT_CR(0, RA_BITMASK | RB_BITMASK, BF_BITMASK);
+
+0.4,6.RS,11.RA,16.RB,21.79,29.CRFS:X:e500:evsel %RS,%RA,%RB,%CRFS:Vector Select
+	unsigned32 w1, w2;
+	int cr;
+	cr = CR_FIELD(CRFS);
+	if (cr & 8)
+	  w1 = *rAh;
+	else
+	  w1 = *rBh;
+	if (cr & 4)
+	  w2 = *rA;
+	else
+	  w2 = *rB;
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.527:X:e500:brinc %RS,%RA,%RB:Bit Reversed Increment
+	unsigned32 w1, w2, a, d, mask;
+	mask = (*rB) & 0xffff;
+	a = (*rA) & 0xffff;
+	d = EV_BITREVERSE16(1 + EV_BITREVERSE16(a | ~mask));
+	*rS = ((*rA) & 0xffff0000) | (d & 0xffff);
+		//printf("brinc: *rS = %08x\n", *rS);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+#
+# A.2.8 Integer SPE Complex Instructions
+#
+
+0.4,6.RS,11.RA,16.RB,21.1031:EVX:e500:evmhossf %RS,%RA,%RB:Vector Multiply Half Words Odd Signed Saturate Fractional
+	signed16 al, ah, bl, bh;
+	signed32 tl, th;
+	int movl, movh;
+	
+	al = (signed16) EV_LOHALF (*rA);
+	ah = (signed16) EV_LOHALF (*rAh);
+	bl = (signed16) EV_LOHALF (*rB);
+	bh = (signed16) EV_LOHALF (*rBh);
+	tl = ev_multiply16_ssf (al, bl, &movl);
+	th = ev_multiply16_ssf (ah, bh, &movh);
+	EV_SET_REG2 (*rSh, *rS, EV_SATURATE (movh, 0x7fffffff, th),
+			        EV_SATURATE (movl, 0x7fffffff, tl));
+	EV_SET_SPEFSCR_OV (movl, movh);
+	PPC_INSN_INT_SPR (RS_BITMASK, RA_BITMASK | RB_BITMASK, spr_spefscr);
+
+0.4,6.RS,11.RA,16.RB,21.1063:EVX:e500:evmhossfa %RS,%RA,%RB:Vector Multiply Half Words Odd Signed Saturate Fractional Accumulate
+	signed16 al, ah, bl, bh;
+	signed32 tl, th;
+	int movl, movh;
+	
+	al = (signed16) EV_LOHALF (*rA);
+	ah = (signed16) EV_LOHALF (*rAh);
+	bl = (signed16) EV_LOHALF (*rB);
+	bh = (signed16) EV_LOHALF (*rBh);
+	tl = ev_multiply16_ssf (al, bl, &movl);
+	th = ev_multiply16_ssf (ah, bh, &movh);
+	EV_SET_REG2 (*rSh, *rS, EV_SATURATE (movh, 0x7fffffff, th),
+			        EV_SATURATE (movl, 0x7fffffff, tl));
+	EV_SET_SPEFSCR_OV (movl, movh);
+	PPC_INSN_INT_SPR (RS_BITMASK, RA_BITMASK | RB_BITMASK, spr_spefscr);
+
+0.4,6.RS,11.RA,16.RB,21.1039:EVX:e500:evmhosmf %RS,%RA,%RB:Vector Multiply Half Words Odd Signed Modulo Fractional
+	signed16 al, ah, bl, bh;
+	signed32 tl, th;
+	int dummy;
+	
+	al = (signed16) EV_LOHALF (*rA);
+	ah = (signed16) EV_LOHALF (*rAh);
+	bl = (signed16) EV_LOHALF (*rB);
+	bh = (signed16) EV_LOHALF (*rBh);
+	tl = ev_multiply16_smf (al, bl, & dummy);
+	th = ev_multiply16_smf (ah, bh, & dummy);
+	EV_SET_REG2 (*rSh, *rS, th, tl);
+	PPC_INSN_INT (RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.1071:EVX:e500:evmhosmfa %RS,%RA,%RB:Vector Multiply Half Words Odd Signed Modulo Fractional Accumulate
+	signed32 al, ah, bl, bh;
+	signed32 tl, th;
+	int dummy;
+	
+	al = (signed16) EV_LOHALF (*rA);
+	ah = (signed16) EV_LOHALF (*rAh);
+	bl = (signed16) EV_LOHALF (*rB);
+	bh = (signed16) EV_LOHALF (*rBh);
+	tl = ev_multiply16_smf (al, bl, & dummy);
+	th = ev_multiply16_smf (ah, bh, & dummy);
+	EV_SET_REG2_ACC (*rSh, *rS, th, tl);
+	PPC_INSN_INT (RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.1037:EVX:e500:evmhosmi %RS,%RA,%RB:Vector Multiply Half Words Odd Signed Modulo Integer
+	signed32 al, ah, bl, bh, tl, th;
+	al = (signed32)(signed16)EV_LOHALF(*rA);
+	ah = (signed32)(signed16)EV_LOHALF(*rAh);
+	bl = (signed32)(signed16)EV_LOHALF(*rB);
+	bh = (signed32)(signed16)EV_LOHALF(*rBh);
+	tl = al * bl;
+	th = ah * bh;
+	EV_SET_REG2(*rSh, *rS, th, tl);
+		//printf("evmhosmi: *rSh = %08x; *rS = %08x\n", *rSh, *rS);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.1069:EVX:e500:evmhosmia %RS,%RA,%RB:Vector Multiply Half Words Odd Signed Modulo Integer Accumulate
+	signed32 al, ah, bl, bh, tl, th;
+	al = (signed32)(signed16)EV_LOHALF(*rA);
+	ah = (signed32)(signed16)EV_LOHALF(*rAh);
+	bl = (signed32)(signed16)EV_LOHALF(*rB);
+	bh = (signed32)(signed16)EV_LOHALF(*rBh);
+	tl = al * bl;
+	th = ah * bh;
+	EV_SET_REG2_ACC(*rSh, *rS, th, tl);
+		//printf("evmhosmia: ACC = %08x; *rSh = %08x; *rS = %08x\n", ACC, *rSh, *rS);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.1036:EVX:e500:evmhoumi %RS,%RA,%RB:Vector Multiply Half Words Odd Unsigned Modulo Integer
+	unsigned32 al, ah, bl, bh, tl, th;
+	al = (unsigned32)(unsigned16)EV_LOHALF(*rA);
+	ah = (unsigned32)(unsigned16)EV_LOHALF(*rAh);
+	bl = (unsigned32)(unsigned16)EV_LOHALF(*rB);
+	bh = (unsigned32)(unsigned16)EV_LOHALF(*rBh);
+	tl = al * bl;
+	th = ah * bh;
+	EV_SET_REG2(*rSh, *rS, th, tl);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.1068:EVX:e500:evmhoumia %RS,%RA,%RB:Vector Multiply Half Words Odd Unsigned Modulo Integer Accumulate
+	unsigned32 al, ah, bl, bh, tl, th;
+	al = (unsigned32)(unsigned16)EV_LOHALF(*rA);
+	ah = (unsigned32)(unsigned16)EV_LOHALF(*rAh);
+	bl = (unsigned32)(unsigned16)EV_LOHALF(*rB);
+	bh = (unsigned32)(unsigned16)EV_LOHALF(*rBh);
+	tl = al * bl;
+	th = ah * bh;
+	EV_SET_REG2_ACC(*rSh, *rS, th, tl);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.1027:EVX:e500:evmhessf %RS,%RA,%RB:Vector Multiply Half Words Even Signed Saturate Fractional
+	signed16 al, ah, bl, bh;
+	signed32 tl, th;
+	int movl, movh;
+	
+	al = (signed16) EV_HIHALF (*rA);
+	ah = (signed16) EV_HIHALF (*rAh);
+	bl = (signed16) EV_HIHALF (*rB);
+	bh = (signed16) EV_HIHALF (*rBh);
+	tl = ev_multiply16_ssf (al, bl, &movl);
+	th = ev_multiply16_ssf (ah, bh, &movh);
+	EV_SET_REG2 (*rSh, *rS, EV_SATURATE (movh, 0x7fffffff, th),
+			       EV_SATURATE (movl, 0x7fffffff, tl));
+	EV_SET_SPEFSCR_OV (movl, movh);
+	PPC_INSN_INT_SPR (RS_BITMASK, RA_BITMASK | RB_BITMASK, spr_spefscr);
+
+0.4,6.RS,11.RA,16.RB,21.1059:EVX:e500:evmhessfa %RS,%RA,%RB:Vector Multiply Half Words Even Signed Saturate Fractional Accumulate
+	signed16 al, ah, bl, bh;
+	signed32 tl, th;
+	int movl, movh;
+	
+	al = (signed16) EV_HIHALF (*rA);
+	ah = (signed16) EV_HIHALF (*rAh);
+	bl = (signed16) EV_HIHALF (*rB);
+	bh = (signed16) EV_HIHALF (*rBh);
+	tl = ev_multiply16_ssf (al, bl, &movl);
+	th = ev_multiply16_ssf (ah, bh, &movh);
+	EV_SET_REG2_ACC (*rSh, *rS, EV_SATURATE (movh, 0x7fffffff, th),
+				    EV_SATURATE (movl, 0x7fffffff, tl));
+	EV_SET_SPEFSCR_OV (movl, movh);
+	PPC_INSN_INT_SPR (RS_BITMASK, RA_BITMASK | RB_BITMASK, spr_spefscr);
+
+0.4,6.RS,11.RA,16.RB,21.1035:EVX:e500:evmhesmf %RS,%RA,%RB:Vector Multiply Half Words Even Signed Modulo Fractional
+	signed16 al, ah, bl, bh;
+	signed64 tl, th;
+	int movl, movh;
+	
+	al = (signed16) EV_HIHALF (*rA);
+	ah = (signed16) EV_HIHALF (*rAh);
+	bl = (signed16) EV_HIHALF (*rB);
+	bh = (signed16) EV_HIHALF (*rBh);
+	tl = ev_multiply16_smf (al, bl, &movl);
+	th = ev_multiply16_smf (ah, bh, &movh);
+	EV_SET_REG2 (*rSh, *rS, th, tl);
+	EV_SET_SPEFSCR_OV (movl, movh);
+	PPC_INSN_INT_SPR (RS_BITMASK, RA_BITMASK | RB_BITMASK, spr_spefscr);
+
+0.4,6.RS,11.RA,16.RB,21.1067:EVX:e500:evmhesmfa %RS,%RA,%RB:Vector Multiply Half Words Even Signed Modulo Fractional Accumulate
+	signed16 al, ah, bl, bh;
+	signed32 tl, th;
+	int dummy;
+	
+	al = (signed16) EV_HIHALF (*rA);
+	ah = (signed16) EV_HIHALF (*rAh);
+	bl = (signed16) EV_HIHALF (*rB);
+	bh = (signed16) EV_HIHALF (*rBh);
+	tl = ev_multiply16_smf (al, bl, & dummy);
+	th = ev_multiply16_smf (ah, bh, & dummy);
+	EV_SET_REG2_ACC (*rSh, *rS, th, tl);
+	PPC_INSN_INT (RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.1033:EVX:e500:evmhesmi %RS,%RA,%RB:Vector Multiply Half Words Even Signed Modulo Integer
+	signed16 al, ah, bl, bh;
+	signed32 tl, th;
+	
+	al = (signed16) EV_HIHALF (*rA);
+	ah = (signed16) EV_HIHALF (*rAh);
+	bl = (signed16) EV_HIHALF (*rB);
+	bh = (signed16) EV_HIHALF (*rBh);
+	tl = al * bl;
+	th = ah * bh;
+	EV_SET_REG2 (*rSh, *rS, th, tl);
+	PPC_INSN_INT (RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.1065:EVX:e500:evmhesmia %RS,%RA,%RB:Vector Multiply Half Words Even Signed Modulo Integer Accumulate
+	signed32 al, ah, bl, bh, tl, th;
+	al = (signed32)(signed16)EV_HIHALF(*rA);
+	ah = (signed32)(signed16)EV_HIHALF(*rAh);
+	bl = (signed32)(signed16)EV_HIHALF(*rB);
+	bh = (signed32)(signed16)EV_HIHALF(*rBh);
+	tl = al * bl;
+	th = ah * bh;
+	EV_SET_REG2_ACC(*rSh, *rS, th, tl);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.1032:EVX:e500:evmheumi %RS,%RA,%RB:Vector Multiply Half Words Even Unsigned Modulo Integer
+	unsigned32 al, ah, bl, bh, tl, th;
+	al = (unsigned32)(unsigned16)EV_HIHALF(*rA);
+	ah = (unsigned32)(unsigned16)EV_HIHALF(*rAh);
+	bl = (unsigned32)(unsigned16)EV_HIHALF(*rB);
+	bh = (unsigned32)(unsigned16)EV_HIHALF(*rBh);
+	tl = al * bl;
+	th = ah * bh;
+	EV_SET_REG2(*rSh, *rS, th, tl);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.1064:EVX:e500:evmheumia %RS,%RA,%RB:Vector Multiply Half Words Even Unsigned Modulo Integer Accumulate
+	unsigned32 al, ah, bl, bh, tl, th;
+	al = (unsigned32)(unsigned16)EV_HIHALF(*rA);
+	ah = (unsigned32)(unsigned16)EV_HIHALF(*rAh);
+	bl = (unsigned32)(unsigned16)EV_HIHALF(*rB);
+	bh = (unsigned32)(unsigned16)EV_HIHALF(*rBh);
+	tl = al * bl;
+	th = ah * bh;
+	EV_SET_REG2_ACC(*rSh, *rS, th, tl);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.1287:EVX:e500:evmhossfaaw %RS,%RA,%RB:Vector Multiply Half Words Odd Signed Saturate Fractional and Accumulate into Words
+	signed16 al, ah, bl, bh;
+	signed32 t1, t2;
+	signed64 tl, th;
+	int movl, movh, ovl, ovh;
+	
+	al = (signed16) EV_LOHALF (*rA);
+	ah = (signed16) EV_LOHALF (*rAh);
+	bl = (signed16) EV_LOHALF (*rB);
+	bh = (signed16) EV_LOHALF (*rBh);
+	t1 = ev_multiply16_ssf (ah, bh, &movh);
+	t2 = ev_multiply16_ssf (al, bl, &movl);
+	th = EV_ACCHIGH + EV_SATURATE (movh, 0x7fffffff, t1);
+	tl = EV_ACCLOW  + EV_SATURATE (movl, 0x7fffffff, t2);
+	ovh = EV_SAT_P_S32 (th);
+	ovl = EV_SAT_P_S32 (tl);
+	EV_SET_REG2_ACC (*rSh, *rS, EV_SATURATE_ACC (ovh, th, 0x80000000, 0x7fffffff, th),
+			            EV_SATURATE_ACC (ovl, tl, 0x80000000, 0x7fffffff, tl));
+	EV_SET_SPEFSCR_OV (movl | ovl, movh | ovh);
+	PPC_INSN_INT_SPR (RS_BITMASK, RA_BITMASK | RB_BITMASK, spr_spefscr);
+
+0.4,6.RS,11.RA,16.RB,21.1285:EVX:e500:evmhossiaaw %RS,%RA,%RB:Vector Multiply Half Words Odd Signed Saturate Integer and Accumulate into Words
+	signed32 al, ah, bl, bh;
+	signed64 t1, t2, tl, th;
+	int ovl, ovh;
+	al = (signed32)(signed16)EV_LOHALF(*rA);
+	ah = (signed32)(signed16)EV_LOHALF(*rAh);
+	bl = (signed32)(signed16)EV_LOHALF(*rB);
+	bh = (signed32)(signed16)EV_LOHALF(*rBh);
+	t1 = ah * bh;
+	t2 = al * bl;
+	th = EV_ACCHIGH + t1;
+	tl = EV_ACCLOW + t2;
+	ovh = EV_SAT_P_S32(th);
+	ovl = EV_SAT_P_S32(tl);
+	EV_SET_REG2_ACC(*rSh, *rS, EV_SATURATE_ACC(ovh, th, 0x80000000, 0x7fffffff, th),
+			           EV_SATURATE_ACC(ovl, tl, 0x80000000, 0x7fffffff, tl));
+		//printf("evmhossiaaw: ovh %d ovl %d al %d ah %d bl %d bh %d t1 %qd t2 %qd tl %qd th %qd\n", ovh, ovl, al, ah, bl, bh, t1, t2, tl, th);
+		//printf("evmhossiaaw: ACC = %08x.%08x; *rSh = %08x; *rS = %08x\n", (int)(ACC >> 32), (int)ACC, *rSh, *rS);
+	EV_SET_SPEFSCR_OV(ovl, ovh);
+	PPC_INSN_INT_SPR(RS_BITMASK, RA_BITMASK | RB_BITMASK, spr_spefscr);
+
+0.4,6.RS,11.RA,16.RB,21.1295:EVX:e500:evmhosmfaaw %RS,%RA,%RB:Vector Multiply Half Words Odd Signed Modulo Fractional and Accumulate into Words
+	signed32 al, ah, bl, bh;
+	signed64 t1, t2, tl, th;
+	al = (signed32)(signed16)EV_LOHALF(*rA);
+	ah = (signed32)(signed16)EV_LOHALF(*rAh);
+	bl = (signed32)(signed16)EV_LOHALF(*rB);
+	bh = (signed32)(signed16)EV_LOHALF(*rBh);
+	t1 = ((signed64)ah * bh) << 1;
+	t2 = ((signed64)al * bl) << 1;
+	th = EV_ACCHIGH + (t1 & 0xffffffff);
+	tl = EV_ACCLOW + (t2 & 0xffffffff);
+	EV_SET_REG2_ACC(*rSh, *rS, th & 0xffffffff, tl & 0xffffffff);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.1293:EVX:e500:evmhosmiaaw %RS,%RA,%RB:Vector Multiply Half Words Odd Signed Modulo Integer and Accumulate into Words
+	signed32 al, ah, bl, bh;
+	signed64 t1, t2, tl, th;
+	al = (signed32)(signed16)EV_LOHALF(*rA);
+	ah = (signed32)(signed16)EV_LOHALF(*rAh);
+	bl = (signed32)(signed16)EV_LOHALF(*rB);
+	bh = (signed32)(signed16)EV_LOHALF(*rBh);
+	t1 = ah * bh;
+	t2 = al * bl;
+	th = EV_ACCHIGH + t1;
+	tl = EV_ACCLOW + t2;
+	EV_SET_REG2_ACC(*rSh, *rS, th & 0xffffffff, tl & 0xffffffff);
+		//printf("evmhosmiaaw: al %d ah %d bl %d bh %d t1 %qd t2 %qd tl %qd th %qd\n", al, ah, bl, bh, t1, t2, tl, th);
+		//printf("evmhosmiaaw: ACC = %08x.%08x; *rSh = %08x; *rS = %08x\n", (int)(ACC >> 32), (int)ACC, *rSh, *rS);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.1284:EVX:e500:evmhousiaaw %RS,%RA,%RB:Vector Multiply Half Words Odd Unsigned Saturate Integer and Accumulate into Words
+	unsigned32 al, ah, bl, bh;
+	unsigned64 t1, t2;
+	signed64 tl, th;
+	int ovl, ovh;
+	al = (unsigned32)(unsigned16)EV_LOHALF(*rA);
+	ah = (unsigned32)(unsigned16)EV_LOHALF(*rAh);
+	bl = (unsigned32)(unsigned16)EV_LOHALF(*rB);
+	bh = (unsigned32)(unsigned16)EV_LOHALF(*rBh);
+	t1 = ah * bh;
+	t2 = al * bl;
+	th = (signed64)EV_ACCHIGH + (signed64)t1;
+	tl = (signed64)EV_ACCLOW + (signed64)t2;
+	ovh = EV_SAT_P_U32(th);
+	ovl = EV_SAT_P_U32(tl);
+	EV_SET_REG2_ACC(*rSh, *rS, EV_SATURATE_ACC(ovh, th, 0, 0xffffffff, th),
+			           EV_SATURATE_ACC(ovl, tl, 0, 0xffffffff, tl));
+		//printf("evmhousiaaw: al %u ah %u bl %u bh %u t1 %qu t2 %qu tl %qu th %qu\n", al, ah, bl, bh, t1, t2, tl, th);
+		//printf("evmhousiaaw: ACC = %08x.%08x; *rSh = %08x; *rS = %08x\n", (int)(ACC >> 32), (int)ACC, *rSh, *rS);
+	EV_SET_SPEFSCR_OV(ovl, ovh);
+	PPC_INSN_INT_SPR(RS_BITMASK, RA_BITMASK | RB_BITMASK, spr_spefscr);
+
+0.4,6.RS,11.RA,16.RB,21.1292:EVX:e500:evmhoumiaaw %RS,%RA,%RB:Vector Multiply Half Words Odd Unsigned Modulo Integer and Accumulate into Words
+	unsigned32 al, ah, bl, bh;
+	unsigned32 t1, t2;
+	signed64 tl, th;
+	al = (unsigned32)(unsigned16)EV_LOHALF(*rA);
+	ah = (unsigned32)(unsigned16)EV_LOHALF(*rAh);
+	bl = (unsigned32)(unsigned16)EV_LOHALF(*rB);
+	bh = (unsigned32)(unsigned16)EV_LOHALF(*rBh);
+	t1 = ah * bh;
+	t2 = al * bl;
+	th = EV_ACCHIGH + t1;
+	tl = EV_ACCLOW + t2;
+	EV_SET_REG2_ACC(*rSh, *rS, th & 0xffffffff, tl & 0xffffffff);
+		//printf("evmhoumiaaw: al %u ah %u bl %u bh %u t1 %qu t2 %qu tl %qu th %qu\n", al, ah, bl, bh, t1, t2, tl, th);
+		//printf("evmhoumiaaw: ACC = %08x.%08x; *rSh = %08x; *rS = %08x\n", (int)(ACC >> 32), (int)ACC, *rSh, *rS);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.1283:EVX:e500:evmhessfaaw %RS,%RA,%RB:Vector Multiply Half Words Even Signed Saturate Fractional and Accumulate into Words
+	signed16 al, ah, bl, bh;
+	signed32 t1, t2;
+	signed64 tl, th;
+	int movl, movh, ovl, ovh;
+	
+	al = (signed16) EV_HIHALF (*rA);
+	ah = (signed16) EV_HIHALF (*rAh);
+	bl = (signed16) EV_HIHALF (*rB);
+	bh = (signed16) EV_HIHALF (*rBh);
+	t1 = ev_multiply16_ssf (ah, bh, &movh);
+	t2 = ev_multiply16_ssf (al, bl, &movl);
+	th = EV_ACCHIGH + EV_SATURATE (movh, 0x7fffffff, t1);
+	tl = EV_ACCLOW  + EV_SATURATE (movl, 0x7fffffff, t2);
+	ovh = EV_SAT_P_S32 (th);
+	ovl = EV_SAT_P_S32 (tl);
+	EV_SET_REG2_ACC (*rSh, *rS, EV_SATURATE_ACC (ovh, th, 0x80000000, 0x7fffffff, th),
+			            EV_SATURATE_ACC (ovl, tl, 0x80000000, 0x7fffffff, tl));
+	EV_SET_SPEFSCR_OV (movl | ovl, movh | ovh);
+	PPC_INSN_INT_SPR (RS_BITMASK, RA_BITMASK | RB_BITMASK, spr_spefscr);
+
+0.4,6.RS,11.RA,16.RB,21.1281:EVX:e500:evmhessiaaw %RS,%RA,%RB:Vector Multiply Half Words Even Signed Saturate Integer and Accumulate into Words
+	signed32 al, ah, bl, bh;
+	signed64 t1, t2, tl, th;
+	int ovl, ovh;
+	al = (signed32)(signed16)EV_HIHALF(*rA);
+	ah = (signed32)(signed16)EV_HIHALF(*rAh);
+	bl = (signed32)(signed16)EV_HIHALF(*rB);
+	bh = (signed32)(signed16)EV_HIHALF(*rBh);
+	t1 = ah * bh;
+	t2 = al * bl;
+	th = EV_ACCHIGH + t1;
+	tl = EV_ACCLOW + t2;
+	ovh = EV_SAT_P_S32(th);
+	ovl = EV_SAT_P_S32(tl);
+	EV_SET_REG2_ACC(*rSh, *rS, EV_SATURATE_ACC(ovh, th, 0x80000000, 0x7fffffff, th),
+			           EV_SATURATE_ACC(ovl, tl, 0x80000000, 0x7fffffff, tl));
+		//printf("evmhessiaaw: ovh %d ovl %d al %d ah %d bl %d bh %d t1 %qd t2 %qd tl %qd th %qd\n", ovh, ovl, al, ah, bl, bh, t1, t2, tl, th);
+		//printf("evmhessiaaw: ACC = %08x.%08x; *rSh = %08x; *rS = %08x\n", (int)(ACC >> 32), (int)ACC, *rSh, *rS);
+	EV_SET_SPEFSCR_OV(ovl, ovh);
+	PPC_INSN_INT_SPR(RS_BITMASK, RA_BITMASK | RB_BITMASK, spr_spefscr);
+
+0.4,6.RS,11.RA,16.RB,21.1291:EVX:e500:evmhesmfaaw %RS,%RA,%RB:Vector Multiply Half Words Even Signed Modulo Fractional and Accumulate into Words
+	signed16 al, ah, bl, bh;
+	signed32 t1, t2, th, tl;
+	int dummy;
+
+	al = (signed16)EV_HIHALF(*rA);
+	ah = (signed16)EV_HIHALF(*rAh);
+	bl = (signed16)EV_HIHALF(*rB);
+	bh = (signed16)EV_HIHALF(*rBh);
+	t1 = ev_multiply16_smf (ah, bh, &dummy);
+	t2 = ev_multiply16_smf (al, bl, &dummy);
+	th = EV_ACCHIGH + t1;
+	tl = EV_ACCLOW + t2;
+	EV_SET_REG2_ACC(*rSh, *rS, th, tl);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.1289:EVX:e500:evmhesmiaaw %RS,%RA,%RB:Vector Multiply Half Words Even Signed Modulo Integer and Accumulate into Words
+	signed32 al, ah, bl, bh;
+	signed64 t1, t2, tl, th;
+	al = (signed32)(signed16)EV_HIHALF(*rA);
+	ah = (signed32)(signed16)EV_HIHALF(*rAh);
+	bl = (signed32)(signed16)EV_HIHALF(*rB);
+	bh = (signed32)(signed16)EV_HIHALF(*rBh);
+	t1 = ah * bh;
+	t2 = al * bl;
+	th = EV_ACCHIGH + t1;
+	tl = EV_ACCLOW + t2;
+	EV_SET_REG2_ACC(*rSh, *rS, th & 0xffffffff, tl & 0xffffffff);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.1280:EVX:e500:evmheusiaaw %RS,%RA,%RB:Vector Multiply Half Words Even Unsigned Saturate Integer and Accumulate into Words
+	unsigned32 al, ah, bl, bh;
+	unsigned64 t1, t2;
+	signed64 tl, th;
+	int ovl, ovh;
+	al = (unsigned32)(unsigned16)EV_HIHALF(*rA);
+	ah = (unsigned32)(unsigned16)EV_HIHALF(*rAh);
+	bl = (unsigned32)(unsigned16)EV_HIHALF(*rB);
+	bh = (unsigned32)(unsigned16)EV_HIHALF(*rBh);
+	t1 = ah * bh;
+	t2 = al * bl;
+	th = (signed64)EV_ACCHIGH + (signed64)t1;
+	tl = (signed64)EV_ACCLOW + (signed64)t2;
+	ovh = EV_SAT_P_U32(th);
+	ovl = EV_SAT_P_U32(tl);
+	EV_SET_REG2_ACC(*rSh, *rS, EV_SATURATE_ACC(ovh, th, 0, 0xffffffff, th),
+			           EV_SATURATE_ACC(ovl, tl, 0, 0xffffffff, tl));
+	EV_SET_SPEFSCR_OV(ovl, ovh);
+	PPC_INSN_INT_SPR(RS_BITMASK, RA_BITMASK | RB_BITMASK, spr_spefscr);
+
+0.4,6.RS,11.RA,16.RB,21.1288:EVX:e500:evmheumiaaw %RS,%RA,%RB:Vector Multiply Half Words Even Unsigned Modulo Integer and Accumulate into Words
+	unsigned32 al, ah, bl, bh;
+	unsigned32 t1, t2;
+	unsigned64 tl, th;
+	al = (unsigned32)(unsigned16)EV_HIHALF(*rA);
+	ah = (unsigned32)(unsigned16)EV_HIHALF(*rAh);
+	bl = (unsigned32)(unsigned16)EV_HIHALF(*rB);
+	bh = (unsigned32)(unsigned16)EV_HIHALF(*rBh);
+	t1 = ah * bh;
+	t2 = al * bl;
+	th = EV_ACCHIGH + t1;
+	tl = EV_ACCLOW + t2;
+	EV_SET_REG2_ACC(*rSh, *rS, th & 0xffffffff, tl & 0xffffffff);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+
+0.4,6.RS,11.RA,16.RB,21.1415:EVX:e500:evmhossfanw %RS,%RA,%RB:Vector Multiply Half Words Odd Signed Saturate Fractional and Accumulate Negative into Words
+	signed16 al, ah, bl, bh;
+	signed32 t1, t2;
+	signed64 tl, th;
+	int movl, movh, ovl, ovh;
+	
+	al = (signed16) EV_LOHALF (*rA);
+	ah = (signed16) EV_LOHALF (*rAh);
+	bl = (signed16) EV_LOHALF (*rB);
+	bh = (signed16) EV_LOHALF (*rBh);
+	t1 = ev_multiply16_ssf (ah, bh, &movh);
+	t2 = ev_multiply16_ssf (al, bl, &movl);
+	th = EV_ACCHIGH - EV_SATURATE (movh, 0x7fffffff, t1);
+	tl = EV_ACCLOW  - EV_SATURATE (movl, 0x7fffffff, t2);
+	ovh = EV_SAT_P_S32 (th);
+	ovl = EV_SAT_P_S32 (tl);
+	EV_SET_REG2_ACC (*rSh, *rS, EV_SATURATE_ACC (ovh, th, 0x80000000, 0x7fffffff, th),
+			            EV_SATURATE_ACC (ovl, tl, 0x80000000, 0x7fffffff, tl));
+	EV_SET_SPEFSCR_OV (movl | ovl, movh | ovh);
+	PPC_INSN_INT_SPR (RS_BITMASK, RA_BITMASK | RB_BITMASK, spr_spefscr);
+
+0.4,6.RS,11.RA,16.RB,21.1413:EVX:e500:evmhossianw %RS,%RA,%RB:Vector Multiply Half Words Odd Signed Saturate Integer and Accumulate Negative into Words
+	signed32 al, ah, bl, bh;
+	signed64 t1, t2, tl, th;
+	int ovl, ovh;
+	al = (signed32)(signed16)EV_LOHALF(*rA);
+	ah = (signed32)(signed16)EV_LOHALF(*rAh);
+	bl = (signed32)(signed16)EV_LOHALF(*rB);
+	bh = (signed32)(signed16)EV_LOHALF(*rBh);
+	t1 = ah * bh;
+	t2 = al * bl;
+	th = EV_ACCHIGH - t1;
+	tl = EV_ACCLOW - t2;
+	ovh = EV_SAT_P_S32(th);
+	ovl = EV_SAT_P_S32(tl);
+	EV_SET_REG2_ACC(*rSh, *rS, EV_SATURATE_ACC(ovh, th, 0x80000000, 0x7fffffff, th),
+			           EV_SATURATE_ACC(ovl, tl, 0x80000000, 0x7fffffff, tl));
+	EV_SET_SPEFSCR_OV(ovl, ovh);
+		//printf("evmhossianw: ACC = %08x; *rSh = %08x; *rS = %08x\n", ACC, *rSh, *rS);
+	PPC_INSN_INT_SPR(RS_BITMASK, RA_BITMASK | RB_BITMASK, spr_spefscr);
+
+0.4,6.RS,11.RA,16.RB,21.1423:EVX:e500:evmhosmfanw %RS,%RA,%RB:Vector Multiply Half Words Odd Signed Modulo Fractional and Accumulate Negative into Words
+	signed32 al, ah, bl, bh;
+	signed64 t1, t2, tl, th;
+	al = (signed32)(signed16)EV_LOHALF(*rA);
+	ah = (signed32)(signed16)EV_LOHALF(*rAh);
+	bl = (signed32)(signed16)EV_LOHALF(*rB);
+	bh = (signed32)(signed16)EV_LOHALF(*rBh);
+	t1 = ((signed64)ah * bh) << 1;
+	t2 = ((signed64)al * bl) << 1;
+	th = EV_ACCHIGH - (t1 & 0xffffffff);
+	tl = EV_ACCLOW - (t2 & 0xffffffff);
+	EV_SET_REG2_ACC(*rSh, *rS, th & 0xffffffff, tl & 0xffffffff);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.1421:EVX:e500:evmhosmianw %RS,%RA,%RB:Vector Multiply Half Words Odd Signed Modulo Integer and Accumulate Negative into Words
+	signed32 al, ah, bl, bh;
+	signed64 t1, t2, tl, th;
+	al = (signed32)(signed16)EV_LOHALF(*rA);
+	ah = (signed32)(signed16)EV_LOHALF(*rAh);
+	bl = (signed32)(signed16)EV_LOHALF(*rB);
+	bh = (signed32)(signed16)EV_LOHALF(*rBh);
+	t1 = ah * bh;
+	t2 = al * bl;
+	th = EV_ACCHIGH - t1;
+	tl = EV_ACCLOW - t2;
+	EV_SET_REG2_ACC(*rSh, *rS, th & 0xffffffff, tl & 0xffffffff);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.1412:EVX:e500:evmhousianw %RS,%RA,%RB:Vector Multiply Half Words Odd Unsigned Saturate Integer and Accumulate Negative into Words
+	unsigned32 al, ah, bl, bh;
+	unsigned64 t1, t2;
+	signed64 tl, th;
+	int ovl, ovh;
+	al = (unsigned32)(unsigned16)EV_LOHALF(*rA);
+	ah = (unsigned32)(unsigned16)EV_LOHALF(*rAh);
+	bl = (unsigned32)(unsigned16)EV_LOHALF(*rB);
+	bh = (unsigned32)(unsigned16)EV_LOHALF(*rBh);
+	t1 = ah * bh;
+	t2 = al * bl;
+	th = (signed64)EV_ACCHIGH - (signed64)t1;
+	tl = (signed64)EV_ACCLOW - (signed64)t2;
+	ovl = EV_SAT_P_U32(tl);
+	ovh = EV_SAT_P_U32(th);
+	EV_SET_REG2_ACC(*rSh, *rS, EV_SATURATE_ACC(ovh, th, 0, 0xffffffff, th),
+			           EV_SATURATE_ACC(ovl, tl, 0, 0xffffffff, tl));
+		//printf("evmhousianw: ovh %d ovl %d al %d ah %d bl %d bh %d t1 %qd t2 %qd tl %qd th %qd\n", ovh, ovl, al, ah, bl, bh, t1, t2, tl, th);
+		//printf("evmoussianw: ACC = %08x.%08x; *rSh = %08x; *rS = %08x\n", (int)(ACC >> 32), (int)ACC, *rSh, *rS);
+	EV_SET_SPEFSCR_OV(ovl, ovh);
+	PPC_INSN_INT_SPR(RS_BITMASK, RA_BITMASK | RB_BITMASK, spr_spefscr);
+
+0.4,6.RS,11.RA,16.RB,21.1420:EVX:e500:evmhoumianw %RS,%RA,%RB:Vector Multiply Half Words Odd Unsigned Modulo Integer and Accumulate Negative into Words
+	unsigned32 al, ah, bl, bh;
+	unsigned32 t1, t2;
+	unsigned64 tl, th;
+	al = (unsigned32)(unsigned16)EV_LOHALF(*rA);
+	ah = (unsigned32)(unsigned16)EV_LOHALF(*rAh);
+	bl = (unsigned32)(unsigned16)EV_LOHALF(*rB);
+	bh = (unsigned32)(unsigned16)EV_LOHALF(*rBh);
+	t1 = ah * bh;
+	t2 = al * bl;
+	th = EV_ACCHIGH - t1;
+	tl = EV_ACCLOW - t2;
+	EV_SET_REG2_ACC(*rSh, *rS, th & 0xffffffff, tl & 0xffffffff);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.1411:EVX:e500:evmhessfanw %RS,%RA,%RB:Vector Multiply Half Words Even Signed Saturate Fractional and Accumulate Negative into Words
+	signed16 al, ah, bl, bh;
+	signed32 t1, t2;
+	signed64 tl, th;
+	int movl, movh, ovl, ovh;
+	
+	al = (signed16) EV_HIHALF (*rA);
+	ah = (signed16) EV_HIHALF (*rAh);
+	bl = (signed16) EV_HIHALF (*rB);
+	bh = (signed16) EV_HIHALF (*rBh);
+	t1 = ev_multiply16_ssf (ah, bh, &movh);
+	t2 = ev_multiply16_ssf (al, bl, &movl);
+	th = EV_ACCHIGH - EV_SATURATE (movh, 0x7fffffff, t1);
+	tl = EV_ACCLOW  - EV_SATURATE (movl, 0x7fffffff, t2);
+	ovh = EV_SAT_P_S32 (th);
+	ovl = EV_SAT_P_S32 (tl);
+	EV_SET_REG2_ACC (*rSh, *rS, EV_SATURATE_ACC (ovh, th, 0x80000000, 0x7fffffff, th),
+			            EV_SATURATE_ACC (ovl, tl, 0x80000000, 0x7fffffff, tl));
+	EV_SET_SPEFSCR_OV (movl | ovl, movh | ovh);
+	PPC_INSN_INT_SPR (RS_BITMASK, RA_BITMASK | RB_BITMASK, spr_spefscr);
+
+0.4,6.RS,11.RA,16.RB,21.1409:EVX:e500:evmhessianw %RS,%RA,%RB:Vector Multiply Half Words Even Signed Saturate Integer and Accumulate Negative into Words
+	signed32 al, ah, bl, bh;
+	signed64 t1, t2, tl, th;
+	int ovl, ovh;
+	al = (signed32)(signed16)EV_HIHALF(*rA);
+	ah = (signed32)(signed16)EV_HIHALF(*rAh);
+	bl = (signed32)(signed16)EV_HIHALF(*rB);
+	bh = (signed32)(signed16)EV_HIHALF(*rBh);
+	t1 = ah * bh;
+	t2 = al * bl;
+	th = EV_ACCHIGH - t1;
+	tl = EV_ACCLOW - t2;
+	ovh = EV_SAT_P_S32(th);
+	ovl = EV_SAT_P_S32(tl);
+	EV_SET_REG2_ACC(*rSh, *rS, EV_SATURATE_ACC(ovh, th, 0x80000000, 0x7fffffff, th),
+			           EV_SATURATE_ACC(ovl, tl, 0x80000000, 0x7fffffff, tl));
+	EV_SET_SPEFSCR_OV(ovl, ovh);
+	PPC_INSN_INT_SPR(RS_BITMASK, RA_BITMASK | RB_BITMASK, spr_spefscr);
+
+0.4,6.RS,11.RA,16.RB,21.1419:EVX:e500:evmhesmfanw %RS,%RA,%RB:Vector Multiply Half Words Even Signed Modulo Fractional and Accumulate Negative into Words
+	signed32 al, ah, bl, bh;
+	signed64 t1, t2, tl, th;
+	al = (unsigned32)(unsigned16)EV_HIHALF(*rA);
+	ah = (unsigned32)(unsigned16)EV_HIHALF(*rAh);
+	bl = (unsigned32)(unsigned16)EV_HIHALF(*rB);
+	bh = (unsigned32)(unsigned16)EV_HIHALF(*rBh);
+	t1 = ((signed64)ah * bh) << 1;
+	t2 = ((signed64)al * bl) << 1;
+	th = EV_ACCHIGH - (t1 & 0xffffffff);
+	tl = EV_ACCLOW - (t2 & 0xffffffff);
+	EV_SET_REG2_ACC(*rSh, *rS, th & 0xffffffff, tl & 0xffffffff);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.1417:EVX:e500:evmhesmianw %RS,%RA,%RB:Vector Multiply Half Words Even Signed Modulo Integer and Accumulate Negative into Words
+	signed32 al, ah, bl, bh;
+	signed64 t1, t2, tl, th;
+	al = (signed32)(signed16)EV_HIHALF(*rA);
+	ah = (signed32)(signed16)EV_HIHALF(*rAh);
+	bl = (signed32)(signed16)EV_HIHALF(*rB);
+	bh = (signed32)(signed16)EV_HIHALF(*rBh);
+	t1 = ah * bh;
+	t2 = al * bl;
+	th = EV_ACCHIGH - t1;
+	tl = EV_ACCLOW - t2;
+	EV_SET_REG2_ACC(*rSh, *rS, th & 0xffffffff, tl & 0xffffffff);
+		//printf("evmhesmianw: al %d ah %d bl %d bh %d t1 %qd t2 %qd tl %qd th %qd\n", al, ah, bl, bh, t1, t2, tl, th);
+		//printf("evmhesmianw: ACC = %08x.%08x; *rSh = %08x; *rS = %08x\n", (int)(ACC >> 32), (int)ACC, *rSh, *rS);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.1408:EVX:e500:evmheusianw %RS,%RA,%RB:Vector Multiply Half Words Even Unsigned Saturate Integer and Accumulate Negative into Words
+	unsigned32 al, ah, bl, bh;
+	unsigned64 t1, t2;
+	signed64 tl, th;
+	int ovl, ovh;
+	al = (unsigned32)(unsigned16)EV_HIHALF(*rA);
+	ah = (unsigned32)(unsigned16)EV_HIHALF(*rAh);
+	bl = (unsigned32)(unsigned16)EV_HIHALF(*rB);
+	bh = (unsigned32)(unsigned16)EV_HIHALF(*rBh);
+	t1 = ah * bh;
+	t2 = al * bl;
+	th = (signed64)EV_ACCHIGH - (signed64)t1;
+	tl = (signed64)EV_ACCLOW - (signed64)t2;
+	ovl = EV_SAT_P_U32(tl);
+	ovh = EV_SAT_P_U32(th);
+	EV_SET_REG2_ACC(*rSh, *rS, EV_SATURATE_ACC(ovh, th, 0, 0xffffffff, th),
+			           EV_SATURATE_ACC(ovl, tl, 0, 0xffffffff, tl));
+		//printf("evmheusianw: ovh %d ovl %d al %u ah %u bl %u bh %u t1 %qu t2 %qu tl %qd th %qd\n", ovh, ovl, al, ah, bl, bh, t1, t2, tl, th);
+		//printf("evmheusianw: ACC = %08x.%08x; *rSh = %08x; *rS = %08x\n", (int)(ACC >> 32), (int)ACC, *rSh, *rS);
+	EV_SET_SPEFSCR_OV(ovl, ovh);
+	PPC_INSN_INT_SPR(RS_BITMASK, RA_BITMASK | RB_BITMASK, spr_spefscr);
+
+0.4,6.RS,11.RA,16.RB,21.1416:EVX:e500:evmheumianw %RS,%RA,%RB:Vector Multiply Half Words Even Unsigned Modulo Integer and Accumulate Negative into Words
+	unsigned32 al, ah, bl, bh;
+	unsigned32 t1, t2;
+	unsigned64 tl, th;
+	al = (unsigned32)(unsigned16)EV_HIHALF(*rA);
+	ah = (unsigned32)(unsigned16)EV_HIHALF(*rAh);
+	bl = (unsigned32)(unsigned16)EV_HIHALF(*rB);
+	bh = (unsigned32)(unsigned16)EV_HIHALF(*rBh);
+	t1 = ah * bh;
+	t2 = al * bl;
+	th = EV_ACCHIGH - t1;
+	tl = EV_ACCLOW - t2;
+	EV_SET_REG2_ACC(*rSh, *rS, th & 0xffffffff, tl & 0xffffffff);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.1327:EVX:e500:evmhogsmfaa %RS,%RA,%RB:Multiply Half Words Odd Guarded Signed Modulo Fractional and Accumulate
+	signed32 a, b;
+	signed64 t1, t2;
+	a = (signed32)(signed16)EV_LOHALF(*rA);
+	b = (signed32)(signed16)EV_LOHALF(*rB);
+	t1 = EV_MUL16_SSF(a, b);
+	if (t1 & ((unsigned64)1 << 32))
+	  t1 |= 0xfffffffe00000000;
+	t2 = ACC + t1;
+	EV_SET_REG1_ACC(*rSh, *rS, t2);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.1325:EVX:e500:evmhogsmiaa %RS,%RA,%RB:Multiply Half Words Odd Guarded Signed Modulo Integer and Accumulate
+	signed32 a, b;
+	signed64 t1, t2;
+	a = (signed32)(signed16)EV_LOHALF(*rA);
+	b = (signed32)(signed16)EV_LOHALF(*rB);
+	t1 = (signed64)a * (signed64)b;
+	t2 = (signed64)ACC + t1;
+	EV_SET_REG1_ACC(*rSh, *rS, t2);
+		//printf("evmhogsmiaa: a %d b %d t1 %qd t2 %qd\n", a, b, t1, t2);
+		//printf("evmhogsmiaa: ACC = %08x.%08x; *rSh = %08x; *rS = %08x\n", (int)(ACC >> 32), (int)ACC, *rSh, *rS);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.1324:EVX:e500:evmhogumiaa %RS,%RA,%RB:Multiply Half Words Odd Guarded Unsigned Modulo Integer and Accumulate
+	unsigned32 a, b;
+	unsigned64 t1, t2;
+	a = (unsigned32)(unsigned16)EV_LOHALF(*rA);
+	b = (unsigned32)(unsigned16)EV_LOHALF(*rB);
+	t1 = a * b;
+	t2 = ACC + t1;
+	EV_SET_REG1_ACC(*rSh, *rS, t2);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.1323:EVX:e500:evmhegsmfaa %RS,%RA,%RB:Multiply Half Words Even Guarded Signed Modulo Fractional and Accumulate
+	signed32 a, b;
+	signed64 t1, t2;
+	a = (signed32)(signed16)EV_HIHALF(*rA);
+	b = (signed32)(signed16)EV_HIHALF(*rB);
+	t1 = EV_MUL16_SSF(a, b);
+	if (t1 & ((unsigned64)1 << 32))
+	  t1 |= 0xfffffffe00000000;
+	t2 = ACC + t1;
+	EV_SET_REG1_ACC(*rSh, *rS, t2);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.1321:EVX:e500:evmhegsmiaa %RS,%RA,%RB:Multiply Half Words Even Guarded Signed Modulo Integer and Accumulate
+	signed32 a, b;
+	signed64 t1, t2;
+	a = (signed32)(signed16)EV_HIHALF(*rA);
+	b = (signed32)(signed16)EV_HIHALF(*rB);
+	t1 = (signed64)(a * b);
+	t2 = ACC + t1;
+	EV_SET_REG1_ACC(*rSh, *rS, t2);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.1320:EVX:e500:evmhegumiaa %RS,%RA,%RB:Multiply Half Words Even Guarded Unsigned Modulo Integer and Accumulate
+	unsigned32 a, b;
+	unsigned64 t1, t2;
+	a = (unsigned32)(unsigned16)EV_HIHALF(*rA);
+	b = (unsigned32)(unsigned16)EV_HIHALF(*rB);
+	t1 = a * b;
+	t2 = ACC + t1;
+	EV_SET_REG1_ACC(*rSh, *rS, t2);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+
+0.4,6.RS,11.RA,16.RB,21.1455:EVX:e500:evmhogsmfan %RS,%RA,%RB:Multiply Half Words Odd Guarded Signed Modulo Fractional and Accumulate Negative
+	signed32 a, b;
+	signed64 t1, t2;
+	a = (signed32)(signed16)EV_LOHALF(*rA);
+	b = (signed32)(signed16)EV_LOHALF(*rB);
+	t1 = EV_MUL16_SSF(a, b);
+	if (t1 & ((unsigned64)1 << 32))
+	  t1 |= 0xfffffffe00000000;
+	t2 = ACC - t1;
+	EV_SET_REG1_ACC(*rSh, *rS, t2);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.1453:EVX:e500:evmhogsmian %RS,%RA,%RB:Multiply Half Words Odd Guarded Signed Modulo Integer and Accumulate Negative
+	signed32 a, b;
+	signed64 t1, t2;
+	a = (signed32)(signed16)EV_LOHALF(*rA);
+	b = (signed32)(signed16)EV_LOHALF(*rB);
+	t1 = (signed64)a * (signed64)b;
+	t2 = ACC - t1;
+	EV_SET_REG1_ACC(*rSh, *rS, t2);
+		//printf("evmhogsmian: a %d b %d t1 %qd t2 %qd\n", a, b, t1, t2);
+		//printf("evmhogsmian: ACC = %08x.%08x; *rSh = %08x; *rS = %08x\n", (int)(ACC >> 32), (int)ACC, *rSh, *rS);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.1452:EVX:e500:evmhogumian %RS,%RA,%RB:Multiply Half Words Odd Guarded Unsigned Modulo Integer and Accumulate Negative
+	unsigned32 a, b;
+	unsigned64 t1, t2;
+	a = (unsigned32)(unsigned16)EV_LOHALF(*rA);
+	b = (unsigned32)(unsigned16)EV_LOHALF(*rB);
+	t1 = (unsigned64)a * (unsigned64)b;
+	t2 = ACC - t1;
+	EV_SET_REG1_ACC(*rSh, *rS, t2);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.1451:EVX:e500:evmhegsmfan %RS,%RA,%RB:Multiply Half Words Even Guarded Signed Modulo Fractional and Accumulate Negative
+	signed32 a, b;
+	signed64 t1, t2;
+	a = (signed32)(signed16)EV_HIHALF(*rA);
+	b = (signed32)(signed16)EV_HIHALF(*rB);
+	t1 = EV_MUL16_SSF(a, b);
+	if (t1 & ((unsigned64)1 << 32))
+	  t1 |= 0xfffffffe00000000;
+	t2 = ACC - t1;
+	EV_SET_REG1_ACC(*rSh, *rS, t2);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.1449:EVX:e500:evmhegsmian %RS,%RA,%RB:Multiply Half Words Even Guarded Signed Modulo Integer and Accumulate Negative
+	signed32 a, b;
+	signed64 t1, t2;
+	a = (signed32)(signed16)EV_HIHALF(*rA);
+	b = (signed32)(signed16)EV_HIHALF(*rB);
+	t1 = (signed64)a * (signed64)b;
+	t2 = ACC - t1;
+	EV_SET_REG1_ACC(*rSh, *rS, t2);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.1448:EVX:e500:evmhegumian %RS,%RA,%RB:Multiply Half Words Even Guarded Unsigned Modulo Integer and Accumulate Negative
+	unsigned32 a, b;
+	unsigned64 t1, t2;
+	a = (unsigned32)(unsigned16)EV_HIHALF(*rA);
+	b = (unsigned32)(unsigned16)EV_HIHALF(*rB);
+	t1 = (unsigned64)a * (unsigned64)b;
+	t2 = ACC - t1;
+	EV_SET_REG1_ACC(*rSh, *rS, t2);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+
+0.4,6.RS,11.RA,16.RB,21.1095:EVX:e500:evmwhssf %RS,%RA,%RB:Vector Multiply Word High Signed Saturate Fractional
+	signed32 al, ah, bl, bh;
+	signed64 t1, t2;
+	int movl, movh;
+	al = *rA;
+	ah = *rAh;
+	bl = *rB;
+	bh = *rBh;
+	t1 = ev_multiply32_ssf(al, bl, &movl);
+	t2 = ev_multiply32_ssf(ah, bh, &movh);
+	EV_SET_REG2(*rSh, *rS, EV_SATURATE(movh, 0x7fffffff, t2 >> 32),
+			       EV_SATURATE(movl, 0x7fffffff, t1 >> 32));
+	EV_SET_SPEFSCR_OV(movl, movh);
+	PPC_INSN_INT_SPR(RS_BITMASK, RA_BITMASK | RB_BITMASK, spr_spefscr);
+
+0.4,6.RS,11.RA,16.RB,21.1127:EVX:e500:evmwhssfa %RS,%RA,%RB:Vector Multiply Word High Signed Saturate Fractional and Accumulate
+	signed32 al, ah, bl, bh;
+	signed64 t1, t2;
+	int movl, movh;
+	al = *rA;
+	ah = *rAh;
+	bl = *rB;
+	bh = *rBh;
+	t1 = ev_multiply32_ssf(al, bl, &movl);
+	t2 = ev_multiply32_ssf(ah, bh, &movh);
+	EV_SET_REG2_ACC(*rSh, *rS, EV_SATURATE(movh, 0x7fffffff, t2 >> 32),
+			           EV_SATURATE(movl, 0x7fffffff, t1 >> 32));
+	EV_SET_SPEFSCR_OV(movl, movh);
+	PPC_INSN_INT_SPR(RS_BITMASK, RA_BITMASK | RB_BITMASK, spr_spefscr);
+
+0.4,6.RS,11.RA,16.RB,21.1103:EVX:e500:evmwhsmf %RS,%RA,%RB:Vector Multiply Word High Signed Modulo Fractional
+	signed32 al, ah, bl, bh;
+	signed64 t1, t2;
+	al = *rA;
+	ah = *rAh;
+	bl = *rB;
+	bh = *rBh;
+	t1 = EV_MUL32_SSF(al, bl);
+	t2 = EV_MUL32_SSF(ah, bh);
+	EV_SET_REG2(*rSh, *rS, t2 >> 32, t1 >> 32);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+	
+0.4,6.RS,11.RA,16.RB,21.1135:EVX:e500:evmwhsmfa %RS,%RA,%RB:Vector Multiply Word High Signed Modulo Fractional and Accumulate
+	signed32 al, ah, bl, bh;
+	signed64 t1, t2;
+	al = *rA;
+	ah = *rAh;
+	bl = *rB;
+	bh = *rBh;
+	t1 = EV_MUL32_SSF(al, bl);
+	t2 = EV_MUL32_SSF(ah, bh);
+	EV_SET_REG2_ACC(*rSh, *rS, t2 >> 32, t1 >> 32);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.1101:EVX:e500:evmwhsmi %RS,%RA,%RB:Vector Multiply Word High Signed Modulo Integer
+	signed32 al, ah, bl, bh;
+	signed64 t1, t2;
+	al = *rA;
+	ah = *rAh;
+	bl = *rB;
+	bh = *rBh;
+	t1 = (signed64)al * (signed64)bl;
+	t2 = (signed64)ah * (signed64)bh;
+	EV_SET_REG2(*rSh, *rS, t2 >> 32, t1 >> 32);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.1133:EVX:e500:evmwhsmia %RS,%RA,%RB:Vector Multiply Word High Signed Modulo Integer and Accumulate
+	signed32 al, ah, bl, bh;
+	signed64 t1, t2;
+	al = *rA;
+	ah = *rAh;
+	bl = *rB;
+	bh = *rBh;
+	t1 = (signed64)al * (signed64)bl;
+	t2 = (signed64)ah * (signed64)bh;
+	EV_SET_REG2_ACC(*rSh, *rS, t2 >> 32, t1 >> 32);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.1100:EVX:e500:evmwhumi %RS,%RA,%RB:Vector Multiply Word High Unsigned Modulo Integer
+	unsigned32 al, ah, bl, bh;
+	unsigned64 t1, t2;
+	al = *rA;
+	ah = *rAh;
+	bl = *rB;
+	bh = *rBh;
+	t1 = (unsigned64)al * (unsigned64)bl;
+	t2 = (unsigned64)ah * (unsigned64)bh;
+	EV_SET_REG2(*rSh, *rS, t2 >> 32, t1 >> 32);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.1132:EVX:e500:evmwhumia %RS,%RA,%RB:Vector Multiply Word High Unsigned Modulo Integer and Accumulate
+	unsigned32 al, ah, bl, bh;
+	unsigned64 t1, t2;
+	al = *rA;
+	ah = *rAh;
+	bl = *rB;
+	bh = *rBh;
+	t1 = (unsigned64)al * (unsigned64)bl;
+	t2 = (unsigned64)ah * (unsigned64)bh;
+	EV_SET_REG2_ACC(*rSh, *rS, t2 >> 32, t1 >> 32);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+
+0.4,6.RS,11.RA,16.RB,21.1091:EVX:e500:evmwlssf %RS,%RA,%RB:Vector Multiply Word Low Signed Saturate Fractional
+	signed32 al, ah, bl, bh;
+	signed64 t1, t2;
+	int movl, movh;
+	al = *rA;
+	ah = *rAh;
+	bl = *rB;
+	bh = *rBh;
+	t1 = ev_multiply32_ssf(al, bl, &movl);
+	t2 = ev_multiply32_ssf(ah, bh, &movh);
+	EV_SET_REG2(*rSh, *rS, EV_SATURATE(movh, 0xffffffff, t2),
+			       EV_SATURATE(movl, 0xffffffff, t1));
+	EV_SET_SPEFSCR_OV(movl, movh);
+	PPC_INSN_INT_SPR(RS_BITMASK, RA_BITMASK | RB_BITMASK, spr_spefscr);
+
+0.4,6.RS,11.RA,16.RB,21.1123:EVX:e500:evmwlssfa %RS,%RA,%RB:Vector Multiply Word Low Signed Saturate Fractional and Accumulate
+	signed32 al, ah, bl, bh;
+	signed64 t1, t2;
+	int movl, movh;
+	al = *rA;
+	ah = *rAh;
+	bl = *rB;
+	bh = *rBh;
+	t1 = ev_multiply32_ssf(al, bl, &movl);
+	t2 = ev_multiply32_ssf(ah, bh, &movh);
+	EV_SET_REG2_ACC(*rSh, *rS, EV_SATURATE(movh, 0xffffffff, t2),
+			           EV_SATURATE(movl, 0xffffffff, t1));
+	EV_SET_SPEFSCR_OV(movl, movh);
+	PPC_INSN_INT_SPR(RS_BITMASK, RA_BITMASK | RB_BITMASK, spr_spefscr);
+
+0.4,6.RS,11.RA,16.RB,21.1099:EVX:e500:evmwlsmf %RS,%RA,%RB:Vector Multiply Word Low Signed Modulo Fractional
+	signed32 al, ah, bl, bh;
+	signed64 t1, t2;
+	al = *rA;
+	ah = *rAh;
+	bl = *rB;
+	bh = *rBh;
+	t1 = EV_MUL32_SSF(al, bl);
+	t2 = EV_MUL32_SSF(ah, bh);
+	EV_SET_REG2(*rSh, *rS, t2, t1);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.1131:EVX:e500:evmwlsmfa %RS,%RA,%RB:Vector Multiply Word Low Signed Modulo Fractional and Accumulate
+	signed32 al, ah, bl, bh;
+	signed64 t1, t2;
+	al = *rA;
+	ah = *rAh;
+	bl = *rB;
+	bh = *rBh;
+	t1 = EV_MUL32_SSF(al, bl);
+	t2 = EV_MUL32_SSF(ah, bh);
+	EV_SET_REG2_ACC(*rSh, *rS, t2, t1);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.1096:EVX:e500:evmwlumi %RS,%RA,%RB:Vector Multiply Word Low Unsigned Modulo Integer
+	unsigned32 al, ah, bl, bh;
+	unsigned64 t1, t2;
+	al = *rA;
+	ah = *rAh;
+	bl = *rB;
+	bh = *rBh;
+	t1 = (unsigned64)al * (unsigned64)bl;
+	t2 = (unsigned64)ah * (unsigned64)bh;
+	EV_SET_REG2(*rSh, *rS, t2, t1);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.1128:EVX:e500:evmwlumia %RS,%RA,%RB:Vector Multiply Word Low Unsigned Modulo Integer and Accumulate
+	unsigned32 al, ah, bl, bh;
+	unsigned64 t1, t2;
+	al = *rA;
+	ah = *rAh;
+	bl = *rB;
+	bh = *rBh;
+	t1 = (unsigned64)al * (unsigned64)bl;
+	t2 = (unsigned64)ah * (unsigned64)bh;
+	EV_SET_REG2_ACC(*rSh, *rS, t2, t1);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+
+0.4,6.RS,11.RA,16.RB,21.1347:EVX:e500:evmwlssfaaw %RS,%RA,%RB:Vector Multiply Word Low Signed Saturate Fractional and Accumulate in Words
+	signed32 al, ah, bl, bh;
+	signed64 t1, t2, tl, th;
+	int movl, movh, ovl, ovh;
+	al = *rA;
+	ah = *rAh;
+	bl = *rB;
+	bh = *rBh;
+	t1 = ev_multiply32_ssf(ah, bh, &movh);
+	t2 = ev_multiply32_ssf(al, bl, &movl);
+	th = EV_ACCHIGH + EV_SATURATE(movh, 0xffffffff, t1);
+	tl = EV_ACCLOW + EV_SATURATE(movl, 0xffffffff, t2);
+	ovh = EV_SAT_P_S32(th);
+	ovl = EV_SAT_P_S32(tl);
+	EV_SET_REG2_ACC(*rSh, *rS, EV_SATURATE_ACC(ovh, th, 0x80000000, 0x7fffffff, th),
+			           EV_SATURATE_ACC(ovl, tl, 0x80000000, 0x7fffffff, tl));
+	EV_SET_SPEFSCR_OV(movl | ovl, movh | ovh);
+	PPC_INSN_INT_SPR(RS_BITMASK, RA_BITMASK | RB_BITMASK, spr_spefscr);
+
+0.4,6.RS,11.RA,16.RB,21.1345:EVX:e500:evmwlssiaaw %RS,%RA,%RB:Vector Multiply Word Low Signed Saturate Integer and Accumulate in Words
+	signed32 al, ah, bl, bh;
+	signed64 t1, t2, tl, th;
+	int ovl, ovh;
+	al = *rA;
+	ah = *rAh;
+	bl = *rB;
+	bh = *rBh;
+	t1 = (signed64)ah * (signed64)bh;
+	t2 = (signed64)al * (signed64)bl;
+	th = EV_ACCHIGH + (t1 & 0xffffffff);
+	tl = EV_ACCLOW + (t2 & 0xffffffff);
+	ovh = EV_SAT_P_S32(th);
+	ovl = EV_SAT_P_S32(tl);
+	EV_SET_REG2_ACC(*rSh, *rS, EV_SATURATE_ACC(ovh, th, 0x80000000, 0x7fffffff, th),
+			           EV_SATURATE_ACC(ovl, tl, 0x80000000, 0x7fffffff, tl));
+	EV_SET_SPEFSCR_OV(ovl, ovh);
+	PPC_INSN_INT_SPR(RS_BITMASK, RA_BITMASK | RB_BITMASK, spr_spefscr);
+
+0.4,6.RS,11.RA,16.RB,21.1355:EVX:e500:evmwlsmfaaw %RS,%RA,%RB:Vector Multiply Word Low Signed Modulo Fractional and Accumulate in Words
+	signed32 al, ah, bl, bh;
+	signed64 t1, t2;
+	int mov;
+	al = *rA;
+	ah = *rAh;
+	bl = *rB;
+	bh = *rBh;
+	t1 = ev_multiply32_smf(ah, bh, &mov);
+	t2 = ev_multiply32_smf(al, bl, &mov);
+	EV_SET_REG2_ACC(*rSh, *rS, EV_ACCHIGH + (t1 & 0xffffffff),
+				 EV_ACCLOW + (t2 & 0xffffffff));
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.1353:EVX:e500:evmwlsmiaaw %RS,%RA,%RB:Vector Multiply Word Low Signed Modulo Integer and Accumulate in Words
+	signed32 al, ah, bl, bh;
+	signed64 t1, t2;
+	al = *rA;
+	ah = *rAh;
+	bl = *rB;
+	bh = *rBh;
+	t1 = (signed64)ah * (signed64)bh;
+	t2 = (signed64)al * (signed64)bl;
+	EV_SET_REG2_ACC(*rSh, *rS, EV_ACCHIGH + (t1 & 0xffffffff),
+				 EV_ACCLOW + (t2 & 0xffffffff));
+		//printf("evmwlsmiaaw: al %d ah %d bl %d bh %d t1 %qd t2 %qd\n", al, ah, bl, bh, t1, t2);
+		//printf("evmwlsmiaaw: *rSh = %08x; *rS = %08x\n", *rSh, *rS);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.1344:EVX:e500:evmwlusiaaw %RS,%RA,%RB:Vector Multiply Word Low Unsigned Saturate Integer and Accumulate in Words
+	unsigned32 al, ah, bl, bh;
+	unsigned64 t1, t2, tl, th;
+	int ovl, ovh;
+	al = *rA;
+	ah = *rAh;
+	bl = *rB;
+	bh = *rBh;
+	t1 = (unsigned64)ah * (unsigned64)bh;
+	t2 = (unsigned64)al * (unsigned64)bl;
+	th = EV_ACCHIGH + (t1 & 0xffffffff);
+	tl = EV_ACCLOW + (t2 & 0xffffffff);
+	ovh = (th >> 32);
+	ovl = (tl >> 32);
+	EV_SET_REG2_ACC(*rSh, *rS, EV_SATURATE(ovh, 0xffffffff, th),
+			           EV_SATURATE(ovl, 0xffffffff, tl));
+	EV_SET_SPEFSCR_OV(ovl, ovh);
+	PPC_INSN_INT_SPR(RS_BITMASK, RA_BITMASK | RB_BITMASK, spr_spefscr);
+
+0.4,6.RS,11.RA,16.RB,21.1352:EVX:e500:evmwlumiaaw %RS,%RA,%RB:Vector Multiply Word Low Unsigned Modulo Integer and Accumulate in Words
+	unsigned32 al, ah, bl, bh;
+	unsigned64 t1, t2;
+	al = *rA;
+	ah = *rAh;
+	bl = *rB;
+	bh = *rBh;
+	t1 = (unsigned64)ah * (unsigned64)bh;
+	t2 = (unsigned64)al * (unsigned64)bl;
+	EV_SET_REG2_ACC(*rSh, *rS, EV_ACCHIGH + (t1 & 0xffffffff),
+				 EV_ACCLOW + (t2 & 0xffffffff));
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+
+0.4,6.RS,11.RA,16.RB,21.1475:EVX:e500:evmwlssfanw %RS,%RA,%RB:Vector Multiply Word Low Signed Saturate Fractional and Accumulate Negative in Words
+	signed32 al, ah, bl, bh;
+	signed64 t1, t2, tl, th;
+	int movl, movh, ovl, ovh;
+	al = *rA;
+	ah = *rAh;
+	bl = *rB;
+	bh = *rBh;
+	t1 = ev_multiply32_ssf(ah, bh, &movh);
+	t2 = ev_multiply32_ssf(al, bl, &movl);
+	th = EV_ACCHIGH - EV_SATURATE(movh, 0xffffffff, t1);
+	tl = EV_ACCLOW - EV_SATURATE(movl, 0xffffffff, t2);
+	ovh = EV_SAT_P_S32(th);
+	ovl = EV_SAT_P_S32(tl);
+	EV_SET_REG2_ACC(*rSh, *rS, EV_SATURATE_ACC(ovh, th, 0x80000000, 0x7fffffff, th),
+			           EV_SATURATE_ACC(ovl, tl, 0x80000000, 0x7fffffff, tl));
+	EV_SET_SPEFSCR_OV(movl | ovl, movh | ovh);
+	PPC_INSN_INT_SPR(RS_BITMASK, RA_BITMASK | RB_BITMASK, spr_spefscr);
+
+0.4,6.RS,11.RA,16.RB,21.1473:EVX:e500:evmwlssianw %RS,%RA,%RB:Vector Multiply Word Low Signed Saturate Integer and Accumulate Negative in Words
+	signed32 al, ah, bl, bh;
+	signed64 t1, t2, tl, th;
+	int ovl, ovh;
+	al = *rA;
+	ah = *rAh;
+	bl = *rB;
+	bh = *rBh;
+	t1 = (signed64)ah * (signed64)bh;
+	t2 = (signed64)al * (signed64)bl;
+	th = EV_ACCHIGH - (t1 & 0xffffffff);
+	tl = EV_ACCLOW - (t2 & 0xffffffff);
+	ovh = EV_SAT_P_S32(th);
+	ovl = EV_SAT_P_S32(tl);
+	EV_SET_REG2_ACC(*rSh, *rS, EV_SATURATE_ACC(ovh, th, 0x80000000, 0x7fffffff, th),
+			           EV_SATURATE_ACC(ovl, tl, 0x80000000, 0x7fffffff, tl));
+	EV_SET_SPEFSCR_OV(ovl, ovh);
+	PPC_INSN_INT_SPR(RS_BITMASK, RA_BITMASK | RB_BITMASK, spr_spefscr);
+
+0.4,6.RS,11.RA,16.RB,21.1483:EVX:e500:evmwlsmfanw %RS,%RA,%RB:Vector Multiply Word Low Signed Modulo Fractional and Accumulate Negative in Words
+	signed32 al, ah, bl, bh;
+	signed64 t1, t2;
+	int mov;
+	al = *rA;
+	ah = *rAh;
+	bl = *rB;
+	bh = *rBh;
+	t1 = ev_multiply32_smf(ah, bh, &mov);
+	t2 = ev_multiply32_smf(al, bl, &mov);
+	EV_SET_REG2_ACC(*rSh, *rS, EV_ACCHIGH - (t1 & 0xffffffff),
+				 EV_ACCLOW - (t2 & 0xffffffff));
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.1481:EVX:e500:evmwlsmianw %RS,%RA,%RB:Vector Multiply Word Low Signed Modulo Integer and Accumulate Negative in Words
+	signed32 al, ah, bl, bh;
+	signed64 t1, t2;
+	al = *rA;
+	ah = *rAh;
+	bl = *rB;
+	bh = *rBh;
+	t1 = (signed64)ah * (signed64)bh;
+	t2 = (signed64)al * (signed64)bl;
+	EV_SET_REG2_ACC(*rSh, *rS, EV_ACCHIGH - (t1 & 0xffffffff),
+				 EV_ACCLOW - (t2 & 0xffffffff));
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.1472:EVX:e500:evmwlusianw %RS,%RA,%RB:Vector Multiply Word Low Unsigned Saturate Integer and Accumulate Negative in Words
+	unsigned32 al, ah, bl, bh;
+	unsigned64 t1, t2, tl, th;
+	int ovl, ovh;
+	al = *rA;
+	ah = *rAh;
+	bl = *rB;
+	bh = *rBh;
+	t1 = (unsigned64)ah * (unsigned64)bh;
+	t2 = (unsigned64)al * (unsigned64)bl;
+	th = EV_ACCHIGH - (t1 & 0xffffffff);
+	tl = EV_ACCLOW - (t2 & 0xffffffff);
+	ovh = (th >> 32);
+	ovl = (tl >> 32);
+	EV_SET_REG2_ACC(*rSh, *rS, EV_SATURATE(ovh, 0xffffffff, th),
+			           EV_SATURATE(ovl, 0xffffffff, tl));
+		//printf("evmwlusianw: ovl %d ovh %d al %d ah %d bl %d bh %d t1 %qd t2 %qd th %qd tl %qd\n", ovl, ovh, al, ah, al, bh, t1, t2, th, tl);
+		//printf("evmwlusianw: ACC = %08x.%08x; *rSh = %08x; *rS = %08x\n", (int)(ACC >> 32), (int)ACC, *rSh, *rS);
+	EV_SET_SPEFSCR_OV(ovl, ovh);
+	PPC_INSN_INT_SPR(RS_BITMASK, RA_BITMASK | RB_BITMASK, spr_spefscr);
+
+0.4,6.RS,11.RA,16.RB,21.1480:EVX:e500:evmwlumianw %RS,%RA,%RB:Vector Multiply Word Low Unsigned Modulo Integer and Accumulate Negative in Words
+	unsigned32 al, ah, bl, bh;
+	unsigned64 t1, t2;
+	al = *rA;
+	ah = *rAh;
+	bl = *rB;
+	bh = *rBh;
+	t1 = (unsigned64)ah * (unsigned64)bh;
+	t2 = (unsigned64)al * (unsigned64)bl;
+	EV_SET_REG2_ACC(*rSh, *rS, EV_ACCHIGH - (t1 & 0xffffffff),
+				   EV_ACCLOW - (t2 & 0xffffffff));
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+
+0.4,6.RS,11.RA,16.RB,21.1107:EVX:e500:evmwssf %RS,%RA,%RB:Vector Multiply Word Signed Saturate Fractional
+	signed32 a, b;
+	signed64 t;
+	int movl;
+	a = *rA;
+	b = *rB;
+	t = ev_multiply32_ssf(a, b, &movl);
+	EV_SET_REG1(*rSh, *rS, EV_SATURATE(movl, 0x7fffffffffffffff, t));
+	EV_SET_SPEFSCR_OV(movl, 0);
+	PPC_INSN_INT_SPR(RS_BITMASK, RA_BITMASK | RB_BITMASK, spr_spefscr);
+
+0.4,6.RS,11.RA,16.RB,21.1139:EVX:e500:evmwssfa %RS,%RA,%RB:Vector Multiply Word Signed Saturate Fractional and Accumulate
+	signed32 a, b;
+	signed64 t;
+	int movl;
+	a = *rA;
+	b = *rB;
+	t = ev_multiply32_ssf(a, b, &movl);
+	EV_SET_REG1_ACC(*rSh, *rS, EV_SATURATE(movl, 0x7fffffffffffffff, t));
+	EV_SET_SPEFSCR_OV(movl, 0);
+	PPC_INSN_INT_SPR(RS_BITMASK, RA_BITMASK | RB_BITMASK, spr_spefscr);
+
+0.4,6.RS,11.RA,16.RB,21.1115:EVX:e500:evmwsmf %RS,%RA,%RB:Vector Multiply Word Signed Modulo Fractional
+	signed32 a, b;
+	signed64 t;
+	int movl;
+	a = *rA;
+	b = *rB;
+	t = ev_multiply32_smf(a, b, &movl);
+	EV_SET_REG1(*rSh, *rS, t);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.1147:EVX:e500:evmwsmfa %RS,%RA,%RB:Vector Multiply Word Signed Modulo Fractional and Accumulate
+	signed32 a, b;
+	signed64 t;
+	int movl;
+	a = *rA;
+	b = *rB;
+	t = ev_multiply32_smf(a, b, &movl);
+	EV_SET_REG1_ACC(*rSh, *rS, t);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.1113:EVX:e500:evmwsmi %RS,%RA,%RB:Vector Multiply Word Signed Modulo Integer
+	signed32 a, b;
+	signed64 t;
+	int movl;
+	a = *rA;
+	b = *rB;
+	t = (signed64)a * (signed64)b;
+	EV_SET_REG1(*rSh, *rS, t);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.1145:EVX:e500:evmwsmia %RS,%RA,%RB:Vector Multiply Word Signed Modulo Integer and Accumulate
+	signed32 a, b;
+	signed64 t;
+	int movl;
+	a = *rA;
+	b = *rB;
+	t = (signed64)a * (signed64)b;
+	EV_SET_REG1_ACC(*rSh, *rS, t);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.1112:EVX:e500:evmwumi %RS,%RA,%RB:Vector Multiply Word Unigned Modulo Integer
+	unsigned32 a, b;
+	unsigned64 t;
+	int movl;
+	a = *rA;
+	b = *rB;
+	t = (signed64)a * (signed64)b;
+	EV_SET_REG1(*rSh, *rS, t);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.1144:EVX:e500:evmwumia %RS,%RA,%RB:Vector Multiply Word Unigned Modulo Integer and Accumulate
+	unsigned32 a, b;
+	unsigned64 t;
+	int movl;
+	a = *rA;
+	b = *rB;
+	t = (signed64)a * (signed64)b;
+	EV_SET_REG1_ACC(*rSh, *rS, t);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+
+0.4,6.RS,11.RA,16.RB,21.1363:EVX:e500:evmwssfaa %RS,%RA,%RB:Vector Multiply Word Signed Saturate Fractional Add and Accumulate
+	signed64 t1, t2;
+	signed32 a, b;
+	int movl;
+	a = *rA;
+	b = *rB;
+	t1 = ev_multiply32_ssf(a, b, &movl);
+	t2 = ACC + EV_SATURATE(movl, 0x7fffffffffffffff, t1);
+	EV_SET_REG1_ACC(*rSh, *rS, t2);
+	EV_SET_SPEFSCR_OV(movl, 0);
+	PPC_INSN_INT_SPR(RS_BITMASK, RA_BITMASK | RB_BITMASK, spr_spefscr);
+
+0.4,6.RS,11.RA,16.RB,21.1371:EVX:e500:evmwsmfaa %RS,%RA,%RB:Vector Multiply Word Signed Modulo Fractional Add and Accumulate
+	signed64 t1, t2;
+	signed32 a, b;
+	int movl;
+	a = *rA;
+	b = *rB;
+	t1 = ev_multiply32_smf(a, b, &movl);
+	t2 = ACC + t1;
+	EV_SET_REG1_ACC(*rSh, *rS, t2);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.1369:EVX:e500:evmwsmiaa %RS,%RA,%RB:Vector Multiply Word Signed Modulo Integer And and Accumulate
+	signed64 t1, t2;
+	signed32 a, b;
+	a = *rA;
+	b = *rB;
+	t1 = (signed64)a * (signed64)b;
+	t2 = ACC + t1;
+	EV_SET_REG1_ACC(*rSh, *rS, t2);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.1368:EVX:e500:evmwumiaa %RS,%RA,%RB:Vector Multiply Word Unsigned Modulo Integer Add and Accumulate
+	unsigned64 t1, t2;
+	unsigned32 a, b;
+	a = *rA;
+	b = *rB;
+	t1 = (unsigned64)a * (unsigned64)b;
+	t2 = ACC + t1;
+	EV_SET_REG1_ACC(*rSh, *rS, t2);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+
+0.4,6.RS,11.RA,16.RB,21.1491:EVX:e500:evmwssfan %RS,%RA,%RB:Vector Multiply Word Signed Saturate Fractional and Accumulate Negative
+	signed64 t1, t2;
+	signed32 a, b;
+	int movl;
+	a = *rA;
+	b = *rB;
+	t1 = ev_multiply32_ssf(a, b, &movl);
+	t2 = ACC - EV_SATURATE(movl, 0x7fffffffffffffff, t1);
+	EV_SET_REG1_ACC(*rSh, *rS, t2);
+	EV_SET_SPEFSCR_OV(movl, 0);
+	PPC_INSN_INT_SPR(RS_BITMASK, RA_BITMASK | RB_BITMASK, spr_spefscr);
+
+0.4,6.RS,11.RA,16.RB,21.1499:EVX:e500:evmwsmfan %RS,%RA,%RB:Vector Multiply Word Signed Modulo Fractional and Accumulate Negative
+	signed64 t1, t2;
+	signed32 a, b;
+	int movl;
+	a = *rA;
+	b = *rB;
+	t1 = ev_multiply32_smf(a, b, &movl);
+	t2 = ACC - t1;
+	EV_SET_REG1_ACC(*rSh, *rS, t2);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.1497:EVX:e500:evmwsmian %RS,%RA,%RB:Vector Multiply Word Signed Modulo Integer and Accumulate Negative
+	signed64 t1, t2;
+	signed32 a, b;
+	a = *rA;
+	b = *rB;
+	t1 = (signed64)a * (signed64)b;
+	t2 = ACC - t1;
+	EV_SET_REG1_ACC(*rSh, *rS, t2);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.1496:EVX:e500:evmwumian %RS,%RA,%RB:Vector Multiply Word Unsigned Modulo Integer and Accumulate Negative
+	unsigned64 t1, t2;
+	unsigned32 a, b;
+	a = *rA;
+	b = *rB;
+	t1 = (unsigned64)a * (unsigned64)b;
+	t2 = ACC - t1;
+	EV_SET_REG1_ACC(*rSh, *rS, t2);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
+
+
+0.4,6.RS,11.RA,16.0,21.1217:EVX:e500:evaddssiaaw %RS,%RA:Vector Add Signed Saturate Integer to Accumulator Word
+	signed64 t1, t2;
+	signed32 al, ah;
+	int ovl, ovh;
+	al = *rA;
+	ah = *rAh;
+	t1 = (signed64)EV_ACCHIGH + (signed64)ah;
+	t2 = (signed64)EV_ACCLOW + (signed64)al;
+	ovh = EV_SAT_P_S32(t1);
+	ovl = EV_SAT_P_S32(t2);
+	EV_SET_REG2_ACC(*rSh, *rS, EV_SATURATE_ACC(ovh, t1 & ((unsigned64)1 << 32), 0x80000000, 0x7fffffff, t1),
+			           EV_SATURATE_ACC(ovl, t2 & ((unsigned64)1 << 32), 0x80000000, 0x7fffffff, t2));
+	EV_SET_SPEFSCR_OV(ovl, ovh);
+	PPC_INSN_INT_SPR(RS_BITMASK, RA_BITMASK, spr_spefscr);
+
+0.4,6.RS,11.RA,16.0,21.1225:EVX:e500:evaddsmiaaw %RS,%RA:Vector Add Signed Modulo Integer to Accumulator Word
+	signed64 t1, t2;
+	signed32 al, ah;
+	al = *rA;
+	ah = *rAh;
+	t1 = (signed64)EV_ACCHIGH + (signed64)ah;
+	t2 = (signed64)EV_ACCLOW + (signed64)al;
+	EV_SET_REG2_ACC(*rSh, *rS, t1, t2);
+		//printf("evaddsmiaaw: al %d ah %d t1 %qd t2 %qd\n", al, ah, t1, t2);
+		//printf("evaddsmiaaw: ACC = %08x.%08x; *rSh = %08x; *rS = %08x\n", (int)(ACC >> 32), (int)ACC, *rSh, *rS);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.0,21.1216:EVX:e500:evaddusiaaw %RS,%RA:Vector Add Unsigned Saturate Integer to Accumulator Word
+	signed64 t1, t2;
+	unsigned32 al, ah;
+	int ovl, ovh;
+	al = *rA;
+	ah = *rAh;
+	t1 = (signed64)EV_ACCHIGH + (signed64)ah;
+	t2 = (signed64)EV_ACCLOW + (signed64)al;
+	ovh = EV_SAT_P_U32(t1);
+	ovl = EV_SAT_P_U32(t2);
+	EV_SET_REG2_ACC(*rSh, *rS, EV_SATURATE(ovh, 0xffffffff, t1),
+				   EV_SATURATE(ovl, 0xffffffff, t2));
+		//printf("evaddusiaaw: ovl %d ovh %d al %d ah %d t1 %qd t2 %qd\n", ovl, ovh, al, ah, t1, t2);
+		//printf("evaddusiaaw: ACC = %08x.%08x; *rSh = %08x; *rS = %08x\n", (int)(ACC >> 32), (int)ACC, *rSh, *rS);
+	EV_SET_SPEFSCR_OV(ovl, ovh);
+	PPC_INSN_INT_SPR(RS_BITMASK, RA_BITMASK, spr_spefscr);
+
+0.4,6.RS,11.RA,16.0,21.1224:EVX:e500:evaddumiaaw %RS,%RA:Vector Add Unsigned Modulo Integer to Accumulator Word
+	unsigned64 t1, t2;
+	unsigned32 al, ah;
+	al = *rA;
+	ah = *rAh;
+	t1 = (unsigned64)EV_ACCHIGH + (unsigned64)ah;
+	t2 = EV_ACCLOW + al;
+	EV_SET_REG2_ACC(*rSh, *rS, t1, t2);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK, 0);
+
+
+0.4,6.RS,11.RA,16.0,21.1219:EVX:e500:evsubfssiaaw %RS,%RA:Vector Subtract Signed Saturate Integer to Accumulator Word
+	signed64 t1, t2;
+	signed32 al, ah;
+	int ovl, ovh;
+	al = *rA;
+	ah = *rAh;
+	t1 = (signed64)EV_ACCHIGH - (signed64)ah;
+	t2 = (signed64)EV_ACCLOW - (signed64)al;
+	ovh = EV_SAT_P_S32(t1);
+	ovl = EV_SAT_P_S32(t2);
+	EV_SET_REG2_ACC(*rSh, *rS, EV_SATURATE_ACC(ovh, t1, 0x80000000, 0x7fffffff, t1),
+			           EV_SATURATE_ACC(ovl, t2, 0x80000000, 0x7fffffff, t2));
+	EV_SET_SPEFSCR_OV(ovl, ovh);
+	PPC_INSN_INT_SPR(RS_BITMASK, RA_BITMASK, spr_spefscr);
+
+0.4,6.RS,11.RA,16.0,21.1227:EVX:e500:evsubfsmiaaw %RS,%RA:Vector Subtract Signed Modulo Integer to Accumulator Word
+	signed64 t1, t2;
+	signed32 al, ah;
+	al = *rA;
+	ah = *rAh;
+	t1 = (signed64)EV_ACCHIGH - (signed64)ah;
+	t2 = (signed64)EV_ACCLOW - (signed64)al;
+	EV_SET_REG2_ACC(*rSh, *rS, t1, t2);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.0,21.1218:EVX:e500:evsubfusiaaw %RS,%RA:Vector Subtract Unsigned Saturate Integer to Accumulator Word
+	signed64 t1, t2;
+	unsigned32 al, ah;
+	int ovl, ovh;
+	
+	al = *rA;
+	ah = *rAh;
+	t1 = (signed64)EV_ACCHIGH - (signed64)ah;
+	t2 = (signed64)EV_ACCLOW - (signed64)al;
+	ovh = EV_SAT_P_U32(t1);
+	ovl = EV_SAT_P_U32(t2);
+	EV_SET_REG2_ACC(*rSh, *rS, EV_SATURATE(ovh, 0, t1),
+			           EV_SATURATE(ovl, 0, t2));
+	EV_SET_SPEFSCR_OV(ovl, ovh);
+	PPC_INSN_INT_SPR(RS_BITMASK, RA_BITMASK, spr_spefscr);
+
+0.4,6.RS,11.RA,16.0,21.1226:EVX:e500:evsubfumiaaw %RS,%RA:Vector Subtract Unsigned Modulo Integer to Accumulator Word
+	unsigned64 t1, t2;
+	unsigned32 al, ah;
+	al = *rA;
+	ah = *rAh;
+	t1 = (unsigned64)EV_ACCHIGH - (unsigned64)ah;
+	t2 = (unsigned64)EV_ACCLOW - (unsigned64)al;
+	EV_SET_REG2_ACC(*rSh, *rS, t1, t2);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK, 0);
+
+
+0.4,6.RS,11.RA,16.0,21.1220:EVX:e500:evmra %RS,%RA:Initialize Accumulator
+	EV_SET_REG2_ACC(*rSh, *rS, *rAh, *rA);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.1222:EVX:e500:evdivws %RS,%RA,%RB:Vector Divide Word Signed
+	signed32 dividendh, dividendl, divisorh, divisorl;
+	signed32 w1, w2;
+	int ovh, ovl;
+	dividendh = *rAh;
+	dividendl = *rA;
+	divisorh = *rBh;
+	divisorl = *rB;
+	if (dividendh < 0 && divisorh == 0) {
+	  w1 = 0x80000000;
+	  ovh = 1;
+	} else if (dividendh > 0 && divisorh == 0) {
+	  w1 = 0x7fffffff;
+	  ovh = 1;
+	} else if (dividendh == 0x80000000 && divisorh == -1) {
+	  w1 = 0x7fffffff;
+	  ovh = 1;
+	} else {
+	  w1 = dividendh / divisorh;
+	  ovh = 0;
+	}
+	if (dividendl < 0 && divisorl == 0) {
+	  w2 = 0x80000000;
+	  ovl = 1;
+	} else if (dividendl > 0 && divisorl == 0) {
+	  w2 = 0x7fffffff;
+	  ovl = 1;
+	} else if (dividendl == 0x80000000 && divisorl == -1) {
+	  w2 = 0x7fffffff;
+	  ovl = 1;
+	} else {
+	  w2 = dividendl / divisorl;
+	  ovl = 0;
+	}
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+	EV_SET_SPEFSCR_OV(ovl, ovh);
+	PPC_INSN_INT_SPR(RS_BITMASK, RA_BITMASK, spr_spefscr);
+	
+
+0.4,6.RS,11.RA,16.RB,21.1223:EVX:e500:evdivwu %RS,%RA,%RB:Vector Divide Word Unsigned
+	unsigned32 dividendh, dividendl, divisorh, divisorl;
+	unsigned32 w1, w2;
+	int ovh, ovl;
+	dividendh = *rAh;
+	dividendl = *rA;
+	divisorh = *rBh;
+	divisorl = *rB;
+	if (divisorh == 0) {
+	  w1 = 0xffffffff;
+	  ovh = 1;
+	} else {
+	  w1 = dividendh / divisorh;
+	  ovh = 0;
+	}
+	if (divisorl == 0) {
+	  w2 = 0xffffffff;
+	  ovl = 1;
+	} else {
+	  w2 = dividendl / divisorl;
+	  ovl = 0;
+	}
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+	EV_SET_SPEFSCR_OV(ovl, ovh);
+	PPC_INSN_INT_SPR(RS_BITMASK, RA_BITMASK, spr_spefscr);
+
+
+#
+# A.2.9 Floating Point SPE Instructions
+#
+
+0.4,6.RS,11.RA,16.0,21.644:EVX:e500:evfsabs %RS,%RA:Vector Floating-Point Absolute Value
+	unsigned32 w1, w2;
+	w1 = *rAh & 0x7fffffff;
+	w2 = *rA & 0x7fffffff;
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.0,21.645:EVX:e500:evfsnabs %RS,%RA:Vector Floating-Point Negative Absolute Value
+	unsigned32 w1, w2;
+	w1 = *rAh | 0x80000000;
+	w2 = *rA | 0x80000000;
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.0,21.646:EVX:e500:evfsneg %RS,%RA:Vector Floating-Point Negate
+	unsigned32 w1, w2;
+	w1 = *rAh;
+	w2 = *rA;
+	w1 = (w1 & 0x7fffffff) | ((~w1) & 0x80000000);
+	w2 = (w2 & 0x7fffffff) | ((~w2) & 0x80000000);
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.640:EVX:e500:evfsadd %RS,%RA,%RB:Vector Floating-Point Add
+	unsigned32 w1, w2;
+	w1 = ev_fs_add (*rAh, *rBh, spefscr_finvh, spefscr_fovfh, spefscr_funfh, spefscr_fgh, spefscr_fxh, processor);
+	w2 = ev_fs_add (*rA, *rB, spefscr_finv, spefscr_fovf, spefscr_funf, spefscr_fgh, spefscr_fxh, processor);
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+	PPC_INSN_INT_SPR(RS_BITMASK, RA_BITMASK | RB_BITMASK, spr_spefscr);
+
+0.4,6.RS,11.RA,16.RB,21.641:EVX:e500:evfssub %RS,%RA,%RB:Vector Floating-Point Subtract
+	unsigned32 w1, w2;
+	w1 = ev_fs_sub (*rAh, *rBh, spefscr_finvh, spefscr_fovfh, spefscr_funfh, spefscr_fgh, spefscr_fxh, processor);
+	w2 = ev_fs_sub (*rA, *rB, spefscr_finv, spefscr_fovf, spefscr_funf, spefscr_fgh, spefscr_fxh, processor);
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+	PPC_INSN_INT_SPR(RS_BITMASK, RA_BITMASK | RB_BITMASK, spr_spefscr);
+
+0.4,6.RS,11.RA,16.RB,21.648:EVX:e500:evfsmul %RS,%RA,%RB:Vector Floating-Point Multiply
+	unsigned32 w1, w2;
+	w1 = ev_fs_mul (*rAh, *rBh, spefscr_finvh, spefscr_fovfh, spefscr_funfh, spefscr_fgh, spefscr_fxh, processor);
+	w2 = ev_fs_mul (*rA, *rB, spefscr_finv, spefscr_fovf, spefscr_funf, spefscr_fgh, spefscr_fxh, processor);
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+	PPC_INSN_INT_SPR(RS_BITMASK, RA_BITMASK | RB_BITMASK, spr_spefscr);
+
+0.4,6.RS,11.RA,16.RB,21.649:EVX:e500:evfsdiv %RS,%RA,%RB:Vector Floating-Point Divide
+	signed32 w1, w2;
+	w1 = ev_fs_div (*rAh, *rBh, spefscr_finvh, spefscr_fovfh, spefscr_funfh, spefscr_fdbzh, spefscr_fgh, spefscr_fxh, processor);
+	w2 = ev_fs_div (*rA, *rB, spefscr_finv, spefscr_fovf, spefscr_funf, spefscr_fdbz, spefscr_fg, spefscr_fx, processor);
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+	PPC_INSN_INT_SPR(RS_BITMASK, RA_BITMASK | RB_BITMASK, spr_spefscr);
+
+0.4,6.BF,9./,11.RA,16.RB,21.652:EVX:e500:evfscmpgt %BF,%RA,%RB:Vector Floating-Point Compare Greater Than
+	sim_fpu al, ah, bl, bh;
+	int w, ch, cl;
+	sim_fpu_32to (&al, *rA);
+	sim_fpu_32to (&ah, *rAh);
+	sim_fpu_32to (&bl, *rB);
+	sim_fpu_32to (&bh, *rBh);
+	if (EV_IS_INFDENORMNAN(&al) || EV_IS_INFDENORMNAN(&bl))
+	  EV_SET_SPEFSCR_BITS(spefscr_finv);
+	if (EV_IS_INFDENORMNAN(&ah) || EV_IS_INFDENORMNAN(&bh))
+	  EV_SET_SPEFSCR_BITS(spefscr_finvh);
+	if (sim_fpu_is_gt(&ah, &bh))
+	  ch = 1;
+	else
+	  ch = 0;
+	if (sim_fpu_is_gt(&al, &bl))
+	  cl = 1;
+	else
+	  cl = 0;
+	w = ch << 3 | cl << 2 | (ch | cl) << 1 | (ch & cl);
+	CR_SET(BF, w);
+	PPC_INSN_INT_SPR(0, RA_BITMASK | RB_BITMASK, spr_spefscr);
+
+0.4,6.BF,9./,11.RA,16.RB,21.653:EVX:e500:evfscmplt %BF,%RA,%RB:Vector Floating-Point Compare Less Than
+	sim_fpu al, ah, bl, bh;
+	int w, ch, cl;
+	sim_fpu_32to (&al, *rA);
+	sim_fpu_32to (&ah, *rAh);
+	sim_fpu_32to (&bl, *rB);
+	sim_fpu_32to (&bh, *rBh);
+	if (EV_IS_INFDENORMNAN(&al) || EV_IS_INFDENORMNAN(&bl))
+	  EV_SET_SPEFSCR_BITS(spefscr_finv);
+	if (EV_IS_INFDENORMNAN(&ah) || EV_IS_INFDENORMNAN(&bh))
+	  EV_SET_SPEFSCR_BITS(spefscr_finvh);
+	if (sim_fpu_is_lt(&ah, &bh))
+	  ch = 1;
+	else
+	  ch = 0;
+	if (sim_fpu_is_lt(&al, &bl))
+	  cl = 1;
+	else
+	  cl = 0;
+	w = ch << 3 | cl << 2 | (ch | cl) << 1 | (ch & cl);
+	CR_SET(BF, w);
+	PPC_INSN_INT_SPR(0, RA_BITMASK | RB_BITMASK, spr_spefscr);
+
+0.4,6.BF,9./,11.RA,16.RB,21.654:EVX:e500:evfscmpeq %BF,%RA,%RB:Vector Floating-Point Compare Equal
+	sim_fpu al, ah, bl, bh;
+	int w, ch, cl;
+	sim_fpu_32to (&al, *rA);
+	sim_fpu_32to (&ah, *rAh);
+	sim_fpu_32to (&bl, *rB);
+	sim_fpu_32to (&bh, *rBh);
+	if (EV_IS_INFDENORMNAN(&al) || EV_IS_INFDENORMNAN(&bl))
+	  EV_SET_SPEFSCR_BITS(spefscr_finv);
+	if (EV_IS_INFDENORMNAN(&ah) || EV_IS_INFDENORMNAN(&bh))
+	  EV_SET_SPEFSCR_BITS(spefscr_finvh);
+	if (sim_fpu_is_eq(&ah, &bh))
+	  ch = 1;
+	else
+	  ch = 0;
+	if (sim_fpu_is_eq(&al, &bl))
+	  cl = 1;
+	else
+	  cl = 0;
+	w = ch << 3 | cl << 2 | (ch | cl) << 1 | (ch & cl);
+	CR_SET(BF, w);
+	PPC_INSN_INT_SPR(0, RA_BITMASK | RB_BITMASK, spr_spefscr);
+
+0.4,6.BF,9./,11.RA,16.RB,21.668:EVX:e500:evfststgt %BF,%RA,%RB:Vector Floating-Point Test Greater Than
+	sim_fpu al, ah, bl, bh;
+	int w, ch, cl;
+	sim_fpu_32to (&al, *rA);
+	sim_fpu_32to (&ah, *rAh);
+	sim_fpu_32to (&bl, *rB);
+	sim_fpu_32to (&bh, *rBh);
+	if (sim_fpu_is_gt(&ah, &bh))
+	  ch = 1;
+	else
+	  ch = 0;
+	if (sim_fpu_is_gt(&al, &bl))
+	  cl = 1;
+	else
+	  cl = 0;
+	w = ch << 3 | cl << 2 | (ch | cl) << 1 | (ch & cl);
+	CR_SET(BF, w);
+	PPC_INSN_INT_CR(0, RA_BITMASK | RB_BITMASK, BF_BITMASK);
+
+0.4,6.BF,9./,11.RA,16.RB,21.669:EVX:e500:evfststlt %BF,%RA,%RB:Vector Floating-Point Test Less Than
+	sim_fpu al, ah, bl, bh;
+	int w, ch, cl;
+	sim_fpu_32to (&al, *rA);
+	sim_fpu_32to (&ah, *rAh);
+	sim_fpu_32to (&bl, *rB);
+	sim_fpu_32to (&bh, *rBh);
+	if (sim_fpu_is_lt(&ah, &bh))
+	  ch = 1;
+	else
+	  ch = 0;
+	if (sim_fpu_is_lt(&al, &bl))
+	  cl = 1;
+	else
+	  cl = 0;
+	w = ch << 3 | cl << 2 | (ch | cl) << 1 | (ch & cl);
+	CR_SET(BF, w);
+	PPC_INSN_INT_CR(0, RA_BITMASK | RB_BITMASK, BF_BITMASK);
+
+0.4,6.BF,9./,11.RA,16.RB,21.670:EVX:e500:evfststeq %BF,%RA,%RB:Vector Floating-Point Test Equal
+	sim_fpu al, ah, bl, bh;
+	int w, ch, cl;
+	sim_fpu_32to (&al, *rA);
+	sim_fpu_32to (&ah, *rAh);
+	sim_fpu_32to (&bl, *rB);
+	sim_fpu_32to (&bh, *rBh);
+	if (sim_fpu_is_eq(&ah, &bh))
+	  ch = 1;
+	else
+	  ch = 0;
+	if (sim_fpu_is_eq(&al, &bl))
+	  cl = 1;
+	else
+	  cl = 0;
+	w = ch << 3 | cl << 2 | (ch | cl) << 1 | (ch & cl);
+	CR_SET(BF, w);
+	PPC_INSN_INT_CR(0, RA_BITMASK | RB_BITMASK, BF_BITMASK);
+
+0.4,6.RS,11.0,16.RB,21.656:EVX:e500:evfscfui %RS,%RB:Vector Convert Floating-Point from Unsigned Integer
+	unsigned32 f, w1, w2;
+	sim_fpu b;
+	
+	sim_fpu_u32to (&b, *rBh, sim_fpu_round_default);
+	sim_fpu_to32 (&w1, &b);
+	sim_fpu_u32to (&b, *rB, sim_fpu_round_default);
+	sim_fpu_to32 (&w2, &b);
+	
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+	PPC_INSN_INT(RS_BITMASK, RB_BITMASK, 0);
+
+0.4,6.RS,11.0,16.RB,21.664:EVX:e500:evfsctuiz %RS,%RB:Vector Convert Floating-Point to Unsigned Integer with Round toward Zero
+	unsigned32 w1, w2;
+	sim_fpu b;
+	
+	sim_fpu_32to (&b, *rBh);
+	sim_fpu_to32u (&w1, &b, sim_fpu_round_zero);
+	sim_fpu_32to (&b, *rB);
+	sim_fpu_to32u (&w2, &b, sim_fpu_round_zero);
+
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+	PPC_INSN_INT(RS_BITMASK, RB_BITMASK, 0);
+
+0.4,6.RS,11.0,16.RB,21.657:EVX:e500:evfscfsi %RS,%RB:Vector Convert Floating-Point from Signed Integer 
+	signed32 w1, w2;
+	sim_fpu b, x, y;
+	
+	sim_fpu_i32to (&b, *rBh, sim_fpu_round_default);
+	sim_fpu_to32 (&w1, &b);
+	sim_fpu_i32to (&b, *rB, sim_fpu_round_default);
+	sim_fpu_to32 (&w2, &b);
+
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+	PPC_INSN_INT(RS_BITMASK, RB_BITMASK, 0);
+
+0.4,6.RS,11.0,16.RB,21.658:EVX:e500:evfscfuf %RS,%RB:Vector Convert Floating-Point from Unsigned Fraction
+	unsigned32 w1, w2, bh, bl;
+	sim_fpu b, x, y;
+	bh = *rBh;
+	if (bh == 0xffffffff)
+	  sim_fpu_to32 (&w1, &sim_fpu_one);
+	else {
+	  sim_fpu_u64to (&x, 0x100000000, sim_fpu_round_default);
+	  sim_fpu_u32to (&y, bh, sim_fpu_round_default);
+	  sim_fpu_div (&b, &y, &x);
+	  sim_fpu_to32 (&w1, &b);
+	}
+	bl = *rB;
+	if (bl == 0xffffffff)
+	  sim_fpu_to32 (&w2, &sim_fpu_one);
+	else {
+	  sim_fpu_u64to (&x, 0x100000000, sim_fpu_round_default);
+	  sim_fpu_u32to (&y, bl, sim_fpu_round_default);
+	  sim_fpu_div (&b, &y, &x);
+	  sim_fpu_to32 (&w2, &b);
+	}
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+	PPC_INSN_INT(RS_BITMASK, RB_BITMASK, 0);
+
+0.4,6.RS,11.0,16.RB,21.659:EVX:e500:evfscfsf %RS,%RB:Vector Convert Floating-Point from Signed Fraction
+	unsigned32 w1, w2;
+	sim_fpu b, x, y;
+	
+	sim_fpu_u32to (&x, 0x80000000, sim_fpu_round_default);
+	sim_fpu_i32to (&y, *rBh, sim_fpu_round_default);
+	sim_fpu_div (&b, &y, &x);
+	sim_fpu_to32 (&w1, &b);
+	
+	sim_fpu_u32to (&x, 0x80000000, sim_fpu_round_default);
+	sim_fpu_i32to (&y, *rB, sim_fpu_round_default);
+	sim_fpu_div (&b, &y, &x);
+	sim_fpu_to32 (&w2, &b);
+	
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+	PPC_INSN_INT(RS_BITMASK, RB_BITMASK, 0);
+
+0.4,6.RS,11.0,16.RB,21.660:EVX:e500:evfsctui %RS,%RB:Vector Convert Floating-Point to Unsigned Integer
+	unsigned32 w1, w2;
+	sim_fpu b;
+	
+	sim_fpu_32to (&b, *rBh);
+	sim_fpu_to32u (&w1, &b, sim_fpu_round_default);
+	sim_fpu_32to (&b, *rB);
+	sim_fpu_to32u (&w2, &b, sim_fpu_round_default);
+	
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+	PPC_INSN_INT(RS_BITMASK, RB_BITMASK, 0);
+
+0.4,6.RS,11.0,16.RB,21.661:EVX:e500:evfsctsi %RS,%RB:Vector Convert Floating-Point to Signed Integer
+	signed32 w1, w2;
+	sim_fpu b;
+	
+	sim_fpu_32to (&b, *rBh);
+	sim_fpu_to32i (&w1, &b, sim_fpu_round_default);
+	sim_fpu_32to (&b, *rB);
+	sim_fpu_to32i (&w2, &b, sim_fpu_round_default);
+	
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+	PPC_INSN_INT(RS_BITMASK, RB_BITMASK, 0);
+
+0.4,6.RS,11.0,16.RB,21.666:EVX:e500:evfsctsiz %RS,%RB:Vector Convert Floating-Point to Signed Integer with Round toward Zero
+	signed32 w1, w2;
+	sim_fpu b;
+	
+	sim_fpu_32to (&b, *rBh);
+	sim_fpu_to32i (&w1, &b, sim_fpu_round_zero);
+	sim_fpu_32to (&b, *rB);
+	sim_fpu_to32i (&w2, &b, sim_fpu_round_zero);
+	
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+	PPC_INSN_INT(RS_BITMASK, RB_BITMASK, 0);
+
+0.4,6.RS,11.0,16.RB,21.662:EVX:e500:evfsctuf %RS,%RB:Vector Convert Floating-Point to Unsigned Fraction
+	unsigned32 w1, w2;
+	sim_fpu b, x, y;
+	
+	sim_fpu_u64to (&x, 0x100000000, sim_fpu_round_default);
+	sim_fpu_32to (&y, *rBh);
+	sim_fpu_mul (&b, &y, &x);
+	sim_fpu_to32u (&w1, &b, sim_fpu_round_default);
+	
+	sim_fpu_u64to (&x, 0x100000000, sim_fpu_round_default);
+	sim_fpu_32to (&y, *rB);
+	sim_fpu_mul (&b, &y, &x);
+	sim_fpu_to32u (&w2, &b, sim_fpu_round_default);
+	
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+	PPC_INSN_INT(RS_BITMASK, RB_BITMASK, 0);
+
+0.4,6.RS,11.0,16.RB,21.663:EVX:e500:evfsctsf %RS,%RB:Vector Convert Floating-Point to Signed Fraction
+	signed32 w1, w2;
+	sim_fpu b, x, y;
+	
+	sim_fpu_32to (&y, *rBh);
+	sim_fpu_u32to (&x, 0x80000000, sim_fpu_round_default);
+	sim_fpu_mul (&b, &y, &x);
+	sim_fpu_to32i (&w1, &b, sim_fpu_round_near);
+	
+	sim_fpu_32to (&y, *rB);
+	sim_fpu_u32to (&x, 0x80000000, sim_fpu_round_default);
+	sim_fpu_mul (&b, &y, &x);
+	sim_fpu_to32i (&w2, &b, sim_fpu_round_near);
+	
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+	PPC_INSN_INT(RS_BITMASK, RB_BITMASK, 0);
+
+
+0.4,6.RS,11.RA,16.0,21.708:EVX:e500:efsabs %RS,%RA:Floating-Point Absolute Value
+	unsigned32 w1, w2;
+	w1 = *rSh;
+	w2 = *rA & 0x7fffffff;
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.0,21.709:EVX:e500:efsnabs %RS,%RA:Floating-Point Negative Absolute Value
+	unsigned32 w1, w2;
+	w1 = *rSh;
+	w2 = *rA | 0x80000000;
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.0,21.710:EVX:e500:efsneg %RS,%RA:Floating-Point Negate
+	unsigned32 w1, w2;
+	w1 = *rSh;
+	w2 = (*rA & 0x7fffffff) | ((~*rA) & 0x80000000);
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.RB,21.704:EVX:e500:efsadd %RS,%RA,%RB:Floating-Point Add
+	unsigned32 w;
+	w = ev_fs_add (*rA, *rB, spefscr_finv, spefscr_fovf, spefscr_funf, spefscr_fgh, spefscr_fxh, processor);
+	EV_SET_REG(*rS, w);
+	PPC_INSN_INT_SPR(RS_BITMASK, RA_BITMASK | RB_BITMASK, spr_spefscr);
+
+0.4,6.RS,11.RA,16.RB,21.705:EVX:e500:efssub %RS,%RA,%RB:Floating-Point Subtract
+	unsigned32 w;
+	w = ev_fs_sub (*rA, *rB, spefscr_finv, spefscr_fovf, spefscr_funf, spefscr_fgh, spefscr_fxh, processor);
+	EV_SET_REG(*rS, w);
+	PPC_INSN_INT_SPR(RS_BITMASK, RA_BITMASK | RB_BITMASK, spr_spefscr);
+
+0.4,6.RS,11.RA,16.RB,21.712:EVX:e500:efsmul %RS,%RA,%RB:Floating-Point Multiply
+	unsigned32 w;
+	w = ev_fs_mul (*rA, *rB, spefscr_finv, spefscr_fovf, spefscr_funf, spefscr_fgh, spefscr_fxh, processor);
+	EV_SET_REG(*rS, w);
+	PPC_INSN_INT_SPR(RS_BITMASK, RA_BITMASK | RB_BITMASK, spr_spefscr);
+
+0.4,6.RS,11.RA,16.RB,21.713:EVX:e500:efsdiv %RS,%RA,%RB:Floating-Point Divide
+	unsigned32 w;
+	w = ev_fs_div (*rA, *rB, spefscr_finv, spefscr_fovf, spefscr_funf, spefscr_fdbz, spefscr_fg, spefscr_fx, processor);
+	EV_SET_REG(*rS, w);
+	PPC_INSN_INT_SPR(RS_BITMASK, RA_BITMASK | RB_BITMASK, spr_spefscr);
+
+0.4,6.BF,9./,11.RA,16.RB,21.716:EVX:e500:efscmpgt %BF,%RA,%RB:Floating-Point Compare Greater Than
+	sim_fpu a, b;
+	int w, cl;
+	sim_fpu_32to (&a, *rA);
+	sim_fpu_32to (&b, *rB);
+	if (EV_IS_INFDENORMNAN(&a) || EV_IS_INFDENORMNAN(&b))
+	  EV_SET_SPEFSCR_BITS(spefscr_finv);
+	if (sim_fpu_is_gt(&a, &b))
+	  cl = 1;
+	else
+	  cl = 0;
+	w = cl << 2 | cl << 1;
+	CR_SET(BF, w);
+	PPC_INSN_INT_SPR(0, RA_BITMASK | RB_BITMASK, spr_spefscr);
+
+0.4,6.BF,9./,11.RA,16.RB,21.717:EVX:e500:efscmplt %BF,%RA,%RB:Floating-Point Compare Less Than
+	sim_fpu al, bl;
+	int w, cl;
+	sim_fpu_32to (&al, *rA);
+	sim_fpu_32to (&bl, *rB);
+	if (EV_IS_INFDENORMNAN(&al) || EV_IS_INFDENORMNAN(&bl))
+	  EV_SET_SPEFSCR_BITS(spefscr_finv);
+	if (sim_fpu_is_lt(&al, &bl))
+	  cl = 1;
+	else
+	  cl = 0;
+	w = cl << 2 | cl << 1;
+	CR_SET(BF, w);
+	PPC_INSN_INT_SPR(0, RA_BITMASK | RB_BITMASK, spr_spefscr);
+
+0.4,6.BF,9./,11.RA,16.RB,21.718:EVX:e500:efscmpeq %BF,%RA,%RB:Floating-Point Compare Equal
+	sim_fpu al, bl;
+	int w, cl;
+	sim_fpu_32to (&al, *rA);
+	sim_fpu_32to (&bl, *rB);
+	if (EV_IS_INFDENORMNAN(&al) || EV_IS_INFDENORMNAN(&bl))
+	  EV_SET_SPEFSCR_BITS(spefscr_finv);
+	if (sim_fpu_is_eq(&al, &bl))
+	  cl = 1;
+	else
+	  cl = 0;
+	w = cl << 2 | cl << 1;
+	CR_SET(BF, w);
+	PPC_INSN_INT_SPR(0, RA_BITMASK | RB_BITMASK, spr_spefscr);
+
+0.4,6.BF,9./,11.RA,16.RB,21.732:EVX:e500:efststgt %BF,%RA,%RB:Floating-Point Test Greater Than
+	sim_fpu al, bl;
+	int w, cl;
+	sim_fpu_32to (&al, *rA);
+	sim_fpu_32to (&bl, *rB);
+	if (sim_fpu_is_gt(&al, &bl))
+	  cl = 1;
+	else
+	  cl = 0;
+	w = cl << 2 | cl << 1;
+	CR_SET(BF, w);
+	PPC_INSN_INT_CR(0, RA_BITMASK | RB_BITMASK, BF_BITMASK);
+
+0.4,6.BF,9./,11.RA,16.RB,21.733:EVX:e500:efststlt %BF,%RA,%RB:Floating-Point Test Less Than
+	sim_fpu al, bl;
+	int w, cl;
+	sim_fpu_32to (&al, *rA);
+	sim_fpu_32to (&bl, *rB);
+	if (sim_fpu_is_lt(&al, &bl))
+	  cl = 1;
+	else
+	  cl = 0;
+	w = cl << 2 | cl << 1;
+	CR_SET(BF, w);
+	PPC_INSN_INT_CR(0, RA_BITMASK | RB_BITMASK, BF_BITMASK);
+
+0.4,6.BF,9./,11.RA,16.RB,21.734:EVX:e500:efststeq %BF,%RA,%RB:Floating-Point Test Equal
+	sim_fpu al, bl;
+	int w, cl;
+	sim_fpu_32to (&al, *rA);
+	sim_fpu_32to (&bl, *rB);
+	if (sim_fpu_is_eq(&al, &bl))
+	  cl = 1;
+	else
+	  cl = 0;
+	w = cl << 2 | cl << 1;
+	CR_SET(BF, w);
+	PPC_INSN_INT_CR(0, RA_BITMASK | RB_BITMASK, BF_BITMASK);
+
+0.4,6.RS,11.0,16.RB,21.721:EVX:e500:efscfsi %RS,%RB:Convert Floating-Point from Signed Integer
+	signed32 f, w1, w2;
+	sim_fpu b;
+	w1 = *rSh;
+	sim_fpu_i32to (&b, *rB, sim_fpu_round_default);
+	sim_fpu_to32 (&w2, &b);
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+	PPC_INSN_INT(RS_BITMASK, RB_BITMASK, 0);
+
+0.4,6.RS,11.0,16.RB,21.720:EVX:e500:efscfui %RS,%RB:Convert Floating-Point from Unsigned Integer
+	unsigned32 w1, w2;
+	sim_fpu b;
+	w1 = *rSh;
+	sim_fpu_u32to (&b, *rB, sim_fpu_round_default);
+	sim_fpu_to32 (&w2, &b);
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+	PPC_INSN_INT(RS_BITMASK, RB_BITMASK, 0);
+
+0.4,6.RS,11.0,16.RB,21.723:EVX:e500:efscfsf %RS,%RB:Convert Floating-Point from Signed Fraction
+	unsigned32 w1, w2;
+	sim_fpu b, x, y;
+	w1 = *rSh;
+	sim_fpu_u32to (&x, 0x80000000, sim_fpu_round_default);
+	sim_fpu_i32to (&y, *rB, sim_fpu_round_default);
+	sim_fpu_div (&b, &y, &x);
+	sim_fpu_to32 (&w2, &b);
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+	PPC_INSN_INT(RS_BITMASK, RB_BITMASK, 0);
+
+0.4,6.RS,11.0,16.RB,21.722:EVX:e500:efscfuf %RS,%RB:Convert Floating-Point from Unsigned Fraction
+	unsigned32 w1, w2, bl;
+	sim_fpu b, x, y;
+	w1 = *rSh;
+	bl = *rB;
+	if (bl == 0xffffffff)
+	  sim_fpu_to32 (&w2, &sim_fpu_one);
+	else {
+	  sim_fpu_u64to (&x, 0x100000000, sim_fpu_round_default);
+	  sim_fpu_u32to (&y, bl, sim_fpu_round_default);
+	  sim_fpu_div (&b, &y, &x);
+	  sim_fpu_to32 (&w2, &b);
+	}
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+	PPC_INSN_INT(RS_BITMASK, RB_BITMASK, 0);
+
+0.4,6.RS,11.0,16.RB,21.725:EVX:e500:efsctsi %RS,%RB:Convert Floating-Point to Signed Integer
+	signed64 temp;
+	signed32 w1, w2;
+	sim_fpu b;
+	w1 = *rSh;
+	sim_fpu_32to (&b, *rB);
+	sim_fpu_to32i (&w2, &b, sim_fpu_round_default);
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+	PPC_INSN_INT(RS_BITMASK, RB_BITMASK, 0);
+
+0.4,6.RS,11.0,16.RB,21.730:EVX:e500:efsctsiz %RS,%RB:Convert Floating-Point to Signed Integer with Round toward Zero
+	signed64 temp;
+	signed32 w1, w2;
+	sim_fpu b;
+	w1 = *rSh;
+	sim_fpu_32to (&b, *rB);
+	sim_fpu_to32i (&w2, &b, sim_fpu_round_zero);
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+	PPC_INSN_INT(RS_BITMASK, RB_BITMASK, 0);
+
+0.4,6.RS,11.0,16.RB,21.724:EVX:e500:efsctui %RS,%RB:Convert Floating-Point to Unsigned Integer
+	unsigned64 temp;
+	signed32 w1, w2;
+	sim_fpu b;
+	w1 = *rSh;
+	sim_fpu_32to (&b, *rB);
+	sim_fpu_to32u (&w2, &b, sim_fpu_round_default);
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+	PPC_INSN_INT(RS_BITMASK, RB_BITMASK, 0);
+
+0.4,6.RS,11.0,16.RB,21.728:EVX:e500:efsctuiz %RS,%RB:Convert Floating-Point to Unsigned Integer with Round toward Zero
+	unsigned64 temp;
+	signed32 w1, w2;
+	sim_fpu b;
+	w1 = *rSh;
+	sim_fpu_32to (&b, *rB);
+	sim_fpu_to32u (&w2, &b, sim_fpu_round_zero);
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+	PPC_INSN_INT(RS_BITMASK, RB_BITMASK, 0);
+
+0.4,6.RS,11.0,16.RB,21.727:EVX:e500:efsctsf %RS,%RB:Convert Floating-Point to Signed Fraction
+	unsigned32 w1, w2;
+	sim_fpu b, x, y;
+	w1 = *rSh;
+	sim_fpu_32to (&y, *rB);
+	sim_fpu_u32to (&x, 0x80000000, sim_fpu_round_default);
+	sim_fpu_mul (&b, &y, &x);
+	sim_fpu_to32i (&w2, &b, sim_fpu_round_default);
+	sim_fpu_to32 (&w2, &b);
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+	PPC_INSN_INT(RS_BITMASK, RB_BITMASK, 0);
+
+0.4,6.RS,11.0,16.RB,21.726:EVX:e500:efsctuf %RS,%RB:Convert Floating-Point to Unsigned Fraction
+	unsigned32 w1, w2;
+	sim_fpu b, x, y;
+	w1 = *rSh;
+	sim_fpu_u64to (&x, 0x100000000, sim_fpu_round_default);
+	sim_fpu_32to (&y, *rB);
+	sim_fpu_mul (&b, &y, &x);
+	sim_fpu_to32u (&w2, &b, sim_fpu_round_default);
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+	PPC_INSN_INT(RS_BITMASK, RB_BITMASK, 0);
+
+
+#
+# A.2.10 Vector Load/Store Instructions
+#
+
+0.4,6.RS,11.RA,16.UIMM,21.769:EVX:e500:evldd %RS,%RA,%UIMM:Vector Load Double Word into Double Word
+	unsigned64 m;
+	unsigned_word b;
+	unsigned_word EA;
+	if (RA_is_0) b = 0;
+	else         b = *rA;
+	EA = b + (UIMM << 3);
+	m = MEM(unsigned, EA, 8);
+	EV_SET_REG1(*rSh, *rS, m);
+		//printf("evldd(%d<-%d + %u): m %08x.%08x, *rSh %x *rS %x\n", RS, RA, UIMM, (int)(m >> 32), (int)m, *rSh, *rS);
+	PPC_INSN_INT(RS_BITMASK, (RA_BITMASK & ~1), 0);
+
+0.4,6.RS,11.RA,16.RB,21.768:EVX:e500:evlddx %RS,%RA,%RB:Vector Load Double Word into Double Word Indexed
+	unsigned64 m;
+	unsigned_word b;
+	unsigned_word EA;
+	if (RA_is_0) b = 0;
+	else         b = *rA;
+	EA = b + *rB;
+	m = MEM(unsigned, EA, 8);
+	EV_SET_REG1(*rSh, *rS, m);
+	PPC_INSN_INT(RS_BITMASK, (RA_BITMASK & ~1) | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.UIMM,21.771:EVX:e500:evldw %RS,%RA,%UIMM:Vector Load Double into Two Words
+	unsigned_word b;
+	unsigned_word EA;
+	unsigned32 w1, w2;
+	if (RA_is_0) b = 0;
+	else         b = *rA;
+	EA = b + (UIMM << 3);
+	w1 = MEM(unsigned, EA, 4);
+	w2 = MEM(unsigned, EA + 4, 4);
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+	PPC_INSN_INT(RS_BITMASK, (RA_BITMASK & ~1), 0);
+
+0.4,6.RS,11.RA,16.RB,21.770:EVX:e500:evldwx %RS,%RA,%RB:Vector Load Double into Two Words Indexed
+	unsigned_word b;
+	unsigned_word EA;
+	unsigned32 w1, w2;
+	if (RA_is_0) b = 0;
+	else         b = *rA;
+	EA = b + *rB;
+	w1 = MEM(unsigned, EA, 4);
+	w2 = MEM(unsigned, EA + 4, 4);
+	EV_SET_REG2(*rSh, *rS, w1, w2);
+	PPC_INSN_INT(RS_BITMASK, (RA_BITMASK & ~1) | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.UIMM,21.773:EVX:e500:evldh %RS,%RA,%UIMM:Vector Load Double into 4 Half Words
+	unsigned_word b;
+	unsigned_word EA;
+	unsigned16 h1, h2, h3, h4;
+	if (RA_is_0) b = 0;
+	else         b = *rA;
+	EA = b + (UIMM << 3);
+	h1 = MEM(unsigned, EA, 2);
+	h2 = MEM(unsigned, EA + 2, 2);
+	h3 = MEM(unsigned, EA + 4, 2);
+	h4 = MEM(unsigned, EA + 6, 2);
+	EV_SET_REG4(*rSh, *rS, h1, h2, h3, h4);
+	PPC_INSN_INT(RS_BITMASK, (RA_BITMASK & ~1), 0);
+
+0.4,6.RS,11.RA,16.RB,21.772:EVX:e500:evldhx %RS,%RA,%RB:Vector Load Double into 4 Half Words Indexed
+	unsigned_word b;
+	unsigned_word EA;
+	unsigned16 h1, h2, h3, h4;
+	if (RA_is_0) b = 0;
+	else         b = *rA;
+	EA = b + *rB;
+	h1 = MEM(unsigned, EA, 2);
+	h2 = MEM(unsigned, EA + 2, 2);
+	h3 = MEM(unsigned, EA + 4, 2);
+	h4 = MEM(unsigned, EA + 6, 2);
+	EV_SET_REG4(*rSh, *rS, h1, h2, h3, h4);
+	PPC_INSN_INT(RS_BITMASK, (RA_BITMASK & ~1) | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.UIMM,21.785:EVX:e500:evlwhe %RS,%RA,%UIMM:Vector Load Word into Two Half Words Even
+	unsigned_word b;
+	unsigned_word EA;
+	unsigned16 h1, h2, h3, h4;
+	if (RA_is_0) b = 0;
+	else         b = *rA;
+	EA = b + (UIMM << 2);
+	h1 = MEM(unsigned, EA, 2);
+	h2 = 0;
+	h3 = MEM(unsigned, EA + 2, 2);
+	h4 = 0;
+	EV_SET_REG4(*rSh, *rS, h1, h2, h3, h4);
+	PPC_INSN_INT(RS_BITMASK, (RA_BITMASK & ~1), 0);
+
+0.4,6.RS,11.RA,16.RB,21.784:EVX:e500:evlwhex %RS,%RA,%RB:Vector Load Word into Two Half Words Even Indexed
+	unsigned_word b;
+	unsigned_word EA;
+	unsigned16 h1, h2, h3, h4;
+	if (RA_is_0) b = 0;
+	else         b = *rA;
+	EA = b + *rB;
+	h1 = MEM(unsigned, EA, 2);
+	h2 = 0;
+	h3 = MEM(unsigned, EA + 2, 2);
+	h4 = 0;
+	EV_SET_REG4(*rSh, *rS, h1, h2, h3, h4);
+	PPC_INSN_INT(RS_BITMASK, (RA_BITMASK & ~1) | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.UIMM,21.789:EVX:e500:evlwhou %RS,%RA,%UIMM:Vector Load Word into Two Half Words Odd Unsigned zero-extended
+	unsigned_word b;
+	unsigned_word EA;
+	unsigned16 h1, h2, h3, h4;
+	if (RA_is_0) b = 0;
+	else         b = *rA;
+	EA = b + (UIMM << 2);
+	h1 = 0;
+	h2 = MEM(unsigned, EA, 2);
+	h3 = 0;
+	h4 = MEM(unsigned, EA + 2, 2);
+	EV_SET_REG4(*rSh, *rS, h1, h2, h3, h4);
+	PPC_INSN_INT(RS_BITMASK, (RA_BITMASK & ~1), 0);
+
+0.4,6.RS,11.RA,16.RB,21.788:EVX:e500:evlwhoux %RS,%RA,%RB:Vector Load Word into Two Half Words Odd Unsigned Indexed zero-extended
+	unsigned_word b;
+	unsigned_word EA;
+	unsigned16 h1, h2, h3, h4;
+	if (RA_is_0) b = 0;
+	else         b = *rA;
+	EA = b + *rB;
+	h1 = 0;
+	h2 = MEM(unsigned, EA, 2);
+	h3 = 0;
+	h4 = MEM(unsigned, EA + 2, 2);
+	EV_SET_REG4(*rSh, *rS, h1, h2, h3, h4);
+	PPC_INSN_INT(RS_BITMASK, (RA_BITMASK & ~1) | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.UIMM,21.791:EVX:e500:evlwhos %RS,%RA,%UIMM:Vector Load Word into Half Words Odd Signed with sign extension
+	unsigned_word b;
+	unsigned_word EA;
+	unsigned16 h1, h2, h3, h4;
+	if (RA_is_0) b = 0;
+	else         b = *rA;
+	EA = b + (UIMM << 2);
+	h2 = MEM(unsigned, EA, 2);
+	if (h2 & 0x8000)
+	  h1 = 0xffff;
+	else
+	  h1 = 0;
+	h4 = MEM(unsigned, EA + 2, 2);
+	if (h4 & 0x8000)
+	  h3 = 0xffff;
+	else
+	  h3 = 0;
+	EV_SET_REG4(*rSh, *rS, h1, h2, h3, h4);
+	PPC_INSN_INT(RS_BITMASK, (RA_BITMASK & ~1), 0);
+
+0.4,6.RS,11.RA,16.RB,21.790:EVX:e500:evlwhosx %RS,%RA,%RB:Vector Load Word into Half Words Odd Signed Indexed with sign extension
+	unsigned_word b;
+	unsigned_word EA;
+	unsigned16 h1, h2, h3, h4;
+	if (RA_is_0) b = 0;
+	else         b = *rA;
+	EA = b + *rB;
+	h2 = MEM(unsigned, EA, 2);
+	if (h2 & 0x8000)
+	  h1 = 0xffff;
+	else
+	  h1 = 0;
+	h4 = MEM(unsigned, EA + 2, 2);
+	if (h4 & 0x8000)
+	  h3 = 0xffff;
+	else
+	  h3 = 0;
+	EV_SET_REG4(*rSh, *rS, h1, h2, h3, h4);
+	PPC_INSN_INT(RS_BITMASK, (RA_BITMASK & ~1) | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.UIMM,21.793:EVX:e500:evlwwsplat %RS,%RA,%UIMM:Vector Load Word into Word and Splat
+	unsigned_word b;
+	unsigned_word EA;
+	unsigned32 w1;
+	if (RA_is_0) b = 0;
+	else         b = *rA;
+	EA = b + (UIMM << 2);
+	w1 = MEM(unsigned, EA, 4);
+	EV_SET_REG2(*rSh, *rS, w1, w1);
+	PPC_INSN_INT(RS_BITMASK, (RA_BITMASK & ~1), 0);
+
+0.4,6.RS,11.RA,16.RB,21.792:EVX:e500:evlwwsplatx %RS,%RA,%RB:Vector Load Word into Word and Splat Indexed
+	unsigned_word b;
+	unsigned_word EA;
+	unsigned32 w1;
+	if (RA_is_0) b = 0;
+	else         b = *rA;
+	EA = b + *rB;
+	w1 = MEM(unsigned, EA, 4);
+	EV_SET_REG2(*rSh, *rS, w1, w1);
+	PPC_INSN_INT(RS_BITMASK, (RA_BITMASK & ~1) | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.UIMM,21.797:EVX:e500:evlwhsplat %RS,%RA,%UIMM:Vector Load Word into 2 Half Words and Splat
+	unsigned_word b;
+	unsigned_word EA;
+	unsigned16 h1, h2;
+	if (RA_is_0) b = 0;
+	else         b = *rA;
+	EA = b + (UIMM << 2);
+	h1 = MEM(unsigned, EA, 2);
+	h2 = MEM(unsigned, EA + 2, 2);
+	EV_SET_REG4(*rSh, *rS, h1, h1, h2, h2);
+	PPC_INSN_INT(RS_BITMASK, (RA_BITMASK & ~1), 0);
+
+0.4,6.RS,11.RA,16.RB,21.796:EVX:e500:evlwhsplatx %RS,%RA,%RB:Vector Load Word into 2 Half Words and Splat Indexed
+	unsigned_word b;
+	unsigned_word EA;
+	unsigned16 h1, h2;
+	if (RA_is_0) b = 0;
+	else         b = *rA;
+	EA = b + *rB;
+	h1 = MEM(unsigned, EA, 2);
+	h2 = MEM(unsigned, EA + 2, 2);
+	EV_SET_REG4(*rSh, *rS, h1, h1, h2, h2);
+	PPC_INSN_INT(RS_BITMASK, (RA_BITMASK & ~1) | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.UIMM,21.777:EVX:e500:evlhhesplat %RS,%RA,%UIMM:Vector Load Half Word into Half Words Even and Splat
+	unsigned_word b;
+	unsigned_word EA;
+	unsigned16 h;
+	if (RA_is_0) b = 0;
+	else         b = *rA;
+	EA = b + (UIMM << 1);
+	h = MEM(unsigned, EA, 2);
+	EV_SET_REG4(*rSh, *rS, h, 0, h, 0);
+	PPC_INSN_INT(RS_BITMASK, (RA_BITMASK & ~1), 0);
+
+0.4,6.RS,11.RA,16.RB,21.776:EVX:e500:evlhhesplatx %RS,%RA,%RB:Vector Load Half Word into Half Words Even and Splat Indexed
+	unsigned_word b;
+	unsigned_word EA;
+	unsigned16 h;
+	if (RA_is_0) b = 0;
+	else         b = *rA;
+	EA = b + *rB;
+	h = MEM(unsigned, EA, 2);
+	EV_SET_REG4(*rSh, *rS, h, 0, h, 0);
+	PPC_INSN_INT(RS_BITMASK, (RA_BITMASK & ~1) | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.UIMM,21.781:EVX:e500:evlhhousplat %RS,%RA,%UIMM:Vector Load Half Word into Half Word Odd Unsigned and Splat
+	unsigned_word b;
+	unsigned_word EA;
+	unsigned16 h;
+	if (RA_is_0) b = 0;
+	else         b = *rA;
+	EA = b + (UIMM << 1);
+	h = MEM(unsigned, EA, 2);
+	EV_SET_REG4(*rSh, *rS, 0, h, 0, h);
+	PPC_INSN_INT(RS_BITMASK, (RA_BITMASK & ~1), 0);
+
+0.4,6.RS,11.RA,16.RB,21.780:EVX:e500:evlhhousplatx %RS,%RA,%RB:Vector Load Half Word into Half Word Odd Unsigned and Splat Indexed
+	unsigned_word b;
+	unsigned_word EA;
+	unsigned16 h;
+	if (RA_is_0) b = 0;
+	else         b = *rA;
+	EA = b + *rB;
+	h = MEM(unsigned, EA, 2);
+	EV_SET_REG4(*rSh, *rS, 0, h, 0, h);
+	PPC_INSN_INT(RS_BITMASK, (RA_BITMASK & ~1) | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.UIMM,21.783:EVX:e500:evlhhossplat %RS,%RA,%UIMM:Vector Load Half Word into Half Word Odd Signed and Splat
+	unsigned_word b;
+	unsigned_word EA;
+	unsigned16 h1, h2;
+	if (RA_is_0) b = 0;
+	else         b = *rA;
+	EA = b + (UIMM << 1);
+	h2 = MEM(unsigned, EA, 2);
+	if (h2 & 0x8000)
+	  h1 = 0xffff;
+	else
+	  h1 = 0;
+	EV_SET_REG4(*rSh, *rS, h1, h2, h1, h2);
+	PPC_INSN_INT(RS_BITMASK, (RA_BITMASK & ~1), 0);
+
+0.4,6.RS,11.RA,16.RB,21.782:EVX:e500:evlhhossplatx %RS,%RA,%RB:Vector Load Half Word into Half Word Odd Signed and Splat Indexed
+	unsigned_word b;
+	unsigned_word EA;
+	unsigned16 h1, h2;
+	if (RA_is_0) b = 0;
+	else         b = *rA;
+	EA = b + *rB;
+	h2 = MEM(unsigned, EA, 2);
+	if (h2 & 0x8000)
+	  h1 = 0xffff;
+	else
+	  h1 = 0;
+	EV_SET_REG4(*rSh, *rS, h1, h2, h1, h2);
+	PPC_INSN_INT(RS_BITMASK, (RA_BITMASK & ~1) | RB_BITMASK, 0);
+
+
+0.4,6.RS,11.RA,16.UIMM,21.801:EVX:e500:evstdd %RS,%RA,%UIMM:Vector Store Double of Double
+	unsigned_word b;
+	unsigned_word EA;
+	if (RA_is_0) b = 0;
+	else         b = *rA;
+	EA = b + (UIMM << 3);
+	STORE(EA, 4, (*rSh));
+	STORE(EA + 4, 4, (*rS));
+	PPC_INSN_INT(RS_BITMASK, (RA_BITMASK & ~1), 0);
+
+0.4,6.RS,11.RA,16.RB,21.800:EVX:e500:evstddx %RS,%RA,%RB:Vector Store Double of Double Indexed
+	unsigned_word b;
+	unsigned_word EA;
+	if (RA_is_0) b = 0;
+	else         b = *rA;
+	EA = b + *rB;
+	STORE(EA, 4, (*rSh));
+	STORE(EA + 4, 4, (*rS));
+	PPC_INSN_INT(RS_BITMASK, (RA_BITMASK & ~1) | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.UIMM,21.803:EVX:e500:evstdw %RS,%RA,%UIMM:Vector Store Double of Two Words
+	unsigned_word b;
+	unsigned_word EA;
+	unsigned32 w1, w2;
+	if (RA_is_0) b = 0;
+	else         b = *rA;
+	EA = b + (UIMM << 3);
+	w1 = *rSh;
+	w2 = *rS;
+	STORE(EA + 0, 4, w1);
+	STORE(EA + 4, 4, w2);
+	PPC_INSN_INT(RS_BITMASK, (RA_BITMASK & ~1), 0);
+
+0.4,6.RS,11.RA,16.RB,21.802:EVX:e500:evstdwx %RS,%RA,%RB:Vector Store Double of Two Words Indexed
+	unsigned_word b;
+	unsigned_word EA;
+	unsigned32 w1, w2;
+	if (RA_is_0) b = 0;
+	else         b = *rA;
+	EA = b + *rB;
+	w1 = *rSh;
+	w2 = *rS;
+	STORE(EA + 0, 4, w1);
+	STORE(EA + 4, 4, w2);
+	PPC_INSN_INT(RS_BITMASK, (RA_BITMASK & ~1) | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.UIMM,21.805:EVX:e500:evstdh %RS,%RA,%UIMM:Vector Store Double of Four Half Words
+	unsigned_word b;
+	unsigned_word EA;
+	unsigned16 h1, h2, h3, h4;
+	if (RA_is_0) b = 0;
+	else         b = *rA;
+	EA = b + (UIMM << 3);
+	h1 = EV_HIHALF(*rSh);
+	h2 = EV_LOHALF(*rSh);
+	h3 = EV_HIHALF(*rS);
+	h4 = EV_LOHALF(*rS);
+	STORE(EA + 0, 2, h1);
+	STORE(EA + 2, 2, h2);
+	STORE(EA + 4, 2, h3);
+	STORE(EA + 6, 2, h4);
+	PPC_INSN_INT(RS_BITMASK, (RA_BITMASK & ~1), 0);
+
+0.4,6.RS,11.RA,16.RB,21.804:EVX:e500:evstdhx %RS,%RA,%RB:Vector Store Double of Four Half Words Indexed
+	unsigned_word b;
+	unsigned_word EA;
+	unsigned16 h1, h2, h3, h4;
+	if (RA_is_0) b = 0;
+	else         b = *rA;
+	EA = b + *rB;
+	h1 = EV_HIHALF(*rSh);
+	h2 = EV_LOHALF(*rSh);
+	h3 = EV_HIHALF(*rS);
+	h4 = EV_LOHALF(*rS);
+	STORE(EA + 0, 2, h1);
+	STORE(EA + 2, 2, h2);
+	STORE(EA + 4, 2, h3);
+	STORE(EA + 6, 2, h4);
+	PPC_INSN_INT(RS_BITMASK, (RA_BITMASK & ~1) | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.UIMM,21.825:EVX:e500:evstwwe %RS,%RA,%UIMM:Vector Store Word of Word from Even
+	unsigned_word b;
+	unsigned_word EA;
+	unsigned32 w;
+	if (RA_is_0) b = 0;
+	else         b = *rA;
+	EA = b + (UIMM << 3);
+	w = *rSh;
+	STORE(EA, 4, w);
+	PPC_INSN_INT(RS_BITMASK, (RA_BITMASK & ~1), 0);
+
+0.4,6.RS,11.RA,16.RB,21.824:EVX:e500:evstwwex %RS,%RA,%RB:Vector Store Word of Word from Even Indexed
+	unsigned_word b;
+	unsigned_word EA;
+	unsigned32 w;
+	if (RA_is_0) b = 0;
+	else         b = *rA;
+	EA = b + *rB;
+	w = *rSh;
+	STORE(EA, 4, w);
+	PPC_INSN_INT(RS_BITMASK, (RA_BITMASK & ~1) | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.UIMM,21.829:EVX:e500:evstwwo %RS,%RA,%UIMM:Vector Store Word of Word from Odd
+	unsigned_word b;
+	unsigned_word EA;
+	unsigned32 w;
+	if (RA_is_0) b = 0;
+	else         b = *rA;
+	EA = b + (UIMM << 3);
+	w = *rS;
+	STORE(EA, 4, w);
+	PPC_INSN_INT(RS_BITMASK, (RA_BITMASK & ~1), 0);
+
+0.4,6.RS,11.RA,16.RB,21.828:EVX:e500:evstwwox %RS,%RA,%RB:Vector Store Word of Word from Odd Indexed
+	unsigned_word b;
+	unsigned_word EA;
+	unsigned32 w;
+	if (RA_is_0) b = 0;
+	else         b = *rA;
+	EA = b + *rB;
+	w = *rS;
+	STORE(EA, 4, w);
+	PPC_INSN_INT(RS_BITMASK, (RA_BITMASK & ~1) | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.UIMM,21.817:EVX:e500:evstwhe %RS,%RA,%UIMM:Vector Store Word of Two Half Words from Even
+	unsigned_word b;
+	unsigned_word EA;
+	unsigned16 h1, h2;
+	if (RA_is_0) b = 0;
+	else         b = *rA;
+	EA = b + (UIMM << 3);
+	h1 = EV_HIHALF(*rSh);
+	h2 = EV_HIHALF(*rS);
+	STORE(EA + 0, 2, h1);
+	STORE(EA + 2, 2, h2);
+	PPC_INSN_INT(RS_BITMASK, (RA_BITMASK & ~1), 0);
+
+0.4,6.RS,11.RA,16.RB,21.816:EVX:e500:evstwhex %RS,%RA,%RB:Vector Store Word of Two Half Words from Even Indexed
+	unsigned_word b;
+	unsigned_word EA;
+	unsigned16 h1, h2;
+	if (RA_is_0) b = 0;
+	else         b = *rA;
+	EA = b + *rB;
+	h1 = EV_HIHALF(*rSh);
+	h2 = EV_HIHALF(*rS);
+	STORE(EA + 0, 2, h1);
+	STORE(EA + 2, 2, h2);
+	PPC_INSN_INT(RS_BITMASK, (RA_BITMASK & ~1) | RB_BITMASK, 0);
+
+0.4,6.RS,11.RA,16.UIMM,21.821:EVX:e500:evstwho %RS,%RA,%UIMM:Vector Store Word of Two Half Words from Odd
+	unsigned_word b;
+	unsigned_word EA;
+	unsigned16 h1, h2;
+	if (RA_is_0) b = 0;
+	else         b = *rA;
+	EA = b + (UIMM << 3);
+	h1 = EV_LOHALF(*rSh);
+	h2 = EV_LOHALF(*rS);
+	STORE(EA + 0, 2, h1);
+	STORE(EA + 2, 2, h2);
+	PPC_INSN_INT(RS_BITMASK, (RA_BITMASK & ~1), 0);
+
+0.4,6.RS,11.RA,16.RB,21.820:EVX:e500:evstwhox %RS,%RA,%RB:Vector Store Word of Two Half Words from Odd Indexed
+	unsigned_word b;
+	unsigned_word EA;
+	unsigned16 h1, h2;
+	if (RA_is_0) b = 0;
+	else         b = *rA;
+	EA = b + *rB;
+	h1 = EV_LOHALF(*rSh);
+	h2 = EV_LOHALF(*rS);
+	STORE(EA + 0, 2, h1);
+	STORE(EA + 2, 2, h2);
+	PPC_INSN_INT(RS_BITMASK, (RA_BITMASK & ~1) | RB_BITMASK, 0);
+
+
+#
+# 4.5.1 Integer Select Instruction
+#
+
+0.31,6.RS,11.RA,16.RB,21.CRB,26.30:X:e500:isel %RS,%RA,%RB,%CRB:Integer Select
+	if (CR & (1 << (31 - (unsigned)CRB)))
+	  if (RA_is_0)
+	    EV_SET_REG1(*rSh, *rS, 0);
+	  else
+	    EV_SET_REG2(*rSh, *rS, *rAh, *rA);
+	else
+	  EV_SET_REG2(*rSh, *rS, *rBh, *rB);
+	PPC_INSN_INT(RS_BITMASK, RA_BITMASK | RB_BITMASK, 0);
diff --git a/sim/ppc/e500_expression.h b/sim/ppc/e500_expression.h
new file mode 100644
index 0000000..c634a1c
--- /dev/null
+++ b/sim/ppc/e500_expression.h
@@ -0,0 +1,173 @@
+/* e500 expression macros, for PSIM, the PowerPC simulator.
+
+   Copyright 2003 Free Software Foundation, Inc.
+
+   Contributed by Red Hat Inc; developed under contract from Motorola.
+   Written by matthew green <mrg@redhat.com>.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+/* e500 register dance */
+#define EV_SET_REG4(sh, sl, h0, h1, h2, h3) do { \
+	(sh) = (((h0) & 0xffff) << 16) | ((h1) & 0xffff); \
+	(sl) = (((h2) & 0xffff) << 16) | ((h3) & 0xffff); \
+} while (0)
+#define EV_SET_REG4_ACC(sh, sl, h0, h1, h2, h3) do { \
+	(sh) = (((h0) & 0xffff) << 16) | ((h1) & 0xffff); \
+	(sl) = (((h2) & 0xffff) << 16) | ((h3) & 0xffff); \
+	ACC = ((unsigned64)(sh) << 32) | (sl & 0xffffffff); \
+} while (0)
+
+#define EV_SET_REG2(sh, sl, dh, dl) do { \
+	(sh) = (dh) & 0xffffffff; \
+	(sl) = (dl) & 0xffffffff; \
+} while (0)
+#define EV_SET_REG2_ACC(sh, sl, dh, dl) do { \
+	(sh) = (dh) & 0xffffffff; \
+	(sl) = (dl) & 0xffffffff; \
+	ACC = ((unsigned64)(sh) << 32) | ((sl) & 0xffffffff); \
+} while (0)
+
+#define EV_SET_REG1(sh, sl, d) do { \
+	(sh) = ((unsigned64)(d) >> 32) & 0xffffffff; \
+	(sl) = (d) & 0xffffffff; \
+} while (0)
+#define EV_SET_REG1_ACC(sh, sl, d) do { \
+	(sh) = ((unsigned64)(d) >> 32) & 0xffffffff; \
+	(sl) = (d) & 0xffffffff; \
+	ACC = (d); \
+} while (0)
+
+#define EV_SET_REG(s, d) do { \
+	(s) = (d) & 0xffffffff; \
+} while (0)
+
+/* get the low or high half word of a word */
+#define EV_LOHALF(x)	((unsigned32)(x) & 0xffff)
+#define EV_HIHALF(x)	(((unsigned32)(x) >> 16) & 0xffff)
+
+/* partially visible accumulator accessors */
+#define EV_SET_ACC(rh, rl) \
+	ACC = ((unsigned64)(rh) << 32) | ((rl) & 0xffffffff)
+
+#define EV_ACCLOW	(ACC & 0xffffffff)
+#define EV_ACCHIGH	((ACC >> 32) & 0xffffffff)
+
+/* bit manipulation macros needed for e500 SPE */
+#define EV_BITREVERSE16(x) \
+		  (((x) & 0x0001) << 15) \
+		| (((x) & 0x0002) << 13) \
+		| (((x) & 0x0004) << 11) \
+		| (((x) & 0x0008) << 9) \
+		| (((x) & 0x0010) << 7) \
+		| (((x) & 0x0020) << 5) \
+		| (((x) & 0x0040) << 3) \
+		| (((x) & 0x0080) << 1) \
+		| (((x) & 0x0100) >> 1) \
+		| (((x) & 0x0200) >> 3) \
+		| (((x) & 0x0400) >> 5) \
+		| (((x) & 0x0800) >> 7) \
+		| (((x) & 0x1000) >> 9) \
+		| (((x) & 0x2000) >> 11) \
+		| (((x) & 0x4000) >> 13) \
+		| (((x) & 0x8000) >> 15)
+
+/* saturation helpers */
+#define EV_MUL16_SSF(a,b)	((signed64)((signed32)(signed16)(a) * (signed32)(signed16)(b)) << 1)
+/* this one loses the top sign bit; be careful */
+#define EV_MUL32_SSF(a,b)	(((signed64)(signed32)(a) * (signed64)(signed32)(b)) << 1)
+#define EV_SAT_P_S32(x)		((((signed64)(x)) < -0x80000000LL) || (((signed64)(x)) > 0x7fffffffLL))
+#define EV_SAT_P_U32(x)		((((signed64)(x)) < -0LL) || (((signed64)(x)) > 0xffffffffLL))
+
+#define EV_SATURATE(flag, sat_val, val) \
+	((flag) ? (sat_val) : (val))
+
+#define EV_SATURATE_ACC(flag, sign, negative_sat_val, positive_sat_val, val) \
+	((flag) ? ((((sign) >> 63) & 1) ? (negative_sat_val) : (positive_sat_val)) : (val))
+
+/* SPEFSCR handling.  */
+
+/* These bits must be clear.  */
+#define EV_SPEFSCR_MASK (BIT(40) | BIT(41) | spefscr_mode | BIT(56))
+
+/* The Inexact and Divide by zero sticky bits are based on others.  */
+#define EV_SET_SPEFSCR(bits) do { \
+  int finxs = (bits) & (spefscr_fgh|spefscr_fxh|spefscr_fg|spefscr_fx); \
+  int fdbzs = (bits) & (spefscr_fdbzh|spefscr_fdbz); \
+  SPREG(spr_spefscr) = ((bits) & ~EV_SPEFSCR_MASK) | \
+		       (finxs ? spefscr_finxs : 0) | \
+		       (fdbzs ? spefscr_fdbzs : 0); \
+} while (0)
+
+#define EV_SET_SPEFSCR_BITS(s) \
+  EV_SET_SPEFSCR(SPREG(spr_spefscr) | (s))
+
+#define EV_SET_SPEFSCR_OV(l,h) do { \
+	unsigned32 _sPefScR = SPREG(spr_spefscr); \
+	if (l) \
+	  _sPefScR |= spefscr_ov | spefscr_sov; \
+	else \
+	  _sPefScR &= ~spefscr_ov; \
+	if (h) \
+	  _sPefScR |= spefscr_ovh | spefscr_sovh; \
+	else \
+	  _sPefScR &= ~spefscr_ovh; \
+	EV_SET_SPEFSCR(_sPefScR); \
+} while (0)
+
+/* SPE floating point helpers.  */
+
+#define EV_PMAX	0x7f7fffff
+#define EV_NMAX	0xff7fffff
+#define EV_PMIN	0x00800001
+#define EV_NMIN	0x80800001
+
+#define	EV_IS_INFDENORMNAN(x) \
+	(sim_fpu_is_infinity(x) || sim_fpu_is_denorm(x) || sim_fpu_is_nan(x))
+
+/* These aren't used (yet?)  For now, SPU is always enabled.
+   Would be nice if they were generated by igen for e500.  */
+#define SPU_BEGIN \
+{ \
+  if (MSR & msr_e500_spu_enable) { \
+
+#define SPU_END \
+  } else { \
+    /* FIXME: raise SPU unavailable.  */ \
+  } \
+}
+
+/* These are also not yet used.  */
+#define SPU_FP_BEGIN \
+{
+
+#define SPU_FP_END \
+  { \
+     unsigned s = SPEFSCR; \
+     /* Check SPEFSCR; raise exceptions if any required.  */ \
+     if (((spefscr_finxe || spefscr_finve) \
+	 && (s & (spefscr_finvh|spefscr_finv))) \
+      || ((spefscr_finxe || spefscr_fdbze) \
+	 && (s & (spefscr_fdbzh|spefscr_fdbz))) \
+      || ((spefscr_finxe || spefscr_funfe) \
+	 && (s & (spefscr_funfh|spefscr_funf))) \
+      || ((spefscr_finxe || spefscr_fovfe) \
+	 && (s & (spefscr_fovfh|spefscr_fovf)))) \
+       /* FIXME: raise exceptions.  */; \
+   } \
+}
diff --git a/sim/ppc/e500_registers.h b/sim/ppc/e500_registers.h
new file mode 100644
index 0000000..cd12ab5
--- /dev/null
+++ b/sim/ppc/e500_registers.h
@@ -0,0 +1,83 @@
+/* e500 registers, for PSIM, the PowerPC simulator.
+
+   Copyright 2003 Free Software Foundation, Inc.
+
+   Contributed by Red Hat Inc; developed under contract from Motorola.
+   Written by matthew green <mrg@redhat.com>.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+/* e500 accumulator.  */
+
+typedef unsigned64 accreg;
+
+enum {
+  msr_e500_spu_enable = BIT(38)
+};
+
+/* E500 regsiters.  */
+
+enum
+  {
+  spefscr_sovh = BIT(32),	/* summary integer overlow (high) */
+  spefscr_ovh = BIT(33),	/* int overflow (high) */
+  spefscr_fgh = BIT(34),	/* FP guard (high) */
+  spefscr_fxh = BIT(35),	/* FP sticky (high) */
+  spefscr_finvh = BIT(36),	/* FP invalid operand (high) */
+  spefscr_fdbzh = BIT(37),	/* FP divide by zero (high) */
+  spefscr_funfh = BIT(38),	/* FP underflow (high) */
+  spefscr_fovfh = BIT(39),	/* FP overflow (high) */
+  spefscr_finxs = BIT(42),	/* FP inexact sticky */
+  spefscr_finvs = BIT(43),	/* FP invalid operand sticky */
+  spefscr_fdbzs = BIT(44),	/* FP divide by zero sticky */
+  spefscr_funfs = BIT(45),	/* FP underflow sticky */
+  spefscr_fovfs = BIT(46),	/* FP overflow sticky */
+  spefscr_mode = BIT(47),	/* SPU MODE (read only) */
+  spefscr_sov = BIT(48),	/* Summary integer overlow (low) */
+  spefscr_ov = BIT(49),		/* int overflow (low) */
+  spefscr_fg = BIT(50),		/* FP guard (low) */
+  spefscr_fx = BIT(51),		/* FP sticky (low) */
+  spefscr_finv = BIT(52),	/* FP invalid operand (low) */
+  spefscr_fdbz = BIT(53),	/* FP divide by zero (low) */
+  spefscr_funf = BIT(54),	/* FP underflow (low) */
+  spefscr_fovf = BIT(55),	/* FP overflow (low) */
+  spefscr_finxe = BIT(57),	/* FP inexact enable */
+  spefscr_finve = BIT(58),	/* FP invalid operand enable */
+  spefscr_fdbze = BIT(59),	/* FP divide by zero enable */
+  spefscr_funfe = BIT(60),	/* FP underflow enable */
+  spefscr_fovfe = BIT(61),	/* FP overflow enable */
+  spefscr_frmc0 = BIT(62),	/* FP round mode control */
+  spefscr_frmc1 = BIT(63),
+  spefscr_frmc = (spefscr_frmc0 | spefscr_frmc1),
+};
+
+struct e500_regs {
+  /* e500 high bits.  */
+  signed_word gprh[32];
+  /* Accumulator */
+  accreg acc;
+};
+
+/* SPE partially visible acculator */
+#define ACC		cpu_registers(processor)->e500.acc
+
+/* e500 register high bits */
+#define GPRH(N)		cpu_registers(processor)->e500.gprh[N]
+
+/* e500 unified vector register */
+#define EVR(N)		((((unsigned64)GPRH(N)) << 32) | GPR(N))
diff --git a/sim/ppc/emul_chirp.c b/sim/ppc/emul_chirp.c
index c4deb18..976f766 100644
--- a/sim/ppc/emul_chirp.c
+++ b/sim/ppc/emul_chirp.c
@@ -1,6 +1,6 @@
 /*  This file is part of the program psim.
 
-    Copyright (C) 1994-1997, Andrew Cagney <cagney@highland.com.au>
+    Copyright 1994, 1995, 1996, 1997, 2003 Andrew Cagney
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -584,10 +584,15 @@
   if (chirp_read_t2h_args(&args, sizeof(args), 3, 1, data, processor, cia))
     return -1;
   phandle = external_to_device(data->root, args.phandle);
-  emul_read_string(previous,
-		   args.previous,
-		   sizeof(previous),
-		   processor, cia);
+  if (args.previous != 0)
+    emul_read_string(previous,
+		     args.previous,
+		     sizeof(previous),
+		     processor, cia);
+  else
+    /* If previous is NULL, make it look like the empty string.  The
+       next property after the empty string is the first property.  */
+    strcpy (previous, "");
   TRACE(trace_os_emul, ("nextprop - in - phandle=0x%lx(0x%lx`%s') previous=`%s' buf=0x%lx\n",
 			(unsigned long)args.phandle,
 			(unsigned long)phandle,
@@ -602,11 +607,19 @@
   else {
     const device_property *prev_prop = device_find_property(phandle, previous);
     if (prev_prop == NULL) {
-      args.flag = -1; /* name invalid */
+      if (strcmp (previous, "") == 0)
+	args.flag = 0; /* No properties */
+      else
+	args.flag = -1; /* name invalid */
     }
     else {
       const device_property *next_prop;
-      next_prop = device_next_property(prev_prop);
+      if (strcmp (previous, "") == 0) {
+	next_prop = prev_prop;	/* The first property.  */
+      }
+      else {
+	next_prop = device_next_property(prev_prop);
+      }
       if (next_prop == NULL) {
 	args.flag = 0; /* last property */
       }
diff --git a/sim/ppc/gen-idecode.c b/sim/ppc/gen-idecode.c
index 3b88866..8c29cc4 100644
--- a/sim/ppc/gen-idecode.c
+++ b/sim/ppc/gen-idecode.c
@@ -1,6 +1,6 @@
 /*  This file is part of the program psim.
 
-    Copyright (C) 1994-1997, Andrew Cagney <cagney@highland.com.au>
+    Copyright 1994, 1995, 1996, 1997, 2003 Andrew Cagney
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -1499,6 +1499,10 @@
   lf_printf(file, "#include \"idecode.h\"\n");
   lf_printf(file, "#include \"semantics.h\"\n");
   lf_printf(file, "#include \"icache.h\"\n");
+  lf_printf(file, "#ifdef HAVE_COMMON_FPU\n");
+  lf_printf(file, "#include \"sim-inline.h\"\n");
+  lf_printf(file, "#include \"sim-fpu.h\"\n");
+  lf_printf(file, "#endif\n");
   lf_printf(file, "#include \"support.h\"\n");
   lf_printf(file, "\n");
   lf_printf(file, "#include <setjmp.h>\n");
diff --git a/sim/ppc/gen-itable.c b/sim/ppc/gen-itable.c
index 132aa29..4897b98 100644
--- a/sim/ppc/gen-itable.c
+++ b/sim/ppc/gen-itable.c
@@ -26,6 +26,7 @@
 
 #include "filter.h"
 
+#include "ld-cache.h"
 #include "ld-decode.h"
 #include "ld-insn.h"
 
diff --git a/sim/ppc/gen-model.c b/sim/ppc/gen-model.c
index 34c1b90..b461431 100644
--- a/sim/ppc/gen-model.c
+++ b/sim/ppc/gen-model.c
@@ -25,6 +25,7 @@
 
 #include "filter.h"
 
+#include "ld-cache.h"
 #include "ld-decode.h"
 #include "ld-insn.h"
 
diff --git a/sim/ppc/gen-support.c b/sim/ppc/gen-support.c
index d3067c3..ed02d7d 100644
--- a/sim/ppc/gen-support.c
+++ b/sim/ppc/gen-support.c
@@ -1,6 +1,6 @@
 /*  This file is part of the program psim.
 
-    Copyright (C) 1994-1995, Andrew Cagney <cagney@highland.com.au>
+    Copyright 1994, 1995, 2003 Andrew Cagney
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -122,6 +122,10 @@
 {
   lf_printf(file, "#include \"cpu.h\"\n");
   lf_printf(file, "#include \"idecode.h\"\n");
+  lf_printf(file, "#ifdef HAVE_COMMON_FPU\n");
+  lf_printf(file, "#include \"sim-inline.h\"\n");
+  lf_printf(file, "#include \"sim-fpu.h\"\n");
+  lf_printf(file, "#endif\n");
   lf_printf(file, "#include \"support.h\"\n");
   lf_printf(file, "\n");
 
diff --git a/sim/ppc/hw_com.c b/sim/ppc/hw_com.c
index 4362322..ff8afe7 100644
--- a/sim/ppc/hw_com.c
+++ b/sim/ppc/hw_com.c
@@ -249,7 +249,7 @@
   if (device_find_property(me, "output-file") != NULL) {
     const char *output_file = device_find_string_property(me, "output-file");
     com->output.file = fopen(output_file, "w");
-    if (com->input.file == NULL)
+    if (com->output.file == NULL)
       device_error(me, "Problem opening output file %s\n", output_file);
     if (device_find_property(me, "output-buffering") != NULL) {
       const char *buffering = device_find_string_property(me, "output-buffering");
diff --git a/sim/ppc/hw_htab.c b/sim/ppc/hw_htab.c
index 50a7b6a..d536068 100644
--- a/sim/ppc/hw_htab.c
+++ b/sim/ppc/hw_htab.c
@@ -1,6 +1,6 @@
 /*  This file is part of the program psim.
 
-    Copyright (C) 1994-1996, Andrew Cagney <cagney@highland.com.au>
+    Copyright 1994, 1995, 1996, 2003 Andrew Cagney
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -217,14 +217,21 @@
     device_error(parent, "must be a htab device");
   htab_ra = device_find_integer_property(parent, "real-address");
   htab_nr_bytes = device_find_integer_property(parent, "nr-bytes");
+  if (htab_nr_bytes < 0x10000) {
+    device_error(parent, "htab size 0x%x less than 0x1000",
+		 htab_nr_bytes);
+  }
   for (n = htab_nr_bytes; n > 1; n = n / 2) {
     if (n % 2 != 0)
       device_error(parent, "htab size 0x%x not a power of two",
 		   htab_nr_bytes);
   }
   *htaborg = htab_ra;
+  /* Position the HTABMASK ready for use against a hashed address and
+     not ready for insertion into SDR1.HTABMASK.  */
   *htabmask = MASKED32(htab_nr_bytes - 1, 7, 31-6);
-  if ((htab_ra & INSERTED32(*htabmask, 7, 15)) != 0) {
+  /* Check that the MASK and ADDRESS do not overlap.  */
+  if ((htab_ra & (*htabmask)) != 0) {
     device_error(parent, "htaborg 0x%lx not aligned to htabmask 0x%lx",
 		 (unsigned long)*htaborg, (unsigned long)*htabmask);
   }
diff --git a/sim/ppc/hw_init.c b/sim/ppc/hw_init.c
index 86e753c..253ef7c 100644
--- a/sim/ppc/hw_init.c
+++ b/sim/ppc/hw_init.c
@@ -1,6 +1,6 @@
 /*  This file is part of the program psim.
     
-    Copyright (C) 1994-1997, Andrew Cagney <cagney@highland.com.au>
+    Copyright 1994, 1997, 2003 Andrew Cagney
     
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -591,16 +591,16 @@
 			start_argv, start_envp);
 
   /* set up the registers */
-  psim_write_register(device_system(me), -1,
-		      &top_of_stack, "sp", cooked_transfer);
-  psim_write_register(device_system(me), -1,
-		      &argc, "r3", cooked_transfer);
-  psim_write_register(device_system(me), -1,
-		      &start_argv, "r4", cooked_transfer);
-  psim_write_register(device_system(me), -1,
-		      &start_envp, "r5", cooked_transfer);
-  psim_write_register(device_system(me), -1,
-		      &start_aux, "r6", cooked_transfer);
+  ASSERT (psim_write_register(device_system(me), -1,
+			      &top_of_stack, "sp", cooked_transfer) > 0);
+  ASSERT (psim_write_register(device_system(me), -1,
+			      &argc, "r3", cooked_transfer) > 0);
+  ASSERT (psim_write_register(device_system(me), -1,
+			      &start_argv, "r4", cooked_transfer) > 0);
+  ASSERT (psim_write_register(device_system(me), -1,
+			      &start_envp, "r5", cooked_transfer) > 0);
+  ASSERT (psim_write_register(device_system(me), -1,
+			      &start_aux, "r6", cooked_transfer) > 0);
 }
 
 static void
@@ -619,16 +619,16 @@
   create_ppc_elf_stack_frame(me, bottom_of_stack, argv, envp);
   
   /* extract argument addresses from registers */
-  psim_read_register(device_system(me), 0,
-		     &top_of_stack, "r1", cooked_transfer);
-  psim_read_register(device_system(me), 0,
-		     &core_argc, "r3", cooked_transfer);
-  psim_read_register(device_system(me), 0,
-		     &core_argv, "r4", cooked_transfer);
-  psim_read_register(device_system(me), 0,
-		     &core_envp, "r5", cooked_transfer);
-  psim_read_register(device_system(me), 0,
-		     &core_aux, "r6", cooked_transfer);
+  ASSERT (psim_read_register(device_system(me), 0,
+			     &top_of_stack, "r1", cooked_transfer) > 0);
+  ASSERT (psim_read_register(device_system(me), 0,
+			     &core_argc, "r3", cooked_transfer) > 0);
+  ASSERT (psim_read_register(device_system(me), 0,
+			     &core_argv, "r4", cooked_transfer) > 0);
+  ASSERT (psim_read_register(device_system(me), 0,
+			     &core_envp, "r5", cooked_transfer) > 0);
+  ASSERT (psim_read_register(device_system(me), 0,
+			     &core_aux, "r6", cooked_transfer) > 0);
 
   /* extract arguments from registers */
   device_error(me, "Unfinished procedure create_ppc_aix_stack_frame\n");
diff --git a/sim/ppc/hw_nvram.c b/sim/ppc/hw_nvram.c
index 4c87d05..32308f7 100644
--- a/sim/ppc/hw_nvram.c
+++ b/sim/ppc/hw_nvram.c
@@ -140,7 +140,7 @@
     nvram->memory = zalloc(nvram->sizeof_memory);
   }
   else
-    memset(nvram->memory, nvram->sizeof_memory, 0);
+    memset(nvram->memory, 0, nvram->sizeof_memory);
   
   if (device_find_property(me, "timezone") == NULL)
     nvram->timezone = 0;
diff --git a/sim/ppc/hw_register.c b/sim/ppc/hw_register.c
index f361e46..549ecf9 100644
--- a/sim/ppc/hw_register.c
+++ b/sim/ppc/hw_register.c
@@ -1,6 +1,6 @@
 /*  This file is part of the program psim.
     
-    Copyright (C) 1994-1996, Andrew Cagney <cagney@highland.com.au>
+    Copyright 1994, 1995, 1996, 2003 Andrew Cagney
     
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -98,10 +98,11 @@
       DTRACE(register, ("%d.%s=0x%lx\n", processor, name,
 			(unsigned long)value));
     }    
-    psim_write_register(system, processor, /* all processors */
-			&value,
-			name,
-			cooked_transfer);
+    if (psim_write_register(system, processor, /* all processors */
+			    &value,
+			    name,
+			    cooked_transfer) <= 0)
+      error("Invalid register name %s\n", name);
   }
 }
 		 
diff --git a/sim/ppc/idecode_expression.h b/sim/ppc/idecode_expression.h
index 1f9b725..936583c 100644
--- a/sim/ppc/idecode_expression.h
+++ b/sim/ppc/idecode_expression.h
@@ -1,6 +1,6 @@
 /*  This file is part of the program psim.
 
-    Copyright (C) 1994-1997, Andrew Cagney <cagney@highland.com.au>
+    Copyright 1994, 1995, 1996, 1997, 2003 Andrew Cagney
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -18,6 +18,13 @@
  
     */
 
+/* Additional, and optional expressions.  */
+#ifdef WITH_ALTIVEC
+#include "altivec_expression.h"
+#endif
+#ifdef WITH_E500
+#include "e500_expression.h"
+#endif
 
 /* 32bit target expressions:
 
diff --git a/sim/ppc/igen.c b/sim/ppc/igen.c
index 7008e96..cc09662 100644
--- a/sim/ppc/igen.c
+++ b/sim/ppc/igen.c
@@ -1,6 +1,6 @@
 /*  This file is part of the program psim.
 
-    Copyright (C) 1994-1997, Andrew Cagney <cagney@highland.com.au>
+    Copyright 1994, 1995, 1996, 1997, 2003 Andrew Cagney
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -29,8 +29,8 @@
 
 #include "filter.h"
 
-#include "ld-decode.h"
 #include "ld-cache.h"
+#include "ld-decode.h"
 #include "ld-insn.h"
 
 #include "igen.h"
@@ -220,9 +220,11 @@
     lf_printf(file, "#include \"cpu.h\"\n");
     lf_printf(file, "#include \"idecode.h\"\n");
     lf_printf(file, "#include \"semantics.h\"\n");
-    lf_printf(file, "#include \"support.h\"\n");
+    lf_printf(file, "#ifdef HAVE_COMMON_FPU\n");
     lf_printf(file, "#include \"sim-inline.h\"\n");
     lf_printf(file, "#include \"sim-fpu.h\"\n");
+    lf_printf(file, "#endif\n");
+    lf_printf(file, "#include \"support.h\"\n");
     lf_printf(file, "\n");
     lf_printf(file, "int option_mpc860c0 = 0;\n");
     lf_printf(file, "\n");
@@ -306,9 +308,11 @@
     lf_printf(file, "#include \"idecode.h\"\n");
     lf_printf(file, "#include \"semantics.h\"\n");
     lf_printf(file, "#include \"icache.h\"\n");
-    lf_printf(file, "#include \"support.h\"\n");
+    lf_printf(file, "#ifdef HAVE_COMMON_FPU\n");
     lf_printf(file, "#include \"sim-inline.h\"\n");
     lf_printf(file, "#include \"sim-fpu.h\"\n");
+    lf_printf(file, "#endif\n");
+    lf_printf(file, "#include \"support.h\"\n");
     lf_printf(file, "\n");
     insn_table_traverse_function(table,
 				 file, NULL,
@@ -476,11 +480,12 @@
       force_decode_gen_type(optarg);
       break;
     case 'i':
-      if (decode_rules == NULL || cache_rules == NULL) {
-	fprintf(stderr, "Must specify decode and cache tables\n");
+      if (decode_rules == NULL) {
+	fprintf(stderr, "Must specify decode tables\n");
 	exit (1);
       }
-      instructions = load_insn_table(optarg, decode_rules, filters, includes);
+      instructions = load_insn_table(optarg, decode_rules, filters, includes,
+				     &cache_rules);
       fprintf(stderr, "\texpanding ...\n");
       insn_table_expand_insns(instructions);
       break;
diff --git a/sim/ppc/interrupts.c b/sim/ppc/interrupts.c
index 681e791..dafb2b3 100644
--- a/sim/ppc/interrupts.c
+++ b/sim/ppc/interrupts.c
@@ -1,6 +1,6 @@
 /*  This file is part of the program psim.
 
-    Copyright (C) 1994-1997, Andrew Cagney <cagney@highland.com.au>
+    Copyright 1994, 1995, 1996, 1997, 2003 Andrew Cagney
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -522,7 +522,7 @@
 {
   interrupts *ints = cpu_interrupts(processor);
   if (is_asserted) {
-    if (!ints->pending_interrupts & external_interrupt_pending) {
+    if (!(ints->pending_interrupts & external_interrupt_pending)) {
       ints->pending_interrupts |= external_interrupt_pending;
       if (cpu_registers(processor)->msr & msr_external_interrupt_enable)
 	schedule_hardware_interrupt_delivery(processor);
diff --git a/sim/ppc/ld-cache.c b/sim/ppc/ld-cache.c
index 135013e..ef16c67 100644
--- a/sim/ppc/ld-cache.c
+++ b/sim/ppc/ld-cache.c
@@ -1,6 +1,6 @@
 /*  This file is part of the program psim.
 
-    Copyright (C) 1994-1997, Andrew Cagney <cagney@highland.com.au>
+    Copyright 1994, 1995, 1996, 1997, 2003 Andrew Cagney
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -46,6 +46,24 @@
 };
 
 
+void
+append_cache_rule (cache_table **table, char *type, char *field_name,
+		   char *derived_name, char *type_def,
+		   char *expression, table_entry *file_entry)
+{
+  while ((*table) != NULL)
+    table = &(*table)->next;
+  (*table) = ZALLOC(cache_table);
+  (*table)->type = name2i(type, cache_type_map);
+  (*table)->field_name = field_name;
+  (*table)->derived_name = derived_name;
+  (*table)->type_def = (strlen(type_def) > 0 ? type_def : NULL);
+  (*table)->expression = (strlen(expression) > 0 ? expression : NULL);
+  (*table)->file_entry = file_entry;
+  (*table)->next = NULL;
+}
+
+
 cache_table *
 load_cache_table(char *file_name,
 		 int hi_bit_nr)
@@ -55,19 +73,13 @@
   cache_table *table = NULL;
   cache_table **curr_rule = &table;
   while ((entry = table_entry_read(file)) != NULL) {
-    cache_table *new_rule = ZALLOC(cache_table);
-    new_rule->type = name2i(entry->fields[ca_type], cache_type_map);
-    new_rule->field_name = entry->fields[ca_field_name];
-    new_rule->derived_name = entry->fields[ca_derived_name];
-    new_rule->type_def = (strlen(entry->fields[ca_type_def])
-			  ? entry->fields[ca_type_def]
-			  : NULL);
-    new_rule->expression = (strlen(entry->fields[ca_expression]) > 0
-			    ? entry->fields[ca_expression]
-			    : NULL);
-    new_rule->file_entry = entry;
-    *curr_rule = new_rule;
-    curr_rule = &new_rule->next;
+    append_cache_rule (curr_rule, entry->fields[ca_type],
+		       entry->fields[ca_field_name],
+		       entry->fields[ca_derived_name],
+		       entry->fields[ca_type_def],
+		       entry->fields[ca_expression],
+		       entry);
+    curr_rule = &(*curr_rule)->next;
   }
   return table;
 }
diff --git a/sim/ppc/ld-cache.h b/sim/ppc/ld-cache.h
index 72e3950..a3fd0a4 100644
--- a/sim/ppc/ld-cache.h
+++ b/sim/ppc/ld-cache.h
@@ -1,6 +1,6 @@
 /*  This file is part of the program psim.
 
-    Copyright (C) 1994-1997, Andrew Cagney <cagney@highland.com.au>
+    Copyright 1994, 1995, 1996, 1997, 2003, Andrew Cagney
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -79,3 +79,13 @@
 extern cache_table *load_cache_table
 (char *file_name,
  int hi_bit_nr);
+
+extern void append_cache_rule
+(cache_table **table,
+ char *type,
+ char *field_name,
+ char *derived_name,
+ char *type_def,
+ char *expression,
+ table_entry *file_entry);
+
diff --git a/sim/ppc/ld-insn.c b/sim/ppc/ld-insn.c
index 28b6b55..e3b1ba5 100644
--- a/sim/ppc/ld-insn.c
+++ b/sim/ppc/ld-insn.c
@@ -1,6 +1,6 @@
 /*  This file is part of the program psim.
 
-    Copyright (C) 1994,1995,1996, Andrew Cagney <cagney@highland.com.au>
+    Copyright 1994, 1995, 1996, 2003 Andrew Cagney
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -332,7 +332,8 @@
 load_insn_table(const char *file_name,
 		decode_table *decode_rules,
 		filter *filters,
-		table_include *includes)
+		table_include *includes,
+		cache_table **cache_rules)
 {
   table *file = table_open(file_name, nr_insn_table_fields, nr_insn_model_table_fields);
   insn_table *table = ZALLOC(insn_table);
@@ -344,6 +345,33 @@
 	|| it_is("internal", file_entry->fields[insn_flags])) {
       insn_table_insert_function(table, file_entry);
     }
+    else if ((it_is("function", file_entry->fields[insn_form])
+	      || it_is("internal", file_entry->fields[insn_form]))
+	     && !is_filtered_out(file_entry->fields[insn_flags], filters)) {
+      /* Ok, this is evil.  Need to convert a new style function into
+         an old style function.  Construct an old style table and then
+         copy it back.  */
+      char *fields[nr_insn_table_fields];
+      memset (fields, 0, sizeof fields);
+      fields[insn_flags] = file_entry->fields[insn_form];
+      fields[function_type] = file_entry->fields[insn_name];
+      fields[function_name] = file_entry->fields[insn_comment];
+      fields[function_param] = file_entry->fields[insn_field_6];
+      memcpy (file_entry->fields, fields,
+	      sizeof (fields[0]) * file_entry->nr_fields);
+      insn_table_insert_function(table, file_entry);
+#if 0
+      ":" "..."
+       ":" <filter-flags>
+       ":" <filter-models>
+       ":" <typedef>
+       ":" <name>
+       [ ":" <parameter-list> ]
+       <nl>
+       [ <function-model> ]
+       <code-block>
+#endif
+    }	     
     else if (it_is("model", file_entry->fields[insn_flags])) {
       model_table_insert(table, file_entry);
     }
@@ -366,6 +394,18 @@
              && !is_filtered_out(file_entry->fields[insn_flags], filters)) {
       parse_include_entry (file, file_entry, filters, includes);
     }
+    else if ((it_is("cache", file_entry->fields[insn_form])
+	      || it_is("compute", file_entry->fields[insn_form])
+	      || it_is("scratch", file_entry->fields[insn_form]))
+	     && !is_filtered_out(file_entry->fields[insn_flags], filters)) {
+      append_cache_rule (cache_rules,
+			 file_entry->fields[insn_form], /* type */
+			 file_entry->fields[cache_name],
+			 file_entry->fields[cache_derived_name],
+			 file_entry->fields[cache_type_def],
+			 file_entry->fields[cache_expression],
+			 file_entry);
+    }
     else {
       insn_fields *fields;
       /* skip instructions that aren't relevant to the mode */
@@ -930,6 +970,7 @@
   filter *filters = NULL;
   decode_table *decode_rules = NULL;
   insn_table *instructions = NULL;
+  cache_table *cache_rules = NULL;
 
   if (argc != 5)
     error("Usage: insn <filter> <hi-bit-nr> <decode-table> <insn-table>\n");
@@ -938,7 +979,8 @@
   hi_bit_nr = a2i(argv[2]);
   ASSERT(hi_bit_nr < insn_bit_size);
   decode_rules = load_decode_table(argv[3], hi_bit_nr);
-  instructions = load_insn_table(argv[4], decode_rules, filters, NULL);
+  instructions = load_insn_table(argv[4], decode_rules, filters, NULL,
+				 &cache_rules);
   insn_table_expand_insns(instructions);
 
   dump_insn_table(instructions, 0, -1);
diff --git a/sim/ppc/ld-insn.h b/sim/ppc/ld-insn.h
index 06bf838..4e1b7f7 100644
--- a/sim/ppc/ld-insn.h
+++ b/sim/ppc/ld-insn.h
@@ -1,6 +1,6 @@
 /*  This file is part of the program psim.
 
-    Copyright (C) 1994,1995,1996, Andrew Cagney <cagney@highland.com.au>
+    Copyright 1994, 1995, 1996, 2003 Andrew Cagney
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -119,6 +119,8 @@
   insn_mnemonic,
   insn_name,
   insn_comment,
+  insn_field_6,
+  insn_field_7,
   nr_insn_table_fields
 } insn_table_fields;
 
@@ -139,6 +141,13 @@
   include_path = insn_name,
 } model_include_fields;
 
+typedef enum {
+  cache_type_def = insn_name,
+  cache_derived_name = insn_comment,
+  cache_name = insn_field_6,
+  cache_expression = insn_field_7,
+} cache_fields;
+
 typedef struct _insn insn;
 struct _insn {
   table_entry *file_entry;
@@ -189,7 +198,8 @@
 (const char *file_name,
  decode_table *decode_rules,
  filter *filters,
- table_include *includes);
+ table_include *includes,
+ cache_table **cache_rules);
 
 model *models;
 model *last_model;
diff --git a/sim/ppc/ppc-cache-rules b/sim/ppc/ppc-cache-rules
deleted file mode 100644
index 2b5f472..0000000
--- a/sim/ppc/ppc-cache-rules
+++ /dev/null
@@ -1,65 +0,0 @@
-#
-#   This file is part of the program psim.
-#
-#   Copyright (C) 1994-1995, Andrew Cagney <cagney@highland.com.au>
-#
-#   This program is free software; you can redistribute it and/or modify
-#   it under the terms of the GNU General Public License as published by
-#   the Free Software Foundation; either version 2 of the License, or
-#   (at your option) any later version.
-#
-#   This program is distributed in the hope that it will be useful,
-#   but WITHOUT ANY WARRANTY; without even the implied warranty of
-#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#   GNU General Public License for more details.
-#
-#   You should have received a copy of the GNU General Public License
-#   along with this program; if not, write to the Free Software
-#   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-cache:RA:RA::
-cache:RA:rA:signed_word *:(cpu_registers(processor)->gpr + RA)
-cache:RA:RA_BITMASK:unsigned32:(1 << RA)
-compute:RA:RA_is_0:int:(RA == 0)
-cache:RT:RT::
-cache:RT:rT:signed_word *:(cpu_registers(processor)->gpr + RT)
-cache:RT:RT_BITMASK:unsigned32:(1 << RT)
-cache:RS:RS::
-cache:RS:rS:signed_word *:(cpu_registers(processor)->gpr + RS)
-cache:RS:RS_BITMASK:unsigned32:(1 << RS)
-cache:RB:RB::
-cache:RB:rB:signed_word *:(cpu_registers(processor)->gpr + RB)
-cache:RB:RB_BITMASK:unsigned32:(1 << RB)
-scratch:FRA:FRA::
-cache:FRA:frA:unsigned64 *:(cpu_registers(processor)->fpr + FRA)
-cache:FRA:FRA_BITMASK:unsigned32:(1 << FRA)
-scratch:FRB:FRB::
-cache:FRB:frB:unsigned64 *:(cpu_registers(processor)->fpr + FRB)
-cache:FRB:FRB_BITMASK:unsigned32:(1 << FRB)
-scratch:FRC:FRC::
-cache:FRC:frC:unsigned64 *:(cpu_registers(processor)->fpr + FRC)
-cache:FRC:FRC_BITMASK:unsigned32:(1 << FRC)
-scratch:FRS:FRS::
-cache:FRS:frS:unsigned64 *:(cpu_registers(processor)->fpr + FRS)
-cache:FRS:FRS_BITMASK:unsigned32:(1 << FRS)
-scratch:FRT:FRT::
-cache:FRT:frT:unsigned64 *:(cpu_registers(processor)->fpr + FRT)
-cache:FRT:FRT_BITMASK:unsigned32:(1 << FRT)
-cache:SI:EXTS_SI:unsigned_word:((signed_word)(signed16)instruction)
-scratch:BI:BI::
-cache:BI:BIT32_BI::BIT32(BI)
-cache:BF:BF::
-cache:BF:BF_BITMASK:unsigned32:(1 << BF)
-scratch:BA:BA::
-cache:BA:BIT32_BA::BIT32(BA)
-cache:BA:BA_BITMASK:unsigned32:(1 << BA)
-scratch:BB:BB::
-cache:BB:BIT32_BB::BIT32(BB)
-cache:BB:BB_BITMASK:unsigned32:(1 << BB)
-cache:BT:BT::
-cache:BT:BT_BITMASK:unsigned32:(1 << BT)
-cache:BD:EXTS_BD_0b00:unsigned_word:(((signed_word)(signed16)instruction) & ~3)
-cache:LI:EXTS_LI_0b00:unsigned_word:((((signed_word)(signed32)(instruction << 6)) >> 6) & ~0x3)
-cache:D:EXTS_D:unsigned_word:((signed_word)(signed16)(instruction))
-cache:DS:EXTS_DS_0b00:unsigned_word:(((signed_word)(signed16)instruction) & ~0x3)
-#compute:SPR:SPR_is_256:int:(SPR == 256)
diff --git a/sim/ppc/ppc-instructions b/sim/ppc/ppc-instructions
index 6ba0090..a930dc8 100644
--- a/sim/ppc/ppc-instructions
+++ b/sim/ppc/ppc-instructions
@@ -1,7 +1,7 @@
 #
 #   This file is part of the program psim.
 #
-#   Copyright (C) 1994-1997, Andrew Cagney <cagney@highland.com.au>
+#   Copyright 1994, 1995, 1996, 1997, 2003 Andrew Cagney
 #
 #   --
 #
@@ -33,6 +33,53 @@
 #   along with this program; if not, write to the Free Software
 #   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 #
+
+:cache::::RA:RA:
+:cache:::signed_word *:rA:RA:(cpu_registers(processor)->gpr + RA)
+:cache:::unsigned32:RA_BITMASK:RA:(1 << RA)
+:compute:::int:RA_is_0:RA:(RA == 0)
+:cache::::RT:RT:
+:cache:::signed_word *:rT:RT:(cpu_registers(processor)->gpr + RT)
+:cache:::unsigned32:RT_BITMASK:RT:(1 << RT)
+:cache::::RS:RS:
+:cache:::signed_word *:rS:RS:(cpu_registers(processor)->gpr + RS)
+:cache:::unsigned32:RS_BITMASK:RS:(1 << RS)
+:cache::::RB:RB:
+:cache:::signed_word *:rB:RB:(cpu_registers(processor)->gpr + RB)
+:cache:::unsigned32:RB_BITMASK:RB:(1 << RB)
+:scratch::::FRA:FRA:
+:cache:::unsigned64 *:frA:FRA:(cpu_registers(processor)->fpr + FRA)
+:cache:::unsigned32:FRA_BITMASK:FRA:(1 << FRA)
+:scratch::::FRB:FRB:
+:cache:::unsigned64 *:frB:FRB:(cpu_registers(processor)->fpr + FRB)
+:cache:::unsigned32:FRB_BITMASK:FRB:(1 << FRB)
+:scratch::::FRC:FRC:
+:cache:::unsigned64 *:frC:FRC:(cpu_registers(processor)->fpr + FRC)
+:cache:::unsigned32:FRC_BITMASK:FRC:(1 << FRC)
+:scratch::::FRS:FRS:
+:cache:::unsigned64 *:frS:FRS:(cpu_registers(processor)->fpr + FRS)
+:cache:::unsigned32:FRS_BITMASK:FRS:(1 << FRS)
+:scratch::::FRT:FRT:
+:cache:::unsigned64 *:frT:FRT:(cpu_registers(processor)->fpr + FRT)
+:cache:::unsigned32:FRT_BITMASK:FRT:(1 << FRT)
+:cache:::unsigned_word:EXTS_SI:SI:((signed_word)(signed16)instruction)
+:scratch::::BI:BI:
+:cache::::BIT32_BI:BI:BIT32(BI)
+:cache::::BF:BF:
+:cache:::unsigned32:BF_BITMASK:BF:(1 << BF)
+:scratch::::BA:BA:
+:cache::::BIT32_BA:BA:BIT32(BA)
+:cache:::unsigned32:BA_BITMASK:BA:(1 << BA)
+:scratch::::BB:BB:
+:cache::::BIT32_BB:BB:BIT32(BB)
+:cache:::unsigned32:BB_BITMASK:BB:(1 << BB)
+:cache::::BT:BT:
+:cache:::unsigned32:BT_BITMASK:BT:(1 << BT)
+:cache:::unsigned_word:EXTS_BD_0b00:BD:(((signed_word)(signed16)instruction) & ~3)
+:cache:::unsigned_word:EXTS_LI_0b00:LI:((((signed_word)(signed32)(instruction << 6)) >> 6) & ~0x3)
+:cache:::unsigned_word:EXTS_D:D:((signed_word)(signed16)(instruction))
+:cache:::unsigned_word:EXTS_DS_0b00:DS:(((signed_word)(signed16)instruction) & ~0x3)
+#:compute:::int:SPR_is_256:SPR:(SPR == 256)
 
 # PowerPC models
 ::model:604:ppc604:  PPC_UNIT_BAD,   PPC_UNIT_BAD,   1,  1,  0
@@ -151,6 +198,8 @@
 	  unsigned32 fp_busy;				/* floating point registers that are busy */
 	  unsigned32 cr_fpscr_busy;			/* CR/FPSCR registers that are busy */
 	  signed16 spr_busy;				/* SPR register that is busy or PPC_NO_SPR */
+	  unsigned32 vr_busy;				/* AltiVec registers that are busy */
+	  signed16 vscr_busy;				/* AltiVec status register busy */
 	  signed16 issue;				/* # of cycles until unit can accept another insn */
 	  signed16 done;				/* # of cycles until insn is done */
 	  signed16 nr_writebacks;			/* # of registers this unit writes back */
@@ -181,6 +230,8 @@
 	  unsigned32 fp_busy;				/* floating point registers that are busy */
 	  unsigned32 cr_fpscr_busy;			/* CR/FPSCR registers that are busy */
 	  unsigned8 spr_busy[nr_of_sprs];		/* SPR registers that are busy */
+	  unsigned32 vr_busy;				/* AltiVec registers that are busy */
+	  unsigned8 vscr_busy;				/* AltiVec SC register busy */
 	  unsigned8 busy[nr_ppc_function_units];	/* whether a function is busy or not */
 	};
 
@@ -273,6 +324,15 @@
 	}
 	if (busy->spr_busy != PPC_NO_SPR)
 	  TRACE(trace_model, ("Register %s is now available.\n", spr_name(busy->spr_busy)));
+	if (busy->vr_busy) {
+	  for(i = 0; i < 32; i++) {
+	    if (((1 << i) & busy->vr_busy) != 0) {
+	      TRACE(trace_model, ("Register v%d is now available.\n", i));
+	    }
+	  }
+	}
+	if (busy->vscr_busy)
+	  TRACE(trace_model, ("VSCR Register is now available.\n", spr_name(busy->spr_busy)));
 
 # Trace making registers busy
 void::model-static::model_trace_make_busy:model_data *model_ptr, unsigned32 int_mask, unsigned32 fp_mask, unsigned32 cr_mask
@@ -351,6 +411,8 @@
 	      model_ptr->cr_fpscr_busy &= ~cur_busy->cr_fpscr_busy;
 	      if (cur_busy->spr_busy != PPC_NO_SPR)
 		model_ptr->spr_busy[cur_busy->spr_busy] = 0;
+	      model_ptr->vr_busy &= ~cur_busy->vr_busy;
+	      model_ptr->vscr_busy = ~cur_busy->vscr_busy;
 
 	      if (WITH_TRACE && ppc_trace[trace_model])
 		model_trace_release(model_ptr, cur_busy);
@@ -407,6 +469,8 @@
 	  busy->fp_busy = 0;
 	  busy->cr_fpscr_busy = 0;
 	  busy->nr_writebacks = 0;
+	  busy->vr_busy = 0;
+	  busy->vscr_busy = 0;
 	}
 
 	busy->unit = unit;
@@ -2256,6 +2320,7 @@
 	    GPR(r) = 0;
 	  }
 	  GPR(r) |= INSERTED(MEM(unsigned, EA, 1), i, i+7);
+	  i = i + 8;
 	  if (i == 64) i = 32;
 	  EA = EA + 1;
 	  n = n - 1;
@@ -4925,3 +4990,6 @@
 0.31,6.RT,11.RA,16.RB,21.310,31./:X:earwax::External Control In Word Indexed
 
 0.31,6.RS,11.RA,16.RB,21.438,31./:X:earwax::External Control Out Word Indexed
+
+:include:::altivec.igen
+:include:::e500.igen
diff --git a/sim/ppc/ppc-spr-table b/sim/ppc/ppc-spr-table
index 373fb6b..221ccbe 100644
--- a/sim/ppc/ppc-spr-table
+++ b/sim/ppc/ppc-spr-table
@@ -31,6 +31,7 @@
 SDR1:25:0:0
 SRR0:26:0:0
 SRR1:27:0:0
+VRSAVE:256:0:0
 SPRG0:272:0:0
 SPRG1:273:0:0
 SPRG2:274:0:0
@@ -39,6 +40,7 @@
 TBL:284:0:0
 TBU:285:0:0
 PVR:287:0:0
+SPEFSCR:512:0:0
 IBAT0U:528:0:0
 IBAT0L:529:0:0
 IBAT1U:530:0:0
diff --git a/sim/ppc/psim.c b/sim/ppc/psim.c
index 76bb452..c20effb 100644
--- a/sim/ppc/psim.c
+++ b/sim/ppc/psim.c
@@ -1,6 +1,6 @@
 /*  This file is part of the program psim.
 
-    Copyright (C) 1994-1997, Andrew Cagney <cagney@highland.com.au>
+    Copyright 1994, 1995, 1996, 1997, 2003 Andrew Cagney
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -729,7 +729,8 @@
 					  "/openprom/init/stack");
   if (stack_device != (device*)0) {
     unsigned_word stack_pointer;
-    psim_read_register(system, 0, &stack_pointer, "sp", cooked_transfer);
+    ASSERT (psim_read_register(system, 0, &stack_pointer, "sp",
+			       cooked_transfer) > 0);
     device_ioctl(stack_device,
 		 NULL, /*cpu*/
 		 0, /*cia*/
@@ -766,7 +767,7 @@
 /* storage manipulation functions */
 
 INLINE_PSIM\
-(void)
+(int)
 psim_read_register(psim *system,
 		   int which_cpu,
 		   void *buf,
@@ -774,7 +775,7 @@
 		   transfer_mode mode)
 {
   register_descriptions description;
-  char cooked_buf[sizeof(unsigned_8)];
+  char *cooked_buf;
   cpu *processor;
 
   /* find our processor */
@@ -792,7 +793,8 @@
   /* find the register description */
   description = register_description(reg);
   if (description.type == reg_invalid)
-    error("psim_read_register() invalid register name `%s'\n", reg);
+    return 0;
+  cooked_buf = alloca (description.size);
 
   /* get the cooked value */
   switch (description.type) {
@@ -846,6 +848,30 @@
     *(unsigned_word*)cooked_buf = model_get_number_of_cycles(cpu_model(processor));
     break;
 
+#ifdef WITH_ALTIVEC
+  case reg_vr:
+    *(vreg*)cooked_buf = cpu_registers(processor)->altivec.vr[description.index];
+    break;
+
+  case reg_vscr:
+    *(vscreg*)cooked_buf = cpu_registers(processor)->altivec.vscr;
+    break;
+#endif
+
+#ifdef WITH_E500
+  case reg_gprh:
+    *(gpreg*)cooked_buf = cpu_registers(processor)->e500.gprh[description.index];
+    break;
+
+  case reg_evr:
+    *(unsigned64*)cooked_buf = EVR(description.index);
+    break;
+
+  case reg_acc:
+    *(accreg*)cooked_buf = cpu_registers(processor)->e500.acc;
+    break;
+#endif
+
   default:
     printf_filtered("psim_read_register(processor=0x%lx,buf=0x%lx,reg=%s) %s\n",
 		    (unsigned long)processor, (unsigned long)buf, reg,
@@ -871,18 +897,34 @@
     case 8:
       *(unsigned_8*)buf = H2T_8(*(unsigned_8*)cooked_buf);
       break;
+#ifdef WITH_ALTIVEC
+    case 16:
+      if (CURRENT_HOST_BYTE_ORDER != CURRENT_TARGET_BYTE_ORDER)
+        {
+	  union { vreg v; unsigned_8 d[2]; } h, t;
+          memcpy(&h.v/*dest*/, cooked_buf/*src*/, description.size);
+	  { _SWAP_8(t.d[0] =, h.d[1]); }
+	  { _SWAP_8(t.d[1] =, h.d[0]); }
+          memcpy(buf/*dest*/, &t/*src*/, description.size);
+          break;
+        }
+      else
+        memcpy(buf/*dest*/, cooked_buf/*src*/, description.size);
+      break;
+#endif
     }
   }
   else {
     memcpy(buf/*dest*/, cooked_buf/*src*/, description.size);
   }
 
+  return description.size;
 }
 
 
 
 INLINE_PSIM\
-(void)
+(int)
 psim_write_register(psim *system,
 		    int which_cpu,
 		    const void *buf,
@@ -891,7 +933,7 @@
 {
   cpu *processor;
   register_descriptions description;
-  char cooked_buf[sizeof(unsigned_8)];
+  char *cooked_buf;
 
   /* find our processor */
   if (which_cpu == MAX_NR_PROCESSORS) {
@@ -901,20 +943,22 @@
     else
       which_cpu = system->last_cpu;
   }
-  if (which_cpu == -1) {
-    int i;
-    for (i = 0; i < system->nr_cpus; i++)
-      psim_write_register(system, i, buf, reg, mode);
-    return;
-  }
-  ASSERT(which_cpu >= 0 && which_cpu < system->nr_cpus);
-
-  processor = system->processors[which_cpu];
 
   /* find the description of the register */
   description = register_description(reg);
   if (description.type == reg_invalid)
-    error("psim_write_register() invalid register name %s\n", reg);
+    return 0;
+  cooked_buf = alloca (description.size);
+
+  if (which_cpu == -1) {
+    int i;
+    for (i = 0; i < system->nr_cpus; i++)
+      psim_write_register(system, i, buf, reg, mode);
+    return description.size;
+  }
+  ASSERT(which_cpu >= 0 && which_cpu < system->nr_cpus);
+
+  processor = system->processors[which_cpu];
 
   /* If the data is comming in raw (target order), need to cook it
      into host order before putting it into PSIM's internal structures */
@@ -932,6 +976,20 @@
     case 8:
       *(unsigned_8*)cooked_buf = T2H_8(*(unsigned_8*)buf);
       break;
+#ifdef WITH_ALTIVEC
+    case 16:
+      if (CURRENT_HOST_BYTE_ORDER != CURRENT_TARGET_BYTE_ORDER)
+        {
+	  union { vreg v; unsigned_8 d[2]; } h, t;
+          memcpy(&t.v/*dest*/, buf/*src*/, description.size);
+	  { _SWAP_8(h.d[0] =, t.d[1]); }
+	  { _SWAP_8(h.d[1] =, t.d[0]); }
+          memcpy(cooked_buf/*dest*/, &h/*src*/, description.size);
+          break;
+        }
+      else
+        memcpy(cooked_buf/*dest*/, buf/*src*/, description.size);
+#endif
     }
   }
   else {
@@ -973,6 +1031,35 @@
     cpu_registers(processor)->fpscr = *(fpscreg*)cooked_buf;
     break;
 
+#ifdef WITH_E500
+  case reg_gprh:
+    cpu_registers(processor)->e500.gprh[description.index] = *(gpreg*)cooked_buf;
+    break;
+
+  case reg_evr:
+    {
+      unsigned64 v;
+      v = *(unsigned64*)cooked_buf;
+      cpu_registers(processor)->e500.gprh[description.index] = v >> 32;
+      cpu_registers(processor)->gpr[description.index] = v;
+      break;
+    }
+
+  case reg_acc:
+    cpu_registers(processor)->e500.acc = *(accreg*)cooked_buf;
+    break;
+#endif
+
+#ifdef WITH_ALTIVEC
+  case reg_vr:
+    cpu_registers(processor)->altivec.vr[description.index] = *(vreg*)cooked_buf;
+    break;
+
+  case reg_vscr:
+    cpu_registers(processor)->altivec.vscr = *(vscreg*)cooked_buf;
+    break;
+#endif
+
   default:
     printf_filtered("psim_write_register(processor=0x%lx,cooked_buf=0x%lx,reg=%s) %s\n",
 		    (unsigned long)processor, (unsigned long)cooked_buf, reg,
@@ -981,6 +1068,7 @@
 
   }
 
+  return description.size;
 }
 
 
diff --git a/sim/ppc/psim.h b/sim/ppc/psim.h
index f0cf3a5..8c1c920 100644
--- a/sim/ppc/psim.h
+++ b/sim/ppc/psim.h
@@ -138,21 +138,24 @@
  
 
 
-/* manipulate the state (registers or memory) of a processor within
+/* Manipulate the state (registers or memory) of a processor within
    the system.  In the case of memory, the read/write is performed
    using the specified processors address translation tables.
 
    Where applicable, WHICH_CPU == -1 indicates all processors and
-   WHICH_CPU == <nr_cpus> indicates the `current' processor. */
+   WHICH_CPU == <nr_cpus> indicates the `current' processor.
 
-extern void psim_read_register
+   The register functions return the size of the register, or 0 if the
+   register's name is not recognized.  */
+
+extern int psim_read_register
 (psim *system,
  int which_cpu,
  void *host_ordered_buf,
  const char reg[],
  transfer_mode mode);
 
-extern void psim_write_register
+extern int psim_write_register
 (psim *system,
  int which_cpu,
  const void *buf,
diff --git a/sim/ppc/registers.c b/sim/ppc/registers.c
index 2181ced..8323601 100644
--- a/sim/ppc/registers.c
+++ b/sim/ppc/registers.c
@@ -150,6 +150,35 @@
     description.index = spr_ctr;
     description.size = sizeof(unsigned_word);
   }
+#ifdef WITH_ALTIVEC
+  else if (reg[0] == 'v' && reg[1] == 'r' && are_digits(reg + 2)) {
+    description.type = reg_vr;
+    description.index = atoi(reg+2);
+    description.size = sizeof(vreg);
+  }
+   else if (!strcmp(reg, "vscr")) {
+    description.type = reg_vscr;
+    description.index = 0;
+    description.size = sizeof(vscreg);
+  }
+#endif
+#ifdef WITH_E500
+  else if (reg[0] == 'e' && reg[1] == 'v' && are_digits(reg + 2)) {
+    description.type = reg_evr;
+    description.index = atoi(reg+2);
+    description.size = sizeof(unsigned64);
+  }
+  else if (reg[0] == 'r' && reg[1] == 'h' && are_digits(reg + 2)) {
+    description.type = reg_gprh;
+    description.index = atoi(reg+2);
+    description.size = sizeof(gpreg);
+  }
+  else if (!strcmp(reg, "acc")) {
+    description.type = reg_acc;
+    description.index = 0;
+    description.size = sizeof(unsigned64);
+  }
+#endif
   else {
     sprs spr = find_spr(reg);
     if (spr != nr_of_sprs) {
diff --git a/sim/ppc/registers.h b/sim/ppc/registers.h
index 4da6ea4..15c9d43 100644
--- a/sim/ppc/registers.h
+++ b/sim/ppc/registers.h
@@ -1,6 +1,6 @@
 /*  This file is part of the program psim.
 
-    Copyright (C) 1994-1997, Andrew Cagney <cagney@highland.com.au>
+    Copyright 1994, 1997, 2003 Andrew Cagney
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -28,6 +28,19 @@
  *
  */
 
+/* FIXME:
+
+   For the moment use macro's to determine if the E500 or Altivec
+   registers should be included.  IGEN should instead of a :register:
+   field to facilitate the specification and generation of per ISA
+   registers.  */
+
+#ifdef WITH_E500
+#include "e500_registers.h"
+#endif
+#if WITH_ALTIVEC
+#include "altivec_registers.h"
+#endif
 
 /**
  ** General Purpose Registers
@@ -228,7 +241,6 @@
   srr1_subsequent_instruction = BIT(47)
 };
 
-
 /**
  ** storage interrupt registers
  **/
@@ -264,8 +276,14 @@
   /* Segment Registers */
   sreg sr[nr_of_srs];
 
-} registers;
+#if WITH_ALTIVEC
+  struct altivec_regs altivec;
+#endif
+#if WITH_E500
+  struct e500_regs e500;
+#endif
 
+} registers;
 
 /* dump out all the registers */
 
@@ -281,6 +299,12 @@
   reg_gpr, reg_fpr, reg_spr, reg_msr,
   reg_cr, reg_fpscr, reg_pc, reg_sr,
   reg_insns, reg_stalls, reg_cycles,
+#ifdef WITH_ALTIVEC
+  reg_vr, reg_vscr,
+#endif
+#ifdef WITH_E500
+  reg_acc, reg_gprh, reg_evr,
+#endif
   nr_register_types
 } register_types;
 
diff --git a/sim/ppc/sim_calls.c b/sim/ppc/sim_calls.c
index 22aa21b..040ce83 100644
--- a/sim/ppc/sim_calls.c
+++ b/sim/ppc/sim_calls.c
@@ -1,6 +1,6 @@
 /*  This file is part of the program psim.
 
-    Copyright (C) 1994-1996,1998, Andrew Cagney <cagney@highland.com.au>
+    Copyright 1994, 1995, 1996, 1998, 2003 Andrew Cagney
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -180,7 +180,7 @@
 int
 sim_fetch_register (SIM_DESC sd, int regno, unsigned char *buf, int length)
 {
-  char *regname;
+  const char *regname;
 
   if (simulator == NULL) {
     return 0;
@@ -194,43 +194,33 @@
      But there are loops that just walk through the entire list of
      names and try to get everything.  */
   regname = gdbarch_register_name (current_gdbarch, regno);
-  /* FIXME: ezannoni 2002/04/15 Remove the 'vr' and 'vscr' check
-     once AltiVec support is committed.  */
-  if (! regname || regname[0] == '\0'
-      || (regname[0] == 'v' && regname[1] == 'r')
-      || (strcmp (regname, "vscr") == 0))
+  if (! regname || regname[0] == '\0')
     return -1;
 
   TRACE(trace_gdb, ("sim_fetch_register(regno=%d(%s), buf=0x%lx)\n",
 		    regno, regname, (long)buf));
-  psim_read_register(simulator, MAX_NR_PROCESSORS,
-		     buf, regname, raw_transfer);
-  return -1;
+  return psim_read_register(simulator, MAX_NR_PROCESSORS,
+			    buf, regname, raw_transfer);
 }
 
 
 int
 sim_store_register (SIM_DESC sd, int regno, unsigned char *buf, int length)
 {
-  char *regname;
+  const char *regname;
 
   if (simulator == NULL)
     return 0;
 
   /* See comments in sim_fetch_register, above.  */
   regname = gdbarch_register_name (current_gdbarch, regno);
-  /* FIXME: ezannoni 2002/04/15 Remove the 'vr' and 'vscr' check
-     once AltiVec support is committed.  */
-  if (! regname || regname[0] == '\0'
-      || (regname[0] == 'v' && regname[1] == 'r')
-      || (strcmp (regname, "vscr") == 0))
+  if (! regname || regname[0] == '\0')
     return -1;
 
   TRACE(trace_gdb, ("sim_store_register(regno=%d(%s), buf=0x%lx)\n",
 		    regno, regname, (long)buf));
-  psim_write_register(simulator, MAX_NR_PROCESSORS,
-		      buf, regname, raw_transfer);
-  return -1;
+  return psim_write_register(simulator, MAX_NR_PROCESSORS,
+			     buf, regname, raw_transfer);
 }
 
 
@@ -263,8 +253,8 @@
   psim_init(simulator);
   psim_stack(simulator, argv, envp);
 
-  psim_write_register(simulator, -1 /* all start at same PC */,
-		      &entry_point, "pc", cooked_transfer);
+  ASSERT (psim_write_register(simulator, -1 /* all start at same PC */,
+			      &entry_point, "pc", cooked_transfer) > 0);
   return SIM_RC_OK;
 }
 
diff --git a/sim/testsuite/sim/h8300/ChangeLog b/sim/testsuite/sim/h8300/ChangeLog
index e03bb3c..3f1c1d3 100644
--- a/sim/testsuite/sim/h8300/ChangeLog
+++ b/sim/testsuite/sim/h8300/ChangeLog
@@ -1,3 +1,62 @@
+2003-05-30  Alexandre Oliva  <aoliva@redhat.com>
+
+	* allinsn.exp: Fix typos introduced on 2003-05-27.
+
+2003-05-29  Michael Snyder  <msnyder@redhat.com>
+
+	* tas.s: Use er4 for h8h and h8s, er3 for h8sx.
+
+2003-05-28  Michael Snyder  <msnyder@redhat.com>
+
+	* subs.s: New file.
+	* subx.s: New file.
+	* allinsn.exp: Add new subs and subx tests.
+	* testutils.inc: Simplify (and fix) set_carry_flag. 
+	(clear_carry_flag, set_zero_flag, clear_zero_flag...): New macros.
+	* addx.s: Use simplified set_carry_flag.	
+
+2003-05-27  Michael Snyder  <msnyder@redhat.com>
+
+	* tas.s: New file.
+	* band.s: New file.
+	* biand.s: New file.
+	* allinsn.exp: Add tas, band, biand tests.
+	* brabc.s: Add abs8 test.
+	* bset.s: Add bset/ne, bclr/ne tests.
+
+2003-05-23  Michael Snyder  <msnyder@redhat.com>
+
+	* and.b.s: Add andc exr.
+	* or.b.s: Add orc.exr.
+	* xor.b.s: Add xor exr.
+
+	* jmp.s: Fix 8-bit indirect test.  Add 7-bit vector test.
+
+2003-05-22  Michael Snyder  <msnyder@redhat.com>
+
+	* stack.s: Add rte/l and rts/l tests.
+	* allinsn.exp: Add stack tests.
+
+2003-05-21  Michael Snyder  <msnyder@redhat.com>
+
+	* stack.s: New file: test stack operations.
+	* stack.s: Add bsr, jsr tests.
+	* stack.s: Add trapa, rte tests.
+
+	* div.s: Corrections for size of dividend.
+
+2003-05-20  Michael Snyder  <msnyder@redhat.com>
+
+	* mul.s: Corrections for unsigned multiply.
+
+	* div.s: New file, test div instructions.
+	* allinsn.exp: Add div test.
+
+2003-05-19  Michael Snyder  <msnyder@redhat.com>
+
+	* mul.s: New file, test mul instructions.
+	* allinsn.exp: Add mul test.
+
 2003-05-14  Michael Snyder  <msnyder@redhat.com>
 
 	* addb.s, addw.s, addl.s, addw.s, addx.s, andb.s, andw.s, andl.s,
diff --git a/sim/testsuite/sim/h8300/addx.s b/sim/testsuite/sim/h8300/addx.s
index 27697a7..ef4e9d3 100644
--- a/sim/testsuite/sim/h8300/addx.s
+++ b/sim/testsuite/sim/h8300/addx.s
@@ -22,7 +22,6 @@
 	# addx.b @ers, @erd	; 0 1 7 4 6 8 ers d 0 erd 1 ???? 
 	# addx.b @ers-, @erd-	; 0 1 7 6 6 c ers d a erd 1 ????
 	#
-	# coming soon:
 	# word ops
 	# long ops	
 
@@ -70,7 +69,7 @@
 	set_ccr_zero
 
 	;;  addx.b #xx:8,Rd	; Addx with carry initially one.
-	set_carry_flag 1
+	set_carry_flag
 	addx.b	#5, r0l		; Immediate 8-bit operand
 
 	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
@@ -181,7 +180,7 @@
 
 	;;  addx.b Rs,Rd	; addx with carry initially one
 	mov.b	#5, r0h
-	set_carry_flag 1
+	set_carry_flag
 	addx.b	r0h, r0l	; Register operand
 
 	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
@@ -393,7 +392,7 @@
 	set_ccr_zero
 
 	;;  addx.w #xx:16,Rd	; Addx with carry initially one.
-	set_carry_flag 1
+	set_carry_flag
 	addx.w	#0x505, r0	; Immediate 16-bit operand
 
 	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
@@ -497,7 +496,7 @@
 
 	;;  addx.w Rs,Rd	; addx with carry initially one
 	mov.w	#0x505, e0
-	set_carry_flag 1
+	set_carry_flag
 	addx.w	e0, r0		; Register operand
 
 	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
@@ -704,7 +703,7 @@
 	set_ccr_zero
 
 	;;  addx.l #xx:32,Rd	; Addx with carry initially one.
-	set_carry_flag 1
+	set_carry_flag
 	addx.l	#0x50505, er0	; Immediate 32-bit operand
 
 	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
@@ -807,7 +806,7 @@
 
 	;;  addx.l Rs,Rd	; addx with carry initially one
 	mov.l	#0x50505, er0
-	set_carry_flag 1
+	set_carry_flag
 	addx.l	er0, er1	; Register operand
 
 	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
diff --git a/sim/testsuite/sim/h8300/allinsn.exp b/sim/testsuite/sim/h8300/allinsn.exp
index 9f3351b..82fedeb 100644
--- a/sim/testsuite/sim/h8300/allinsn.exp
+++ b/sim/testsuite/sim/h8300/allinsn.exp
@@ -3,43 +3,46 @@
 set all "h8300 h8300h h8300s h8sx"
 
 if {[istarget h8300*-*-*] || [istarget h8sx*-*-*]} then {
-    run_sim_test addb.s $all
-    run_sim_test addw.s $all
-    run_sim_test addl.s $all
+    run_sim_test addb.s  $all
+    run_sim_test addw.s  $all
+    run_sim_test addl.s  $all
     run_sim_test adds.s  $all
     run_sim_test addx.s  $all
-    run_sim_test andb.s $all
-    run_sim_test andw.s $all
-    run_sim_test andl.s $all
+    run_sim_test andb.s  $all
+    run_sim_test andw.s  $all
+    run_sim_test andl.s  $all
+    run_sim_test band.s  $all
     run_sim_test bfld.s  h8sx
-    run_sim_test brabc.s h8sx
+    run_sim_test biand.s $all
     run_sim_test bra.s   $all
     run_sim_test bset.s  $all
-    run_sim_test cmpb.s $all
-    run_sim_test cmpw.s $all
-    run_sim_test cmpl.s $all
+    run_sim_test cmpb.s  $all
+    run_sim_test cmpw.s  $all
+    run_sim_test cmpl.s  $all
     run_sim_test daa.s   $all
     run_sim_test das.s   $all
     run_sim_test dec.s   $all
-    run_sim_test extw.s $all
-    run_sim_test extl.s $all
+    run_sim_test div.s   $all
+    run_sim_test extw.s  $all
+    run_sim_test extl.s  $all
     run_sim_test inc.s   $all
     run_sim_test jmp.s   $all
     run_sim_test ldc.s   $all
     run_sim_test ldm.s   $all
     run_sim_test mac.s   $all
+    run_sim_test movb.s  $all
+    run_sim_test movw.s  $all
+    run_sim_test movl.s  $all
     run_sim_test mova.s  h8sx
-    run_sim_test movb.s $all
-    run_sim_test movw.s $all
-    run_sim_test movl.s $all
     run_sim_test movmd.s h8sx
     run_sim_test movsd.s h8sx
+    run_sim_test mul.s   $all
     run_sim_test neg.s   $all
     run_sim_test nop.s   $all
     run_sim_test not.s   $all
-    run_sim_test orb.s  $all
-    run_sim_test orw.s  $all
-    run_sim_test orl.s  $all
+    run_sim_test orb.s   $all
+    run_sim_test orw.s   $all
+    run_sim_test orl.s   $all
     run_sim_test rotl.s  $all
     run_sim_test rotr.s  $all
     run_sim_test rotxl.s $all
@@ -48,11 +51,15 @@
     run_sim_test shar.s  $all
     run_sim_test shll.s  $all
     run_sim_test shlr.s  $all
+    run_sim_test stack.s $all
     run_sim_test stc.s   $all
-    run_sim_test subb.s $all
-    run_sim_test subw.s $all
-    run_sim_test subl.s $all
-    run_sim_test xorb.s $all
-    run_sim_test xorw.s $all
-    run_sim_test xorl.s $all
+    run_sim_test subb.s  $all
+    run_sim_test subw.s  $all
+    run_sim_test subl.s  $all
+    run_sim_test subs.s  $all
+    run_sim_test subx.s  $all
+    run_sim_test tas.s   $all
+    run_sim_test xorb.s  $all
+    run_sim_test xorw.s  $all
+    run_sim_test xorl.s  $all
 }
diff --git a/sim/testsuite/sim/h8300/andb.s b/sim/testsuite/sim/h8300/andb.s
index 3377674..8f11805 100644
--- a/sim/testsuite/sim/h8300/andb.s
+++ b/sim/testsuite/sim/h8300/andb.s
@@ -238,8 +238,7 @@
 	fail
 .L5:
 
-
-.endif
+.endif				; h8sx
 
 and_b_reg8_reg8:
 	set_grs_a5a5		; Fill all general regs with a fixed pattern
@@ -452,6 +451,7 @@
 	beq	.L10
 	fail
 .L10:
+.endif				; h8sx
 
 andc_imm8_ccr:
 	set_grs_a5a5		; Fill all general regs with a fixed pattern
@@ -484,8 +484,44 @@
 	test_gr_a5a5 5
 	test_gr_a5a5 6
 	test_gr_a5a5 7
+
+.if (sim_cpu == h8300s || sim_cpu == h8sx)	; Earlier versions, no exr
+andc_imm8_exr:
+	set_grs_a5a5		; Fill all general regs with a fixed pattern
+
+	ldc	#0xff, exr
+	stc	exr, r0l
+	test_h_gr8 0x87, r0l
+
+	;;  andc #xx:8,exr
+	set_ccr_zero
+	andc	#0x7f, exr
+	test_cc_clear
+	stc	exr, r0l
+	test_h_gr8 0x7, r0l
+
+	andc	#0x3, exr
+	stc	exr, r0l
+	test_h_gr8 0x3, r0l
+
+	andc	#0x1, exr
+	stc	exr, r0l
+	test_h_gr8 0x1, r0l
+
+	andc	#0x0, exr
+	stc	exr, r0l
+	test_h_gr8 0x0, r0l
+
+	test_h_gr32  0xa5a5a500 er0
+	test_gr_a5a5 1
+	test_gr_a5a5 2
+	test_gr_a5a5 3
+	test_gr_a5a5 4
+	test_gr_a5a5 5
+	test_gr_a5a5 6
+	test_gr_a5a5 7
+.endif				; not h8300 or h8300h
 	
-.endif
 	pass
 
 	exit 0
diff --git a/sim/testsuite/sim/h8300/band.s b/sim/testsuite/sim/h8300/band.s
new file mode 100644
index 0000000..f3455ad
--- /dev/null
+++ b/sim/testsuite/sim/h8300/band.s
@@ -0,0 +1,525 @@
+# Hitachi H8 testcase 'band', 'bor', 'bxor', 'bld', 'bst', 'bstz'
+# mach(): all
+# as(h8300):	--defsym sim_cpu=0
+# as(h8300h):	--defsym sim_cpu=1
+# as(h8300s):	--defsym sim_cpu=2
+# as(h8sx):	--defsym sim_cpu=3
+# ld(h8300h):	-m h8300helf	
+# ld(h8300s):	-m h8300self	
+# ld(h8sx):	-m h8300sxelf
+
+	.include "testutils.inc"
+
+	.data
+byte_src:	.byte 0xa5
+byte_dst:	.byte 0
+
+	start
+
+band_imm3_reg8:
+	set_grs_a5a5
+	set_ccr_zero
+	;; band xx:3, reg8
+	band	#7, r0l		; this should NOT set the carry flag.
+	test_cc_clear
+	band	#6, r0l		; this should NOT set the carry flag.
+	test_cc_clear
+
+	orc	#1, ccr		; set the carry flag
+	band	#7, r0l		; this should NOT clear the carry flag
+	test_carry_set
+	test_ovf_clear
+	test_neg_clear
+	test_zero_clear
+	band	#6, r0l		; this should clear the carry flag
+	test_cc_clear
+
+	test_grs_a5a5		; general registers should not be changed.
+
+band_imm3_ind:
+	set_grs_a5a5
+.if (sim_cpu == h8300)
+	mov	#byte_src, r1
+	set_ccr_zero
+	;; band xx:3, ind
+	band	#7, @r1		; this should NOT set the carry flag.
+	test_cc_clear
+	band	#6, @r1		; this should NOT set the carry flag.
+	test_cc_clear
+
+	orc	#1, ccr		; set the carry flag
+	band	#7, @r1		; this should NOT clear the carry flag
+	test_carry_set
+	test_ovf_clear
+	test_neg_clear
+	test_zero_clear
+	band	#6, @r1		; this should clear the carry flag
+	test_cc_clear
+;;; 	test_h_gr16  byte_src r1	;FIXME
+.else
+	mov	#byte_src, er1
+	set_ccr_zero
+	;; band xx:3, ind
+	band	#7, @er1	; this should NOT set the carry flag.
+	test_cc_clear
+	band	#6, @er1	; this should NOT set the carry flag.
+	test_cc_clear
+
+	orc	#1, ccr		; set the carry flag
+	band	#7, @er1	; this should NOT clear the carry flag
+	test_carry_set
+	test_ovf_clear
+	test_neg_clear
+	test_zero_clear
+	band	#6, @er1	; this should clear the carry flag
+	test_cc_clear
+	test_h_gr32  byte_src er1
+.endif				; h8300
+	test_gr_a5a5 0		; general registers should not be changed.
+	test_gr_a5a5 2
+	test_gr_a5a5 3
+	test_gr_a5a5 4
+	test_gr_a5a5 5
+	test_gr_a5a5 6
+	test_gr_a5a5 7
+
+band_imm3_abs8:
+	set_grs_a5a5
+	mov.b	r1l, @0x20
+	set_ccr_zero
+	;; band xx:3, aa:8
+	band	#7, @0x20:8	; this should NOT set the carry flag.
+	test_cc_clear
+	band	#6, @0x20:8	; this should NOT set the carry flag.
+	test_cc_clear
+
+	orc	#1, ccr		; set the carry flag
+	band	#7, @0x20:8	; this should NOT clear the carry flag
+	test_carry_set
+	test_ovf_clear
+	test_neg_clear
+	test_zero_clear
+	band	#6, @0x20:8	; this should clear the carry flag
+	test_cc_clear
+
+	test_grs_a5a5		; general registers should not be changed.
+
+.if (sim_cpu)			; non-zero means not h8300
+band_imm3_abs16:
+	set_grs_a5a5
+	set_ccr_zero
+	;; band xx:3, aa:16
+	band	#7, @byte_src:16	; this should NOT set the carry flag.
+	test_cc_clear
+	band	#6, @byte_src:16	; this should NOT set the carry flag.
+	test_cc_clear
+
+	orc	#1, ccr			; set the carry flag
+	band	#7, @byte_src:16	; this should NOT clear the carry flag
+	test_carry_set
+	test_ovf_clear
+	test_neg_clear
+	test_zero_clear
+	band	#6, @byte_src:16	; this should clear the carry flag
+	test_cc_clear
+
+	test_grs_a5a5		; general registers should not be changed.
+
+band_imm3_abs32:
+	set_grs_a5a5
+	set_ccr_zero
+	;; band xx:3, aa:32
+	band	#7, @byte_src:32	; this should NOT set the carry flag.
+	test_cc_clear
+	band	#6, @byte_src:32	; this should NOT set the carry flag.
+	test_cc_clear
+
+	orc	#1, ccr			; set the carry flag
+	band	#7, @byte_src:32	; this should NOT clear the carry flag
+	test_carry_set
+	test_ovf_clear
+	test_neg_clear
+	test_zero_clear
+	band	#6, @byte_src:32	; this should clear the carry flag
+	test_cc_clear
+
+	test_grs_a5a5		; general registers should not be changed.
+.endif
+
+bor_imm3_reg8:
+	set_grs_a5a5
+	set_ccr_zero
+	;; bor xx:3, reg8
+	bor	#6, r0l		; this should NOT set the carry flag.
+	test_cc_clear
+
+	bor	#7, r0l		; this should set the carry flag.
+	test_carry_set
+	test_ovf_clear
+	test_neg_clear
+	test_zero_clear
+
+	orc	#1, ccr		; set the carry flag
+	bor	#7, r0l		; this should NOT clear the carry flag
+	test_carry_set
+	test_ovf_clear
+	test_neg_clear
+	test_zero_clear
+	bor	#6, r0l		; this should NOT clear the carry flag
+	test_carry_set
+	test_ovf_clear
+	test_neg_clear
+	test_zero_clear
+
+	test_grs_a5a5		; general registers should not be changed.
+
+bor_imm3_abs8:
+	set_grs_a5a5
+	mov.b	r1l, @0x20
+	set_ccr_zero
+	;; bor xx:3, aa:8
+	bor	#6, @0x20:8	; this should NOT set the carry flag.
+	test_cc_clear
+	bor	#7, @0x20:8	; this should set the carry flag.
+	test_carry_set
+	test_ovf_clear
+	test_neg_clear
+	test_zero_clear
+
+	orc	#1, ccr		; set the carry flag
+	bor	#7, @0x20:8	; this should NOT clear the carry flag
+	test_carry_set
+	test_ovf_clear
+	test_neg_clear
+	test_zero_clear
+	bor	#6, @0x20:8	; this should NOT clear the carry flag
+	test_carry_set
+	test_ovf_clear
+	test_neg_clear
+	test_zero_clear
+
+	test_grs_a5a5		; general registers should not be changed.
+
+bxor_imm3_reg8:
+	set_grs_a5a5
+	set_ccr_zero
+	;; bxor xx:3, reg8
+	bxor	#6, r0l		; this should NOT set the carry flag.
+	test_cc_clear
+
+	bxor	#7, r0l		; this should set the carry flag.
+	test_carry_set
+	test_ovf_clear
+	test_neg_clear
+	test_zero_clear
+
+	orc	#1, ccr		; set the carry flag
+	bxor	#6, r0l		; this should NOT clear the carry flag
+	test_carry_set
+	test_ovf_clear
+	test_neg_clear
+	test_zero_clear
+
+	bxor	#7, r0l		; this should clear the carry flag
+	test_cc_clear
+
+	test_grs_a5a5		; general registers should not be changed.
+
+bxor_imm3_abs8:
+	set_grs_a5a5
+	mov.b	r1l, @0x20
+	set_ccr_zero
+	;; bxor xx:3, aa:8
+	bxor	#6, @0x20:8	; this should NOT set the carry flag.
+	test_cc_clear
+	bxor	#7, @0x20:8	; this should set the carry flag.
+	test_carry_set
+	test_ovf_clear
+	test_neg_clear
+	test_zero_clear
+
+	orc	#1, ccr		; set the carry flag
+	bxor	#6, @0x20:8	; this should NOT clear the carry flag
+	test_carry_set
+	test_ovf_clear
+	test_neg_clear
+	test_zero_clear
+
+	bxor	#7, @0x20:8	; this should clear the carry flag
+	test_cc_clear
+
+	test_grs_a5a5		; general registers should not be changed.
+
+bld_imm3_reg8:
+	set_grs_a5a5
+	set_ccr_zero
+	;; bld xx:3, reg8
+	bld	#6, r0l		; this should NOT set the carry flag.
+	test_cc_clear
+	bld	#7, r0l		; this should set the carry flag.
+	test_carry_set
+	test_ovf_clear
+	test_neg_clear
+	test_zero_clear
+
+	test_grs_a5a5		; general registers should not be changed.
+
+bld_imm3_ind:
+	set_grs_a5a5
+.if (sim_cpu == h8300)
+	mov	#byte_src, r1
+	set_ccr_zero
+	;; bld xx:3, ind
+	bld	#6, @r1		; this should NOT set the carry flag.
+	test_cc_clear
+	bld	#7, @r1		; this should set the carry flag.
+	test_carry_set
+	test_ovf_clear
+	test_neg_clear
+	test_zero_clear
+;;; 	test_h_gr16  byte_src r1	;FIXME
+.else
+	mov	#byte_src, er1
+	set_ccr_zero
+	;; bld xx:3, ind
+	bld	#6, @er1	; this should NOT set the carry flag.
+	test_cc_clear
+	bld	#7, @er1	; this should NOT set the carry flag.
+	test_carry_set
+	test_ovf_clear
+	test_neg_clear
+	test_zero_clear
+	test_h_gr32  byte_src er1
+.endif				; h8300
+	test_gr_a5a5 0		; general registers should not be changed.
+	test_gr_a5a5 2
+	test_gr_a5a5 3
+	test_gr_a5a5 4
+	test_gr_a5a5 5
+	test_gr_a5a5 6
+	test_gr_a5a5 7
+
+bld_imm3_abs8:
+	set_grs_a5a5
+	mov.b	r1l, @0x20
+	set_ccr_zero
+	;; bld xx:3, aa:8
+	bld	#6, @0x20:8	; this should NOT set the carry flag.
+	test_cc_clear
+	bld	#7, @0x20:8	; this should set the carry flag.
+	test_carry_set
+	test_ovf_clear
+	test_neg_clear
+	test_zero_clear
+
+	test_grs_a5a5		; general registers should not be changed.
+
+.if (sim_cpu)			; non-zero means not h8300
+bld_imm3_abs16:
+	set_grs_a5a5
+	set_ccr_zero
+	;; bld xx:3, aa:16
+	bld	#6, @byte_src:16	; this should NOT set the carry flag.
+	test_cc_clear
+	bld	#7, @byte_src:16	; this should set the carry flag.
+	test_carry_set
+	test_ovf_clear
+	test_neg_clear
+	test_zero_clear
+
+	test_grs_a5a5		; general registers should not be changed.
+
+bld_imm3_abs32:
+	set_grs_a5a5
+	set_ccr_zero
+	;; bld xx:3, aa:32
+	bld	#6, @byte_src:32	; this should NOT set the carry flag.
+	test_cc_clear
+	bld	#7, @byte_src:32	; this should set the carry flag.
+	test_carry_set
+	test_ovf_clear
+	test_neg_clear
+	test_zero_clear
+
+	test_grs_a5a5		; general registers should not be changed.
+.endif
+
+bst_imm3_reg8:
+	set_grs_a5a5
+	set_ccr_zero
+	;; bst xx:3, reg8
+	bst	#7, r0l		; this should clear bit 7
+	test_cc_clear
+	test_h_gr16 0xa525 r0
+
+	set_ccr_zero
+	orc	#1, ccr		; set the carry flag
+	bst	#6, r0l		; this should set bit 6
+	test_carry_set
+	test_ovf_clear
+	test_neg_clear
+	test_zero_clear
+	test_h_gr16 0xa565 r0
+
+	test_gr_a5a5 1		; Rest of general regs should not be changed.
+	test_gr_a5a5 2
+	test_gr_a5a5 3
+	test_gr_a5a5 4
+	test_gr_a5a5 5
+	test_gr_a5a5 6
+	test_gr_a5a5 7
+
+bst_imm3_abs8:
+	set_grs_a5a5
+	mov.b	r1l, @0x20
+	set_ccr_zero
+	;; bst xx:3, aa:8
+	bst	#7, @0x20:8	; this should clear bit 7
+	test_cc_clear
+	mov.b	@0x20, r0l
+	test_h_gr16 0xa525 r0
+
+	set_ccr_zero
+	orc	#1, ccr		; set the carry flag
+	bst	#6, @0x20:8	; this should set bit 6
+	test_carry_set
+	test_ovf_clear
+	test_neg_clear
+	test_zero_clear
+	mov.b	@0x20, r0l
+	test_h_gr16 0xa565 r0
+
+	test_gr_a5a5 1		; general registers should not be changed.
+	test_gr_a5a5 2
+	test_gr_a5a5 3
+	test_gr_a5a5 4
+	test_gr_a5a5 5
+	test_gr_a5a5 6
+	test_gr_a5a5 7
+
+.if (sim_cpu == h8sx)
+bstz_imm3_abs8:
+	set_grs_a5a5
+	mov.b	r1l, @0x20
+	set_ccr_zero
+	;; bstz xx:3, aa:8
+	bstz	#7, @0x20:8	; this should clear bit 7
+	test_cc_clear
+	mov.b	@0x20, r0l
+	test_h_gr16 0xa525 r0
+
+	set_ccr_zero
+	orc	#4, ccr		; set the zero flag
+	bstz	#6, @0x20:8	; this should set bit 6
+	test_carry_clear
+	test_ovf_clear
+	test_neg_clear
+	test_zero_set
+	mov.b	@0x20, r0l
+	test_h_gr16 0xa565 r0
+
+	test_gr_a5a5 1		; general registers should not be changed.
+	test_gr_a5a5 2
+	test_gr_a5a5 3
+	test_gr_a5a5 4
+	test_gr_a5a5 5
+	test_gr_a5a5 6
+	test_gr_a5a5 7
+.endif				; h8sx
+
+btst_imm3_reg8:
+	set_grs_a5a5
+	set_ccr_zero
+	;; btst xx:3, reg8
+	btst	#7, r0l		; this should NOT set the zero flag.
+	test_cc_clear
+	btst	#6, r0l		; this should set the zero flag.
+	test_carry_clear
+	test_ovf_clear
+	test_neg_clear
+	test_zero_set
+
+	test_grs_a5a5		; general registers should not be changed.
+
+btst_imm3_ind:
+	set_grs_a5a5
+.if (sim_cpu == h8300)
+	mov	#byte_src, r1
+	set_ccr_zero
+	;; btst xx:3, ind
+	btst	#7, @r1		; this should NOT set the zero flag.
+	test_cc_clear
+	btst	#6, @r1		; this should set the zero flag.
+	test_carry_clear
+	test_ovf_clear
+	test_neg_clear
+	test_zero_set
+;;; 	test_h_gr16  byte_src r1	;FIXME
+.else
+	mov	#byte_src, er1
+	set_ccr_zero
+	;; btst xx:3, ind
+	btst	#7, @er1	; this should NOT set the zero flag.
+	test_cc_clear
+	btst	#6, @er1	; this should NOT set the zero flag.
+	test_carry_clear
+	test_ovf_clear
+	test_neg_clear
+	test_zero_set
+	test_h_gr32  byte_src er1
+.endif				; h8300
+	test_gr_a5a5 0		; general registers should not be changed.
+	test_gr_a5a5 2
+	test_gr_a5a5 3
+	test_gr_a5a5 4
+	test_gr_a5a5 5
+	test_gr_a5a5 6
+	test_gr_a5a5 7
+
+btst_imm3_abs8:
+	set_grs_a5a5
+	mov.b	r1l, @0x20
+	set_ccr_zero
+	;; btst xx:3, aa:8
+	btst	#7, @0x20:8	; this should NOT set the zero flag.
+	test_cc_clear
+	btst	#6, @0x20:8	; this should set the zero flag.
+	test_carry_clear
+	test_ovf_clear
+	test_neg_clear
+	test_zero_set
+
+	test_grs_a5a5		; general registers should not be changed.
+
+.if (sim_cpu)			; non-zero means not h8300
+btst_imm3_abs16:
+	set_grs_a5a5
+	set_ccr_zero
+	;; btst xx:3, aa:16
+	btst	#7, @byte_src:16	; this should NOT set the zero flag.
+	test_cc_clear
+	btst	#6, @byte_src:16	; this should set the zero flag.
+	test_carry_clear
+	test_ovf_clear
+	test_neg_clear
+	test_zero_set
+
+	test_grs_a5a5		; general registers should not be changed.
+
+btst_imm3_abs32:
+	set_grs_a5a5
+	set_ccr_zero
+	;; btst xx:3, aa:32
+	btst	#7, @byte_src:32	; this should NOT set the zero flag.
+	test_cc_clear
+	btst	#6, @byte_src:32	; this should set the zero flag.
+	test_carry_clear
+	test_ovf_clear
+	test_neg_clear
+	test_zero_set
+
+	test_grs_a5a5		; general registers should not be changed.
+.endif
+
+	pass
+	exit 0
diff --git a/sim/testsuite/sim/h8300/biand.s b/sim/testsuite/sim/h8300/biand.s
new file mode 100644
index 0000000..07d3ecf
--- /dev/null
+++ b/sim/testsuite/sim/h8300/biand.s
@@ -0,0 +1,473 @@
+# Hitachi H8 testcase 'biand', 'bior', 'bixor', 'bild', 'bist', 'bistz'
+# mach(): all
+# as(h8300):	--defsym sim_cpu=0
+# as(h8300h):	--defsym sim_cpu=1
+# as(h8300s):	--defsym sim_cpu=2
+# as(h8sx):	--defsym sim_cpu=3
+# ld(h8300h):	-m h8300helf	
+# ld(h8300s):	-m h8300self	
+# ld(h8sx):	-m h8300sxelf
+
+	.include "testutils.inc"
+
+	.data
+byte_src:	.byte 0xa5
+byte_dst:	.byte 0
+
+	start
+
+biand_imm3_reg8:
+	set_grs_a5a5
+	set_ccr_zero
+	;; biand xx:3, reg8
+	biand	#6, r0l		; this should NOT set the carry flag.
+	test_cc_clear
+	biand	#7, r0l		; this should NOT set the carry flag.
+	test_cc_clear
+
+	orc	#1, ccr		; set the carry flag
+	biand	#6, r0l		; this should NOT clear the carry flag
+	test_carry_set
+	test_ovf_clear
+	test_neg_clear
+	test_zero_clear
+	biand	#7, r0l		; this should clear the carry flag
+	test_cc_clear
+
+	test_grs_a5a5		; general registers should not be changed.
+
+biand_imm3_ind:
+	set_grs_a5a5
+.if (sim_cpu == h8300)
+	mov	#byte_src, r1
+	set_ccr_zero
+	;; biand xx:3, ind
+	biand	#6, @r1		; this should NOT set the carry flag.
+	test_cc_clear
+	biand	#7, @r1		; this should NOT set the carry flag.
+	test_cc_clear
+
+	orc	#1, ccr		; set the carry flag
+	biand	#6, @r1		; this should NOT clear the carry flag
+	test_carry_set
+	test_ovf_clear
+	test_neg_clear
+	test_zero_clear
+	biand	#7, @r1		; this should clear the carry flag
+	test_cc_clear
+;;; 	test_h_gr16  byte_src r1	;FIXME
+.else
+	mov	#byte_src, er1
+	set_ccr_zero
+	;; biand xx:3, ind
+	biand	#6, @er1	; this should NOT set the carry flag.
+	test_cc_clear
+	biand	#7, @er1	; this should NOT set the carry flag.
+	test_cc_clear
+
+	orc	#1, ccr		; set the carry flag
+	biand	#6, @er1	; this should NOT clear the carry flag
+	test_carry_set
+	test_ovf_clear
+	test_neg_clear
+	test_zero_clear
+	biand	#7, @er1	; this should clear the carry flag
+	test_cc_clear
+	test_h_gr32  byte_src er1
+.endif				; h8300
+	test_gr_a5a5 0		; general registers should not be changed.
+	test_gr_a5a5 2
+	test_gr_a5a5 3
+	test_gr_a5a5 4
+	test_gr_a5a5 5
+	test_gr_a5a5 6
+	test_gr_a5a5 7
+
+biand_imm3_abs8:
+	set_grs_a5a5
+	mov.b	r1l, @0x20
+	set_ccr_zero
+	;; biand xx:3, aa:8
+	biand	#6, @0x20:8	; this should NOT set the carry flag.
+	test_cc_clear
+	biand	#7, @0x20:8	; this should NOT set the carry flag.
+	test_cc_clear
+
+	orc	#1, ccr		; set the carry flag
+	biand	#6, @0x20:8	; this should NOT clear the carry flag
+	test_carry_set
+	test_ovf_clear
+	test_neg_clear
+	test_zero_clear
+	biand	#7, @0x20:8	; this should clear the carry flag
+	test_cc_clear
+
+	test_grs_a5a5		; general registers should not be changed.
+
+.if (sim_cpu)			; non-zero means not h8300
+biand_imm3_abs16:
+	set_grs_a5a5
+	set_ccr_zero
+	;; biand xx:3, aa:16
+	biand	#6, @byte_src:16	; this should NOT set the carry flag.
+	test_cc_clear
+	biand	#7, @byte_src:16	; this should NOT set the carry flag.
+	test_cc_clear
+
+	orc	#1, ccr			; set the carry flag
+	biand	#6, @byte_src:16	; this should NOT clear the carry flag
+	test_carry_set
+	test_ovf_clear
+	test_neg_clear
+	test_zero_clear
+	biand	#7, @byte_src:16	; this should clear the carry flag
+	test_cc_clear
+
+	test_grs_a5a5		; general registers should not be changed.
+
+biand_imm3_abs32:
+	set_grs_a5a5
+	set_ccr_zero
+	;; biand xx:3, aa:32
+	biand	#6, @byte_src:32	; this should NOT set the carry flag.
+	test_cc_clear
+	biand	#7, @byte_src:32	; this should NOT set the carry flag.
+	test_cc_clear
+
+	orc	#1, ccr			; set the carry flag
+	biand	#6, @byte_src:32	; this should NOT clear the carry flag
+	test_carry_set
+	test_ovf_clear
+	test_neg_clear
+	test_zero_clear
+	biand	#7, @byte_src:32	; this should clear the carry flag
+	test_cc_clear
+
+	test_grs_a5a5		; general registers should not be changed.
+.endif
+
+bior_imm3_reg8:
+	set_grs_a5a5
+	set_ccr_zero
+	;; bior xx:3, reg8
+	bior	#7, r0l		; this should NOT set the carry flag.
+	test_cc_clear
+
+	bior	#6, r0l		; this should set the carry flag.
+	test_carry_set
+	test_ovf_clear
+	test_neg_clear
+	test_zero_clear
+
+	orc	#1, ccr		; set the carry flag
+	bior	#6, r0l		; this should NOT clear the carry flag
+	test_carry_set
+	test_ovf_clear
+	test_neg_clear
+	test_zero_clear
+	bior	#7, r0l		; this should NOT clear the carry flag
+	test_carry_set
+	test_ovf_clear
+	test_neg_clear
+	test_zero_clear
+
+	test_grs_a5a5		; general registers should not be changed.
+
+bior_imm3_abs8:
+	set_grs_a5a5
+	mov.b	r1l, @0x20
+	set_ccr_zero
+	;; bior xx:3, aa:8
+	bior	#7, @0x20:8	; this should NOT set the carry flag.
+	test_cc_clear
+	bior	#6, @0x20:8	; this should set the carry flag.
+	test_carry_set
+	test_ovf_clear
+	test_neg_clear
+	test_zero_clear
+
+	orc	#1, ccr		; set the carry flag
+	bior	#6, @0x20:8	; this should NOT clear the carry flag
+	test_carry_set
+	test_ovf_clear
+	test_neg_clear
+	test_zero_clear
+	bior	#7, @0x20:8	; this should NOT clear the carry flag
+	test_carry_set
+	test_ovf_clear
+	test_neg_clear
+	test_zero_clear
+
+	test_grs_a5a5		; general registers should not be changed.
+
+bixor_imm3_reg8:
+	set_grs_a5a5
+	set_ccr_zero
+	;; bixor xx:3, reg8
+	bixor	#7, r0l		; this should NOT set the carry flag.
+	test_cc_clear
+
+	bixor	#6, r0l		; this should set the carry flag.
+	test_carry_set
+	test_ovf_clear
+	test_neg_clear
+	test_zero_clear
+
+	orc	#1, ccr		; set the carry flag
+	bixor	#7, r0l		; this should NOT clear the carry flag
+	test_carry_set
+	test_ovf_clear
+	test_neg_clear
+	test_zero_clear
+
+	bixor	#6, r0l		; this should clear the carry flag
+	test_cc_clear
+
+	test_grs_a5a5		; general registers should not be changed.
+
+bixor_imm3_abs8:
+	set_grs_a5a5
+	mov.b	r1l, @0x20
+	set_ccr_zero
+	;; bixor xx:3, aa:8
+	bixor	#7, @0x20:8	; this should NOT set the carry flag.
+	test_cc_clear
+	bixor	#6, @0x20:8	; this should set the carry flag.
+	test_carry_set
+	test_ovf_clear
+	test_neg_clear
+	test_zero_clear
+
+	orc	#1, ccr		; set the carry flag
+	bixor	#7, @0x20:8	; this should NOT clear the carry flag
+	test_carry_set
+	test_ovf_clear
+	test_neg_clear
+	test_zero_clear
+
+	bixor	#6, @0x20:8	; this should clear the carry flag
+	test_cc_clear
+
+	test_grs_a5a5		; general registers should not be changed.
+
+bild_imm3_reg8:
+	set_grs_a5a5
+	set_ccr_zero
+	;; bild xx:3, reg8
+	bild	#7, r0l		; this should NOT set the carry flag.
+	test_cc_clear
+	bild	#6, r0l		; this should set the carry flag.
+	test_carry_set
+	test_ovf_clear
+	test_neg_clear
+	test_zero_clear
+
+	test_grs_a5a5		; general registers should not be changed.
+
+bild_imm3_ind:
+	set_grs_a5a5
+.if (sim_cpu == h8300)
+	mov	#byte_src, r1
+	set_ccr_zero
+	;; bild xx:3, ind
+	bild	#7, @r1		; this should NOT set the carry flag.
+	test_cc_clear
+	bild	#6, @r1		; this should set the carry flag.
+	test_carry_set
+	test_ovf_clear
+	test_neg_clear
+	test_zero_clear
+;;; 	test_h_gr16  byte_src r1	;FIXME
+.else
+	mov	#byte_src, er1
+	set_ccr_zero
+	;; bild xx:3, ind
+	bild	#7, @er1	; this should NOT set the carry flag.
+	test_cc_clear
+	bild	#6, @er1	; this should NOT set the carry flag.
+	test_carry_set
+	test_ovf_clear
+	test_neg_clear
+	test_zero_clear
+	test_h_gr32  byte_src er1
+.endif				; h8300
+	test_gr_a5a5 0		; general registers should not be changed.
+	test_gr_a5a5 2
+	test_gr_a5a5 3
+	test_gr_a5a5 4
+	test_gr_a5a5 5
+	test_gr_a5a5 6
+	test_gr_a5a5 7
+
+bild_imm3_abs8:
+	set_grs_a5a5
+	mov.b	r1l, @0x20
+	set_ccr_zero
+	;; bild xx:3, aa:8
+	bild	#7, @0x20:8	; this should NOT set the carry flag.
+	test_cc_clear
+	bild	#6, @0x20:8	; this should set the carry flag.
+	test_carry_set
+	test_ovf_clear
+	test_neg_clear
+	test_zero_clear
+
+	test_grs_a5a5		; general registers should not be changed.
+
+.if (sim_cpu)			; non-zero means not h8300
+bild_imm3_abs16:
+	set_grs_a5a5
+	set_ccr_zero
+	;; bild xx:3, aa:16
+	bild	#7, @byte_src:16	; this should NOT set the carry flag.
+	test_cc_clear
+	bild	#6, @byte_src:16	; this should set the carry flag.
+	test_carry_set
+	test_ovf_clear
+	test_neg_clear
+	test_zero_clear
+
+	test_grs_a5a5		; general registers should not be changed.
+
+bild_imm3_abs32:
+	set_grs_a5a5
+	set_ccr_zero
+	;; bild xx:3, aa:32
+	bild	#7, @byte_src:32	; this should NOT set the carry flag.
+	test_cc_clear
+	bild	#6, @byte_src:32	; this should set the carry flag.
+	test_carry_set
+	test_ovf_clear
+	test_neg_clear
+	test_zero_clear
+
+	test_grs_a5a5		; general registers should not be changed.
+.endif
+
+bist_imm3_reg8:
+	set_grs_a5a5
+	set_ccr_zero
+	;; bist xx:3, reg8
+	bist	#6, r0l		; this should set bit 6
+	test_cc_clear
+	test_h_gr16 0xa5e5 r0
+
+	set_ccr_zero
+	orc	#1, ccr		; set the carry flag
+	bist	#7, r0l		; this should clear bit 7
+	test_carry_set
+	test_ovf_clear
+	test_neg_clear
+	test_zero_clear
+	test_h_gr16 0xa565 r0
+
+	test_gr_a5a5 1		; Rest of general regs should not be changed.
+	test_gr_a5a5 2
+	test_gr_a5a5 3
+	test_gr_a5a5 4
+	test_gr_a5a5 5
+	test_gr_a5a5 6
+	test_gr_a5a5 7
+
+bist_imm3_abs8:
+	set_grs_a5a5
+	mov.b	r1l, @0x20
+	set_ccr_zero
+	;; bist xx:3, aa:8
+	bist	#6, @0x20:8	; this should set bit 6
+	test_cc_clear
+	mov.b	@0x20, r0l
+	test_h_gr16 0xa5e5 r0
+
+	set_ccr_zero
+	orc	#1, ccr		; set the carry flag
+	bist	#7, @0x20:8	; this should clear bit 7
+	test_carry_set
+	test_ovf_clear
+	test_neg_clear
+	test_zero_clear
+	mov.b	@0x20, r0l
+	test_h_gr16 0xa565 r0
+
+	test_gr_a5a5 1		; general registers should not be changed.
+	test_gr_a5a5 2
+	test_gr_a5a5 3
+	test_gr_a5a5 4
+	test_gr_a5a5 5
+	test_gr_a5a5 6
+	test_gr_a5a5 7
+
+.if (sim_cpu == h8sx)
+bistz_imm3_abs8:
+	set_grs_a5a5
+	mov.b	r1l, @0x20
+	set_ccr_zero
+	;; bistz xx:3, aa:8
+	bistz	#6, @0x20:8	; this should set bit 6
+	test_cc_clear
+	mov.b	@0x20, r0l
+	test_h_gr16 0xa5e5 r0
+
+	set_ccr_zero
+	orc	#4, ccr		; set the zero flag
+	bistz	#7, @0x20:8	; this should clear bit 7
+	test_carry_clear
+	test_ovf_clear
+	test_neg_clear
+	test_zero_set
+	mov.b	@0x20, r0l
+	test_h_gr16 0xa565 r0
+
+	test_gr_a5a5 1		; general registers should not be changed.
+	test_gr_a5a5 2
+	test_gr_a5a5 3
+	test_gr_a5a5 4
+	test_gr_a5a5 5
+	test_gr_a5a5 6
+	test_gr_a5a5 7
+.endif				; h8sx
+
+bnot_imm3_reg8:
+	set_grs_a5a5
+	set_ccr_zero
+	;; bnot xx:3, reg8
+	bnot	#7, r0l
+	test_cc_clear
+	test_h_gr16 0xa525 r0
+	set_ccr_zero
+	bnot	#6, r0l
+	test_cc_clear
+	test_h_gr16 0xa565 r0
+	set_ccr_zero
+	bnot	#5, r0l
+	test_cc_clear
+	test_h_gr16 0xa545 r0
+	set_ccr_zero
+	bnot	#4, r0l
+	test_cc_clear
+	test_h_gr16 0xa555 r0
+	set_ccr_zero
+
+	bnot	#4, r0l
+	bnot	#5, r0l
+	bnot	#6, r0l
+	bnot	#7, r0l
+	test_cc_clear
+	test_grs_a5a5		; general registers should not be changed.
+
+bnot_imm3_abs8:
+	set_grs_a5a5
+	mov.b	r1l, @0x20
+	set_ccr_zero
+	;; bnot xx:3, aa:8
+	bnot	#7, @0x20:8
+	bnot	#6, @0x20:8
+	bnot	#5, @0x20:8
+	bnot	#4, @0x20:8
+	test_cc_clear
+	test_grs_a5a5
+	mov	@0x20, r0l
+	test_h_gr16 0xa555 r0
+	
+	pass
+	exit 0
diff --git a/sim/testsuite/sim/h8300/brabc.s b/sim/testsuite/sim/h8300/brabc.s
index 119d8d9..b9a08ea 100644
--- a/sim/testsuite/sim/h8300/brabc.s
+++ b/sim/testsuite/sim/h8300/brabc.s
@@ -43,18 +43,28 @@
 	test_h_gr32 0xa5a5a5a5 er6
 	test_h_gr32 0xa5a5a5a5 er7
 
+brabc_abs8_disp16:
+	set_grs_a5a5
+	mov.b	#0xa5, @0x20:32
+	set_ccr_zero
+	;; bra/bc xx:3, @aa:8, disp16
+	bra/bc	#1, @0x20:8, .Lpass3:16
+	fail
+.Lpass3:
+	bra/bc	#2, @0x20:8, Lfail:16
+
+	test_cc_clear
+	test_grs_a5a5
+
 brabc_abs16_disp16:
 	set_grs_a5a5
 	set_ccr_zero
 	;; bra/bc xx:3, @aa:16, disp16
-	bra/bc	#1, @byte_src:16, .Lpass3:16
+	bra/bc	#1, @byte_src:16, .Lpass5:16
 	fail
-.Lpass3:
-	bra/bc	#2, @byte_src:16, .Lfail2:16
-	bra	.Lpass4
-.Lfail2:
-	fail
-.Lpass4:	
+.Lpass5:
+	bra/bc	#2, @byte_src:16, Lfail:16
+
 	test_cc_clear
 	test_grs_a5a5
 
@@ -63,18 +73,18 @@
 	mov	#byte_src, er1
 	set_ccr_zero
 	;; bra/bs xx:3, @erd, disp8
-	bra/bs	#2, @er1, .Lpass5:8
+	bra/bs	#2, @er1, .Lpass7:8
 ;;; 	.word	0x7c10
 ;;; 	.word	0x4a10
 	fail
-.Lpass5:
+.Lpass7:
 	bra/bs	#1, @er1, .Lfail3:8
 ;;; 	.word	0x7c10
 ;;; 	.word	0x4902
-	bra	.Lpass6
+	bra	.Lpass8
 .Lfail3:
 	fail
-.Lpass6:
+.Lpass8:
 	test_cc_clear
 	test_h_gr32 0xa5a5a5a5 er0
 	test_h_gr32 byte_src   er1
@@ -89,14 +99,11 @@
 	set_grs_a5a5
 	set_ccr_zero
 	;; bra/bs xx:3, @aa:32, disp16
-	bra/bs	#2, @byte_src:32, .Lpass7:16
+	bra/bs	#2, @byte_src:32, .Lpass9:16
 	fail
-.Lpass7:
-	bra/bs	#1, @byte_src:32, .Lfail4:16
-	bra	.Lpass8
-.Lfail4:
-	fail
-.Lpass8:
+.Lpass9:
+	bra/bs	#1, @byte_src:32, Lfail:16
+
 	test_cc_clear
 	test_grs_a5a5
 
@@ -105,3 +112,5 @@
 	pass
 
 	exit 0
+
+Lfail:	fail
diff --git a/sim/testsuite/sim/h8300/bset.s b/sim/testsuite/sim/h8300/bset.s
index ecf5237..a94e916 100644
--- a/sim/testsuite/sim/h8300/bset.s
+++ b/sim/testsuite/sim/h8300/bset.s
@@ -824,11 +824,56 @@
 	test_h_gr8 0 r1l
 
 	test_gr_a5a5 0		; Make sure other general regs not disturbed
-.if (sim_cpu == h8300)
-	test_h_gr16 0xa500 r1
-.else
 	test_h_gr32  0xa5a5a500 er1
-.endif
+	test_gr_a5a5 2
+	test_gr_a5a5 3
+	test_gr_a5a5 4
+	test_gr_a5a5 5
+	test_gr_a5a5 6
+	test_gr_a5a5 7
+
+bset_ne_imm3_abs16:
+	set_grs_a5a5		; Fill all general regs with a fixed pattern
+
+	;;  bset/ne xx:3, aa:16
+	mov	#0, @byte_dst
+	set_ccr_zero
+	orc	#4, ccr		; Set zero flag
+	bset/ne	#0, @byte_dst:16 ; Zero is set; should have no effect.
+	test_zero_set
+	test_neg_clear
+	test_ovf_clear
+	test_carry_clear
+	mov	@byte_dst, r1l
+	test_h_gr8 0 r1l
+
+	set_ccr_zero
+	bset/ne	#0, @byte_dst:16 ; Zero is clear: operation should succeed.
+	test_cc_clear
+	mov	@byte_dst, r1l
+	test_h_gr8 1 r1l
+
+bclr_ne_imm3_abs32:
+	mov	#1, @byte_dst
+	set_ccr_zero
+	orc	#4, ccr		; Set zero flag
+	;; bclr/ne xx:3, aa:16
+	bclr/ne	#0, @byte_dst:32 ; Zero is set, should have no effect.
+	test_neg_clear
+	test_zero_set
+	test_ovf_clear
+	test_carry_clear
+	mov	@byte_dst, r1l
+	test_h_gr8 1 r1l
+
+	set_ccr_zero
+	bclr/ne	#0, @byte_dst:32 ; Zero is clear: operation should succeed.
+	test_cc_clear
+	mov	@byte_dst, r1l
+	test_h_gr8 0 r1l
+
+	test_gr_a5a5 0		; Make sure other general regs not disturbed
+	test_h_gr32  0xa5a5a500 er1
 	test_gr_a5a5 2
 	test_gr_a5a5 3
 	test_gr_a5a5 4
diff --git a/sim/testsuite/sim/h8300/div.s b/sim/testsuite/sim/h8300/div.s
new file mode 100644
index 0000000..518b62f
--- /dev/null
+++ b/sim/testsuite/sim/h8300/div.s
@@ -0,0 +1,387 @@
+# Hitachi H8 testcase 'divs', 'divu', 'divxs', 'divxu'
+# mach(): all
+# as(h8300):	--defsym sim_cpu=0
+# as(h8300h):	--defsym sim_cpu=1
+# as(h8300s):	--defsym sim_cpu=2
+# as(h8sx):	--defsym sim_cpu=3
+# ld(h8300h):	-m h8300helf
+# ld(h8300s):	-m h8300self
+# ld(h8sx):	-m h8300sxelf	
+
+	.include "testutils.inc"
+
+	start
+
+.if (sim_cpu == h8sx)	
+divs_w_reg_reg:	
+	set_grs_a5a5
+
+	;; divs.w rs, rd
+	mov.w	#32, r1
+	mov.w	#-2, r2
+	set_ccr_zero
+	divs.w	r2, r1
+
+	;; test ccr		; H=0 N=1 Z=0 V=0 C=0
+	test_neg_set
+	test_carry_clear
+	test_zero_clear
+	test_ovf_clear
+	
+	test_gr_a5a5	0
+	test_h_gr16	0xfff0	r1
+	test_h_gr32	0xa5a5fffe	er2
+	test_gr_a5a5	3
+	test_gr_a5a5	4
+	test_gr_a5a5	5
+	test_gr_a5a5	6
+	test_gr_a5a5	7
+
+divs_w_imm4_reg:
+	set_grs_a5a5
+
+	;; divs.w xx:4, rd
+	mov.w	#32, r1
+	set_ccr_zero
+	divs.w	#-2:4, r1
+
+	;; test ccr		; H=0 N=1 Z=0 V=0 C=0
+	test_neg_set
+	test_carry_clear
+	test_zero_clear
+	test_ovf_clear
+
+	test_gr_a5a5	0
+	test_h_gr16	-16	r1
+	test_gr_a5a5	2
+	test_gr_a5a5	3
+	test_gr_a5a5	4
+	test_gr_a5a5	5
+	test_gr_a5a5	6
+	test_gr_a5a5	7
+
+divs_l_reg_reg:	
+	set_grs_a5a5
+
+	;; divs.l ers, erd
+	mov.l	#320000, er1
+	mov.l	#-2, er2
+	set_ccr_zero
+	divs.l	er2, er1
+
+	;; test ccr		; H=0 N=1 Z=0 V=0 C=0
+	test_neg_set
+	test_carry_clear
+	test_zero_clear
+	test_ovf_clear
+	
+	test_gr_a5a5	0
+	test_h_gr32	-160000	er1
+	test_h_gr32	-2	er2
+	test_gr_a5a5	3
+	test_gr_a5a5	4
+	test_gr_a5a5	5
+	test_gr_a5a5	6
+	test_gr_a5a5	7
+
+divs_l_imm4_reg:
+	set_grs_a5a5
+
+	;; divs.l xx:4, rd
+	mov.l	#320000, er1
+	set_ccr_zero
+	divs.l	#-2:4, er1
+
+	;; test ccr		; H=0 N=1 Z=0 V=0 C=0
+	test_neg_set
+	test_carry_clear
+	test_zero_clear
+	test_ovf_clear
+
+	test_gr_a5a5	0
+	test_h_gr32	-160000	er1
+	test_gr_a5a5	2
+	test_gr_a5a5	3
+	test_gr_a5a5	4
+	test_gr_a5a5	5
+	test_gr_a5a5	6
+	test_gr_a5a5	7
+
+divu_w_reg_reg:	
+	set_grs_a5a5
+
+	;; divu.w rs, rd
+	mov.w	#32, r1
+	mov.w	#2, r2
+	set_ccr_zero
+	divu.w	r2, r1
+
+	;; test ccr		; H=0 N=0 Z=0 V=0 C=0
+	test_cc_clear
+
+	test_gr_a5a5	0
+	test_h_gr16	16	r1
+	test_h_gr32	0xa5a50002	er2
+	test_gr_a5a5	3
+	test_gr_a5a5	4
+	test_gr_a5a5	5
+	test_gr_a5a5	6
+	test_gr_a5a5	7
+
+divu_w_imm4_reg:
+	set_grs_a5a5
+
+	;; divu.w xx:4, rd
+	mov.w	#32, r1
+	set_ccr_zero
+	divu.w	#2:4, r1
+
+	;; test ccr		; H=0 N=0 Z=0 V=0 C=0
+	test_cc_clear
+
+	test_gr_a5a5	0
+	test_h_gr16	16	r1
+	test_gr_a5a5	2
+	test_gr_a5a5	3
+	test_gr_a5a5	4
+	test_gr_a5a5	5
+	test_gr_a5a5	6
+	test_gr_a5a5	7
+
+divu_l_reg_reg:	
+	set_grs_a5a5
+
+	;; divu.l ers, erd
+	mov.l	#320000, er1
+	mov.l	#2, er2
+	set_ccr_zero
+	divu.l	er2, er1
+
+	;; test ccr		; H=0 N=0 Z=0 V=0 C=0
+	test_cc_clear
+	
+	test_gr_a5a5	0
+	test_h_gr32	160000	er1
+	test_h_gr32	2	er2
+	test_gr_a5a5	3
+	test_gr_a5a5	4
+	test_gr_a5a5	5
+	test_gr_a5a5	6
+	test_gr_a5a5	7
+
+divu_l_imm4_reg:
+	set_grs_a5a5
+
+	;; divu.l xx:4, rd
+	mov.l	#320000, er1
+	set_ccr_zero
+	divu.l	#2:4, er1
+
+	;; test ccr		; H=0 N=0 Z=0 V=0 C=0
+	test_cc_clear
+
+	test_gr_a5a5	0
+	test_h_gr32	160000	er1
+	test_gr_a5a5	2
+	test_gr_a5a5	3
+	test_gr_a5a5	4
+	test_gr_a5a5	5
+	test_gr_a5a5	6
+	test_gr_a5a5	7
+
+.endif
+
+.if (sim_cpu)			; not equal to zero ie. not h8
+divxs_b_reg_reg:
+	set_grs_a5a5
+
+	;; divxs.b rs, rd
+	mov.w	#32, r1
+	mov.b	#-2, r2l
+	set_ccr_zero
+	divxs.b	r2l, r1
+
+	;; test ccr		; H=0 N=1 Z=0 V=0 C=0
+	test_neg_set
+	test_carry_clear
+	test_zero_clear
+	test_ovf_clear
+	
+	test_gr_a5a5	0
+	test_h_gr16	0x00f0	r1
+	test_h_gr32	0xa5a5a5fe	er2
+	test_gr_a5a5	3
+	test_gr_a5a5	4
+	test_gr_a5a5	5
+	test_gr_a5a5	6
+	test_gr_a5a5	7
+
+.if (sim_cpu == h8sx)	
+divxs_b_imm4_reg:
+	set_grs_a5a5
+
+	;; divxs.b xx:4, rd
+	mov.w	#32, r1
+	set_ccr_zero
+	divxs.b	#-2:4, r1
+
+	;; test ccr		; H=0 N=1 Z=0 V=0 C=0
+	test_neg_set
+	test_carry_clear
+	test_zero_clear
+	test_ovf_clear
+
+	test_gr_a5a5	0
+	test_h_gr16	0x00f0	r1
+	test_gr_a5a5	2
+	test_gr_a5a5	3
+	test_gr_a5a5	4
+	test_gr_a5a5	5
+	test_gr_a5a5	6
+	test_gr_a5a5	7
+.endif				; h8sx
+
+divxs_w_reg_reg:	
+	set_grs_a5a5
+
+	;; divxs.w ers, erd
+	mov.l	#0x1000,  er1
+	mov.w	#-0x1000, r2
+	set_ccr_zero
+	divxs.w	r2, er1
+
+	;; test ccr		; H=0 N=1 Z=0 V=0 C=0
+	test_neg_set
+	test_carry_clear
+	test_zero_clear
+	test_ovf_clear
+	
+	test_gr_a5a5	0
+	test_h_gr32	0x0000ffff	er1
+	test_h_gr32	0xa5a5f000	er2
+	test_gr_a5a5	3
+	test_gr_a5a5	4
+	test_gr_a5a5	5
+	test_gr_a5a5	6
+	test_gr_a5a5	7
+
+.if (sim_cpu == h8sx)
+divxs_w_imm4_reg:
+	set_grs_a5a5
+
+	;; divxs.w xx:4, rd
+	mov.l	#-4, er1
+	set_ccr_zero
+	divxs.w	#2:4, er1
+
+	;; test ccr		; H=0 N=1 Z=0 V=0 C=0
+	test_neg_set
+	test_carry_clear
+	test_zero_clear
+	test_ovf_clear
+
+	test_gr_a5a5	0
+	test_h_gr32	0x0000fffe	er1
+	test_gr_a5a5	2
+	test_gr_a5a5	3
+	test_gr_a5a5	4
+	test_gr_a5a5	5
+	test_gr_a5a5	6
+	test_gr_a5a5	7
+.endif				; h8sx
+.endif				; not h8
+
+divxu_b_reg_reg:
+	set_grs_a5a5
+
+	;; divxu.b rs, rd
+	mov.w	#32, r1
+	mov.b	#2, r2l
+	set_ccr_zero
+	divxu.b	r2l, r1
+
+	;; test ccr		; H=0 N=0 Z=0 V=0 C=0
+	test_cc_clear
+	
+	test_gr_a5a5	0
+	test_h_gr16	0x0010	r1
+	test_h_gr16	0xa502  r2
+.if (sim_cpu)
+	test_h_gr32	0xa5a5a502	er2
+.endif
+	test_gr_a5a5	3
+	test_gr_a5a5	4
+	test_gr_a5a5	5
+	test_gr_a5a5	6
+	test_gr_a5a5	7
+
+.if (sim_cpu)			; not h8
+.if (sim_cpu == h8sx)
+divxu_b_imm4_reg:
+	set_grs_a5a5
+
+	;; divxu.b xx:4, rd
+	mov.w	#32, r1
+	set_ccr_zero
+	divxu.b	#2:4, r1
+
+	;; test ccr		; H=0 N=0 Z=0 V=0 C=0
+	test_cc_clear
+
+	test_gr_a5a5	0
+	test_h_gr16	0x0010	r1
+	test_gr_a5a5	2
+	test_gr_a5a5	3
+	test_gr_a5a5	4
+	test_gr_a5a5	5
+	test_gr_a5a5	6
+	test_gr_a5a5	7
+.endif				; h8sx
+
+divxu_w_reg_reg:	
+	set_grs_a5a5
+
+	;; divxu.w ers, erd
+	mov.l	#0x1000, er1
+	mov.w	#0x1000, r2
+	set_ccr_zero
+	divxu.w	r2, er1
+
+	;; test ccr		; H=0 N=0 Z=0 V=0 C=0
+	test_cc_clear
+	
+	test_gr_a5a5	0
+	test_h_gr32	0x00000001	er1
+	test_h_gr32	0xa5a51000	er2
+	test_gr_a5a5	3
+	test_gr_a5a5	4
+	test_gr_a5a5	5
+	test_gr_a5a5	6
+	test_gr_a5a5	7
+
+.if (sim_cpu == h8sx)
+divxu_w_imm4_reg:
+	set_grs_a5a5
+
+	;; divxu.w xx:4, rd
+	mov.l	#0xffff, er1
+	set_ccr_zero
+	divxu.w	#2:4, er1
+
+	;; test ccr		; H=0 N=0 Z=0 V=0 C=0
+	test_cc_clear
+
+	test_gr_a5a5	0
+	test_h_gr32	0x00017fff	er1
+	test_gr_a5a5	2
+	test_gr_a5a5	3
+	test_gr_a5a5	4
+	test_gr_a5a5	5
+	test_gr_a5a5	6
+	test_gr_a5a5	7
+.endif				; h8sx
+.endif				; not h8
+
+	pass
+
+	exit 0
diff --git a/sim/testsuite/sim/h8300/jmp.s b/sim/testsuite/sim/h8300/jmp.s
index 805bafe..30a4b28 100644
--- a/sim/testsuite/sim/h8300/jmp.s
+++ b/sim/testsuite/sim/h8300/jmp.s
@@ -10,15 +10,19 @@
 
 	.include "testutils.inc"
 
+	.data
+vector_area:
+	.fill	0x400, 1, 0
+
 	start
 	
-.if 0				; this one isn't right -- it's an indirect
+.if (sim_cpu == h8sx)
 jmp_8:
 	set_grs_a5a5		; Fill all general regs with a fixed pattern
+	mov.l	#.Ltgt_8:32, @0x20
 	set_ccr_zero
-
-	;;  jmp @aa:8		; 8-bit displacement
-	jmp @@.Ltgt_8:8
+	;;  jmp @@aa:8		; 8-bit displacement
+	jmp @@0x20
 	fail
 
 .Ltgt_8:	
@@ -31,7 +35,23 @@
 	test_gr_a5a5 5
 	test_gr_a5a5 6
 	test_gr_a5a5 7
-.endif
+
+jmp_7:				; vector jump
+	mov.l	#vector_area, er0
+	ldc.l	er0, vbr
+	set_grs_a5a5
+	mov.l	#.Ltgt_7:32, @vector_area+0x300
+	set_ccr_zero
+
+	jmp	@@0x300
+	fail
+.Ltgt_7:
+	test_cc_clear
+	test_grs_a5a5
+	stc.l	vbr, er0
+	test_h_gr32 vector_area, er0
+	
+.endif				; h8sx
 
 jmp_24:
 	set_grs_a5a5		; Fill all general regs with a fixed pattern
@@ -52,7 +72,7 @@
 	test_gr_a5a5 6
 	test_gr_a5a5 7
 
-.if	(sim_cpu)		; Non-zero means h8300h, h8300s, or h8sx
+.if (sim_cpu)			; Non-zero means h8300h, h8300s, or h8sx
 jmp_reg:
 	set_grs_a5a5		; Fill all general regs with a fixed pattern
 	set_ccr_zero
@@ -72,7 +92,7 @@
 	test_h_gr32 .Ltgt_reg er5
 	test_gr_a5a5 6
 	test_gr_a5a5 7
-.endif
+.endif				; not h8300
 
 .if (sim_cpu == h8sx)
 jmp_32:
@@ -95,7 +115,7 @@
 	test_gr_a5a5 5
 	test_gr_a5a5 6
 	test_gr_a5a5 7
-.endif
+.endif				; h8sx
 
 	pass
 	exit 0
diff --git a/sim/testsuite/sim/h8300/ldm.s b/sim/testsuite/sim/h8300/ldm.s
index c26349f..c816221 100644
--- a/sim/testsuite/sim/h8300/ldm.s
+++ b/sim/testsuite/sim/h8300/ldm.s
@@ -180,8 +180,9 @@
 	test_h_gr32  _stack+20, er7
 .endif
 
-.if (sim_cpu == h8300)
+pushpop:
 	set_grs_a5a5
+.if (sim_cpu == h8300)
 	mov	#_stack_top, r7
 	mov	#12, r1
 	mov	#34, r2
@@ -204,8 +205,6 @@
 	cmp.w	r0, r7
 	bne	fail1
 .else
-pushpop:
-	set_grs_a5a5
 	mov	#_stack_top, er7
 	mov	#12, er1
 	mov	#34, er2
diff --git a/sim/testsuite/sim/h8300/mac.s b/sim/testsuite/sim/h8300/mac.s
index 0388b98..d60fe30 100644
--- a/sim/testsuite/sim/h8300/mac.s
+++ b/sim/testsuite/sim/h8300/mac.s
@@ -1,5 +1,5 @@
 # Hitachi H8 testcase 'mac'
-# mach(): h8300h h8300s h8sx
+# mach(): h8300s h8sx
 # as(h8300):	--defsym sim_cpu=0
 # as(h8300h):	--defsym sim_cpu=1
 # as(h8300s):	--defsym sim_cpu=2
diff --git a/sim/testsuite/sim/h8300/mul.s b/sim/testsuite/sim/h8300/mul.s
new file mode 100644
index 0000000..70ab7ec
--- /dev/null
+++ b/sim/testsuite/sim/h8300/mul.s
@@ -0,0 +1,474 @@
+# Hitachi H8 testcase 'muls', 'muls/u', mulu', 'mulu/u', 'mulxs', 'mulxu'
+# mach(): all
+# as(h8300):	--defsym sim_cpu=0
+# as(h8300h):	--defsym sim_cpu=1
+# as(h8300s):	--defsym sim_cpu=2
+# as(h8sx):	--defsym sim_cpu=3
+# ld(h8300h):	-m h8300helf
+# ld(h8300s):	-m h8300self
+# ld(h8sx):	-m h8300sxelf	
+
+	.include "testutils.inc"
+
+	start
+
+.if (sim_cpu == h8sx)	
+muls_w_reg_reg:	
+	set_grs_a5a5
+
+	;; muls.w rs, rd
+	mov.w	#32, r1
+	mov.w	#-2, r2
+	set_ccr_zero
+	muls.w	r2, r1
+
+	;; test ccr		; H=0 N=1 Z=0 V=0 C=0
+	test_neg_set
+	test_carry_clear
+	test_zero_clear
+	test_ovf_clear
+	
+	test_gr_a5a5	0
+	test_h_gr16	-64	r1
+	test_h_gr32	0xa5a5fffe	er2
+	test_gr_a5a5	3
+	test_gr_a5a5	4
+	test_gr_a5a5	5
+	test_gr_a5a5	6
+	test_gr_a5a5	7
+
+muls_w_imm4_reg:
+	set_grs_a5a5
+
+	;; muls.w xx:4, rd
+	mov.w	#32, r1
+	set_ccr_zero
+	muls.w	#-2:4, r1
+
+	;; test ccr		; H=0 N=1 Z=0 V=0 C=0
+	test_neg_set
+	test_carry_clear
+	test_zero_clear
+	test_ovf_clear
+
+	test_gr_a5a5	0
+	test_h_gr16	-64	r1
+	test_gr_a5a5	2
+	test_gr_a5a5	3
+	test_gr_a5a5	4
+	test_gr_a5a5	5
+	test_gr_a5a5	6
+	test_gr_a5a5	7
+
+muls_l_reg_reg:	
+	set_grs_a5a5
+
+	;; muls.l ers, erd
+	mov.l	#320000, er1
+	mov.l	#-2, er2
+	set_ccr_zero
+	muls.l	er2, er1
+
+	;; test ccr		; H=0 N=1 Z=0 V=0 C=0
+	test_neg_set
+	test_carry_clear
+	test_zero_clear
+	test_ovf_clear
+	
+	test_gr_a5a5	0
+	test_h_gr32	-640000	er1
+	test_h_gr32	-2	er2
+	test_gr_a5a5	3
+	test_gr_a5a5	4
+	test_gr_a5a5	5
+	test_gr_a5a5	6
+	test_gr_a5a5	7
+
+muls_l_imm4_reg:
+	set_grs_a5a5
+
+	;; muls.l xx:4, rd
+	mov.l	#320000, er1
+	set_ccr_zero
+	muls.l	#-2:4, er1
+
+	;; test ccr		; H=0 N=1 Z=0 V=0 C=0
+	test_neg_set
+	test_carry_clear
+	test_zero_clear
+	test_ovf_clear
+
+	test_gr_a5a5	0
+	test_h_gr32	-640000	er1
+	test_gr_a5a5	2
+	test_gr_a5a5	3
+	test_gr_a5a5	4
+	test_gr_a5a5	5
+	test_gr_a5a5	6
+	test_gr_a5a5	7
+
+muls_u_l_reg_reg:
+	set_grs_a5a5
+
+	;; muls/u.l ers, erd
+	mov.l	#0x10000000, er1
+	mov.l	#-16, er2
+	set_ccr_zero
+	muls/u.l	er2, er1
+
+	;; test ccr		; H=0 N=1 Z=0 V=0 C=0
+	test_neg_set
+	test_carry_clear
+	test_zero_clear
+	test_ovf_clear
+	
+	test_gr_a5a5	0
+	test_h_gr32	-1	er1
+	test_h_gr32	-16	er2
+	test_gr_a5a5	3
+	test_gr_a5a5	4
+	test_gr_a5a5	5
+	test_gr_a5a5	6
+	test_gr_a5a5	7
+
+muls_u_l_imm4_reg:
+	set_grs_a5a5
+
+	;; muls/u.l xx:4, rd
+	mov.l	#0xffffffff, er1
+	set_ccr_zero
+	muls/u.l	#2:4, er1
+
+	;; test ccr		; H=0 N=1 Z=0 V=0 C=0
+	test_neg_set
+	test_carry_clear
+	test_zero_clear
+	test_ovf_clear
+
+	test_gr_a5a5	0
+	test_h_gr32	-1	er1
+	test_gr_a5a5	2
+	test_gr_a5a5	3
+	test_gr_a5a5	4
+	test_gr_a5a5	5
+	test_gr_a5a5	6
+	test_gr_a5a5	7
+
+mulu_w_reg_reg:	
+	set_grs_a5a5
+
+	;; mulu.w rs, rd
+	mov.w	#32, r1
+	mov.w	#-2, r2
+	set_ccr_zero
+	mulu.w	r2, r1
+
+	;; test ccr		; H=0 N=0 Z=0 V=0 C=0
+	test_cc_clear
+	
+	test_gr_a5a5	0
+	test_h_gr16	-64	r1
+	test_h_gr32	0xa5a5fffe	er2
+	test_gr_a5a5	3
+	test_gr_a5a5	4
+	test_gr_a5a5	5
+	test_gr_a5a5	6
+	test_gr_a5a5	7
+
+mulu_w_imm4_reg:
+	set_grs_a5a5
+
+	;; mulu.w xx:4, rd
+	mov.w	#32, r1
+	set_ccr_zero
+	mulu.w	#-2:4, r1
+
+	;; test ccr		; H=0 N=0 Z=0 V=0 C=0
+	test_cc_clear
+
+	test_gr_a5a5	0
+	test_h_gr16	0x1c0	r1
+	test_gr_a5a5	2
+	test_gr_a5a5	3
+	test_gr_a5a5	4
+	test_gr_a5a5	5
+	test_gr_a5a5	6
+	test_gr_a5a5	7
+
+mulu_l_reg_reg:	
+	set_grs_a5a5
+
+	;; mulu.l ers, erd
+	mov.l	#320000, er1
+	mov.l	#-2, er2
+	set_ccr_zero
+	mulu.l	er2, er1
+
+	;; test ccr		; H=0 N=0 Z=0 V=0 C=0
+	test_cc_clear
+	
+	test_gr_a5a5	0
+	test_h_gr32	-640000	er1
+	test_h_gr32	-2	er2
+	test_gr_a5a5	3
+	test_gr_a5a5	4
+	test_gr_a5a5	5
+	test_gr_a5a5	6
+	test_gr_a5a5	7
+
+mulu_l_imm4_reg:
+	set_grs_a5a5
+
+	;; mulu.l xx:4, rd
+	mov.l	#320000, er1
+	set_ccr_zero
+	mulu.l	#-2:4, er1
+
+	;; test ccr		; H=0 N=0 Z=0 V=0 C=0
+	test_cc_clear
+
+	test_gr_a5a5	0
+	test_h_gr32	0x445c00	er1
+	test_gr_a5a5	2
+	test_gr_a5a5	3
+	test_gr_a5a5	4
+	test_gr_a5a5	5
+	test_gr_a5a5	6
+	test_gr_a5a5	7
+
+mulu_u_l_reg_reg:
+	set_grs_a5a5
+
+	;; mulu/u.l ers, erd
+	mov.l	#0x10000000, er1
+	mov.l	#16, er2
+	set_ccr_zero
+	mulu/u.l	er2, er1
+
+	;; test ccr		; H=0 N=0 Z=0 V=0 C=0
+	test_cc_clear
+	
+	test_gr_a5a5	0
+	test_h_gr32	1	er1
+	test_h_gr32	16	er2
+	test_gr_a5a5	3
+	test_gr_a5a5	4
+	test_gr_a5a5	5
+	test_gr_a5a5	6
+	test_gr_a5a5	7
+
+mulu_u_l_imm4_reg:
+	set_grs_a5a5
+
+	;; mulu/u.l xx:4, rd
+	mov.l	#0xffffffff, er1
+	set_ccr_zero
+	mulu/u.l	#2:4, er1
+
+	;; test ccr		; H=0 N=0 Z=0 V=0 C=0
+	test_cc_clear
+
+	test_gr_a5a5	0
+	test_h_gr32	0x1	er1
+	test_gr_a5a5	2
+	test_gr_a5a5	3
+	test_gr_a5a5	4
+	test_gr_a5a5	5
+	test_gr_a5a5	6
+	test_gr_a5a5	7
+.endif
+
+.if (sim_cpu)			; not equal to zero ie. not h8
+mulxs_b_reg_reg:
+	set_grs_a5a5
+
+	;; mulxs.b rs, rd
+	mov.b	#32, r1l
+	mov.b	#-2, r2l
+	set_ccr_zero
+	mulxs.b	r2l, r1
+
+	;; test ccr		; H=0 N=1 Z=0 V=0 C=0
+	test_neg_set
+	test_carry_clear
+	test_zero_clear
+	test_ovf_clear
+	
+	test_gr_a5a5	0
+	test_h_gr16	-64	r1
+	test_h_gr32	0xa5a5a5fe	er2
+	test_gr_a5a5	3
+	test_gr_a5a5	4
+	test_gr_a5a5	5
+	test_gr_a5a5	6
+	test_gr_a5a5	7
+
+.if (sim_cpu == h8sx)	
+mulxs_b_imm4_reg:
+	set_grs_a5a5
+
+	;; mulxs.b xx:4, rd
+	mov.w	#32, r1
+	set_ccr_zero
+	mulxs.b	#-2:4, r1
+
+	;; test ccr		; H=0 N=1 Z=0 V=0 C=0
+	test_neg_set
+	test_carry_clear
+	test_zero_clear
+	test_ovf_clear
+
+	test_gr_a5a5	0
+	test_h_gr16	-64	r1
+	test_gr_a5a5	2
+	test_gr_a5a5	3
+	test_gr_a5a5	4
+	test_gr_a5a5	5
+	test_gr_a5a5	6
+	test_gr_a5a5	7
+.endif				; h8sx
+
+mulxs_w_reg_reg:	
+	set_grs_a5a5
+
+	;; mulxs.w ers, erd
+	mov.w	#0x1000,  r1
+	mov.w	#-0x1000, r2
+	set_ccr_zero
+	mulxs.w	r2, er1
+
+	;; test ccr		; H=0 N=1 Z=0 V=0 C=0
+	test_neg_set
+	test_carry_clear
+	test_zero_clear
+	test_ovf_clear
+	
+	test_gr_a5a5	0
+	test_h_gr32	0xff000000	er1
+	test_h_gr32	0xa5a5f000	er2
+	test_gr_a5a5	3
+	test_gr_a5a5	4
+	test_gr_a5a5	5
+	test_gr_a5a5	6
+	test_gr_a5a5	7
+
+.if (sim_cpu == h8sx)
+mulxs_w_imm4_reg:
+	set_grs_a5a5
+
+	;; mulxs.w xx:4, rd
+	mov.w	#-1, r1
+	set_ccr_zero
+	mulxs.w	#2:4, er1
+
+	;; test ccr		; H=0 N=1 Z=0 V=0 C=0
+	test_neg_set
+	test_carry_clear
+	test_zero_clear
+	test_ovf_clear
+
+	test_gr_a5a5	0
+	test_h_gr32	-2	er1
+	test_gr_a5a5	2
+	test_gr_a5a5	3
+	test_gr_a5a5	4
+	test_gr_a5a5	5
+	test_gr_a5a5	6
+	test_gr_a5a5	7
+.endif				; h8sx
+.endif				; not h8
+
+mulxu_b_reg_reg:
+	set_grs_a5a5
+
+	;; mulxu.b rs, rd
+	mov.b	#32, r1l
+	mov.b	#-2, r2l
+	set_ccr_zero
+	mulxu.b	r2l, r1
+
+	;; test ccr		; H=0 N=0 Z=0 V=0 C=0
+	test_cc_clear
+	
+	test_gr_a5a5	0
+	test_h_gr16	0x1fc0	r1
+	test_h_gr16	0xa5fe  r2
+.if (sim_cpu)
+	test_h_gr32	0xa5a5a5fe	er2
+.endif
+	test_gr_a5a5	3
+	test_gr_a5a5	4
+	test_gr_a5a5	5
+	test_gr_a5a5	6
+	test_gr_a5a5	7
+
+.if (sim_cpu)			; not h8
+.if (sim_cpu == h8sx)
+mulxu_b_imm4_reg:
+	set_grs_a5a5
+
+	;; mulxu.b xx:4, rd
+	mov.b	#32, r1l
+	set_ccr_zero
+	mulxu.b	#-2:4, r1
+
+	;; test ccr		; H=0 N=0 Z=0 V=0 C=0
+	test_cc_clear
+
+	test_gr_a5a5	0
+	test_h_gr16	0x1c0	r1
+	test_gr_a5a5	2
+	test_gr_a5a5	3
+	test_gr_a5a5	4
+	test_gr_a5a5	5
+	test_gr_a5a5	6
+	test_gr_a5a5	7
+.endif				; h8sx
+
+mulxu_w_reg_reg:	
+	set_grs_a5a5
+
+	;; mulxu.w ers, erd
+	mov.w	#0x1000,  r1
+	mov.w	#-0x1000, r2
+	set_ccr_zero
+	mulxu.w	r2, er1
+
+	;; test ccr		; H=0 N=0 Z=0 V=0 C=0
+	test_cc_clear
+	
+	test_gr_a5a5	0
+	test_h_gr32	0x0f000000	er1
+	test_h_gr32	0xa5a5f000	er2
+	test_gr_a5a5	3
+	test_gr_a5a5	4
+	test_gr_a5a5	5
+	test_gr_a5a5	6
+	test_gr_a5a5	7
+
+.if (sim_cpu == h8sx)
+mulxu_w_imm4_reg:
+	set_grs_a5a5
+
+	;; mulxu.w xx:4, rd
+	mov.w	#-1, r1
+	set_ccr_zero
+	mulxu.w	#2:4, er1
+
+	;; test ccr		; H=0 N=0 Z=0 V=0 C=0
+	test_cc_clear
+
+	test_gr_a5a5	0
+	test_h_gr32	0x1fffe	er1
+	test_gr_a5a5	2
+	test_gr_a5a5	3
+	test_gr_a5a5	4
+	test_gr_a5a5	5
+	test_gr_a5a5	6
+	test_gr_a5a5	7
+.endif				; h8sx
+.endif				; not h8
+
+	pass
+
+	exit 0
diff --git a/sim/testsuite/sim/h8300/orb.s b/sim/testsuite/sim/h8300/orb.s
index fd06f08..72da8e6 100644
--- a/sim/testsuite/sim/h8300/orb.s
+++ b/sim/testsuite/sim/h8300/orb.s
@@ -24,6 +24,9 @@
 	# or.b reg8, @+erd	;         0 1 7     9 9 rd 4 rs
 	# or.b reg8, @-erd	;         0 1 7     9 b rd 4 rs
 	#
+	# orc  #xx:8, ccr
+	# orc  #xx:8, exr
+	
 
 	# Coming soon:
 	# ...
@@ -455,6 +458,8 @@
 	fail
 .L10:
 
+.endif
+
 orc_imm8_ccr:
 	set_grs_a5a5		; Fill all general regs with a fixed pattern
 	set_ccr_zero
@@ -486,8 +491,42 @@
 	test_gr_a5a5 6
 	test_gr_a5a5 7
 	
-.endif
+.if (sim_cpu == h8300s || sim_cpu == h8sx)	; Earlier versions, no exr
+orc_imm8_exr:
+	set_grs_a5a5		; Fill all general regs with a fixed pattern
 
+	ldc	#0, exr
+	stc	exr, r0l
+	test_h_gr8 0, r0l
+	
+	;;  orc #xx:8,exr
+
+	orc	#0x1, exr
+	stc	exr,r0l
+	test_h_gr8 1, r0l
+
+	orc	#0x2, exr
+	stc	exr,r0l
+	test_h_gr8 3, r0l
+
+	orc	#0x4, exr
+	stc	exr,r0l
+	test_h_gr8 7, r0l
+
+	orc	#0x80, exr
+	stc	exr,r0l
+	test_h_gr8 0x87, r0l
+
+	test_h_gr32  0xa5a5a587 er0
+	test_gr_a5a5 1		; Make sure other general regs not disturbed
+	test_gr_a5a5 2
+	test_gr_a5a5 3
+	test_gr_a5a5 4
+	test_gr_a5a5 5
+	test_gr_a5a5 6
+	test_gr_a5a5 7
+.endif				; not h8300 or h8300h
+	
 	pass
 
 	exit 0
diff --git a/sim/testsuite/sim/h8300/stack.s b/sim/testsuite/sim/h8300/stack.s
new file mode 100644
index 0000000..dd53445
--- /dev/null
+++ b/sim/testsuite/sim/h8300/stack.s
@@ -0,0 +1,445 @@
+# Hitachi H8 testcase 'ldc'
+# mach(): all
+# as(h8300):	--defsym sim_cpu=0
+# as(h8300h):	--defsym sim_cpu=1
+# as(h8300s):	--defsym sim_cpu=2
+# as(h8sx):	--defsym sim_cpu=3
+# ld(h8300h):	-m h8300helf
+# ld(h8300s):	-m h8300self
+# ld(h8sx):	-m h8300sxelf
+
+	.include "testutils.inc"
+
+	start
+
+.data
+	.align 4
+stack:	
+.if (sim_cpu == h8300)
+	.fill	128, 2, 0
+.else
+	.fill	128, 4, 0
+.endif
+stacktop:
+
+	.text
+
+push_w:
+	set_grs_a5a5		; Fill all general regs with a fixed pattern
+	set_ccr_zero
+.if (sim_cpu == h8300)
+	mov.w	#stacktop, r7
+.else
+	mov.l	#stacktop, er7
+.endif
+	push.w	r0		; a5a5 is negative
+	test_neg_set
+	test_carry_clear
+	test_zero_clear
+	test_ovf_clear
+	
+	push.w	r1
+	push.w	r2
+	push.w	r3
+
+	test_gr_a5a5 0
+	test_gr_a5a5 1
+	test_gr_a5a5 2
+	test_gr_a5a5 3
+	
+	mov	@stacktop-2, r0
+	test_gr_a5a5 0
+	mov	@stacktop-4, r0
+	test_gr_a5a5 0
+	mov	@stacktop-6, r0
+	test_gr_a5a5 0
+	mov	@stacktop-8, r0
+	test_gr_a5a5 0
+
+	mov.w	#1, r1
+	mov.w	#2, r2
+	mov.w	#3, r3
+	mov.w	#4, r4
+
+	push.w	r1		; #1 is non-negative, non-zero
+	test_cc_clear
+	
+	push.w	r2
+	push.w	r3
+	push.w	r4
+
+	test_h_gr16 1 r1
+	test_h_gr16 2 r2
+	test_h_gr16 3 r3
+	test_h_gr16 4 r4
+
+	mov	@stacktop-10, r0
+	test_h_gr16 1 r0
+	mov	@stacktop-12, r0
+	test_h_gr16 2 r0
+	mov	@stacktop-14, r0
+	test_h_gr16 3 r0
+	mov	@stacktop-16, r0
+	test_h_gr16 4 r0
+
+.if (sim_cpu == h8300)
+	test_h_gr16	4 r0
+	test_h_gr16	1 r1
+	test_h_gr16	2 r2
+	test_h_gr16	3 r3
+	test_h_gr16	4 r4
+;;; 	test_h_gr16	stacktop-16 r7	; FIXME
+.else
+	test_h_gr32	0xa5a50004  er0
+	test_h_gr32	0xa5a50001  er1
+	test_h_gr32	0xa5a50002  er2
+	test_h_gr32	0xa5a50003  er3
+	test_h_gr32	0xa5a50004  er4
+	test_h_gr32	stacktop-16 er7
+.endif
+	test_gr_a5a5	5
+	test_gr_a5a5	6
+
+pop_w:
+	set_grs_a5a5		; Fill all general regs with a fixed pattern
+	set_ccr_zero
+.if (sim_cpu == h8300)
+	mov.w	#stacktop-16, r7
+.else
+	mov.l	#stacktop-16, er7
+.endif
+	pop.w	r4
+	pop.w	r3
+	pop.w	r2
+	pop.w	r1		; Should set all flags zero
+	test_cc_clear
+
+	test_h_gr16	1 r1
+	test_h_gr16	2 r2
+	test_h_gr16	3 r3
+	test_h_gr16	4 r4
+
+	pop.w	r4
+	pop.w	r3
+	pop.w	r2
+	pop.w	r1		; a5a5 is negative
+	test_neg_set
+	test_carry_clear
+	test_zero_clear
+	test_ovf_clear
+
+	test_gr_a5a5	0
+	test_gr_a5a5	1
+	test_gr_a5a5	2
+	test_gr_a5a5	3
+	test_gr_a5a5	4
+	test_gr_a5a5	5
+	test_gr_a5a5	6
+.if (sim_cpu == h8300)
+;;; 	test_h_gr16	stacktop r7	; FIXME
+.else
+	test_h_gr32	stacktop er7
+.endif
+
+.if (sim_cpu)			; non-zero means not h8300
+push_l:
+	set_grs_a5a5		; Fill all general regs with a fixed pattern
+	set_ccr_zero
+	mov.l	#stacktop, er7
+	push.l	er0		; a5a5 is negative
+	test_neg_set
+	test_carry_clear
+	test_zero_clear
+	test_ovf_clear
+	
+	push.l	er1
+	push.l	er2
+	push.l	er3
+
+	test_gr_a5a5 0
+	test_gr_a5a5 1
+	test_gr_a5a5 2
+	test_gr_a5a5 3
+	
+	mov	@stacktop-4, er0
+	test_gr_a5a5 0
+	mov	@stacktop-8, er0
+	test_gr_a5a5 0
+	mov	@stacktop-12, er0
+	test_gr_a5a5 0
+	mov	@stacktop-16, er0
+	test_gr_a5a5 0
+
+	mov	#1, er1
+	mov	#2, er2
+	mov	#3, er3
+	mov	#4, er4
+
+	push.l	er1		; #1 is non-negative, non-zero
+	test_cc_clear
+	
+	push.l	er2
+	push.l	er3
+	push.l	er4
+
+	test_h_gr32 1 er1
+	test_h_gr32 2 er2
+	test_h_gr32 3 er3
+	test_h_gr32 4 er4
+
+	mov	@stacktop-20, er0
+	test_h_gr32 1 er0
+	mov	@stacktop-24, er0
+	test_h_gr32 2 er0
+	mov	@stacktop-28, er0
+	test_h_gr32 3 er0
+	mov	@stacktop-32, er0
+	test_h_gr32 4 er0
+
+	test_h_gr32	4  er0
+	test_h_gr32	1  er1
+	test_h_gr32	2  er2
+	test_h_gr32	3  er3
+	test_h_gr32	4  er4
+	test_gr_a5a5	5
+	test_gr_a5a5	6
+	test_h_gr32	stacktop-32 er7
+
+pop_l:
+	set_grs_a5a5		; Fill all general regs with a fixed pattern
+	set_ccr_zero
+	mov.l	#stacktop-32, er7
+	pop.l	er4
+	pop.l	er3
+	pop.l	er2
+	pop.l	er1		; Should set all flags zero
+	test_cc_clear
+
+	test_h_gr32	1 er1
+	test_h_gr32	2 er2
+	test_h_gr32	3 er3
+	test_h_gr32	4 er4
+
+	pop.l	er4
+	pop.l	er3
+	pop.l	er2
+	pop.l	er1		; a5a5 is negative
+	test_neg_set
+	test_carry_clear
+	test_zero_clear
+	test_ovf_clear
+
+	test_gr_a5a5	0
+	test_gr_a5a5	1
+	test_gr_a5a5	2
+	test_gr_a5a5	3
+	test_gr_a5a5	4
+	test_gr_a5a5	5
+	test_gr_a5a5	6
+	test_h_gr32	stacktop er7
+.endif
+
+	;; Jump over subroutine
+	jmp	_bsr
+
+bsr_jsr_func:	
+	test_ccr 0		; call should not affect ccr
+	mov.w	#0, r0
+	mov.w	#1, r1
+	mov.w	#2, r2
+	mov.w	#3, r3
+	mov.w	#4, r4
+	mov.w	#5, r5
+	mov.w	#6, r6
+	rts
+
+_bsr:	set_grs_a5a5
+.if (sim_cpu == h8300)
+	mov.w	#stacktop, r7
+.else
+	mov.l	#stacktop, er7
+.endif
+	set_ccr_zero
+	bsr	bsr_jsr_func
+
+	test_h_gr16	0 r0
+	test_h_gr16	1 r1
+	test_h_gr16	2 r2
+	test_h_gr16	3 r3
+	test_h_gr16	4 r4
+	test_h_gr16	5 r5
+	test_h_gr16	6 r6
+.if (sim_cpu == h8300)
+;;; 	test_h_gr16	stacktop, r7	; FIXME
+.else
+	test_h_gr32	stacktop, er7
+.endif
+
+_jsr:	set_grs_a5a5
+.if (sim_cpu == h8300)
+	mov.w	#stacktop, r7
+.else
+	mov.l	#stacktop, er7
+.endif
+	set_ccr_zero
+	jsr	bsr_jsr_func
+
+	test_h_gr16	0 r0
+	test_h_gr16	1 r1
+	test_h_gr16	2 r2
+	test_h_gr16	3 r3
+	test_h_gr16	4 r4
+	test_h_gr16	5 r5
+	test_h_gr16	6 r6
+.if (sim_cpu == h8300)
+;;; 	test_h_gr16	stacktop, r7	; FIXME
+.else
+	test_h_gr32	stacktop, er7
+.endif
+
+.if (sim_cpu)			; not zero ie. not h8300
+_trapa:
+	set_grs_a5a5
+	mov.l	#trap_handler, er7	; trap vector
+	mov.l	er7, @0x2c
+	mov.l	#stacktop, er7
+	set_ccr_zero
+	trapa	#3
+
+	test_cc_clear		; ccr should be restored by rte
+	test_h_gr16	0x10 r0
+	test_h_gr16	0x11 r1
+	test_h_gr16	0x12 r2
+	test_h_gr16	0x13 r3
+	test_h_gr16	0x14 r4
+	test_h_gr16	0x15 r5
+	test_h_gr16	0x16 r6
+	test_h_gr32	stacktop er7
+.endif
+
+.if (sim_cpu == h8sx)
+_rtsl:				; Test rts/l insn.
+	set_grs_a5a5
+	mov	#0,r0l
+	mov	#1,r1l
+	mov	#2,r2l
+	mov	#3,r3l
+	mov	#4,r4l
+	mov	#5,r5l
+	mov	#6,r6l
+	mov	#stacktop, er7
+
+	jsr	rtsl1_func
+	test_h_gr32	0xa5a5a500 er0
+	test_h_gr32	0xa5a5a501 er1
+	test_h_gr32	0xa5a5a502 er2
+	test_h_gr32	0xa5a5a503 er3
+	test_h_gr32	0xa5a5a504 er4
+	test_h_gr32	0xa5a5a505 er5
+	test_h_gr32	0xa5a5a506 er6
+	test_h_gr32	stacktop   er7
+
+	jsr	rtsl2_func
+	test_h_gr32	0xa5a5a500 er0
+	test_h_gr32	0xa5a5a501 er1
+	test_h_gr32	0xa5a5a502 er2
+	test_h_gr32	0xa5a5a503 er3
+	test_h_gr32	0xa5a5a504 er4
+	test_h_gr32	0xa5a5a505 er5
+	test_h_gr32	0xa5a5a506 er6
+	test_h_gr32	stacktop   er7
+
+	jsr	rtsl3_func
+	test_h_gr32	0xa5a5a500 er0
+	test_h_gr32	0xa5a5a501 er1
+	test_h_gr32	0xa5a5a502 er2
+	test_h_gr32	0xa5a5a503 er3
+	test_h_gr32	0xa5a5a504 er4
+	test_h_gr32	0xa5a5a505 er5
+	test_h_gr32	0xa5a5a506 er6
+	test_h_gr32	stacktop   er7
+
+	jsr	rtsl4_func
+	test_h_gr32	0xa5a5a500 er0
+	test_h_gr32	0xa5a5a501 er1
+	test_h_gr32	0xa5a5a502 er2
+	test_h_gr32	0xa5a5a503 er3
+	test_h_gr32	0xa5a5a504 er4
+	test_h_gr32	0xa5a5a505 er5
+	test_h_gr32	0xa5a5a506 er6
+	test_h_gr32	stacktop   er7
+.endif				; h8sx
+
+	pass
+
+	exit 0
+
+	;; Handler for a software exception (trap).
+trap_handler:
+	;; Test the 'i' interrupt mask flag.
+	stc	ccr, r0l
+	test_h_gr8	0x80, r0l
+	;; Change the registers (so we know we've been here)
+	mov.w	#0x10, r0
+	mov.w	#0x11, r1
+	mov.w	#0x12, r2
+	mov.w	#0x13, r3
+	mov.w	#0x14, r4
+	mov.w	#0x15, r5
+	mov.w	#0x16, r6
+	;; Change the ccr (which will be restored by RTE)
+	orc	#0xff, ccr
+	rte
+
+.if (sim_cpu == h8sx)
+	;; Functions for testing rts/l
+rtsl1_func:			; Save and restore R0
+	push.l	er0
+	;; Now modify it, and verify the modification.
+	mov	#0xfeedface, er0
+	test_h_gr32 0xfeedface, er0
+	;; Then use rts/l to restore them and return.
+	rts/l	er0
+
+rtsl2_func:			; Save and restore R5 and R6
+	push.l	er5
+	push.l	er6
+	;; Now modify them, and verify the modification.
+	mov	#0xdeadbeef, er5
+	mov	#0xfeedface, er6
+	test_h_gr32 0xdeadbeef, er5
+	test_h_gr32 0xfeedface, er6
+	;; Then use rts/l to restore them and return.
+	rts/l	(er5-er6)
+
+rtsl3_func:			; Save and restore R4, R5, and R6
+	push.l	er4
+	push.l	er5
+	push.l	er6
+	;; Now modify them, and verify the modification.
+	mov	#0xdeafcafe, er4
+	mov	#0xdeadbeef, er5
+	mov	#0xfeedface, er6
+	test_h_gr32 0xdeafcafe, er4
+	test_h_gr32 0xdeadbeef, er5
+	test_h_gr32 0xfeedface, er6
+	;; Then use rts/l to restore them and return.
+	rts/l	(er4-er6)
+
+rtsl4_func:			; Save and restore R0 - R3
+	push.l	er0
+	push.l	er1
+	push.l	er2
+	push.l	er3
+	;; Now modify them, and verify the modification.
+	mov	#0xdadacafe, er0
+	mov	#0xfeedbeef, er1
+	mov	#0xdeadface, er2
+	mov	#0xf00dd00d, er3
+	test_h_gr32 0xdadacafe, er0
+	test_h_gr32 0xfeedbeef, er1
+	test_h_gr32 0xdeadface, er2
+	test_h_gr32 0xf00dd00d, er3
+	;; Then use rts/l to restore them and return.
+	rts/l	(er0-er3)
+.endif				; h8sx
diff --git a/sim/testsuite/sim/h8300/subs.s b/sim/testsuite/sim/h8300/subs.s
new file mode 100644
index 0000000..1bb5eea
--- /dev/null
+++ b/sim/testsuite/sim/h8300/subs.s
@@ -0,0 +1,74 @@
+# Hitachi H8 testcase 'subs'
+# mach(): h8300h h8300s h8sx
+# as(h8300):	--defsym sim_cpu=0
+# as(h8300h):	--defsym sim_cpu=1
+# as(h8300s):	--defsym sim_cpu=2
+# as(h8sx):	--defsym sim_cpu=3
+# ld(h8300h):	-m h8300helf
+# ld(h8300s):	-m h8300self
+# ld(h8sx):	-m h8300sxelf	
+
+	.include "testutils.inc"
+
+	# Instructions tested:
+	# subs #1, erd		; 1 b 0 0erd
+	# subs #2, erd		; 1 b 8 0erd
+	# subs #4, erd		; 1 b 9 0erd
+	#
+
+	start
+.if (sim_cpu)			; 32 bit only
+subs_1:	
+	set_grs_a5a5
+	set_ccr_zero
+
+	subs	#1, er0
+
+	test_cc_clear		; subs should not affect any condition codes
+	test_h_gr32  0xa5a5a5a4 er0	; result of subs #1
+
+	test_gr_a5a5 1		; Make sure other general regs not disturbed
+	test_gr_a5a5 2
+	test_gr_a5a5 3
+	test_gr_a5a5 4
+	test_gr_a5a5 5
+	test_gr_a5a5 6
+	test_gr_a5a5 7
+
+subs_2:
+	set_grs_a5a5
+	set_ccr_zero
+
+	subs	#2, er0
+
+	test_cc_clear		; subs should not affect any condition codes
+	test_h_gr32  0xa5a5a5a3 er0	; result of subs #2
+
+	test_gr_a5a5 1		; Make sure other general regs not disturbed
+	test_gr_a5a5 2
+	test_gr_a5a5 3
+	test_gr_a5a5 4
+	test_gr_a5a5 5
+	test_gr_a5a5 6
+	test_gr_a5a5 7
+
+subs_4:	
+	set_grs_a5a5
+	set_ccr_zero
+
+	subs	#4, er0
+
+	test_cc_clear		; subs should not affect any condition codes
+	test_h_gr32  0xa5a5a5a1 er0	; result of subs #4
+
+	test_gr_a5a5 1		; Make sure other general regs not disturbed
+	test_gr_a5a5 2
+	test_gr_a5a5 3
+	test_gr_a5a5 4
+	test_gr_a5a5 5
+	test_gr_a5a5 6
+	test_gr_a5a5 7
+
+	pass
+.endif	
+	exit 0
diff --git a/sim/testsuite/sim/h8300/subx.s b/sim/testsuite/sim/h8300/subx.s
new file mode 100644
index 0000000..78656bc
--- /dev/null
+++ b/sim/testsuite/sim/h8300/subx.s
@@ -0,0 +1,1010 @@
+# Hitachi H8 testcase 'subx'
+# mach(): all
+# as(h8300):	--defsym sim_cpu=0
+# as(h8300h):	--defsym sim_cpu=1
+# as(h8300s):	--defsym sim_cpu=2
+# as(h8sx):	--defsym sim_cpu=3
+# ld(h8300h):	-m h8300helf
+# ld(h8300s):	-m h8300self
+# ld(h8sx):	-m h8300sxelf	
+
+	.include "testutils.inc"
+
+	# Instructions tested:
+	# subx.b #xx:8, rd8	; b rd8 xxxxxxxx
+	# subx.b #xx:8, @erd	; 7 d erd ???? b ???? xxxxxxxx 
+	# subx.b #xx:8, @erd-	; 0 1 7 6 6 c erd 1??? b ???? xxxxxxxx
+	# subx.b rs8, rd8	; 1 e rs8 rd8
+	# subx.b rs8, @erd	; 7 d erd ???? 1 e rs8 ????
+	# subx.b rs8, @erd-	; 0 1 7 6 6 c erd 1??? 1 e rs8 ????
+	# subx.b @ers, rd8	; 7 c ers ???? 1 e ???? rd8
+	# subx.b @ers-, rd8	; 0 1 7 6 6 c ers 00?? 1 e ???? rd8
+	# subx.b @ers, @erd	; 0 1 7 4 6 8 ers d 0 erd 3 ???? 
+	# subx.b @ers-, @erd-	; 0 1 7 6 6 c ers d a erd 3 ????
+	#
+	# word ops
+	# long ops	
+
+.data
+byte_src:	.byte 0x5
+byte_dest:	.byte 0
+
+	.align 2
+word_src:	.word 0x505
+word_dest:	.word 0
+
+	.align 4
+long_src:	.long 0x50505
+long_dest:	.long 0
+
+
+	start
+
+subx_b_imm8_0:
+	set_grs_a5a5		; Fill all general regs with a fixed pattern
+	set_ccr_zero
+
+	;;  subx.b #xx:8,Rd	; Subx with carry initially zero.
+	subx.b	#5, r0l		; Immediate 8-bit operand
+
+	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
+	test_ovf_clear
+	test_zero_clear
+	test_neg_set
+
+	test_h_gr16 0xa5a0 r0	; sub result:	a5 - 5
+.if (sim_cpu)			; non-zero means h8300h, s, or sx
+	test_h_gr32 0xa5a5a5a0 er0	; sub result:	 a5 - 5
+.endif
+	test_gr_a5a5 1		; Make sure other general regs not disturbed
+	test_gr_a5a5 2
+	test_gr_a5a5 3
+	test_gr_a5a5 4
+	test_gr_a5a5 5
+	test_gr_a5a5 6
+	test_gr_a5a5 7
+	
+subx_b_imm8_1:
+	set_grs_a5a5		; Fill all general regs with a fixed pattern
+	set_ccr_zero
+
+	;;  subx.b #xx:8,Rd	; Subx with carry initially one.
+	set_carry_flag
+	subx.b	#4, r0l		; Immediate 8-bit operand
+
+	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
+	test_ovf_clear
+	test_zero_clear
+	test_neg_set
+
+	test_h_gr16 0xa5a0 r0	; sub result:	a5 - (4 + 1)
+.if (sim_cpu)			; non-zero means h8300h, s, or sx
+	test_h_gr32 0xa5a5a5a0 er0	; sub result:	 a5 - (4 + 1)
+.endif
+	test_gr_a5a5 1		; Make sure other general regs not disturbed
+	test_gr_a5a5 2
+	test_gr_a5a5 3
+	test_gr_a5a5 4
+	test_gr_a5a5 5
+	test_gr_a5a5 6
+	test_gr_a5a5 7
+	
+.if (sim_cpu == h8sx)
+subx_b_imm8_rdind:
+	set_grs_a5a5		; Fill all general regs with a fixed pattern
+
+	;;  subx.b #xx:8,@eRd	; Subx to register indirect
+	mov	#byte_dest, er0
+	mov.b	#0xa5, @er0
+	set_ccr_zero
+	subx.b	#5, @er0
+
+	test_carry_clear	; H=0 N=0 Z=0 V=0 C=0
+	test_ovf_clear
+	test_zero_clear
+	test_neg_set
+
+	test_h_gr32 byte_dest er0	; er0 still contains subress
+
+	test_gr_a5a5 1		; Make sure other general regs not disturbed
+	test_gr_a5a5 2
+	test_gr_a5a5 3
+	test_gr_a5a5 4
+	test_gr_a5a5 5
+	test_gr_a5a5 6
+	test_gr_a5a5 7
+
+	;; Now check the result of the sub to memory.
+	cmp.b	#0xa0, @byte_dest
+	beq	.Lb1
+	fail
+.Lb1:
+
+subx_b_imm8_rdpostdec:
+	set_grs_a5a5		; Fill all general regs with a fixed pattern
+
+	;;  subx.b #xx:8,@eRd-	; Subx to register post-decrement
+	mov	#byte_dest, er0
+	mov.b	#0xa5, @er0
+	set_ccr_zero
+	subx.b	#5, @er0-
+
+	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
+	test_ovf_clear
+	test_zero_clear
+	test_neg_set
+
+	test_h_gr32 byte_dest-1 er0	; er0 contains subress minus one
+
+	test_gr_a5a5 1		; Make sure other general regs not disturbed
+	test_gr_a5a5 2
+	test_gr_a5a5 3
+	test_gr_a5a5 4
+	test_gr_a5a5 5
+	test_gr_a5a5 6
+	test_gr_a5a5 7
+
+	;; Now check the result of the sub to memory.
+	cmp.b	#0xa0, @byte_dest
+	beq	.Lb2
+	fail
+.Lb2:
+.endif
+
+subx_b_reg8_0:
+	set_grs_a5a5		; Fill all general regs with a fixed pattern
+
+	;;  subx.b Rs,Rd	; subx with carry initially zero
+	mov.b	#5, r0h
+	set_ccr_zero
+	subx.b	r0h, r0l	; Register operand
+
+	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
+	test_ovf_clear
+	test_zero_clear
+	test_neg_set
+
+	test_h_gr16 0x05a0 r0	; sub result:	a5 - 5
+.if (sim_cpu)			; non-zero means h8300h, s, or sx
+	test_h_gr32 0xa5a505a0 er0	; sub result:	a5 - 5
+.endif
+	test_gr_a5a5 1		; Make sure other general regs not disturbed
+	test_gr_a5a5 2
+	test_gr_a5a5 3
+	test_gr_a5a5 4
+	test_gr_a5a5 5
+	test_gr_a5a5 6
+	test_gr_a5a5 7
+
+subx_b_reg8_1:
+	set_grs_a5a5		; Fill all general regs with a fixed pattern
+
+	;;  subx.b Rs,Rd	; subx with carry initially one
+	mov.b	#4, r0h
+	set_ccr_zero
+	set_carry_flag
+	subx.b	r0h, r0l	; Register operand
+
+	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
+	test_ovf_clear
+	test_zero_clear
+	test_neg_set
+
+	test_h_gr16 0x04a0 r0	; sub result:	a5 - (4 + 1)
+.if (sim_cpu)			; non-zero means h8300h, s, or sx
+	test_h_gr32 0xa5a504a0 er0	; sub result:	a5 - (4 + 1)
+.endif
+	test_gr_a5a5 1		; Make sure other general regs not disturbed
+	test_gr_a5a5 2
+	test_gr_a5a5 3
+	test_gr_a5a5 4
+	test_gr_a5a5 5
+	test_gr_a5a5 6
+	test_gr_a5a5 7
+	
+.if (sim_cpu == h8sx)
+subx_b_reg8_rdind:
+	set_grs_a5a5		; Fill all general regs with a fixed pattern
+
+	;;  subx.b rs8,@eRd	; Subx to register indirect
+	mov	#byte_dest, er0
+	mov.b	#0xa5, @er0
+	mov.b	#5, r1l
+	set_ccr_zero
+	subx.b	r1l, @er0
+
+	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
+	test_ovf_clear
+	test_zero_clear
+	test_neg_set
+
+	test_h_gr32 byte_dest er0	; er0 still contains subress
+	test_h_gr32 0xa5a5a505 er1	; er1 has the test load
+
+	test_gr_a5a5 2		; Make sure other general regs not disturbed
+	test_gr_a5a5 3
+	test_gr_a5a5 4
+	test_gr_a5a5 5
+	test_gr_a5a5 6
+	test_gr_a5a5 7
+
+	;; Now check the result of the sub to memory.
+	cmp.b	#0xa0, @byte_dest
+	beq	.Lb3
+	fail
+.Lb3:
+
+subx_b_reg8_rdpostdec:
+	set_grs_a5a5		; Fill all general regs with a fixed pattern
+
+	;;  subx.b rs8,@eRd-	; Subx to register post-decrement
+	mov	#byte_dest, er0
+	mov.b	#0xa5, @er0
+	mov.b	#5, r1l
+	set_ccr_zero
+	subx.b	r1l, @er0-
+
+	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
+	test_ovf_clear
+	test_zero_clear
+	test_neg_set
+
+	test_h_gr32 byte_dest-1 er0	; er0 contains subress minus one
+	test_h_gr32 0xa5a5a505 er1	; er1 contains the test load
+
+	test_gr_a5a5 2		; Make sure other general regs not disturbed
+	test_gr_a5a5 3
+	test_gr_a5a5 4
+	test_gr_a5a5 5
+	test_gr_a5a5 6
+	test_gr_a5a5 7
+
+	;; Now check the result of the sub to memory.
+	cmp.b	#0xa0, @byte_dest
+	beq	.Lb4
+	fail
+.Lb4:
+
+subx_b_rsind_reg8:
+	set_grs_a5a5		; Fill all general regs with a fixed pattern
+
+	;;  subx.b @eRs,rd8	; Subx from reg indirect to reg
+	mov	#byte_src, er0
+	set_ccr_zero
+	subx.b	@er0, r1l
+
+	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
+	test_ovf_clear
+	test_zero_clear
+	test_neg_set
+
+	test_h_gr32 byte_src er0	; er0 still contains subress
+	test_h_gr32 0xa5a5a5a0 er1	; er1 contains the sum
+
+	test_gr_a5a5 2		; Make sure other general regs not disturbed
+	test_gr_a5a5 3
+	test_gr_a5a5 4
+	test_gr_a5a5 5
+	test_gr_a5a5 6
+	test_gr_a5a5 7
+
+subx_b_rspostdec_reg8:
+	set_grs_a5a5		; Fill all general regs with a fixed pattern
+
+	;;  subx.b @eRs-,rd8	; Subx to register post-decrement
+	mov	#byte_src, er0
+	set_ccr_zero
+	subx.b	@er0-, r1l
+
+	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
+	test_ovf_clear
+	test_zero_clear
+	test_neg_set
+
+	test_h_gr32 byte_src-1 er0	; er0 contains subress minus one
+	test_h_gr32 0xa5a5a5a0 er1	; er1 contains the sum
+
+	test_gr_a5a5 2		; Make sure other general regs not disturbed
+	test_gr_a5a5 3
+	test_gr_a5a5 4
+	test_gr_a5a5 5
+	test_gr_a5a5 6
+	test_gr_a5a5 7
+
+subx_b_rsind_rdind:
+	set_grs_a5a5		; Fill all general regs with a fixed pattern
+
+	;;  subx.b @eRs,rd8	; Subx from reg indirect to reg
+	mov	#byte_src, er0
+	mov	#byte_dest, er1
+	mov.b	#0xa5, @er1
+	set_ccr_zero
+	subx.b	@er0, @er1
+
+	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
+	test_ovf_clear
+	test_zero_clear
+	test_neg_set
+
+	test_h_gr32 byte_src er0	; er0 still contains src subress
+	test_h_gr32 byte_dest er1	; er1 still contains dst subress
+
+	test_gr_a5a5 2		; Make sure other general regs not disturbed
+	test_gr_a5a5 3
+	test_gr_a5a5 4
+	test_gr_a5a5 5
+	test_gr_a5a5 6
+	test_gr_a5a5 7
+	;; Now check the result of the sub to memory.
+	cmp.b	#0xa0, @byte_dest
+	beq	.Lb5
+	fail
+.Lb5:
+
+subx_b_rspostdec_rdpostdec:
+	set_grs_a5a5		; Fill all general regs with a fixed pattern
+
+	mov	#byte_src, er0
+	mov	#byte_dest, er1
+	mov.b	#0xa5, @er1
+	set_ccr_zero
+	;;  subx.b @eRs-,@erd-	; Subx post-decrement to post-decrement
+	subx.b	@er0-, @er1-
+
+	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
+	test_ovf_clear
+	test_zero_clear
+	test_neg_set
+
+	test_h_gr32 byte_src-1 er0	; er0 contains src subress minus one
+	test_h_gr32 byte_dest-1 er1	; er1 contains dst subress minus one
+
+	test_gr_a5a5 2		; Make sure other general regs not disturbed
+	test_gr_a5a5 3
+	test_gr_a5a5 4
+	test_gr_a5a5 5
+	test_gr_a5a5 6
+	test_gr_a5a5 7
+	;; Now check the result of the sub to memory.
+	cmp.b	#0xa0, @byte_dest
+	beq	.Lb6
+	fail
+.Lb6:
+
+subx_w_imm16_0:
+	set_grs_a5a5		; Fill all general regs with a fixed pattern
+	set_ccr_zero
+
+	;;  subx.w #xx:16,Rd	; Subx with carry initially zero.
+	subx.w	#0x505, r0	; Immediate 16-bit operand
+
+	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
+	test_ovf_clear
+	test_zero_clear
+	test_neg_set
+
+	test_h_gr16 0xa0a0 r0	; sub result:	0xa5a5 + 0x505
+	test_h_gr32 0xa5a5a0a0 er0	; sub result:	 0xa5a5 + 0x505
+	test_gr_a5a5 1		; Make sure other general regs not disturbed
+	test_gr_a5a5 2
+	test_gr_a5a5 3
+	test_gr_a5a5 4
+	test_gr_a5a5 5
+	test_gr_a5a5 6
+	test_gr_a5a5 7
+	
+subx_w_imm16_1:
+	set_grs_a5a5		; Fill all general regs with a fixed pattern
+	set_ccr_zero
+
+	;;  subx.w #xx:16,Rd	; Subx with carry initially one.
+	set_carry_flag
+	subx.w	#0x504, r0	; Immediate 16-bit operand
+
+	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
+	test_ovf_clear
+	test_zero_clear
+	test_neg_set
+
+	test_h_gr16 0xa0a0 r0	; sub result:	0xa5a5 + 0x505 + 1
+	test_h_gr32 0xa5a5a0a0 er0	; sub result:	 0xa5a5 + 0x505 + 1
+	test_gr_a5a5 1		; Make sure other general regs not disturbed
+	test_gr_a5a5 2
+	test_gr_a5a5 3
+	test_gr_a5a5 4
+	test_gr_a5a5 5
+	test_gr_a5a5 6
+	test_gr_a5a5 7
+	
+subx_w_imm16_rdind:
+	set_grs_a5a5		; Fill all general regs with a fixed pattern
+
+	;;  subx.w #xx:16,@eRd	; Subx to register indirect
+	mov	#word_dest, er0
+	mov.w	#0xa5a5, @er0
+	set_ccr_zero
+	subx.w	#0x505, @er0
+
+	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
+	test_ovf_clear
+	test_zero_clear
+	test_neg_set
+
+	test_h_gr32 word_dest er0	; er0 still contains subress
+
+	test_gr_a5a5 1		; Make sure other general regs not disturbed
+	test_gr_a5a5 2
+	test_gr_a5a5 3
+	test_gr_a5a5 4
+	test_gr_a5a5 5
+	test_gr_a5a5 6
+	test_gr_a5a5 7
+
+	;; Now check the result of the sub to memory.
+	cmp.w	#0xa0a0, @word_dest
+	beq	.Lw1
+	fail
+.Lw1:
+
+subx_w_imm16_rdpostdec:
+	set_grs_a5a5		; Fill all general regs with a fixed pattern
+
+	;;  subx.w #xx:16,@eRd-	; Subx to register post-decrement
+	mov	#word_dest, er0
+	mov.w	#0xa5a5, @er0
+	set_ccr_zero
+	subx.w	#0x505, @er0-
+
+	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
+	test_ovf_clear
+	test_zero_clear
+	test_neg_set
+
+	test_h_gr32 word_dest-2 er0	; er0 contains subress minus one
+
+	test_gr_a5a5 1		; Make sure other general regs not disturbed
+	test_gr_a5a5 2
+	test_gr_a5a5 3
+	test_gr_a5a5 4
+	test_gr_a5a5 5
+	test_gr_a5a5 6
+	test_gr_a5a5 7
+
+	;; Now check the result of the sub to memory.
+	cmp.w	#0xa0a0, @word_dest
+	beq	.Lw2
+	fail
+.Lw2:
+
+subx_w_reg16_0:
+	set_grs_a5a5		; Fill all general regs with a fixed pattern
+
+	;;  subx.w Rs,Rd	; subx with carry initially zero
+	mov.w	#0x505, e0
+	set_ccr_zero
+	subx.w	e0, r0		; Register operand
+
+	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
+	test_ovf_clear
+	test_zero_clear
+	test_neg_set
+
+	test_h_gr32 0x0505a0a0 er0	; sub result:
+	test_gr_a5a5 1		; Make sure other general regs not disturbed
+	test_gr_a5a5 2
+	test_gr_a5a5 3
+	test_gr_a5a5 4
+	test_gr_a5a5 5
+	test_gr_a5a5 6
+	test_gr_a5a5 7
+
+subx_w_reg16_1:
+	set_grs_a5a5		; Fill all general regs with a fixed pattern
+
+	;;  subx.w Rs,Rd	; subx with carry initially one
+	mov.w	#0x504, e0
+	set_ccr_zero
+	set_carry_flag
+	subx.w	e0, r0		; Register operand
+
+	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
+	test_ovf_clear
+	test_zero_clear
+	test_neg_set
+
+	test_h_gr32 0x0504a0a0 er0	; sub result:
+	test_gr_a5a5 1		; Make sure other general regs not disturbed
+	test_gr_a5a5 2
+	test_gr_a5a5 3
+	test_gr_a5a5 4
+	test_gr_a5a5 5
+	test_gr_a5a5 6
+	test_gr_a5a5 7
+	
+subx_w_reg16_rdind:
+	set_grs_a5a5		; Fill all general regs with a fixed pattern
+
+	;;  subx.w rs8,@eRd	; Subx to register indirect
+	mov	#word_dest, er0
+	mov.w	#0xa5a5, @er0
+	mov.w	#0x505, r1
+	set_ccr_zero
+	subx.w	r1, @er0
+
+	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
+	test_ovf_clear
+	test_zero_clear
+	test_neg_set
+
+	test_h_gr32 word_dest er0	; er0 still contains subress
+	test_h_gr32 0xa5a50505 er1	; er1 has the test load
+
+	test_gr_a5a5 2		; Make sure other general regs not disturbed
+	test_gr_a5a5 3
+	test_gr_a5a5 4
+	test_gr_a5a5 5
+	test_gr_a5a5 6
+	test_gr_a5a5 7
+
+	;; Now check the result of the sub to memory.
+	cmp.w	#0xa0a0, @word_dest
+	beq	.Lw3
+	fail
+.Lw3:
+
+subx_w_reg16_rdpostdec:
+	set_grs_a5a5		; Fill all general regs with a fixed pattern
+
+	;;  subx.w rs8,@eRd-	; Subx to register post-decrement
+	mov	#word_dest, er0
+	mov.w	#0xa5a5, @er0
+	mov.w	#0x505, r1
+	set_ccr_zero
+	subx.w	r1, @er0-
+
+	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
+	test_ovf_clear
+	test_zero_clear
+	test_neg_set
+
+	test_h_gr32 word_dest-2 er0	; er0 contains subress minus one
+	test_h_gr32 0xa5a50505  er1	; er1 contains the test load
+
+	test_gr_a5a5 2		; Make sure other general regs not disturbed
+	test_gr_a5a5 3
+	test_gr_a5a5 4
+	test_gr_a5a5 5
+	test_gr_a5a5 6
+	test_gr_a5a5 7
+
+	;; Now check the result of the sub to memory.
+	cmp.w	#0xa0a0, @word_dest
+	beq	.Lw4
+	fail
+.Lw4:
+
+subx_w_rsind_reg16:
+	set_grs_a5a5		; Fill all general regs with a fixed pattern
+
+	;;  subx.w @eRs,rd8	; Subx from reg indirect to reg
+	mov	#word_src, er0
+	set_ccr_zero
+	subx.w	@er0, r1
+
+	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
+	test_ovf_clear
+	test_zero_clear
+	test_neg_set
+
+	test_h_gr32 word_src er0	; er0 still contains subress
+	test_h_gr32 0xa5a5a0a0 er1	; er1 contains the sum
+
+	test_gr_a5a5 2		; Make sure other general regs not disturbed
+	test_gr_a5a5 3
+	test_gr_a5a5 4
+	test_gr_a5a5 5
+	test_gr_a5a5 6
+	test_gr_a5a5 7
+
+subx_w_rspostdec_reg16:
+	set_grs_a5a5		; Fill all general regs with a fixed pattern
+
+	;;  subx.w @eRs-,rd8	; Subx to register post-decrement
+	mov	#word_src, er0
+	set_ccr_zero
+	subx.w	@er0-, r1
+
+	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
+	test_ovf_clear
+	test_zero_clear
+	test_neg_set
+
+	test_h_gr32 word_src-2 er0	; er0 contains subress minus one
+	test_h_gr32 0xa5a5a0a0 er1	; er1 contains the sum
+
+	test_gr_a5a5 2		; Make sure other general regs not disturbed
+	test_gr_a5a5 3
+	test_gr_a5a5 4
+	test_gr_a5a5 5
+	test_gr_a5a5 6
+	test_gr_a5a5 7
+
+subx_w_rsind_rdind:
+	set_grs_a5a5		; Fill all general regs with a fixed pattern
+
+	;;  subx.w @eRs,rd8	; Subx from reg indirect to reg
+	mov	#word_src, er0
+	mov	#word_dest, er1
+	mov.w	#0xa5a5, @er1
+	set_ccr_zero
+	subx.w	@er0, @er1
+
+	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
+	test_ovf_clear
+	test_zero_clear
+	test_neg_set
+
+	test_h_gr32 word_src er0	; er0 still contains src subress
+	test_h_gr32 word_dest er1	; er1 still contains dst subress
+
+	test_gr_a5a5 2		; Make sure other general regs not disturbed
+	test_gr_a5a5 3
+	test_gr_a5a5 4
+	test_gr_a5a5 5
+	test_gr_a5a5 6
+	test_gr_a5a5 7
+	;; Now check the result of the sub to memory.
+	cmp.w	#0xa0a0, @word_dest
+	beq	.Lw5
+	fail
+.Lw5:
+
+subx_w_rspostdec_rdpostdec:
+	set_grs_a5a5		; Fill all general regs with a fixed pattern
+
+	;;  subx.w @eRs-,rd8	; Subx to register post-decrement
+	mov	#word_src, er0
+	mov	#word_dest, er1
+	mov.w	#0xa5a5, @er1
+	set_ccr_zero
+	subx.w	@er0-, @er1-
+
+	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
+	test_ovf_clear
+	test_zero_clear
+	test_neg_set
+
+	test_h_gr32 word_src-2 er0	; er0 contains src subress minus one
+	test_h_gr32 word_dest-2 er1	; er1 contains dst subress minus one
+
+	test_gr_a5a5 2		; Make sure other general regs not disturbed
+	test_gr_a5a5 3
+	test_gr_a5a5 4
+	test_gr_a5a5 5
+	test_gr_a5a5 6
+	test_gr_a5a5 7
+	;; Now check the result of the sub to memory.
+	cmp.w	#0xa0a0, @word_dest
+	beq	.Lw6
+	fail
+.Lw6:
+
+subx_l_imm32_0:
+	set_grs_a5a5		; Fill all general regs with a fixed pattern
+	set_ccr_zero
+
+	;;  subx.l #xx:32,Rd	; Subx with carry initially zero.
+	subx.l	#0x50505, er0	; Immediate 32-bit operand
+
+	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
+	test_ovf_clear
+	test_zero_clear
+	test_neg_set
+
+	test_h_gr32 0xa5a0a0a0 er0	; sub result:
+	test_gr_a5a5 1		; Make sure other general regs not disturbed
+	test_gr_a5a5 2
+	test_gr_a5a5 3
+	test_gr_a5a5 4
+	test_gr_a5a5 5
+	test_gr_a5a5 6
+	test_gr_a5a5 7
+	
+subx_l_imm32_1:
+	set_grs_a5a5		; Fill all general regs with a fixed pattern
+	set_ccr_zero
+
+	;;  subx.l #xx:32,Rd	; Subx with carry initially one.
+	set_carry_flag
+	subx.l	#0x50504, er0	; Immediate 32-bit operand
+
+	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
+	test_ovf_clear
+	test_zero_clear
+	test_neg_set
+
+	test_h_gr32 0xa5a0a0a0 er0	; sub result:
+	test_gr_a5a5 1		; Make sure other general regs not disturbed
+	test_gr_a5a5 2
+	test_gr_a5a5 3
+	test_gr_a5a5 4
+	test_gr_a5a5 5
+	test_gr_a5a5 6
+	test_gr_a5a5 7
+	
+subx_l_imm32_rdind:
+	set_grs_a5a5		; Fill all general regs with a fixed pattern
+
+	;;  subx.l #xx:32,@eRd	; Subx to register indirect
+	mov	#long_dest, er0
+	mov.l	#0xa5a5a5a5, @er0
+	set_ccr_zero
+	subx.l	#0x50505, @er0
+
+	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
+	test_ovf_clear
+	test_zero_clear
+	test_neg_set
+
+	test_h_gr32 long_dest er0	; er0 still contains subress
+
+	test_gr_a5a5 1		; Make sure other general regs not disturbed
+	test_gr_a5a5 2
+	test_gr_a5a5 3
+	test_gr_a5a5 4
+	test_gr_a5a5 5
+	test_gr_a5a5 6
+	test_gr_a5a5 7
+
+	;; Now check the result of the sub to memory.
+	cmp.l	#0xa5a0a0a0, @long_dest
+	beq	.Ll1
+	fail
+.Ll1:
+
+subx_l_imm32_rdpostdec:
+	set_grs_a5a5		; Fill all general regs with a fixed pattern
+
+	;;  subx.l #xx:32,@eRd-	; Subx to register post-decrement
+	mov	#long_dest, er0
+	mov.l	#0xa5a5a5a5, @er0
+	set_ccr_zero
+	subx.l	#0x50505, @er0-
+
+	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
+	test_ovf_clear
+	test_zero_clear
+	test_neg_set
+
+	test_h_gr32 long_dest-4 er0	; er0 contains subress minus one
+
+	test_gr_a5a5 1		; Make sure other general regs not disturbed
+	test_gr_a5a5 2
+	test_gr_a5a5 3
+	test_gr_a5a5 4
+	test_gr_a5a5 5
+	test_gr_a5a5 6
+	test_gr_a5a5 7
+
+	;; Now check the result of the sub to memory.
+	cmp.l	#0xa5a0a0a0, @long_dest
+	beq	.Ll2
+	fail
+.Ll2:
+
+subx_l_reg32_0:
+	set_grs_a5a5		; Fill all general regs with a fixed pattern
+
+	;;  subx.l Rs,Rd	; subx with carry initially zero
+	mov.l	#0x50505, er0
+	set_ccr_zero
+	subx.l	er0, er1	; Register operand
+
+	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
+	test_ovf_clear
+	test_zero_clear
+	test_neg_set
+
+	test_h_gr32 0x50505    er0	; sub load
+	test_h_gr32 0xa5a0a0a0 er1	; sub result:
+	test_gr_a5a5 2		; Make sure other general regs not disturbed
+	test_gr_a5a5 3
+	test_gr_a5a5 4
+	test_gr_a5a5 5
+	test_gr_a5a5 6
+	test_gr_a5a5 7
+
+subx_l_reg32_1:
+	set_grs_a5a5		; Fill all general regs with a fixed pattern
+
+	;;  subx.l Rs,Rd	; subx with carry initially one
+	mov.l	#0x50504, er0
+	set_ccr_zero
+	set_carry_flag
+	subx.l	er0, er1	; Register operand
+
+	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
+	test_ovf_clear
+	test_zero_clear
+	test_neg_set
+
+	test_h_gr32 0x50504    er0	; sub result:
+	test_h_gr32 0xa5a0a0a0 er1	; sub result:
+	test_gr_a5a5 2		; Make sure other general regs not disturbed
+	test_gr_a5a5 3
+	test_gr_a5a5 4
+	test_gr_a5a5 5
+	test_gr_a5a5 6
+	test_gr_a5a5 7
+	
+subx_l_reg32_rdind:
+	set_grs_a5a5		; Fill all general regs with a fixed pattern
+
+	;;  subx.l rs8,@eRd	; Subx to register indirect
+	mov	#long_dest, er0
+	mov.l	er1, @er0
+	mov.l	#0x50505, er1
+	set_ccr_zero
+	subx.l	er1, @er0
+
+	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
+	test_ovf_clear
+	test_zero_clear
+	test_neg_set
+
+	test_h_gr32 long_dest er0	; er0 still contains subress
+	test_h_gr32 0x50505   er1	; er1 has the test load
+
+	test_gr_a5a5 2		; Make sure other general regs not disturbed
+	test_gr_a5a5 3
+	test_gr_a5a5 4
+	test_gr_a5a5 5
+	test_gr_a5a5 6
+	test_gr_a5a5 7
+
+	;; Now check the result of the sub to memory.
+	cmp.l	#0xa5a0a0a0, @long_dest
+	beq	.Ll3
+	fail
+.Ll3:
+
+subx_l_reg32_rdpostdec:
+	set_grs_a5a5		; Fill all general regs with a fixed pattern
+
+	;;  subx.l rs8,@eRd-	; Subx to register post-decrement
+	mov	#long_dest, er0
+	mov.l	er1, @er0
+	mov.l	#0x50505, er1
+	set_ccr_zero
+	subx.l	er1, @er0-
+
+	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
+	test_ovf_clear
+	test_zero_clear
+	test_neg_set
+
+	test_h_gr32 long_dest-4 er0	; er0 contains subress minus one
+	test_h_gr32 0x50505     er1	; er1 contains the test load
+
+	test_gr_a5a5 2		; Make sure other general regs not disturbed
+	test_gr_a5a5 3
+	test_gr_a5a5 4
+	test_gr_a5a5 5
+	test_gr_a5a5 6
+	test_gr_a5a5 7
+
+	;; Now check the result of the sub to memory.
+	cmp.l	#0xa5a0a0a0, @long_dest
+	beq	.Ll4
+	fail
+.Ll4:
+
+subx_l_rsind_reg32:
+	set_grs_a5a5		; Fill all general regs with a fixed pattern
+
+	;;  subx.l @eRs,rd8	; Subx from reg indirect to reg
+	mov	#long_src, er0
+	set_ccr_zero
+	subx.l	@er0, er1
+
+	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
+	test_ovf_clear
+	test_zero_clear
+	test_neg_set
+
+	test_h_gr32 long_src er0	; er0 still contains subress
+	test_h_gr32 0xa5a0a0a0 er1	; er1 contains the sum
+
+	test_gr_a5a5 2		; Make sure other general regs not disturbed
+	test_gr_a5a5 3
+	test_gr_a5a5 4
+	test_gr_a5a5 5
+	test_gr_a5a5 6
+	test_gr_a5a5 7
+
+subx_l_rspostdec_reg32:
+	set_grs_a5a5		; Fill all general regs with a fixed pattern
+
+	;;  subx.l @eRs-,rd8	; Subx to register post-decrement
+	mov	#long_src, er0
+	set_ccr_zero
+	subx.l	@er0-, er1
+
+	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
+	test_ovf_clear
+	test_zero_clear
+	test_neg_set
+
+	test_h_gr32 long_src-4 er0	; er0 contains subress minus one
+	test_h_gr32 0xa5a0a0a0 er1	; er1 contains the sum
+
+	test_gr_a5a5 2		; Make sure other general regs not disturbed
+	test_gr_a5a5 3
+	test_gr_a5a5 4
+	test_gr_a5a5 5
+	test_gr_a5a5 6
+	test_gr_a5a5 7
+
+subx_l_rsind_rdind:
+	set_grs_a5a5		; Fill all general regs with a fixed pattern
+
+	;;  subx.l @eRs,rd8	; Subx from reg indirect to reg
+	mov	#long_src, er0
+	mov	#long_dest, er1
+	mov.l	er2, @er1
+	set_ccr_zero
+	subx.l	@er0, @er1
+
+	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
+	test_ovf_clear
+	test_zero_clear
+	test_neg_set
+
+	test_h_gr32 long_src er0	; er0 still contains src subress
+	test_h_gr32 long_dest er1	; er1 still contains dst subress
+
+	test_gr_a5a5 2		; Make sure other general regs not disturbed
+	test_gr_a5a5 3
+	test_gr_a5a5 4
+	test_gr_a5a5 5
+	test_gr_a5a5 6
+	test_gr_a5a5 7
+	;; Now check the result of the sub to memory.
+	cmp.l	#0xa5a0a0a0, @long_dest
+	beq	.Ll5
+	fail
+.Ll5:
+
+subx_l_rspostdec_rdpostdec:
+	set_grs_a5a5		; Fill all general regs with a fixed pattern
+
+	;;  subx.l @eRs-,rd8	; Subx to register post-decrement
+	mov	#long_src, er0
+	mov	#long_dest, er1
+	mov.l	er2, @er1
+	set_ccr_zero
+	subx.l	@er0-, @er1-
+
+	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
+	test_ovf_clear
+	test_zero_clear
+	test_neg_set
+
+	test_h_gr32 long_src-4 er0	; er0 contains src subress minus one
+	test_h_gr32 long_dest-4 er1	; er1 contains dst subress minus one
+
+	test_gr_a5a5 2		; Make sure other general regs not disturbed
+	test_gr_a5a5 3
+	test_gr_a5a5 4
+	test_gr_a5a5 5
+	test_gr_a5a5 6
+	test_gr_a5a5 7
+	;; Now check the result of the sub to memory.
+	cmp.l	#0xa5a0a0a0, @long_dest
+	beq	.Ll6
+	fail
+.Ll6:
+.endif
+	pass
+
+	exit 0
diff --git a/sim/testsuite/sim/h8300/tas.s b/sim/testsuite/sim/h8300/tas.s
new file mode 100644
index 0000000..b8aebd8
--- /dev/null
+++ b/sim/testsuite/sim/h8300/tas.s
@@ -0,0 +1,80 @@
+# Hitachi H8 testcase 'tas'
+# mach(): h8300h h8300s h8sx
+# as(h8300):	--defsym sim_cpu=0
+# as(h8300h):	--defsym sim_cpu=1
+# as(h8300s):	--defsym sim_cpu=2
+# as(h8sx):	--defsym sim_cpu=3
+# ld(h8300h):	-m h8300helf	
+# ld(h8300s):	-m h8300self	
+# ld(h8sx):	-m h8300sxelf
+
+	.include "testutils.inc"
+
+	.data
+byte_dst:	.byte 0
+
+	start
+
+tas_ind:			; test and set instruction
+	set_grs_a5a5
+	mov	#byte_dst, er4
+	set_ccr_zero
+	;; tas @erd
+	tas	@er4		; should set zero flag
+	test_carry_clear
+	test_neg_clear
+	test_ovf_clear
+	test_zero_set
+
+	tas	@er4		; should clear zero, set neg
+	test_carry_clear
+	test_neg_set
+	test_ovf_clear
+	test_zero_clear
+
+	test_gr_a5a5 0		; general regs have not been modified
+	test_gr_a5a5 1
+	test_gr_a5a5 2
+	test_gr_a5a5 3
+	test_h_gr32  byte_dst, er4
+	test_gr_a5a5 5
+	test_gr_a5a5 6
+	test_gr_a5a5 7
+
+	mov.b	@byte_dst, r0l	; test variable has MSB set?
+	test_h_gr8 0x80 r0l
+
+.if (sim_cpu == h8sx)		; h8sx can use any register for tas
+tas_h8sx:			; test and set instruction
+	mov.b	#0, @byte_dst
+	set_grs_a5a5
+	mov	#byte_dst, er3
+	set_ccr_zero
+	;; tas @erd
+	tas	@er3		; should set zero flag
+	test_carry_clear
+	test_neg_clear
+	test_ovf_clear
+	test_zero_set
+
+	tas	@er3		; should clear zero, set neg
+	test_carry_clear
+	test_neg_set
+	test_ovf_clear
+	test_zero_clear
+
+	test_gr_a5a5 0		; general regs have not been modified
+	test_gr_a5a5 1
+	test_gr_a5a5 2
+	test_h_gr32  byte_dst, er3
+	test_gr_a5a5 4
+	test_gr_a5a5 5
+	test_gr_a5a5 6
+	test_gr_a5a5 7
+
+	mov.b	@byte_dst, r0l	; test variable has MSB set?
+	test_h_gr8 0x80 r0l
+.endif				; h8sx
+
+	pass
+	exit 0
diff --git a/sim/testsuite/sim/h8300/testutils.inc b/sim/testsuite/sim/h8300/testutils.inc
index fb8bdca..9c2c27a 100644
--- a/sim/testsuite/sim/h8300/testutils.inc
+++ b/sim/testsuite/sim/h8300/testutils.inc
@@ -226,24 +226,34 @@
 	ldc	#0, ccr
 	.endm
 
-; Set carry flag to value
-	.macro set_carry_flag val
-	.data
-scf\@:	.byte	0
-	.text
-	mov.b	r0l, @scf\@
-	mov.b	#\val:8, r0l
-	or.b	r0l, r0l
-	beq	.Lccf\@		; clear
-	stc	ccr, r0l	; set
-	or.b	#0x1, r0l
-	jmp	.Lecf\@
-.Lccf\@:			; clear
-	stc	ccr, r0l
-	and.b	#0xfe, r0l
-.Lecf\@:
-	ldc	r0l, ccr
-	mov	@scf\@, r0l
+; Set carry flag true
+	.macro set_carry_flag
+	orc	#1, ccr
+	.endm
+
+; Clear carry flag
+	.macro clear_carry_flag
+	andc	0xfe, ccr
+	.endm
+
+; Set zero flag true
+	.macro set_zero_flag
+	orc	#4, ccr
+	.endm
+
+; Clear zero flag
+	.macro clear_zero_flag
+	andc	0xfb, ccr
+	.endm
+
+; Set neg flag true
+	.macro set_neg_flag
+	orc	#8, ccr
+	.endm
+
+; Clear neg flag
+	.macro clear_neg_flag
+	andc	0xf7, ccr
 	.endm
 
 ; Test that carry flag is clear
diff --git a/sim/testsuite/sim/h8300/xorb.s b/sim/testsuite/sim/h8300/xorb.s
index 7005a95..337c396 100644
--- a/sim/testsuite/sim/h8300/xorb.s
+++ b/sim/testsuite/sim/h8300/xorb.s
@@ -24,6 +24,8 @@
 	# xor.b reg8, @+erd	;         0 1 7     9 9 rd 5 rs
 	# xor.b reg8, @-erd	;         0 1 7     9 b rd 5 rs
 	#
+	# xorc #xx:8, ccr	; 
+	# xorc #xx:8, exr	; 
 
 	# Coming soon:
 	# ...
@@ -281,6 +283,8 @@
 	fail
 .L6:
 
+.endif				; h8sx
+
 xorc_imm8_ccr:
 	set_grs_a5a5		; Fill all general regs with a fixed pattern
 	set_ccr_zero
@@ -320,8 +324,55 @@
 	test_gr_a5a5 6
 	test_gr_a5a5 7
 	
-.endif
+.if (sim_cpu == h8300s || sim_cpu == h8sx)	; Earlier versions, no exr
+xorc_imm8_exr:
+	set_grs_a5a5		; Fill all general regs with a fixed pattern
+	ldc	#0, exr
+	stc	exr, r0l
+	test_h_gr8 0, r0l
 
+	set_ccr_zero
+	;;  xorc #xx:8,exr
+
+	xorc	#0x80, exr
+	test_cc_clear
+	stc	exr, r0l
+	test_h_gr8 0x80, r0l
+	xorc	#0x80, exr
+	stc	exr, r0l
+	test_h_gr8 0, r0l
+
+	xorc	#0x4, exr
+	stc	exr, r0l
+	test_h_gr8 4, r0l
+	xorc	#0x4, exr
+	stc	exr, r0l
+	test_h_gr8 0, r0l
+
+	xorc	#0x2, exr	; Immediate 8-bit operand (overflow flag)
+	stc	exr, r0l
+	test_h_gr8 2, r0l
+	xorc	#0x2, exr
+	stc	exr, r0l
+	test_h_gr8 0, r0l
+
+	xorc	#0x1, exr	; Immediate 8-bit operand (carry flag)
+	stc	exr, r0l
+	test_h_gr8 1, r0l
+	xorc	#0x1, exr
+	stc	exr, r0l
+	test_h_gr8 0, r0l
+
+	test_h_gr32  0xa5a5a500 er0
+	test_gr_a5a5 1		; Make sure other general regs not disturbed
+	test_gr_a5a5 2
+	test_gr_a5a5 3
+	test_gr_a5a5 4
+	test_gr_a5a5 5
+	test_gr_a5a5 6
+	test_gr_a5a5 7
+.endif				; not h8300 or h8300h
+	
 	pass
 
 	exit 0