[BACK]Return to asm2gas CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / arch / m68k / 060sp

File: [cvs.NetBSD.org] / src / sys / arch / m68k / 060sp / asm2gas (download)

Revision 1.6, Sat Aug 15 03:51:31 1998 UTC (25 years, 8 months ago) by mycroft
Branch: MAIN
CVS Tags: yamt-x86pmap-base4, yamt-x86pmap-base3, yamt-x86pmap-base2, yamt-x86pmap-base, yamt-x86pmap, yamt-vop-base3, yamt-vop-base2, yamt-vop-base, yamt-vop, yamt-uio_vmspace-base5, yamt-uio_vmspace, yamt-splraiseipl-base5, yamt-splraiseipl-base4, yamt-splraiseipl-base3, yamt-splraiseipl-base2, yamt-splraiseipl-base, yamt-splraiseipl, yamt-readahead-pervnode, yamt-readahead-perfile, yamt-readahead-base3, yamt-readahead-base2, yamt-readahead-base, yamt-readahead, yamt-pdpolicy-base9, yamt-pdpolicy-base8, yamt-pdpolicy-base7, yamt-pdpolicy-base6, yamt-pdpolicy-base5, yamt-pdpolicy-base4, yamt-pdpolicy-base3, yamt-pdpolicy-base2, yamt-pdpolicy-base, yamt-pdpolicy, yamt-lazymbuf-base15, yamt-lazymbuf-base14, yamt-lazymbuf, yamt-kmem-base3, yamt-kmem-base2, yamt-kmem-base, yamt-kmem, yamt-km-base4, yamt-km-base3, yamt-km-base2, yamt-km-base, yamt-km, yamt-idlelwp-base8, yamt-idlelwp, wrstuden-fixsa-newbase, wrstuden-fixsa-base-1, wrstuden-fixsa-base, wrstuden-fixsa, wrstuden-devbsize-base, wrstuden-devbsize-19991221, wrstuden-devbsize, vmlocking2-base3, vmlocking2-base2, vmlocking2-base1, vmlocking2, vmlocking-nbase, vmlocking-base, vmlocking, thorpej_scsipi_nbase, thorpej_scsipi_beforemerge, thorpej_scsipi_base, thorpej_scsipi, thorpej-vnode-attr-base, thorpej-vnode-attr, thorpej-mips-cache-base, thorpej-mips-cache, thorpej-devvp-base3, thorpej-devvp-base2, thorpej-devvp-base, thorpej-devvp, thorpej-atomic-base, thorpej-atomic, simonb-timecounters-base, simonb-timecounters, simonb-timcounters-final, rpaulo-netinet-merge-pcb-base, rpaulo-netinet-merge-pcb, reinoud-bufcleanup-nbase, reinoud-bufcleanup-base, reinoud-bufcleanup, pre-chs-ubcperf, ppcoea-renovation-base, ppcoea-renovation, post-newlock2-merge, post-chs-ubcperf, peter-altq-base, peter-altq, nick-net80211-sync-base, nick-net80211-sync, nick-csl-alignment-base5, nick-csl-alignment-base, nick-csl-alignment, newlock2-nbase, newlock2-base, newlock2, newlock-base, newlock, netbsd-4-base, netbsd-4-0-RELEASE, netbsd-4-0-RC5, netbsd-4-0-RC4, netbsd-4-0-RC3, netbsd-4-0-RC2, netbsd-4-0-RC1, netbsd-4-0-1-RELEASE, netbsd-4-0, netbsd-4, netbsd-3-base, netbsd-3-1-RELEASE, netbsd-3-1-RC4, netbsd-3-1-RC3, netbsd-3-1-RC2, netbsd-3-1-RC1, netbsd-3-1-1-RELEASE, netbsd-3-1, netbsd-3-0-RELEASE, netbsd-3-0-RC6, netbsd-3-0-RC5, netbsd-3-0-RC4, netbsd-3-0-RC3, netbsd-3-0-RC2, netbsd-3-0-RC1, netbsd-3-0-3-RELEASE, netbsd-3-0-2-RELEASE, netbsd-3-0-1-RELEASE, netbsd-3-0, netbsd-3, netbsd-2-base, netbsd-2-1-RELEASE, netbsd-2-1-RC6, netbsd-2-1-RC5, netbsd-2-1-RC4, netbsd-2-1-RC3, netbsd-2-1-RC2, netbsd-2-1-RC1, netbsd-2-1, netbsd-2-0-base, netbsd-2-0-RELEASE, netbsd-2-0-RC5, netbsd-2-0-RC4, netbsd-2-0-RC3, netbsd-2-0-RC2, netbsd-2-0-RC1, netbsd-2-0-3-RELEASE, netbsd-2-0-2-RELEASE, netbsd-2-0-1-RELEASE, netbsd-2-0, netbsd-2, netbsd-1-6-base, netbsd-1-6-RELEASE, netbsd-1-6-RC3, netbsd-1-6-RC2, netbsd-1-6-RC1, netbsd-1-6-PATCH002-RELEASE, netbsd-1-6-PATCH002-RC4, netbsd-1-6-PATCH002-RC3, netbsd-1-6-PATCH002-RC2, netbsd-1-6-PATCH002-RC1, netbsd-1-6-PATCH002, netbsd-1-6-PATCH001-RELEASE, netbsd-1-6-PATCH001-RC3, netbsd-1-6-PATCH001-RC2, netbsd-1-6-PATCH001-RC1, netbsd-1-6-PATCH001, netbsd-1-6, netbsd-1-5-base, netbsd-1-5-RELEASE, netbsd-1-5-PATCH003, netbsd-1-5-PATCH002, netbsd-1-5-PATCH001, netbsd-1-5-BETA2, netbsd-1-5-BETA, netbsd-1-5-ALPHA2, netbsd-1-5, netbsd-1-4-base, netbsd-1-4-RELEASE, netbsd-1-4-PATCH003, netbsd-1-4-PATCH002, netbsd-1-4-PATCH001, netbsd-1-4, nathanw_sa_end, nathanw_sa_before_merge, nathanw_sa_base, nathanw_sa, mjf-ufs-trans-base, mjf-ufs-trans, mjf-devfs-base, mjf-devfs, minoura-xpg4dl-base, minoura-xpg4dl, matt-nb4-arm-base, matt-nb4-arm, matt-mips64-base, matt-mips64, matt-armv6-prevmlocking, matt-armv6-nbase, matt-armv6-base, matt-armv6, ktrace-lwp-base, ktrace-lwp, kqueue-beforemerge, kqueue-base, kqueue-aftermerge, kqueue, kent-audio2-base, kent-audio2, kent-audio1-beforemerge, kent-audio1-base, kent-audio1, kenh-if-detach-base, kenh-if-detach, keiichi-mipv6-nbase, keiichi-mipv6-base, keiichi-mipv6, kame_14_19990705, kame_14_19990628, kame_141_19991130, kame, jmcneill-pm-base, jmcneill-pm, jmcneill-base, ifpoll-base, hpcarm-cleanup-base, hpcarm-cleanup, gmcgarry_ucred_base, gmcgarry_ucred, gmcgarry_ctxsw_base, gmcgarry_ctxsw, gehenna-devsw-base, gehenna-devsw, gdamore-uart-base, gdamore-uart, fvdl_fs64_base, fvdl-softdep-base, fvdl-softdep, elad-kernelauth-base, elad-kernelauth, eeh-devprop-base, eeh-devprop, cube-autoconf-base, cube-autoconf, comdex-fall-1999-base, comdex-fall-1999, chs-ubc2-newbase, chs-ubc2-base, chs-ubc2, chs-ubc-base, chs-ubc, chap-midi-nbase, chap-midi-base, chap-midi, bouyer-xeni386-nbase, bouyer-xeni386-merge1, bouyer-xeni386-base, bouyer-xeni386, bouyer-xenamd64-base2, bouyer-xenamd64-base, bouyer-xenamd64, ad-socklock-base1, ad-audiomp-base, ad-audiomp, abandoned-netbsd-4-base, abandoned-netbsd-4
Branch point for: mjf-devfs2
Changes since 1.5: +22 -15 lines

Assign copyrights to TNF.

#!/bin/sh
#	$NetBSD: asm2gas,v 1.6 1998/08/15 03:51:31 mycroft Exp $

#
# Copyright (c) 1998 The NetBSD Foundation, Inc.
# All rights reserved.
#
# This code is derived from software contributed to The NetBSD Foundation
# by Charles M. Hannum.
#
# 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.
# 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
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION 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.
#

# This ugly script converts assembler code from Motorola's format to a
# form that gas (MIT syntax) can digest.

cat $1 | sed -e '
  # format canonicalization

  s/^#/|#/
  /[ 	]IDNT[ 	]/{s/^/|/;p;d;}
  /^\*/{s//|/;p;d;}
  s/;/|/
  /[ 	]equ[ 	]/{
    s/\([A-Za-z_][A-Za-z0-9_]*\)[ 	]*equ[ 	]*/\1,/
    s/[ 	][ 	]*\(.*\)$/		|\1/
    s/		||/		|/
    s/^/	.set	/
    p;d
  }
  s/^\([A-Za-z_][A-Za-z0-9_]*\)[ 	][ 	]*/\1:	/
  s/^\([A-Za-z_][A-Za-z0-9_]*\)$/\1:/
  /^[A-Za-z_][A-Za-z0-9_]*:/{
    h
    s/:.*$/:/
    p
    g
    s/^.*:[ 	]*/	/
    /^	$/d
  }
  /^[ 	][ 	]*\([.a-zA-Z][.a-zA-Z0-9]*\)/{
    h
    s///
    s/^[ 	][ 	]*//
    s/[ 	][ 	]*\(.*\)$/		|\1/
    s/		||/		|/
    x
    s/^[ 	][ 	]*//
    s/[ 	][ 	]*.*$/	/
    y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
    s/^/	/
    G
    s/\n//
  }
' | sed -e '
  # operator conversion

  s/^	section	7/	.text/
  s/^	section	8/	.text/
  s/^	section	15/	.data/
  /^	include/{s/include[ 	]/.include "/;s/\.h[ 	]*$/.defs"/;p;d;}
  s/^	xref/|	xref/
  s/^	end/|	end/
  s/^	xdef/	.global/

  s/^	dc\.l/	.long/
  s/^	dc\.w/	.short/
  s/^	dc\.b/	.byte/

  /^	[aceg-z]/{
    /^	add[aiqx]*\.[bwl]	/{s/\.//;p;d;}
    /^	andi*\.[bwl]	/{s/\.//;p;d;}
    /^	as[lr]\.[bwl]	/{s/\.//;p;d;}
    /^	clr\.[bwl]	/{s/\.//;p;d;}
    /^	cmp[i2]*\.[bwl]	/{s/\.//;p;d;}
    /^	eori*\.[bwl]	/{s/\.//;p;d;}
    /^	lea\.l	/{s/\..//;p;d;}
    /^	ls[lr]\.[bwl]	/{s/\.//;p;d;}
    /^	move[acmqs]*\.[bwl]	/{s/\.//;p;d;}
    /^	mul[su]\.[wl]	/{s/\.//;p;d;}
    /^	neg\.[bwl]	/{s/\.//;p;d;}
    /^	ori*\.[bwl]	/{s/\.//;p;d;}
    /^	ro[lrx]*\.[bwl]	/{s/\.//;p;d;}
    /^	sub[aiqx]*\.[bwl]	/{s/\.//;p;d;}
    /^	swap\.w	/{s/\..//;p;d;}
    /^	s\([a-tv-z][a-z]*\)\.b	/{s/\..//;p;d;}
    /^	tst\.[bwl]	/{s/\.//;p;d;}
    p;d
  }

  /^	bchg\.[bl]	/{s/\..//;p;d;}
  /^	bclr\.[bl]	/{s/\..//;p;d;}
  /^	bset\.[bl]	/{s/\..//;p;d;}
  /^	btst\.[bl]	/{s/\..//;p;d;}
  /^	div[sul]*\.[wl]	/{s/\.//;p;d;}
  /^	fabs\.[sdx]	/{s/\.//;p;d;}
  /^	fadd\.[sdxbwl]	/{s/\.//;p;d;}
  /^	fcmp\.[sdxbwl]	/{s/\.//;p;d;}
  /^	fdiv\.[sdx]	/{s/\.//;p;d;}
  /^	fmove[mx]*\.[sdxbwl]	/{s/\.//;p;d;}
  /^	fmul\.[sdx]	/{s/\.//;p;d;}
  /^	fneg\.[sdx]	/{s/\.//;p;d;}
  /^	fsqrt\.[sdx]	/{s/\.//;p;d;}
  /^	fsub\.[sdxbwl]	/{s/\.//;p;d;}
  /^	ftst\.[sdx]	/{s/\.//;p;d;}

  /^	b[a-eg-z][a-z]*\.b	/{s/\.b/s/;p;d;}
  /^	b[a-eg-z][a-z]*\.w	/{s/\.w//;p;d;}
  /^	b[a-eg-z][a-z]*\.l	/{s/\.l/l/;p;d;}
  /^	db[a-z][a-z]*\.w	/{s/\.w//;p;d;}
  /^	fb[a-eg-z][a-z]*\.w	/{s/\.w//;p;d;}
  /^	fb[a-eg-z][a-z]*\.l	/{s/\.l/l/;p;d;}
' | sed -e '
  # operand conversion

  s/\([^_a-zA-Z0-9]\)FPIAR\([^_a-zA-Z0-9]\)/\1FPI\2/g
  s/\([^_a-zA-Z0-9]\)FPIAR\([^_a-zA-Z0-9]\)/\1FPI\2/g
  s/\([^_a-zA-Z0-9]\)FPIAR$/\1FPI/g
  s/\([^_a-zA-Z0-9]\)fpiar\([^_a-zA-Z0-9]\)/\1fpi\2/g
  s/\([^_a-zA-Z0-9]\)fpiar\([^_a-zA-Z0-9]\)/\1fpi\2/g
  s/\([^_a-zA-Z0-9]\)fpiar$/\1fpi/g

  s/\$\([0-9a-fA-F]\)/0x\1/g
  s/#:/#:0x/g

  s/-(\([sSpPaA][pPcC0-7]\))/\1@-/g
  s/(\([sSpPaA][pPcC0-7]\))+/\1@+/g
  s/\([-+A-Za-z0-9_]*\)(\([sSpPaA][pPcC0-7]\)\([),]\)/\2@(\1\3/g

  s/\.\([bBwWlL])\)/:\1/g
  s/\.\([bBwWlL]\)\*\([0-9][0-9]*)\)/:\1:\2/g
  s/\*\([0-9][0-9]*\))/:l:\1)/g
  s/{\([0-9][0-9]*\):\([0-9][0-9]*\)}/{#\1:#\2}/g
  s/{\([dD][0-7]\):\([0-9][0-9]*\)}/{\1:#\2}/g

  s/@(0*)/@/g
  s/(,/(/g;s/:)/)/g

  # make up for a gas bug
  /^	fmovemx	/{
	s/	\([fF][pP][0-7]\),/	\1-\1,/
	s/,\([fF][pP][0-7]\)	/,\1-\1	/
	s/,\([fF][pP][0-7]\)$/,\1-\1/
  }
'