svn commit: r215938 - in stable/8: contrib/binutils/bfd contrib/gcc/config/mips gnu/lib/libgcc gnu/usr.bin gnu/usr.bin/binutils gnu/usr.bin/binutils/ld gnu/usr.bin/cc lib/libc lib/libc/mips lib/lib...

Jayachandran C. jchandra at FreeBSD.org
Sat Nov 27 12:26:41 UTC 2010


Author: jchandra
Date: Sat Nov 27 12:26:40 2010
New Revision: 215938
URL: http://svn.freebsd.org/changeset/base/215938

Log:
  Merge MIPS platform support to 8-STABLE.
  
  This commit merges the MIPS platform changes that was now stable in
  -CURRENT into 8-STABLE. The MIPS changesets are too many (~400) to list
  here. But the changesets merged in this commit that affect other platforms
  are summarized below:
  
  r204635 : (changes to sys/dev/hwpmc, lib/libpmc, sys/sys/pmc.h)
  Add support for hwpmc(4) on the MIPS 24K, 32 bit, embedded processor.
  
  r205845: (changes to sys/modules/Makefile)
  Fix for building modules on mips and arm.
  
  r204031: (changes to sys/kern/link_elf_obj.c)
  printf fix, as part of kernel module support for MIPS.
  
  r206404: (changes to sys/arm/include/bus.h)
  Add BUS_SPACE_UNRESTRICTED and define it to be ~0, just like all the
  other platforms - for arm and mips.
  
  r206819: (changes to sys/vm/)
  Add VMFS_TLB_ALIGNED_SPACE option and kmem_alloc_nofault_space(), which
  is used to allocate kernel stack address on MIPS.
  
  r208165, r211087: (sys/kern/subr_smp.c, sys/kern/sched_ule.c)
  Enable ULE scheduler for MIPS, Fix for an issue in SMP when 32 cpus are
  enabled.
  
  r208659: (sys/{ia64/ia64,mips/mips,sun4v/sun4v}/pmap.c)
  Simplify the inner loop of get_pv_entry()
  
  r208794: (changes to sys/vm/)
  Make vm_contig_grow_cache() extern, and use it when vm_phys_alloc_contig()
  fails to allocate MIPS page table pages.
  
  r210327:  (changes to sys/vm/)
  Support for MIPS page table page allocation.  Add a new function 'vm_page_t
  vm_page_alloc_freelist(int flind, int order, int req)' to vm/vm_page.c to
  allocate a page from a specified freelist, and other related changes.
  
  Reviewed by:	alc(vm changes only)
  Approved by:	kib(re), alc(vm), imp(mips), jmallett(mips), gnn(mips pmc)

Added:
  stable/8/gnu/usr.bin/binutils/ld/elf32btsmipn32_fbsd.sh
     - copied, changed from r204548, head/gnu/usr.bin/binutils/ld/elf32btsmipn32_fbsd.sh
  stable/8/gnu/usr.bin/binutils/ld/elf32ltsmipn32_fbsd.sh
     - copied, changed from r204548, head/gnu/usr.bin/binutils/ld/elf32ltsmipn32_fbsd.sh
  stable/8/lib/libc/mips/gen/_ctx_start.S
     - copied unchanged from r209233, head/lib/libc/mips/gen/_ctx_start.S
  stable/8/lib/libc/mips/gen/hardfloat/
     - copied from r201856, head/lib/libc/mips/gen/hardfloat/
  stable/8/sys/conf/ldscript.mips.64
     - copied unchanged from r209814, head/sys/conf/ldscript.mips.64
  stable/8/sys/conf/ldscript.mips.64.cfe
     - copied unchanged from r212634, head/sys/conf/ldscript.mips.64.cfe
  stable/8/sys/conf/ldscript.mips.n32
     - copied unchanged from r209502, head/sys/conf/ldscript.mips.n32
  stable/8/sys/contrib/octeon-sdk/
     - copied from r210286, head/sys/contrib/octeon-sdk/
     - copied unchanged from r202061, head/sys/dev/cfe/cfe_env.c
  stable/8/sys/dev/hwpmc/hwpmc_mips.c
     - copied unchanged from r204635, head/sys/dev/hwpmc/hwpmc_mips.c
  stable/8/sys/dev/hwpmc/hwpmc_mips24k.c
     - copied unchanged from r204635, head/sys/dev/hwpmc/hwpmc_mips24k.c
  stable/8/sys/dev/hwpmc/hwpmc_mips24k.h
     - copied unchanged from r204635, head/sys/dev/hwpmc/hwpmc_mips24k.h
  stable/8/sys/mips/alchemy/
     - copied from r202041, head/sys/mips/alchemy/
  stable/8/sys/mips/atheros/
     - copied from r201906, head/sys/mips/atheros/
  stable/8/sys/mips/atheros/ar71xx_chip.c
     - copied, changed from r211482, head/sys/mips/atheros/ar71xx_chip.c
  stable/8/sys/mips/atheros/ar71xx_chip.h
     - copied unchanged from r211482, head/sys/mips/atheros/ar71xx_chip.h
  stable/8/sys/mips/atheros/ar71xx_cpudef.h
     - copied unchanged from r211449, head/sys/mips/atheros/ar71xx_cpudef.h
  stable/8/sys/mips/atheros/ar71xx_gpio.c
     - copied, changed from r213239, head/sys/mips/atheros/ar71xx_gpio.c
  stable/8/sys/mips/atheros/ar71xx_gpiovar.h
     - copied unchanged from r213239, head/sys/mips/atheros/ar71xx_gpiovar.h
  stable/8/sys/mips/atheros/ar71xx_setup.c
     - copied, changed from r211482, head/sys/mips/atheros/ar71xx_setup.c
  stable/8/sys/mips/atheros/ar71xx_setup.h
     - copied unchanged from r211482, head/sys/mips/atheros/ar71xx_setup.h
  stable/8/sys/mips/atheros/ar724x_chip.c
     - copied unchanged from r211504, head/sys/mips/atheros/ar724x_chip.c
  stable/8/sys/mips/atheros/ar724x_chip.h
     - copied unchanged from r211504, head/sys/mips/atheros/ar724x_chip.h
  stable/8/sys/mips/atheros/ar724xreg.h
     - copied, changed from r211440, head/sys/mips/atheros/ar724xreg.h
  stable/8/sys/mips/atheros/ar91xx_chip.c
     - copied, changed from r211504, head/sys/mips/atheros/ar91xx_chip.c
  stable/8/sys/mips/atheros/ar91xx_chip.h
     - copied unchanged from r211504, head/sys/mips/atheros/ar91xx_chip.h
  stable/8/sys/mips/atheros/ar91xxreg.h
     - copied, changed from r211440, head/sys/mips/atheros/ar91xxreg.h
  stable/8/sys/mips/atheros/pcf2123_rtc.c
     - copied unchanged from r202839, head/sys/mips/atheros/pcf2123_rtc.c
  stable/8/sys/mips/atheros/pcf2123reg.h
     - copied unchanged from r202839, head/sys/mips/atheros/pcf2123reg.h
  stable/8/sys/mips/cavium/
     - copied from r201921, head/sys/mips/cavium/
  stable/8/sys/mips/cavium/ciu.c
     - copied, changed from r210311, head/sys/mips/cavium/ciu.c
  stable/8/sys/mips/cavium/cryptocteon/
     - copied from r210312, head/sys/mips/cavium/cryptocteon/
  stable/8/sys/mips/cavium/cvmx_config.h
     - copied unchanged from r210311, head/sys/mips/cavium/cvmx_config.h
  stable/8/sys/mips/cavium/octe/
     - copied from r210311, head/sys/mips/cavium/octe/
  stable/8/sys/mips/cavium/octe/ethernet-mv88e61xx.c
     - copied, changed from r213346, head/sys/mips/cavium/octe/ethernet-mv88e61xx.c
  stable/8/sys/mips/cavium/octe/ethernet-mv88e61xx.h
     - copied unchanged from r213346, head/sys/mips/cavium/octe/ethernet-mv88e61xx.h
  stable/8/sys/mips/cavium/octe/mv88e61xxphy.c
     - copied unchanged from r213762, head/sys/mips/cavium/octe/mv88e61xxphy.c
  stable/8/sys/mips/cavium/octe/mv88e61xxphyreg.h
     - copied unchanged from r213762, head/sys/mips/cavium/octe/mv88e61xxphyreg.h
  stable/8/sys/mips/cavium/octeon_ds1337.c
     - copied unchanged from r210311, head/sys/mips/cavium/octeon_ds1337.c
  stable/8/sys/mips/cavium/octeon_mp.c
     - copied, changed from r206721, head/sys/mips/cavium/octeon_mp.c
  stable/8/sys/mips/cavium/octeon_rnd.c
     - copied unchanged from r210311, head/sys/mips/cavium/octeon_rnd.c
  stable/8/sys/mips/cavium/octeon_rtc.c
     - copied unchanged from r210311, head/sys/mips/cavium/octeon_rtc.c
  stable/8/sys/mips/cavium/octopci.c
     - copied, changed from r210311, head/sys/mips/cavium/octopci.c
  stable/8/sys/mips/cavium/octopci_bus_space.c
     - copied unchanged from r210311, head/sys/mips/cavium/octopci_bus_space.c
  stable/8/sys/mips/cavium/octopcireg.h
     - copied, changed from r210311, head/sys/mips/cavium/octopcireg.h
  stable/8/sys/mips/cavium/octopcivar.h
     - copied unchanged from r210311, head/sys/mips/cavium/octopcivar.h
  stable/8/sys/mips/cavium/usb/
     - copied from r210312, head/sys/mips/cavium/usb/
  stable/8/sys/mips/conf/ALCHEMY   (contents, props changed)
     - copied, changed from r202041, head/sys/mips/conf/ALCHEMY
  stable/8/sys/mips/conf/AR71XX   (contents, props changed)
     - copied, changed from r201917, head/sys/mips/conf/AR71XX
  stable/8/sys/mips/conf/AR71XX.hints   (contents, props changed)
     - copied, changed from r201917, head/sys/mips/conf/AR71XX.hints
  stable/8/sys/mips/conf/MALTA64   (contents, props changed)
     - copied, changed from r201917, head/sys/mips/conf/MALTA64
  stable/8/sys/mips/conf/OCTEON1   (contents, props changed)
     - copied, changed from r201917, head/sys/mips/conf/OCTEON1
  stable/8/sys/mips/conf/OCTEON1-32   (contents, props changed)
     - copied, changed from r201917, head/sys/mips/conf/OCTEON1-32
  stable/8/sys/mips/conf/OCTEON1.hints   (contents, props changed)
     - copied, changed from r201917, head/sys/mips/conf/OCTEON1.hints
  stable/8/sys/mips/conf/SWARM   (contents, props changed)
     - copied, changed from r201917, head/sys/mips/conf/SWARM
     - copied unchanged from r201917, head/sys/mips/conf/SWARM.hints
  stable/8/sys/mips/conf/SWARM64
     - copied, changed from r212634, head/sys/mips/conf/SWARM64
  stable/8/sys/mips/conf/SWARM64_SMP
     - copied, changed from r212634, head/sys/mips/conf/SWARM64_SMP
  stable/8/sys/mips/conf/SWARM_SMP
     - copied, changed from r203697, head/sys/mips/conf/SWARM_SMP
  stable/8/sys/mips/conf/XLR   (contents, props changed)
     - copied, changed from r201917, head/sys/mips/conf/XLR
  stable/8/sys/mips/conf/XLR64
     - copied, changed from r209814, head/sys/mips/conf/XLR64
  stable/8/sys/mips/conf/XLRN32
     - copied, changed from r209502, head/sys/mips/conf/XLRN32
  stable/8/sys/mips/conf/std.SWARM
     - copied unchanged from r215068, head/sys/mips/conf/std.SWARM
  stable/8/sys/mips/include/cdefs.h   (contents, props changed)
     - copied, changed from r202041, head/sys/mips/include/cdefs.h
     - copied unchanged from r202041, head/sys/mips/include/fls64.h
  stable/8/sys/mips/include/tlb.h
     - copied, changed from r209243, head/sys/mips/include/tlb.h
  stable/8/sys/mips/mips/bus_space_generic.c   (contents, props changed)
     - copied, changed from r202041, head/sys/mips/mips/bus_space_generic.c
  stable/8/sys/mips/mips/elf_trampoline.c   (contents, props changed)
     - copied, changed from r202041, head/sys/mips/mips/elf_trampoline.c
     - copied unchanged from r202041, head/sys/mips/mips/inckern.S
  stable/8/sys/mips/mips/minidump_machdep.c
     - copied unchanged from r214903, head/sys/mips/mips/minidump_machdep.c
  stable/8/sys/mips/mips/mpboot.S
     - copied, changed from r203697, head/sys/mips/mips/mpboot.S
     - copied unchanged from r201976, head/sys/mips/mips/ptrace_machdep.c
     - copied unchanged from r202041, head/sys/mips/mips/sys_machdep.c
  stable/8/sys/mips/mips/tlb.c
     - copied, changed from r209243, head/sys/mips/mips/tlb.c
  stable/8/sys/mips/rmi/
     - copied from r201917, head/sys/mips/rmi/
  stable/8/sys/mips/rmi/bus_space_rmi_pci.c
     - copied, changed from r204137, head/sys/mips/rmi/bus_space_rmi_pci.c
  stable/8/sys/mips/rmi/dev/
     - copied from r201979, head/sys/mips/rmi/dev/
  stable/8/sys/mips/rmi/dev/nlge/
     - copied from r211946, head/sys/mips/rmi/dev/nlge/
  stable/8/sys/mips/rmi/dev/xlr/debug.h
     - copied unchanged from r211996, head/sys/mips/rmi/dev/xlr/debug.h
  stable/8/sys/mips/rmi/fmn.c
     - copied, changed from r211809, head/sys/mips/rmi/fmn.c
  stable/8/sys/mips/rmi/mpwait.S
     - copied unchanged from r208250, head/sys/mips/rmi/mpwait.S
  stable/8/sys/mips/rmi/rmi_boot_info.h
     - copied unchanged from r211994, head/sys/mips/rmi/rmi_boot_info.h
  stable/8/sys/mips/rmi/xlr_pcmcia.c
     - copied unchanged from r211923, head/sys/mips/rmi/xlr_pcmcia.c
  stable/8/sys/mips/sibyte/
     - copied from r201905, head/sys/mips/sibyte/
  stable/8/sys/mips/sibyte/sb_bus_space.h
     - copied unchanged from r203985, head/sys/mips/sibyte/sb_bus_space.h
Directory Properties:
  stable/8/sys/dev/cfe/cfe_env.c   (props changed)
  stable/8/sys/mips/conf/SWARM.hints   (props changed)
  stable/8/sys/mips/include/fls64.h   (props changed)
  stable/8/sys/mips/mips/inckern.S   (props changed)
  stable/8/sys/mips/mips/ptrace_machdep.c   (props changed)
  stable/8/sys/mips/mips/sys_machdep.c   (props changed)
Deleted:
  stable/8/lib/libc/mips/gen/fpgetmask.c
  stable/8/lib/libc/mips/gen/fpgetround.c
  stable/8/lib/libc/mips/gen/fpgetsticky.c
  stable/8/lib/libc/mips/gen/fpsetmask.c
  stable/8/lib/libc/mips/gen/fpsetround.c
  stable/8/lib/libc/mips/gen/fpsetsticky.c
  stable/8/sys/mips/include/_bus_octeon.h
  stable/8/sys/mips/include/archtype.h
  stable/8/sys/mips/include/asmacros.h
  stable/8/sys/mips/include/bus_octeon.h
  stable/8/sys/mips/include/defs.h
  stable/8/sys/mips/include/intr.h
  stable/8/sys/mips/include/pltfm.h
  stable/8/sys/mips/include/psl.h
  stable/8/sys/mips/include/queue.h
  stable/8/sys/mips/include/rm7000.h
  stable/8/sys/mips/include/segments.h
  stable/8/sys/mips/mips/copystr.S
  stable/8/sys/mips/mips/psraccess.S
  stable/8/sys/mips/mips/tlb.S
  stable/8/sys/mips/sentry5/siba_cc.c
  stable/8/sys/mips/sentry5/siba_mips.c
  stable/8/sys/mips/sentry5/siba_sdram.c
Modified:
  stable/8/contrib/binutils/bfd/elfxx-mips.c
  stable/8/contrib/gcc/config/mips/freebsd.h
  stable/8/gnu/lib/libgcc/Makefile
  stable/8/gnu/usr.bin/binutils/Makefile.inc0
  stable/8/gnu/usr.bin/binutils/ld/Makefile.mips
  stable/8/gnu/usr.bin/cc/Makefile.inc
  stable/8/gnu/usr.bin/cc/Makefile.tgt
  stable/8/lib/libc/Makefile
  stable/8/lib/libc/mips/Makefile.inc
  stable/8/lib/libc/mips/SYS.h
  stable/8/lib/libc/mips/Symbol.map
  stable/8/lib/libc/mips/gen/Makefile.inc
  stable/8/lib/libc/mips/gen/_setjmp.S
  stable/8/lib/libc/mips/gen/makecontext.c
  stable/8/lib/libc/mips/gen/setjmp.S
  stable/8/lib/libc/mips/gen/sigsetjmp.S
  stable/8/lib/libc/mips/string/bcmp.S
  stable/8/lib/libc/mips/string/bcopy.S
  stable/8/lib/libc/mips/string/bzero.S
  stable/8/lib/libc/mips/string/ffs.S
  stable/8/lib/libc/mips/string/index.S
  stable/8/lib/libc/mips/string/rindex.S
  stable/8/lib/libc/mips/string/strcmp.S
  stable/8/lib/libc/mips/string/strlen.S
  stable/8/lib/libc/mips/sys/Makefile.inc
  stable/8/lib/libc/mips/sys/Ovfork.S
  stable/8/lib/libc/mips/sys/brk.S
  stable/8/lib/libc/mips/sys/cerror.S
  stable/8/lib/libc/mips/sys/exect.S
  stable/8/lib/libc/mips/sys/fork.S
  stable/8/lib/libc/mips/sys/pipe.S
  stable/8/lib/libc/mips/sys/ptrace.S
  stable/8/lib/libc/mips/sys/sbrk.S
  stable/8/lib/libpmc/libpmc.c
  stable/8/lib/libthr/arch/mips/include/pthread_md.h
  stable/8/libexec/rtld-elf/mips/reloc.c
  stable/8/libexec/rtld-elf/mips/rtld_start.S
  stable/8/sys/arm/include/bus.h
  stable/8/sys/conf/Makefile.mips
  stable/8/sys/conf/files.mips
  stable/8/sys/conf/kern.pre.mk
  stable/8/sys/conf/kmod.mk
  stable/8/sys/conf/ldscript.mips
  stable/8/sys/conf/options.mips
  stable/8/sys/contrib/octeon-sdk/cvmx-access-native.h
  stable/8/sys/contrib/octeon-sdk/cvmx-app-init.h
  stable/8/sys/contrib/octeon-sdk/cvmx-asm.h
  stable/8/sys/contrib/octeon-sdk/cvmx-cmd-queue.c
  stable/8/sys/contrib/octeon-sdk/cvmx-cmd-queue.h
  stable/8/sys/contrib/octeon-sdk/cvmx-fpa.c
  stable/8/sys/contrib/octeon-sdk/cvmx-helper-board.c
  stable/8/sys/contrib/octeon-sdk/cvmx-helper-errata.c
  stable/8/sys/contrib/octeon-sdk/cvmx-helper-fpa.c
  stable/8/sys/contrib/octeon-sdk/cvmx-helper-loop.c
  stable/8/sys/contrib/octeon-sdk/cvmx-helper-npi.c
  stable/8/sys/contrib/octeon-sdk/cvmx-helper-rgmii.c
  stable/8/sys/contrib/octeon-sdk/cvmx-helper-sgmii.c
  stable/8/sys/contrib/octeon-sdk/cvmx-helper-spi.c
  stable/8/sys/contrib/octeon-sdk/cvmx-helper-util.c
  stable/8/sys/contrib/octeon-sdk/cvmx-helper-util.h
  stable/8/sys/contrib/octeon-sdk/cvmx-helper-xaui.c
  stable/8/sys/contrib/octeon-sdk/cvmx-helper.c
  stable/8/sys/contrib/octeon-sdk/cvmx-helper.h
  stable/8/sys/contrib/octeon-sdk/cvmx-pko.c
  stable/8/sys/contrib/octeon-sdk/cvmx-platform.h
  stable/8/sys/contrib/octeon-sdk/cvmx-rtc.h
  stable/8/sys/contrib/octeon-sdk/cvmx-spi.c
  stable/8/sys/contrib/octeon-sdk/cvmx-thunder.c
  stable/8/sys/contrib/octeon-sdk/cvmx-usb.c
  stable/8/sys/contrib/octeon-sdk/cvmx-usb.h
  stable/8/sys/contrib/octeon-sdk/octeon-model.h
  stable/8/sys/dev/cfe/cfe_api.c
  stable/8/sys/dev/cfe/cfe_console.c
  stable/8/sys/dev/hwpmc/pmc_events.h
  stable/8/sys/ia64/ia64/pmap.c
  stable/8/sys/kern/link_elf_obj.c
  stable/8/sys/kern/sched_ule.c
  stable/8/sys/kern/subr_smp.c
  stable/8/sys/mips/adm5120/adm5120_machdep.c   (contents, props changed)
  stable/8/sys/mips/adm5120/files.adm5120   (contents, props changed)
  stable/8/sys/mips/adm5120/if_admsw.c   (contents, props changed)
  stable/8/sys/mips/adm5120/if_admswvar.h   (contents, props changed)
  stable/8/sys/mips/adm5120/obio.c   (contents, props changed)
  stable/8/sys/mips/adm5120/uart_cpu_adm5120.c   (contents, props changed)
  stable/8/sys/mips/alchemy/alchemy_machdep.c
  stable/8/sys/mips/alchemy/obio.c
  stable/8/sys/mips/atheros/apb.c   (contents, props changed)
  stable/8/sys/mips/atheros/ar71xx_machdep.c   (contents, props changed)
  stable/8/sys/mips/atheros/ar71xx_pci.c   (contents, props changed)
  stable/8/sys/mips/atheros/ar71xx_spi.c   (contents, props changed)
  stable/8/sys/mips/atheros/ar71xx_wdog.c   (contents, props changed)
  stable/8/sys/mips/atheros/ar71xxreg.h   (contents, props changed)
  stable/8/sys/mips/atheros/files.ar71xx   (contents, props changed)
  stable/8/sys/mips/atheros/if_arge.c   (contents, props changed)
  stable/8/sys/mips/atheros/if_argevar.h   (contents, props changed)
  stable/8/sys/mips/atheros/uart_bus_ar71xx.c   (contents, props changed)
  stable/8/sys/mips/atheros/uart_cpu_ar71xx.c   (contents, props changed)
  stable/8/sys/mips/cavium/asm_octeon.S
  stable/8/sys/mips/cavium/dev/rgmii/octeon_fau.h
  stable/8/sys/mips/cavium/dev/rgmii/octeon_fpa.c
  stable/8/sys/mips/cavium/dev/rgmii/octeon_fpa.h
  stable/8/sys/mips/cavium/dev/rgmii/octeon_ipd.c
  stable/8/sys/mips/cavium/dev/rgmii/octeon_ipd.h
  stable/8/sys/mips/cavium/dev/rgmii/octeon_pip.h
  stable/8/sys/mips/cavium/dev/rgmii/octeon_pko.c
  stable/8/sys/mips/cavium/dev/rgmii/octeon_pko.h
  stable/8/sys/mips/cavium/dev/rgmii/octeon_rgmx.c
  stable/8/sys/mips/cavium/dev/rgmii/octeon_rgmx.h
  stable/8/sys/mips/cavium/files.octeon1   (contents, props changed)
  stable/8/sys/mips/cavium/obio.c
  stable/8/sys/mips/cavium/obiovar.h
  stable/8/sys/mips/cavium/octe/cavium-ethernet.h
  stable/8/sys/mips/cavium/octe/ethernet-common.c
  stable/8/sys/mips/cavium/octe/ethernet-headers.h
  stable/8/sys/mips/cavium/octe/ethernet-mdio.c
  stable/8/sys/mips/cavium/octe/ethernet-rgmii.c
  stable/8/sys/mips/cavium/octe/ethernet-rx.c
  stable/8/sys/mips/cavium/octe/ethernet-sgmii.c
  stable/8/sys/mips/cavium/octe/ethernet-tx.c
  stable/8/sys/mips/cavium/octe/ethernet-xaui.c
  stable/8/sys/mips/cavium/octe/ethernet.c
  stable/8/sys/mips/cavium/octe/octe.c
  stable/8/sys/mips/cavium/octeon_ebt3000_cf.c
  stable/8/sys/mips/cavium/octeon_machdep.c
  stable/8/sys/mips/cavium/octeon_pcmap_regs.h
  stable/8/sys/mips/cavium/std.octeon1   (contents, props changed)
  stable/8/sys/mips/cavium/uart_bus_octeonusart.c
  stable/8/sys/mips/cavium/uart_cpu_octeonusart.c
  stable/8/sys/mips/cavium/uart_dev_oct16550.c
  stable/8/sys/mips/cavium/usb/octusb.c
  stable/8/sys/mips/conf/ADM5120   (contents, props changed)
  stable/8/sys/mips/conf/MALTA   (contents, props changed)
  stable/8/sys/mips/conf/QEMU   (contents, props changed)
  stable/8/sys/mips/conf/SENTRY5   (contents, props changed)
  stable/8/sys/mips/idt/files.idt   (contents, props changed)
  stable/8/sys/mips/idt/idt_machdep.c   (contents, props changed)
  stable/8/sys/mips/idt/obio.c   (contents, props changed)
  stable/8/sys/mips/idt/uart_bus_rc32434.c   (contents, props changed)
  stable/8/sys/mips/idt/uart_cpu_rc32434.c   (contents, props changed)
  stable/8/sys/mips/include/_bus.h   (contents, props changed)
  stable/8/sys/mips/include/_inttypes.h   (contents, props changed)
  stable/8/sys/mips/include/_limits.h   (contents, props changed)
  stable/8/sys/mips/include/_stdint.h   (contents, props changed)
  stable/8/sys/mips/include/_types.h   (contents, props changed)
  stable/8/sys/mips/include/asm.h   (contents, props changed)
  stable/8/sys/mips/include/atomic.h   (contents, props changed)
  stable/8/sys/mips/include/bus.h   (contents, props changed)
  stable/8/sys/mips/include/cache.h   (contents, props changed)
  stable/8/sys/mips/include/cache_mipsNN.h   (contents, props changed)
  stable/8/sys/mips/include/clock.h   (contents, props changed)
  stable/8/sys/mips/include/cpu.h   (contents, props changed)
  stable/8/sys/mips/include/cpufunc.h   (contents, props changed)
  stable/8/sys/mips/include/cpuinfo.h   (contents, props changed)
  stable/8/sys/mips/include/cpuregs.h   (contents, props changed)
  stable/8/sys/mips/include/db_machdep.h   (contents, props changed)
  stable/8/sys/mips/include/elf.h   (contents, props changed)
  stable/8/sys/mips/include/endian.h   (contents, props changed)
  stable/8/sys/mips/include/float.h   (contents, props changed)
  stable/8/sys/mips/include/hwfunc.h   (contents, props changed)
  stable/8/sys/mips/include/intr_machdep.h   (contents, props changed)
  stable/8/sys/mips/include/kdb.h   (contents, props changed)
  stable/8/sys/mips/include/locore.h   (contents, props changed)
  stable/8/sys/mips/include/md_var.h   (contents, props changed)
  stable/8/sys/mips/include/memdev.h   (contents, props changed)
  stable/8/sys/mips/include/param.h   (contents, props changed)
  stable/8/sys/mips/include/pcb.h   (contents, props changed)
  stable/8/sys/mips/include/pcpu.h   (contents, props changed)
  stable/8/sys/mips/include/pmap.h   (contents, props changed)
  stable/8/sys/mips/include/pmc_mdep.h   (contents, props changed)
  stable/8/sys/mips/include/proc.h   (contents, props changed)
  stable/8/sys/mips/include/profile.h   (contents, props changed)
  stable/8/sys/mips/include/pte.h   (contents, props changed)
  stable/8/sys/mips/include/regdef.h   (contents, props changed)
  stable/8/sys/mips/include/regnum.h   (contents, props changed)
  stable/8/sys/mips/include/runq.h   (contents, props changed)
  stable/8/sys/mips/include/setjmp.h   (contents, props changed)
  stable/8/sys/mips/include/sf_buf.h   (contents, props changed)
  stable/8/sys/mips/include/smp.h   (contents, props changed)
  stable/8/sys/mips/include/sysarch.h   (contents, props changed)
  stable/8/sys/mips/include/trap.h   (contents, props changed)
  stable/8/sys/mips/include/ucontext.h   (contents, props changed)
  stable/8/sys/mips/include/vm.h
  stable/8/sys/mips/include/vmparam.h   (contents, props changed)
  stable/8/sys/mips/malta/files.malta   (contents, props changed)
  stable/8/sys/mips/malta/gt_pci.c   (contents, props changed)
  stable/8/sys/mips/malta/malta_machdep.c   (contents, props changed)
  stable/8/sys/mips/malta/maltareg.h   (contents, props changed)
  stable/8/sys/mips/malta/obio.c   (contents, props changed)
  stable/8/sys/mips/malta/std.malta   (contents, props changed)
  stable/8/sys/mips/malta/uart_bus_maltausart.c   (contents, props changed)
  stable/8/sys/mips/malta/uart_cpu_maltausart.c   (contents, props changed)
  stable/8/sys/mips/malta/yamon.h   (contents, props changed)
  stable/8/sys/mips/mips/autoconf.c   (contents, props changed)
  stable/8/sys/mips/mips/busdma_machdep.c   (contents, props changed)
  stable/8/sys/mips/mips/cache.c   (contents, props changed)
  stable/8/sys/mips/mips/cache_mipsNN.c   (contents, props changed)
  stable/8/sys/mips/mips/cpu.c   (contents, props changed)
  stable/8/sys/mips/mips/db_interface.c   (contents, props changed)
  stable/8/sys/mips/mips/db_trace.c   (contents, props changed)
  stable/8/sys/mips/mips/dump_machdep.c   (contents, props changed)
  stable/8/sys/mips/mips/elf_machdep.c   (contents, props changed)
  stable/8/sys/mips/mips/exception.S   (contents, props changed)
  stable/8/sys/mips/mips/fp.S   (contents, props changed)
  stable/8/sys/mips/mips/gdb_machdep.c   (contents, props changed)
  stable/8/sys/mips/mips/genassym.c   (contents, props changed)
  stable/8/sys/mips/mips/in_cksum.c   (contents, props changed)
  stable/8/sys/mips/mips/intr_machdep.c   (contents, props changed)
  stable/8/sys/mips/mips/locore.S   (contents, props changed)
  stable/8/sys/mips/mips/machdep.c   (contents, props changed)
  stable/8/sys/mips/mips/mainbus.c   (contents, props changed)
  stable/8/sys/mips/mips/mem.c   (contents, props changed)
  stable/8/sys/mips/mips/mp_machdep.c   (contents, props changed)
  stable/8/sys/mips/mips/nexus.c   (contents, props changed)
  stable/8/sys/mips/mips/pm_machdep.c   (contents, props changed)
  stable/8/sys/mips/mips/pmap.c   (contents, props changed)
  stable/8/sys/mips/mips/stack_machdep.c   (contents, props changed)
  stable/8/sys/mips/mips/support.S   (contents, props changed)
  stable/8/sys/mips/mips/swtch.S   (contents, props changed)
  stable/8/sys/mips/mips/tick.c   (contents, props changed)
  stable/8/sys/mips/mips/trap.c   (contents, props changed)
  stable/8/sys/mips/mips/uio_machdep.c   (contents, props changed)
  stable/8/sys/mips/mips/vm_machdep.c   (contents, props changed)
  stable/8/sys/mips/rmi/board.c   (contents, props changed)
  stable/8/sys/mips/rmi/board.h   (contents, props changed)
  stable/8/sys/mips/rmi/bus_space_rmi.c   (contents, props changed)
  stable/8/sys/mips/rmi/dev/nlge/if_nlge.c
  stable/8/sys/mips/rmi/dev/nlge/if_nlge.h
  stable/8/sys/mips/rmi/dev/sec/desc.h   (contents, props changed)
  stable/8/sys/mips/rmi/dev/sec/rmilib.c   (contents, props changed)
  stable/8/sys/mips/rmi/dev/sec/rmilib.h   (contents, props changed)
  stable/8/sys/mips/rmi/dev/sec/rmisec.c   (contents, props changed)
  stable/8/sys/mips/rmi/dev/xlr/rge.c   (contents, props changed)
  stable/8/sys/mips/rmi/dev/xlr/rge.h   (contents, props changed)
  stable/8/sys/mips/rmi/ehcireg.h   (contents, props changed)
  stable/8/sys/mips/rmi/ehcivar.h   (contents, props changed)
  stable/8/sys/mips/rmi/files.xlr   (contents, props changed)
  stable/8/sys/mips/rmi/interrupt.h   (contents, props changed)
  stable/8/sys/mips/rmi/intr_machdep.c   (contents, props changed)
  stable/8/sys/mips/rmi/iodi.c   (contents, props changed)
  stable/8/sys/mips/rmi/iomap.h   (contents, props changed)
  stable/8/sys/mips/rmi/msgring.h   (contents, props changed)
  stable/8/sys/mips/rmi/pcibus.h   (contents, props changed)
  stable/8/sys/mips/rmi/pic.h   (contents, props changed)
  stable/8/sys/mips/rmi/rmi_mips_exts.h   (contents, props changed)
  stable/8/sys/mips/rmi/std.xlr   (contents, props changed)
  stable/8/sys/mips/rmi/tick.c   (contents, props changed)
  stable/8/sys/mips/rmi/uart_bus_xlr_iodi.c   (contents, props changed)
  stable/8/sys/mips/rmi/xlr_i2c.c   (contents, props changed)
  stable/8/sys/mips/rmi/xlr_machdep.c   (contents, props changed)
  stable/8/sys/mips/rmi/xlr_pci.c   (contents, props changed)
  stable/8/sys/mips/rmi/xls_ehci.c   (contents, props changed)
  stable/8/sys/mips/sentry5/files.sentry5   (contents, props changed)
  stable/8/sys/mips/sentry5/obio.c   (contents, props changed)
  stable/8/sys/mips/sentry5/s5_machdep.c   (contents, props changed)
  stable/8/sys/mips/sentry5/uart_bus_sbusart.c   (contents, props changed)
  stable/8/sys/mips/sentry5/uart_cpu_sbusart.c   (contents, props changed)
  stable/8/sys/mips/sibyte/sb_asm.S
  stable/8/sys/mips/sibyte/sb_machdep.c
  stable/8/sys/mips/sibyte/sb_scd.c
  stable/8/sys/mips/sibyte/sb_scd.h
  stable/8/sys/mips/sibyte/sb_zbbus.c
  stable/8/sys/mips/sibyte/sb_zbpci.c
  stable/8/sys/modules/Makefile
  stable/8/sys/sun4v/sun4v/pmap.c
  stable/8/sys/sys/kerneldump.h
  stable/8/sys/sys/pmc.h
  stable/8/sys/vm/pmap.h
  stable/8/sys/vm/vm_contig.c
  stable/8/sys/vm/vm_extern.h
  stable/8/sys/vm/vm_glue.c
  stable/8/sys/vm/vm_kern.c
  stable/8/sys/vm/vm_map.c
  stable/8/sys/vm/vm_map.h
  stable/8/sys/vm/vm_page.c
  stable/8/sys/vm/vm_page.h
  stable/8/sys/vm/vm_pageout.h
  stable/8/sys/vm/vm_phys.c
  stable/8/sys/vm/vm_phys.h
Directory Properties:
  stable/8/contrib/binutils/   (props changed)
  stable/8/contrib/gcc/   (props changed)
  stable/8/gnu/lib/libgcc/   (props changed)
  stable/8/gnu/usr.bin/   (props changed)
  stable/8/gnu/usr.bin/Makefile   (props changed)
  stable/8/gnu/usr.bin/dialog/   (props changed)
  stable/8/gnu/usr.bin/gdb/   (props changed)
  stable/8/gnu/usr.bin/gdb/kgdb/   (props changed)
  stable/8/gnu/usr.bin/groff/   (props changed)
  stable/8/gnu/usr.bin/patch/   (props changed)
  stable/8/lib/libc/   (props changed)
  stable/8/lib/libc/locale/   (props changed)
  stable/8/lib/libc/stdtime/   (props changed)
  stable/8/lib/libc/sys/   (props changed)
  stable/8/lib/libthr/   (props changed)
  stable/8/libexec/rtld-elf/   (props changed)
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/mips/adm5120/adm5120reg.h   (props changed)
  stable/8/sys/mips/adm5120/admpci.c   (props changed)
  stable/8/sys/mips/adm5120/console.c   (props changed)
  stable/8/sys/mips/adm5120/if_admswreg.h   (props changed)
  stable/8/sys/mips/adm5120/obiovar.h   (props changed)
  stable/8/sys/mips/adm5120/std.adm5120   (props changed)
  stable/8/sys/mips/adm5120/uart_bus_adm5120.c   (props changed)
  stable/8/sys/mips/adm5120/uart_dev_adm5120.c   (props changed)
  stable/8/sys/mips/adm5120/uart_dev_adm5120.h   (props changed)
  stable/8/sys/mips/alchemy/files.alchemy   (props changed)
  stable/8/sys/mips/alchemy/std.alchemy   (props changed)
  stable/8/sys/mips/atheros/apbvar.h   (props changed)
  stable/8/sys/mips/atheros/ar71xx_bus_space_reversed.c   (props changed)
  stable/8/sys/mips/atheros/ar71xx_bus_space_reversed.h   (props changed)
  stable/8/sys/mips/atheros/ar71xx_ehci.c   (props changed)
  stable/8/sys/mips/atheros/ar71xx_ohci.c   (props changed)
  stable/8/sys/mips/atheros/ar71xx_pci_bus_space.c   (props changed)
  stable/8/sys/mips/atheros/ar71xx_pci_bus_space.h   (props changed)
  stable/8/sys/mips/cavium/dev/   (props changed)
  stable/8/sys/mips/conf/.cvsignore   (props changed)
  stable/8/sys/mips/conf/ADM5120.hints   (props changed)
  stable/8/sys/mips/conf/DEFAULTS   (props changed)
  stable/8/sys/mips/conf/IDT   (props changed)
  stable/8/sys/mips/conf/IDT.hints   (props changed)
  stable/8/sys/mips/conf/MALTA.hints   (props changed)
  stable/8/sys/mips/conf/SENTRY5.hints   (props changed)
  stable/8/sys/mips/idt/idtpci.c   (props changed)
  stable/8/sys/mips/idt/idtreg.h   (props changed)
  stable/8/sys/mips/idt/if_kr.c   (props changed)
  stable/8/sys/mips/idt/if_krreg.h   (props changed)
  stable/8/sys/mips/idt/obiovar.h   (props changed)
  stable/8/sys/mips/idt/std.idt   (props changed)
  stable/8/sys/mips/include/bootinfo.h   (props changed)
  stable/8/sys/mips/include/bswap.h   (props changed)
  stable/8/sys/mips/include/bus_dma.h   (props changed)
  stable/8/sys/mips/include/cache_r4k.h   (props changed)
  stable/8/sys/mips/include/clockvar.h   (props changed)
  stable/8/sys/mips/include/cputypes.h   (props changed)
  stable/8/sys/mips/include/exec.h   (props changed)
  stable/8/sys/mips/include/floatingpoint.h   (props changed)
  stable/8/sys/mips/include/fpu.h   (props changed)
  stable/8/sys/mips/include/frame.h   (props changed)
  stable/8/sys/mips/include/gdb_machdep.h   (props changed)
  stable/8/sys/mips/include/ieee.h   (props changed)
  stable/8/sys/mips/include/ieeefp.h   (props changed)
  stable/8/sys/mips/include/in_cksum.h   (props changed)
  stable/8/sys/mips/include/iodev.h   (props changed)
  stable/8/sys/mips/include/limits.h   (props changed)
  stable/8/sys/mips/include/metadata.h   (props changed)
  stable/8/sys/mips/include/minidump.h   (props changed)
  stable/8/sys/mips/include/mips_opcode.h   (props changed)
  stable/8/sys/mips/include/mp_watchdog.h   (props changed)
  stable/8/sys/mips/include/mutex.h   (props changed)
  stable/8/sys/mips/include/pci_cfgreg.h   (props changed)
  stable/8/sys/mips/include/ppireg.h   (props changed)
  stable/8/sys/mips/include/ptrace.h   (props changed)
  stable/8/sys/mips/include/reg.h   (props changed)
  stable/8/sys/mips/include/reloc.h   (props changed)
  stable/8/sys/mips/include/resource.h   (props changed)
  stable/8/sys/mips/include/sigframe.h   (props changed)
  stable/8/sys/mips/include/signal.h   (props changed)
  stable/8/sys/mips/include/stdarg.h   (props changed)
  stable/8/sys/mips/include/timerreg.h   (props changed)
  stable/8/sys/mips/include/varargs.h   (props changed)
  stable/8/sys/mips/malta/gt.c   (props changed)
  stable/8/sys/mips/malta/gtreg.h   (props changed)
  stable/8/sys/mips/malta/gtvar.h   (props changed)
  stable/8/sys/mips/malta/obiovar.h   (props changed)
  stable/8/sys/mips/malta/yamon.c   (props changed)
  stable/8/sys/mips/mips/db_disasm.c   (props changed)
  stable/8/sys/mips/mips/elf64_machdep.c   (props changed)
  stable/8/sys/mips/rmi/Makefile.msgring   (props changed)
  stable/8/sys/mips/rmi/dev/xlr/atx_cpld.h   (props changed)
  stable/8/sys/mips/rmi/dev/xlr/xgmac_mdio.h   (props changed)
  stable/8/sys/mips/rmi/msgring.c   (props changed)
  stable/8/sys/mips/rmi/msgring.cfg   (props changed)
  stable/8/sys/mips/rmi/msgring_xls.c   (props changed)
  stable/8/sys/mips/rmi/msgring_xls.cfg   (props changed)
  stable/8/sys/mips/rmi/rootfs_list.txt   (props changed)
  stable/8/sys/mips/rmi/uart_cpu_mips_xlr.c   (props changed)
  stable/8/sys/mips/rmi/xlr_csum_nocopy.S   (props changed)
  stable/8/sys/mips/sentry5/obiovar.h   (props changed)
  stable/8/sys/mips/sentry5/s5reg.h   (props changed)
  stable/8/sys/mips/sibyte/files.sibyte   (props changed)

Modified: stable/8/contrib/binutils/bfd/elfxx-mips.c
==============================================================================
--- stable/8/contrib/binutils/bfd/elfxx-mips.c	Sat Nov 27 09:26:46 2010	(r215937)
+++ stable/8/contrib/binutils/bfd/elfxx-mips.c	Sat Nov 27 12:26:40 2010	(r215938)
@@ -4324,6 +4324,15 @@ _bfd_mips_elf_section_processing (bfd *a
 
 	  bfd_mips_elf_swap_options_in (abfd, (Elf_External_Options *) l,
 					&intopt);
+	  if (intopt.size < sizeof (Elf_External_Options))
+	    {
+	      (*_bfd_error_handler)
+		(_("Warning: bad `%s' option size %u smaller than its header"),
+		MIPS_ELF_OPTIONS_SECTION_NAME (abfd), intopt.size);
+	      break;
+	    }
+
+
 	  if (ABI_64_P (abfd) && intopt.kind == ODK_REGINFO)
 	    {
 	      bfd_byte buf[8];
@@ -4536,6 +4545,14 @@ _bfd_mips_elf_section_from_shdr (bfd *ab
 
 	  bfd_mips_elf_swap_options_in (abfd, (Elf_External_Options *) l,
 					&intopt);
+	  if (intopt.size < sizeof (Elf_External_Options))
+	    {
+	      (*_bfd_error_handler)
+		(_("Warning: bad `%s' option size %u smaller than its header"),
+		MIPS_ELF_OPTIONS_SECTION_NAME (abfd), intopt.size);
+	      break;
+	    }
+
 	  if (ABI_64_P (abfd) && intopt.kind == ODK_REGINFO)
 	    {
 	      Elf64_Internal_RegInfo intreg;

Modified: stable/8/contrib/gcc/config/mips/freebsd.h
==============================================================================
--- stable/8/contrib/gcc/config/mips/freebsd.h	Sat Nov 27 09:26:46 2010	(r215937)
+++ stable/8/contrib/gcc/config/mips/freebsd.h	Sat Nov 27 12:26:40 2010	(r215938)
@@ -65,19 +65,23 @@ Boston, MA 02110-1301, USA.  */
 
 #undef	LINK_SPEC
 #define LINK_SPEC "\
-    %{G*} %{mips1} %{mips2} %{mips3} %{mips4} %{mips32} %{mips32r2} %{mips64} \
+    %{EB} %{EL} %(endian_spec) \
+    %{G*} %{mips1} %{mips2} %{mips3} %{mips4} \
+    %{mips32} %{mips32r2} %{mips64} %{mips64r2} \
     %{bestGnum} %{call_shared} %{no_archive} %{exact_version} \
-    %(fbsd_link_spec) "
-#if 0
-    %(endian_spec)
-#endif
+    %{mabi=32:-melf32%{EB:b}%{EL:l}tsmip_fbsd} \
+    %{mabi=n32:-melf32%{EB:b}%{EL:l}tsmipn32_fbsd} \
+    %{mabi=64:-melf64%{EB:b}%{EL:l}tsmip_fbsd} \
+    %{mabi=o64:-melf64%{EB:b}%{EL:l}tsmip_fbsd} \
+    %(fbsd_link_spec)"
+
     
 /* Reset our STARTFILE_SPEC which was properly set in config/freebsd.h
    but trashed by config/mips/elf.h.  */
 #undef  STARTFILE_SPEC
 #define STARTFILE_SPEC	FBSD_STARTFILE_SPEC
 
-/* Provide an ENDFILE_SPEC appropriate for FreeBSD/i386.  */
+/* Provide an ENDFILE_SPEC appropriate for FreeBSD/mips.  */
 #undef  ENDFILE_SPEC
 #define ENDFILE_SPEC	FBSD_ENDFILE_SPEC
 
@@ -97,6 +101,9 @@ Boston, MA 02110-1301, USA.  */
    Needs to agree with <machine/ansi.h>.  GCC defaults come from c-decl.c,
    c-common.c, and config/<arch>/<arch>.h.  */
 
+#undef TARGET_DEFAULT
+#define TARGET_DEFAULT (MASK_ABICALLS | MASK_SOFT_FLOAT)
+
 #if TARGET_ENDIAN_DEFAULT != 0
 #define TARGET_VERSION	fprintf (stderr, " (FreeBSD/mips)");
 #else
@@ -127,29 +134,107 @@ Boston, MA 02110-1301, USA.  */
       if (TARGET_MIPS16)					\
 	builtin_define ("__mips16");				\
 								\
+      if (mips_abi == ABI_N32)                                  \
+        {                                                       \
+          builtin_define ("__mips_n32");                        \
+          builtin_define ("_ABIN32=2");                         \
+          builtin_define ("_MIPS_SIM=_ABIN32");                 \
+          builtin_define ("_MIPS_SZLONG=32");                   \
+          builtin_define ("_MIPS_SZPTR=32");                    \
+        }                                                       \
+      else if (mips_abi == ABI_64)                              \
+        {                                                       \
+          builtin_define ("__mips_n64");                        \
+          builtin_define ("_ABI64=3");                          \
+          builtin_define ("_MIPS_SIM=_ABI64");                  \
+          builtin_define ("_MIPS_SZLONG=64");                   \
+          builtin_define ("_MIPS_SZPTR=64");                    \
+        }                                                       \
+      else if (mips_abi == ABI_O64)                             \
+        {                                                       \
+          builtin_define ("__mips_o64");                        \
+          builtin_define ("_ABIO64=4");                         \
+          builtin_define ("_MIPS_SIM=_ABIO64");                 \
+          builtin_define ("_MIPS_SZLONG=64");                   \
+          builtin_define ("_MIPS_SZPTR=64");                    \
+        }                                                       \
+      else if (mips_abi == ABI_EABI)                            \
+        {                                                       \
+          builtin_define ("__mips_eabi");                       \
+          builtin_define ("_ABIEMB=5");                         \
+          builtin_define ("_MIPS_SIM=_ABIEMB");                 \
+          if (TARGET_LONG64)                                    \
+            builtin_define ("_MIPS_SZLONG=64");                 \
+          else                                                  \
+            builtin_define ("_MIPS_SZLONG=32");                 \
+          if (TARGET_64BIT)                                     \
+            builtin_define ("_MIPS_SZPTR=64");                  \
+          else                                                  \
+            builtin_define ("_MIPS_SZPTR=32");                  \
+        }                                                       \
+      else                                                      \
+        {                                                       \
+          builtin_define ("__mips_o32");                        \
+          builtin_define ("_ABIO32=1");                         \
+          builtin_define ("_MIPS_SIM=_ABIO32");                 \
+          builtin_define ("_MIPS_SZLONG=32");                   \
+          builtin_define ("_MIPS_SZPTR=32");                    \
+        }                                                       \
+      if (TARGET_FLOAT64)                                       \
+        builtin_define ("_MIPS_FPSET=32");                      \
+      else                                                      \
+        builtin_define ("_MIPS_FPSET=16");                      \
+                                                                \
+      builtin_define ("_MIPS_SZINT=32");                        \
+								\
       MIPS_CPP_SET_PROCESSOR ("_MIPS_ARCH", mips_arch_info);	\
       MIPS_CPP_SET_PROCESSOR ("_MIPS_TUNE", mips_tune_info);	\
 								\
-      if (ISA_MIPS3)						\
-	builtin_define ("__mips=3");				\
+      if (ISA_MIPS1)                                            \
+        {                                                       \
+          builtin_define ("__mips=1");                          \
+          builtin_define ("_MIPS_ISA=_MIPS_ISA_MIPS1");         \
+	}							\
+      else if (ISA_MIPS2)                                       \
+        {                                                       \
+          builtin_define ("__mips=2");                          \
+          builtin_define ("_MIPS_ISA=_MIPS_ISA_MIPS2");         \
+	}							\
+      else if (ISA_MIPS3)					\
+        {                                                       \
+          builtin_define ("__mips=3");                          \
+          builtin_define ("_MIPS_ISA=_MIPS_ISA_MIPS3");         \
+	}							\
       else if (ISA_MIPS4)					\
-	builtin_define ("__mips=4");				\
+        {                                                       \
+          builtin_define ("__mips=4");                          \
+          builtin_define ("_MIPS_ISA=_MIPS_ISA_MIPS4");         \
+	}							\
       else if (ISA_MIPS32)					\
 	{							\
 	  builtin_define ("__mips=32");				\
+          builtin_define ("_MIPS_ISA=_MIPS_ISA_MIPS32");        \
 	  builtin_define ("__mips_isa_rev=1");			\
 	}							\
       else if (ISA_MIPS32R2)					\
 	{							\
 	  builtin_define ("__mips=32");				\
+          builtin_define ("_MIPS_ISA=_MIPS_ISA_MIPS32");        \
 	  builtin_define ("__mips_isa_rev=2");			\
 	}							\
       else if (ISA_MIPS64)					\
 	{							\
 	  builtin_define ("__mips=64");				\
+          builtin_define ("_MIPS_ISA=_MIPS_ISA_MIPS64");        \
 	  builtin_define ("__mips_isa_rev=1");			\
 	}							\
-								\
+/*      else if (ISA_MIPS64R2)					\
+	{							\
+	  builtin_define ("__mips=64");				\
+          builtin_define ("_MIPS_ISA=_MIPS_ISA_MIPS64");        \
+	  builtin_define ("__mips_isa_rev=2");			\
+	}							\
+*/								\
       if (TARGET_HARD_FLOAT)					\
 	builtin_define ("__mips_hard_float");			\
       else if (TARGET_SOFT_FLOAT)				\
@@ -164,29 +249,33 @@ Boston, MA 02110-1301, USA.  */
 	builtin_define ("__MIPSEL__");				\
 								\
       /* No language dialect defines.  */			\
-								\
-      if (mips_abi == ABI_EABI)					\
-	builtin_define ("__mips_eabi");				\
-      else if (mips_abi == ABI_N32)				\
-	builtin_define ("__mips_n32");				\
-      else if (mips_abi == ABI_64)				\
-	builtin_define ("__mips_n64");				\
-      else if (mips_abi == ABI_O64)				\
-	builtin_define ("__mips_o64");				\
-      else							\
-	builtin_define ("__mips_o32");				\
-								\
       if (TARGET_ABICALLS)					\
 	builtin_define ("__ABICALLS__");			\
     }								\
   while (0)
 
-/* Default to the mips32 ISA */
-#undef  DRIVER_SELF_SPECS
+/* Default ABI and ISA */
+#undef DRIVER_SELF_SPECS
+#if MIPS_ABI_DEFAULT == ABI_N32
 #define DRIVER_SELF_SPECS \
-  "%{!march=*: -march=mips32}"
-#if 0
-  "%{!EB:%{!EL:%(endian_spec)}}", 
+	"%{!EB:%{!EL:%(endian_spec)}}", \
+	"%{!march=*: -march=mips64}",   \
+	"%{!mabi=*: -mabi=n32}"
+#elif MIPS_ABI_DEFAULT == ABI_64
+#define DRIVER_SELF_SPECS \
+	"%{!EB:%{!EL:%(endian_spec)}}", \
+	"%{!march=*: -march=mips64}",   \
+	"%{!mabi=*: -mabi=64}"
+#elif MIPS_ABI_DEFAULT == ABI_O64
+#define DRIVER_SELF_SPECS \
+	"%{!EB:%{!EL:%(endian_spec)}}", \
+	"%{!march=*: -march=mips64}",   \
+	"%{!mabi=*: -mabi=o64}"
+#else /* default to o32 */
+#define DRIVER_SELF_SPECS \
+	"%{!EB:%{!EL:%(endian_spec)}}", \
+	"%{!march=*: -march=mips32}",   \
+	"%{!mabi=*: -mabi=32}"
 #endif
 
 #if 0
@@ -238,6 +327,15 @@ Boston, MA 02110-1301, USA.  */
 #undef  LOCAL_LABEL_PREFIX
 #define LOCAL_LABEL_PREFIX "."
 
+/* Currently we don't support 128bit long doubles, so for now we force
+   n32 to be 64bit.  */
+#undef	LONG_DOUBLE_TYPE_SIZE
+#define	LONG_DOUBLE_TYPE_SIZE 64
+ 
+#ifdef IN_LIBGCC2
+#undef	LIBGCC2_LONG_DOUBLE_TYPE_SIZE
+#define	LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64
+#endif
 
 /************************[  Debugger stuff  ]*********************************/
 

Modified: stable/8/gnu/lib/libgcc/Makefile
==============================================================================
--- stable/8/gnu/lib/libgcc/Makefile	Sat Nov 27 09:26:46 2010	(r215937)
+++ stable/8/gnu/lib/libgcc/Makefile	Sat Nov 27 12:26:40 2010	(r215938)
@@ -115,6 +115,10 @@ LIB2FUNCS_EXTRA = floatunsidf.c floatuns
 #	_fixsfsi _fixunssfsi _floatdidf _floatdisf
 .endif
 
+.if ${TARGET_ARCH} == "mips"
+LIB2FUNCS_EXTRA = floatunsidf.c floatunsisf.c
+.endif
+
 .if ${TARGET_ARCH} == "ia64"
 #	from config/ia64/t-ia64
 LIB1ASMSRC   = lib1funcs.asm
@@ -179,7 +183,7 @@ OBJ_GRPS =	STD DIV
 #
 # Floating point emulation functions
 #
-.if ${TARGET_ARCH} == "armNOT_YET" || ${TARGET_ARCH} == "mips" || \
+.if ${TARGET_ARCH} == "armNOT_YET" || \
     ${TARGET_ARCH} == "powerpc" || ${TARGET_ARCH} == "sparc64"
 
 FPBIT_CFLAGS =	-DFINE_GRAINED_LIBRARIES -DFLOAT

Modified: stable/8/gnu/usr.bin/binutils/Makefile.inc0
==============================================================================
--- stable/8/gnu/usr.bin/binutils/Makefile.inc0	Sat Nov 27 09:26:46 2010	(r215937)
+++ stable/8/gnu/usr.bin/binutils/Makefile.inc0	Sat Nov 27 12:26:40 2010	(r215938)
@@ -22,7 +22,8 @@ RELTOP:= ..
 RELSRC=	${RELTOP}/../../../contrib/binutils
 SRCDIR=	${.CURDIR}/${RELSRC}
 
-.if ${TARGET_ARCH} == "arm" || ${TARGET_ARCH} == "i386" || ${TARGET_ARCH} == "powerpc"
+.if ${TARGET_ARCH} == "arm" || ${TARGET_ARCH} == "i386" || \
+	${TARGET_ARCH} == "powerpc" || ${TARGET_ARCH} == "mips"
 CFLAGS+= -DBFD_DEFAULT_TARGET_SIZE=32
 .else
 CFLAGS+= -DBFD_DEFAULT_TARGET_SIZE=64

Modified: stable/8/gnu/usr.bin/binutils/ld/Makefile.mips
==============================================================================
--- stable/8/gnu/usr.bin/binutils/ld/Makefile.mips	Sat Nov 27 09:26:46 2010	(r215937)
+++ stable/8/gnu/usr.bin/binutils/ld/Makefile.mips	Sat Nov 27 12:26:40 2010	(r215938)
@@ -10,15 +10,23 @@ NATIVE_EMULATION=elf${_sz}btsmip_fbsd
 NATIVE_EMULATION=elf${_sz}ltsmip_fbsd
 .endif
 
-SRCS+=	e${NATIVE_EMULATION}.c 
-CLEANFILES+=	e${NATIVE_EMULATION}.c
-
+MIPS_ABIS=elf32btsmip_fbsd elf32ltsmip_fbsd elf64btsmip_fbsd elf64ltsmip_fbsd \
+    elf32btsmipn32_fbsd elf32ltsmipn32_fbsd
+.for abi in ${MIPS_ABIS}
+#.if (${abi} != ${NATIVE_EMULATION})
+EMS+= ${abi}
+#.endif
+.for ext in ${ELF_SCR_EXT}
+LDSCRIPTS+= ${abi}.${ext}
+.endfor
+SRCS+=	e${abi}.c 
+CLEANFILES+=	e${abi}.c
 # nb: elf32 handles both elf32 and elf64 targets
-e${NATIVE_EMULATION}.c:	${.CURDIR}/${NATIVE_EMULATION}.sh emultempl/elf32.em \
+e${abi}.c:	${.CURDIR}/${abi}.sh emultempl/elf32.em \
     scripttempl/elf.sc genscripts.sh stringify.sed
 	sh ${.CURDIR}/genscripts.sh ${SRCDIR}/ld ${LIBSERACHPATH} \
 	    ${TOOLS_PREFIX}/usr \
 	    ${HOST} ${TARGET_TUPLE} ${TARGET_TUPLE} \
-	    ${NATIVE_EMULATION} ""  no ${NATIVE_EMULATION} ${TARGET_TUPLE} \
-	    ${.CURDIR}/${NATIVE_EMULATION}.sh
-
+	    ${abi} ""  no ${abi} ${TARGET_TUPLE} \
+	    ${.CURDIR}/${abi}.sh
+.endfor

Copied and modified: stable/8/gnu/usr.bin/binutils/ld/elf32btsmipn32_fbsd.sh (from r204548, head/gnu/usr.bin/binutils/ld/elf32btsmipn32_fbsd.sh)
==============================================================================
--- head/gnu/usr.bin/binutils/ld/elf32btsmipn32_fbsd.sh	Tue Mar  2 05:43:04 2010	(r204548, copy source)
+++ stable/8/gnu/usr.bin/binutils/ld/elf32btsmipn32_fbsd.sh	Sat Nov 27 12:26:40 2010	(r215938)
@@ -1,4 +1,5 @@
 # $FreeBSD$
-. ${srcdir}/emulparams/elf32btsmip.sh
+. ${srcdir}/emulparams/elf32btsmipn32.sh
 . ${srcdir}/emulparams/elf_fbsd.sh
 GENERATE_PIE_SCRIPT=yes
+ALIGNMENT=8

Copied and modified: stable/8/gnu/usr.bin/binutils/ld/elf32ltsmipn32_fbsd.sh (from r204548, head/gnu/usr.bin/binutils/ld/elf32ltsmipn32_fbsd.sh)
==============================================================================
--- head/gnu/usr.bin/binutils/ld/elf32ltsmipn32_fbsd.sh	Tue Mar  2 05:43:04 2010	(r204548, copy source)
+++ stable/8/gnu/usr.bin/binutils/ld/elf32ltsmipn32_fbsd.sh	Sat Nov 27 12:26:40 2010	(r215938)
@@ -1,4 +1,5 @@
 # $FreeBSD$
-. ${srcdir}/emulparams/elf32ltsmip.sh
+. ${srcdir}/emulparams/elf32ltsmipn32.sh
 . ${srcdir}/emulparams/elf_fbsd.sh
 GENERATE_PIE_SCRIPT=yes
+ALIGNMENT=8

Modified: stable/8/gnu/usr.bin/cc/Makefile.inc
==============================================================================
--- stable/8/gnu/usr.bin/cc/Makefile.inc	Sat Nov 27 09:26:46 2010	(r215937)
+++ stable/8/gnu/usr.bin/cc/Makefile.inc	Sat Nov 27 12:26:40 2010	(r215938)
@@ -30,6 +30,39 @@ CFLAGS+=	-DLONG_TYPE_SIZE=${LONG_TYPE_SI
 CFLAGS+=	-DCROSS_COMPILE
 .endif
 
+.if ${TARGET_ARCH} == "mips"
+# XXX This is backwards, MIPS should default to BE.
+.if !defined(TARGET_BIG_ENDIAN)
+CFLAGS += -DTARGET_ENDIAN_DEFAULT=0
+.endif
+
+.if defined(TARGET_ABI) && ${TARGET_ABI} != "o32"
+.if ${TARGET_ABI} == "n32"
+MIPS_ABI_DEFAULT=ABI_N32
+.elif ${TARGET_ABI} == "n64"
+MIPS_ABI_DEFAULT=ABI_64
+.endif
+.endif
+
+MIPS_ABI_DEFAULT?=ABI_32
+CFLAGS += -DMIPS_ABI_DEFAULT=${MIPS_ABI_DEFAULT}
+
+# If we are compiling for the O32 ABI, we need to default to MIPS-III rather
+# than taking the ISA from the ABI requirements, since FreeBSD is built with
+# a number of MIPS-III features/instructions and that is the minimum ISA we
+# support, not the O32 default MIPS-I.
+.if ${MIPS_ABI_DEFAULT} == "ABI_32"
+TARGET_CPUTYPE?=mips3
+.endif
+
+# GCC by default takes the ISA from the ABI's requirements.  If world is built
+# with a superior ISA, since we lack multilib, we have to set the right
+# default ISA to be able to link against what's in /usr/lib.  Terrible stuff.
+.if defined(TARGET_CPUTYPE)
+CFLAGS += -DMIPS_CPU_STRING_DEFAULT=\"${TARGET_CPUTYPE}\"
+.endif
+.endif
+
 .if defined(WANT_FORCE_OPTIMIZATION_DOWNGRADE)
 CFLAGS+= -DFORCE_OPTIMIZATION_DOWNGRADE=${WANT_FORCE_OPTIMIZATION_DOWNGRADE}
 .endif

Modified: stable/8/gnu/usr.bin/cc/Makefile.tgt
==============================================================================
--- stable/8/gnu/usr.bin/cc/Makefile.tgt	Sat Nov 27 09:26:46 2010	(r215937)
+++ stable/8/gnu/usr.bin/cc/Makefile.tgt	Sat Nov 27 12:26:40 2010	(r215938)
@@ -15,9 +15,6 @@ GCC_CPU=	${TARGET_ARCH}
 .if ${TARGET_ARCH} == "ia64"
 TARGET_CPU_DEFAULT= MASK_GNU_AS|MASK_GNU_LD
 .endif
-.if ${TARGET_ARCH} == "mips"
-TARGET_CPU_DEFAULT= 16
-.endif
 .if ${TARGET_ARCH} == "sparc64"
 TARGET_CPU_DEFAULT= TARGET_CPU_ultrasparc
 .endif

Modified: stable/8/lib/libc/Makefile
==============================================================================
--- stable/8/lib/libc/Makefile	Sat Nov 27 09:26:46 2010	(r215937)
+++ stable/8/lib/libc/Makefile	Sat Nov 27 12:26:40 2010	(r215938)
@@ -51,7 +51,12 @@ NOASM=
 .include "${.CURDIR}/posix1e/Makefile.inc"
 .if ${MACHINE_ARCH} != "amd64" && \
     ${MACHINE_ARCH} != "ia64" && \
-    ${MACHINE_ARCH} != "sparc64"
+    ${MACHINE_ARCH} != "sparc64" && \
+    ${MACHINE_ARCH} != "mips"
+.include "${.CURDIR}/quad/Makefile.inc"
+.endif
+.if ${MACHINE_ARCH} == "mips" && \
+    (!defined(TARGET_ABI) || ${TARGET_ABI} == "o32")
 .include "${.CURDIR}/quad/Makefile.inc"
 .endif
 .include "${.CURDIR}/regex/Makefile.inc"
@@ -64,7 +69,7 @@ NOASM=
 .include "${.CURDIR}/rpc/Makefile.inc"
 .include "${.CURDIR}/uuid/Makefile.inc"
 .include "${.CURDIR}/xdr/Makefile.inc"
-.if ${MACHINE_ARCH} == "arm"
+.if ${MACHINE_ARCH} == "arm" || ${MACHINE_ARCH} == "mips"
 .include "${.CURDIR}/softfloat/Makefile.inc"
 .endif
 .if ${MK_NIS} != "no"

Modified: stable/8/lib/libc/mips/Makefile.inc
==============================================================================
--- stable/8/lib/libc/mips/Makefile.inc	Sat Nov 27 09:26:46 2010	(r215937)
+++ stable/8/lib/libc/mips/Makefile.inc	Sat Nov 27 12:26:40 2010	(r215938)
@@ -1,8 +1,6 @@
 #	$NetBSD: Makefile.inc,v 1.7 2005/09/17 11:49:39 tsutsui Exp $
 # $FreeBSD$
 
-SOFTFLOAT_BITS=32
-
 CFLAGS+=-DSOFTFLOAT
 
 MDSRCS+= machdep_ldisd.c

Modified: stable/8/lib/libc/mips/SYS.h
==============================================================================
--- stable/8/lib/libc/mips/SYS.h	Sat Nov 27 09:26:46 2010	(r215937)
+++ stable/8/lib/libc/mips/SYS.h	Sat Nov 27 12:26:40 2010	(r215938)
@@ -1,4 +1,4 @@
-/*	$NetBSD: SYS.h,v 1.18 2003/10/29 12:28:33 pooka Exp $ */
+/*	$NetBSD: SYS.h,v 1.19 2009/12/14 01:07:41 matt Exp $ */
 /* $FreeBSD$ */
 
 /*-
@@ -79,14 +79,22 @@
  */
 #ifdef __ABICALLS__
 	.abicalls
-# define PIC_PROLOGUE(x,sr)	.set noreorder; .cpload sr; .set reorder
-# define PIC_CALL(l,sr)		la sr, _C_LABEL(l); jr sr
+# if defined(__mips_o32) || defined(__mips_o64)
+#  define PIC_PROLOGUE(x)	SETUP_GP
+#  define PIC_TAILCALL(l)	PTR_LA t9, _C_LABEL(l); jr t9
+#  define PIC_RETURN()		j ra
+# else
+#  define PIC_PROLOGUE(x)	SETUP_GP64(t3, x)
+#  define PIC_TAILCALL(l)	PTR_LA t9, _C_LABEL(l); RESTORE_GP64; jr t9
+#  define PIC_RETURN()		RESTORE_GP64; j ra
+# endif
 #else
-# define PIC_PROLOGUE(x,sr)
-# define PIC_CALL(l,sr)		j  _C_LABEL(l)
-#endif
+# define PIC_PROLOGUE(x)
+# define PIC_TAILCALL(l)	j  _C_LABEL(l)
+# define PIC_RETURN()		j ra
+#endif /* __ABICALLS__ */
 
-# define SYSTRAP(x)	li v0, SYS_ ## x; syscall;
+# define SYSTRAP(x)	li v0,SYS_ ## x; syscall;
 
 /*
  * Do a syscall that cannot fail (sync, get{p,u,g,eu,eg)id)
@@ -106,7 +114,7 @@
  */
 #define PSEUDO_NOERROR(x)						\
 LEAF(__sys_ ## x);							\
-        .weak _C_LABEL(x);						\
+	.weak _C_LABEL(x);						\
 	_C_LABEL(x) = _C_LABEL(__CONCAT(__sys_,x));			\
 	.weak _C_LABEL(__CONCAT(_,x));					\
 	_C_LABEL(__CONCAT(_,x)) = _C_LABEL(__CONCAT(__sys_,x));		\
@@ -116,14 +124,14 @@ LEAF(__sys_ ## x);							\
 
 #define PSEUDO(x)							\
 LEAF(__sys_ ## x);							\
-        .weak _C_LABEL(x);						\
+	.weak _C_LABEL(x);						\
 	_C_LABEL(x) = _C_LABEL(__CONCAT(__sys_,x));			\
 	.weak _C_LABEL(__CONCAT(_,x));					\
 	_C_LABEL(__CONCAT(_,x)) = _C_LABEL(__CONCAT(__sys_,x));		\
-	PIC_PROLOGUE(x,t9);						\
+	PIC_PROLOGUE(__sys_ ## x);					\
 	SYSTRAP(x);							\
 	bne a3,zero,err;						\
-	j ra;								\
+	PIC_RETURN();							\
 err:									\
-	PIC_CALL(__cerror,t9);						\
-	END(__sys_ ## x)
+	PIC_TAILCALL(__cerror);						\
+END(__sys_ ## x)

Modified: stable/8/lib/libc/mips/Symbol.map
==============================================================================
--- stable/8/lib/libc/mips/Symbol.map	Sat Nov 27 09:26:46 2010	(r215937)
+++ stable/8/lib/libc/mips/Symbol.map	Sat Nov 27 12:26:40 2010	(r215938)
@@ -24,13 +24,9 @@ FBSD_1.0 {
 	sigsetjmp;
 	siglongjmp;
 	htonl;
-	__htonl;
 	htons;
-	__htons;
 	ntohl;
-	__ntohl;
 	ntohs;
-	__ntohs;
 	vfork;
 	brk;
 	cerror;		/* XXX - Should this be .cerror (see sys/cerror.S)? */
@@ -56,9 +52,27 @@ FBSDprivate_1.0 {
 	__siglongjmp;
 	__sys_vfork;
 	_vfork;
-	end;		/* XXX - Should this be _end (see sys/brk.S)? */
-	curbrk;
+	_end;
+	__curbrk;
 	minbrk;
 	_brk;
 	_sbrk;
+
+	/* softfloat */
+	__addsf3;
+	__adddf3;
+	__subsf3;
+	__subdf3;
+	__mulsf3;
+	__muldf3;
+	__divsf3;
+	__divdf3;
+	__floatsisf;
+	__floatsidf;
+	__fixsfsi;
+	__fixdfsi;
+	__fixunssfsi;
+	__fixunsdfsi;
+	__extendsfdf2;
+	__truncdfsf2;
 };

Modified: stable/8/lib/libc/mips/gen/Makefile.inc
==============================================================================
--- stable/8/lib/libc/mips/gen/Makefile.inc	Sat Nov 27 09:26:46 2010	(r215937)
+++ stable/8/lib/libc/mips/gen/Makefile.inc	Sat Nov 27 12:26:40 2010	(r215938)
@@ -6,4 +6,4 @@ SRCS+=	infinity.c fabs.c ldexp.c modf.c
 # SRCS+=	flt_rounds.c fpgetmask.c fpgetround.c fpgetsticky.c fpsetmask.c \
 #	fpsetround.c fpsetsticky.c
 
-SRCS+=	_set_tp.c _setjmp.S makecontext.c setjmp.S signalcontext.c sigsetjmp.S
+SRCS+=	_ctx_start.S _set_tp.c _setjmp.S makecontext.c setjmp.S signalcontext.c sigsetjmp.S

Copied: stable/8/lib/libc/mips/gen/_ctx_start.S (from r209233, head/lib/libc/mips/gen/_ctx_start.S)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/8/lib/libc/mips/gen/_ctx_start.S	Sat Nov 27 12:26:40 2010	(r215938, copy of r209233, head/lib/libc/mips/gen/_ctx_start.S)
@@ -0,0 +1,41 @@
+/*-
+ * Copyright (c) 2010 Juli Mallett.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <machine/asm.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * XXX gp?
+ */
+ENTRY(_ctx_start)
+	jalr	t9
+
+	move	a0, s0
+	PTR_LA	t9, _ctx_done
+	jalr	t9
+
+	break	0
+END(_ctx_start)

Modified: stable/8/lib/libc/mips/gen/_setjmp.S
==============================================================================
--- stable/8/lib/libc/mips/gen/_setjmp.S	Sat Nov 27 09:26:46 2010	(r215937)
+++ stable/8/lib/libc/mips/gen/_setjmp.S	Sat Nov 27 12:26:40 2010	(r215938)
@@ -1,4 +1,4 @@
-/*	$NetBSD: _setjmp.S,v 1.20 2005/10/07 17:16:40 tsutsui Exp $	*/
+/*	$NetBSD: _setjmp.S,v 1.20.34.5 2010/02/03 23:46:47 matt Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -36,14 +36,15 @@
 __FBSDID("$FreeBSD$");
 #include <machine/regnum.h>
 
-#if defined(LIBC_SCCS) && !defined(lint)
-	ASMSTR("from: @(#)_setjmp.s	8.1 (Berkeley) 6/4/93")
-	ASMSTR("$NetBSD: _setjmp.S,v 1.20 2005/10/07 17:16:40 tsutsui Exp $")
-#endif /* LIBC_SCCS and not lint */
+#include "SYS.h"
 
-#ifdef __ABICALLS__
-	.abicalls
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+	RCSID("from: @(#)_setjmp.s	8.1 (Berkeley) 6/4/93")
+#else
+	RCSID("$NetBSD: _setjmp.S,v 1.20.34.5 2010/02/03 23:46:47 matt Exp $")
 #endif
+#endif /* LIBC_SCCS and not lint */
 
 /*
  * C library -- _setjmp, _longjmp
@@ -56,62 +57,70 @@ __FBSDID("$FreeBSD$");
  * The previous signal state is NOT restored.
  */
 
+	.set	noreorder
 
 LEAF(_setjmp)
-#ifdef __ABICALLS__ 
-	.set	noreorder
-	.cpload t9
-	subu	sp, sp, CALLFRAME_SIZ	# allocate stack frame
-	.cprestore 16
+	REG_PROLOGUE
+	REG_LI	v0, _JB_MAGIC__SETJMP
+	REG_S	v0, (_JB_MAGIC  * SZREG)(a0)
+	REG_S	ra, (_JB_REG_RA * SZREG)(a0)
+	REG_S	s0, (_JB_REG_S0 * SZREG)(a0)
+	REG_S	s1, (_JB_REG_S1 * SZREG)(a0)
+	REG_S	s2, (_JB_REG_S2 * SZREG)(a0)
+	REG_S	s3, (_JB_REG_S3 * SZREG)(a0)
+	REG_S	s4, (_JB_REG_S4 * SZREG)(a0)
+	REG_S	s5, (_JB_REG_S5 * SZREG)(a0)
+	REG_S	s6, (_JB_REG_S6 * SZREG)(a0)
+	REG_S	s7, (_JB_REG_S7 * SZREG)(a0)
+	REG_S	s8, (_JB_REG_S8 * SZREG)(a0)
+#if defined(__mips_n32) || defined(__mips_n64)
+	REG_S	gp, (_JB_REG_GP * SZREG)(a0)	# newabi gp is callee-saved
 #endif
-	li	v0, _JB_MAGIC__SETJMP
-	sw	v0, (_JB_MAGIC  * SZREG)(a0)
-	sw	ra, (_JB_REG_RA * SZREG)(a0)
-	sw	s0, (_JB_REG_S0 * SZREG)(a0)
-	sw	s1, (_JB_REG_S1 * SZREG)(a0)
-	sw	s2, (_JB_REG_S2 * SZREG)(a0)
-	sw	s3, (_JB_REG_S3 * SZREG)(a0)
-	sw	s4, (_JB_REG_S4 * SZREG)(a0)
-	sw	s5, (_JB_REG_S5 * SZREG)(a0)
-	sw	s6, (_JB_REG_S6 * SZREG)(a0)
-	sw	s7, (_JB_REG_S7 * SZREG)(a0)
-	sw	s8, (_JB_REG_S8 * SZREG)(a0)
-#ifdef __ABICALLS__
-	addu	sp, sp, CALLFRAME_SIZ	# un-allocate the stack frame
-#endif	
-	sw	sp, (_JB_REG_SP * SZREG)(a0)
+	REG_S	sp, (_JB_REG_SP * SZREG)(a0)
+	REG_EPILOGUE
+
 	j	ra
 	move	v0, zero
 END(_setjmp)
 
 LEAF(_longjmp)
-#ifdef __ABICALLS__ 
-	.set	noreorder
-	.cpload t9
-	subu	sp, sp, CALLFRAME_SIZ	# allocate stack frame
-	.cprestore 16
-#endif  
-	lw	v0, (_JB_MAGIC  * SZREG)(a0)
-	lw	ra, (_JB_REG_RA * SZREG)(a0)
-	li	t0, _JB_MAGIC__SETJMP
-	bne	v0, t0, botch		# jump if error
-	lw	s0, (_JB_REG_S0 * SZREG)(a0)
-	lw	s1, (_JB_REG_S1 * SZREG)(a0)
-	lw	s2, (_JB_REG_S2 * SZREG)(a0)
-	lw	s3, (_JB_REG_S3 * SZREG)(a0)
-	lw	s4, (_JB_REG_S4 * SZREG)(a0)
-	lw	s5, (_JB_REG_S5 * SZREG)(a0)
-	lw	s6, (_JB_REG_S6 * SZREG)(a0)
-	lw	s7, (_JB_REG_S7 * SZREG)(a0)
-	lw	sp, (_JB_REG_SP * SZREG)(a0)
-	lw	s8, (_JB_REG_S8 * SZREG)(a0)
+	PIC_PROLOGUE(_longjmp)
+	PTR_SUBU	sp, sp, CALLFRAME_SIZ
+	SAVE_GP(CALLFRAME_GP)
+
+	REG_PROLOGUE
+	REG_L		v0, (_JB_MAGIC  * SZREG)(a0)	# get magic number
+	REG_L		ra, (_JB_REG_RA * SZREG)(a0)
+	REG_LI		t0, _JB_MAGIC__SETJMP
+	bne		v0, t0, botch		# jump if error
+	PTR_ADDU	sp, sp, CALLFRAME_SIZ	# does not matter, sanity
+	REG_L		s0, (_JB_REG_S0 * SZREG)(a0)
+	REG_L		s1, (_JB_REG_S1 * SZREG)(a0)
+	REG_L		s2, (_JB_REG_S2 * SZREG)(a0)
+	REG_L		s3, (_JB_REG_S3 * SZREG)(a0)
+	REG_L		s4, (_JB_REG_S4 * SZREG)(a0)
+	REG_L		s5, (_JB_REG_S5 * SZREG)(a0)
+	REG_L		s6, (_JB_REG_S6 * SZREG)(a0)
+	REG_L		s7, (_JB_REG_S7 * SZREG)(a0)
+#if defined(__mips_n32) || defined(__mips_n64)
+	REG_L		gp, (_JB_REG_GP * SZREG)(a0)
+#endif
+	REG_L		sp, (_JB_REG_SP * SZREG)(a0)
+	REG_L		s8, (_JB_REG_S8 * SZREG)(a0)
 
+	REG_EPILOGUE
+	move	v0, a1			# get return value in 1st arg
 	j	ra
-	move	v0, a1
+	nop
 
 botch:
-	jal	_C_LABEL(longjmperror)
-	nop
-	jal	_C_LABEL(abort)
+	/*
+	 * We know we aren't returning so we don't care about restoring
+	 * our caller's GP.
+	 */
+	PTR_LA	t9, _C_LABEL(longjmperror)
+	jalr	t9
 	nop
+
+	PIC_TAILCALL(abort)
 END(_longjmp)

Modified: stable/8/lib/libc/mips/gen/makecontext.c
==============================================================================
--- stable/8/lib/libc/mips/gen/makecontext.c	Sat Nov 27 09:26:46 2010	(r215937)
+++ stable/8/lib/libc/mips/gen/makecontext.c	Sat Nov 27 12:26:40 2010	(r215938)
@@ -1,4 +1,4 @@
-/*	$NetBSD: makecontext.c,v 1.3 2003/01/19 08:53:36 matt Exp $	*/
+/*	$NetBSD: makecontext.c,v 1.5 2009/12/14 01:07:42 matt Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -15,13 +15,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *        This product includes software developed by the NetBSD
- *        Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
@@ -39,48 +32,92 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: makecontext.c,v 1.3 2003/01/19 08:53:36 matt Exp $");
+__RCSID("$NetBSD: makecontext.c,v 1.5 2009/12/14 01:07:42 matt Exp $");
 #endif
 
-#include <sys/types.h>
-#include <ucontext.h>
+#include <sys/param.h>
+#include <machine/regnum.h>
+
 #include <stdarg.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <ucontext.h>
+
+__weak_reference(__makecontext, makecontext);
+
+void _ctx_done(ucontext_t *);
+void _ctx_start(void);
 
 void
-makecontext(ucontext_t *ucp, void (*func)(void), int argc, ...)
+__makecontext(ucontext_t *ucp, void (*func)(void), int argc, ...)
 {
-	/* XXXMIPS: Implement me */
-#if 0
-	__greg_t *gr = ucp->uc_mcontext.__gregs;
-	uintptr_t *sp;
+	mcontext_t *mc;
+	register_t *sp;
 	int i;
 	va_list ap;
 
-	void __resumecontext(void);
+	/*
+	 * XXX/juli
+	 * We need an mc_len or mc_flags like other architectures
+	 * so that we can mark a context as invalid.  Store it in
+	 * mc->mc_regs[ZERO] perhaps?
+	 */
+	if (argc < 0 || argc > 6 || ucp == NULL ||
+	    ucp->uc_stack.ss_sp == NULL ||
+	    ucp->uc_stack.ss_size < MINSIGSTKSZ)
+		return;
+	mc = &ucp->uc_mcontext;
 
-	/* LINTED uintptr_t is safe */
-	sp  = (uintptr_t *)
+	sp  = (register_t *)
 	    ((uintptr_t)ucp->uc_stack.ss_sp + ucp->uc_stack.ss_size);
-	/* LINTED uintptr_t is safe */
+#if defined(__mips_o32) || defined(__mips_o64)
 	sp -= (argc >= 4 ? argc : 4);	/* Make room for >=4 arguments. */
-	sp  = (uintptr_t *)
-	      ((uintptr_t)sp & ~0x7);	/* Align on double-word boundary. */
+	sp  = (register_t *)
+	    ((uintptr_t)sp & ~0x7);	/* Align on double-word boundary. */
+#elif defined(__mips_n32) || defined(__mips_n64)
+	sp -= (argc > 8 ? argc - 8 : 0); /* Make room for > 8 arguments. */
+	sp  = (register_t *)
+	    ((uintptr_t)sp & ~0xf);	/* Align on quad-word boundary. */
+#endif
 
-	gr[_REG_SP]  = (__greg_t)sp;
-	gr[_REG_RA]  = (__greg_t)__resumecontext;
-	gr[_REG_T9]  = (__greg_t)func;	/* required for .abicalls */
-	gr[_REG_EPC] = (__greg_t)func;
+	mc->mc_regs[SP] = (intptr_t)sp;
+	mc->mc_regs[S0] = (intptr_t)ucp;
+	mc->mc_regs[T9] = (intptr_t)func;
+	mc->mc_pc = (intptr_t)_ctx_start;
 
 	/* Construct argument list. */
 	va_start(ap, argc);
+#if defined(__mips_o32) || defined(__mips_o64)
 	/* Up to the first four arguments are passed in $a0-3. */
 	for (i = 0; i < argc && i < 4; i++)
-		/* LINTED uintptr_t is safe */
-		gr[_REG_A0 + i] = va_arg(ap, uintptr_t);
+		/* LINTED register_t is safe */
+		mc->mc_regs[A0 + i] = va_arg(ap, register_t);
+	/* Pass remaining arguments on the stack above the $a0-3 gap. */
+	sp += i;
+#endif
+#if defined(__mips_n32) || defined(__mips_n64)
+	/* Up to the first 8 arguments are passed in $a0-7. */
+	for (i = 0; i < argc && i < 8; i++)
+		/* LINTED register_t is safe */
+		mc->mc_regs[A0 + i] = va_arg(ap, register_t);
 	/* Pass remaining arguments on the stack above the $a0-3 gap. */
-	for (sp += 4; i < argc; i++)
+#endif
+	/* Pass remaining arguments on the stack above the $a0-3 gap. */
+	for (; i < argc; i++)
 		/* LINTED uintptr_t is safe */
-		*sp++ = va_arg(ap, uintptr_t);
+		*sp++ = va_arg(ap, register_t);
 	va_end(ap);
-#endif
+}
+
+void
+_ctx_done(ucontext_t *ucp)
+{
+
+	if (ucp->uc_link == NULL)
+		exit(0);
+	else {
+		setcontext((const ucontext_t *)ucp->uc_link);
+		abort();
+	}
 }

Modified: stable/8/lib/libc/mips/gen/setjmp.S
==============================================================================
--- stable/8/lib/libc/mips/gen/setjmp.S	Sat Nov 27 09:26:46 2010	(r215937)
+++ stable/8/lib/libc/mips/gen/setjmp.S	Sat Nov 27 12:26:40 2010	(r215938)
@@ -41,6 +41,8 @@ __FBSDID("$FreeBSD$");
 	ASMSTR("$NetBSD: setjmp.S,v 1.17 2005/09/17 11:49:39 tsutsui Exp $")
 #endif /* LIBC_SCCS and not lint */
 
+#include "SYS.h"
+
 #ifdef __ABICALLS__
 	.abicalls
 #endif
@@ -61,100 +63,102 @@ __FBSDID("$FreeBSD$");
 
 NESTED(setjmp, SETJMP_FRAME_SIZE, ra)
 	.mask	0x80000000, (CALLFRAME_RA - CALLFRAME_SIZ)
-	.set	noreorder
-#ifdef __ABICALLS__
-	.cpload	t9
-#endif
-	subu	sp, sp, SETJMP_FRAME_SIZE	# allocate stack frame
-#ifdef __ABICALLS__
-	.cprestore 16
-#endif
-	sw	ra, CALLFRAME_RA(sp)		# save RA
-	sw	a0, CALLFRAME_SIZ(sp)		# store env
+	SETUP_GP
+	PTR_SUBU sp, sp, SETJMP_FRAME_SIZE	# allocate stack frame
+	SAVE_GP(CALLFRAME_GP)
+	SETUP_GP64(CALLFRAME_GP, setjmp)
+
+	REG_S	ra, CALLFRAME_RA(sp)		# save RA
+	REG_S	a0, CALLFRAME_SIZ(sp)		# store env
 
 	/* Get the signal mask. */
-	addu	a2, a0, _JB_SIGMASK * SZREG	# &oenv
+	PTR_ADDU a2, a0, _JB_SIGMASK * SZREG	# &oenv
 	li	a0, 1				# SIG_SETBLOCK
 	move	a1, zero			# &env == 0
-	la	t9, _C_LABEL(sigprocmask)	# get current signal mask
-	jal	t9
-	nop
+	PTR_LA	t9, _C_LABEL(sigprocmask)	# get current signal mask
+	jalr	t9
 
-	lw	a0, CALLFRAME_SIZ(sp)		# restore env pointer
-	lw	ra, CALLFRAME_RA(sp)		# restore RA
-	addu	sp, sp, SETJMP_FRAME_SIZE	# pop stack frame
-
-	li	v0, _JB_MAGIC_SETJMP
-	sw	v0, (_JB_MAGIC  * SZREG)(a0)
-	sw	ra, (_JB_REG_RA * SZREG)(a0)
-	sw	s0, (_JB_REG_S0 * SZREG)(a0)
-	sw	s1, (_JB_REG_S1 * SZREG)(a0)
-	sw	s2, (_JB_REG_S2 * SZREG)(a0)
-	sw	s3, (_JB_REG_S3 * SZREG)(a0)
-	sw	s4, (_JB_REG_S4 * SZREG)(a0)
-	sw	s5, (_JB_REG_S5 * SZREG)(a0)
-	sw	s6, (_JB_REG_S6 * SZREG)(a0)
-	sw	s7, (_JB_REG_S7 * SZREG)(a0)
-	sw	sp, (_JB_REG_SP * SZREG)(a0)
-	sw	s8, (_JB_REG_S8 * SZREG)(a0)
+	RESTORE_GP64
+	REG_L	a0, CALLFRAME_SIZ(sp)		# restore env pointer
+	REG_L	ra, CALLFRAME_RA(sp)		# restore RA
+	PTR_ADDU sp, sp, SETJMP_FRAME_SIZE	# pop stack frame
+
+	REG_LI	v0, _JB_MAGIC_SETJMP
+	REG_S	v0, (_JB_MAGIC  * SZREG)(a0)
+	REG_S	ra, (_JB_REG_RA * SZREG)(a0)
+	REG_S	s0, (_JB_REG_S0 * SZREG)(a0)
+	REG_S	s1, (_JB_REG_S1 * SZREG)(a0)
+	REG_S	s2, (_JB_REG_S2 * SZREG)(a0)
+	REG_S	s3, (_JB_REG_S3 * SZREG)(a0)
+	REG_S	s4, (_JB_REG_S4 * SZREG)(a0)
+	REG_S	s5, (_JB_REG_S5 * SZREG)(a0)
+	REG_S	s6, (_JB_REG_S6 * SZREG)(a0)
+	REG_S	s7, (_JB_REG_S7 * SZREG)(a0)
+	REG_S	sp, (_JB_REG_SP * SZREG)(a0)
+	REG_S	s8, (_JB_REG_S8 * SZREG)(a0)
+#if defined(__mips_n32) || defined(__mips_n64)
+	REG_S	gp, (_JB_REG_GP * SZREG)(a0)
+#endif
 
 	move	v0, zero
-	j	ra
+	jr	ra
 END(setjmp)
 
 #define LONGJMP_FRAME_SIZE	(CALLFRAME_SIZ + (SZREG * 2))
 
 NESTED(longjmp, LONGJMP_FRAME_SIZE, ra)
 	.mask	0x80000000, (CALLFRAME_RA - CALLFRAME_SIZ)
-	.set	noreorder
-#ifdef __ABICALLS__
-	.cpload	t9
-#endif
-	subu	sp, sp, LONGJMP_FRAME_SIZE	# allocate stack frame
-#ifdef __ABICALLS__
-	.cprestore 16
-#endif
-	sw	ra, CALLFRAME_RA(sp)		# save RA
-	lw	v0, (_JB_MAGIC  * SZREG)(a0)
-	li	t0, _JB_MAGIC_SETJMP
+	PIC_PROLOGUE(longjmp)
+	PTR_SUBU sp, sp, LONGJMP_FRAME_SIZE	# allocate stack frame
+	SAVE_GP(CALLFRAME_GP)
+
+	REG_S	ra, CALLFRAME_RA(sp)		# save RA
+	REG_L	v0, (_JB_MAGIC  * SZREG)(a0)
+	REG_LI	t0, _JB_MAGIC_SETJMP
 	bne	v0, t0, botch		# jump if error
 	nop
 
-	sw	a0, CALLFRAME_SIZ(sp)		# save env
-	sw	a1, (CALLFRAME_SIZ + SZREG)(sp)	# save return value
+	REG_S	a0, CALLFRAME_SIZ(sp)		# save env
+	REG_S	a1, (CALLFRAME_SIZ + SZREG)(sp)	# save return value
 
 	# set sigmask
-	addu	a1, a0, _JB_SIGMASK * SZREG	# &set
+	PTR_ADDU a1, a0, _JB_SIGMASK * SZREG	# &set
 	move	a2, zero			# &oset == NULL
 	li	a0, 3				# SIG_SETMASK

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-src-all mailing list