diff --git a/Makefile b/Makefile index 30c2393..b28524c 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ PACKAGE = asm VERSION = 0.1.1 -SUBDIRS = data include src +SUBDIRS = data include src test RM = rm -f LN = ln -f TAR = tar -czvf @@ -64,6 +64,9 @@ dist: $(PACKAGE)-$(VERSION)/src/format/pe.c \ $(PACKAGE)-$(VERSION)/src/format/Makefile \ $(PACKAGE)-$(VERSION)/src/format/project.conf \ + $(PACKAGE)-$(VERSION)/test/sparc.S \ + $(PACKAGE)-$(VERSION)/test/Makefile \ + $(PACKAGE)-$(VERSION)/test/project.conf \ $(PACKAGE)-$(VERSION)/Makefile \ $(PACKAGE)-$(VERSION)/COPYING \ $(PACKAGE)-$(VERSION)/config.h \ diff --git a/project.conf b/project.conf index 12edc10..c6e5d1d 100644 --- a/project.conf +++ b/project.conf @@ -2,5 +2,5 @@ package=asm version=0.1.1 config=h,sh -subdirs=data,include,src +subdirs=data,include,src,test dist=Makefile,COPYING,config.h,config.sh diff --git a/test/Makefile b/test/Makefile new file mode 100644 index 0000000..aebadae --- /dev/null +++ b/test/Makefile @@ -0,0 +1,31 @@ +TARGETS = sparc.o +PREFIX = /usr/local +DESTDIR = +BINDIR = $(PREFIX)/bin +AS = ../src/asm +ASFLAGS = +RM = rm -f +LN = ln -f +MKDIR = mkdir -p +INSTALL = install + + +all: $(TARGETS) + +sparc.o_OBJS = sparc.o +sparc.o_ASFLAGS = $(CPPFLAGSF) $(CPPFLAGS) $(ASFLAGS) -a sparc + +sparc.o: sparc.S ../src/asm + $(AS) $(sparc.o_ASFLAGS) -o sparc.o sparc.S + +clean: + $(RM) -- $(sparc.o_OBJS) + +distclean: clean + $(RM) -- $(TARGETS) + +install: $(TARGETS) + +uninstall: + +.PHONY: all clean distclean install uninstall diff --git a/test/project.conf b/test/project.conf new file mode 100644 index 0000000..a487313 --- /dev/null +++ b/test/project.conf @@ -0,0 +1,11 @@ +targets=sparc.o +as=../src/asm +dist=Makefile + +[sparc.o] +type=object +sources=sparc.S + +[sparc.S] +asflags=-a sparc +depends=../src/asm diff --git a/test/sparc.S b/test/sparc.S new file mode 100644 index 0000000..0a562d5 --- /dev/null +++ b/test/sparc.S @@ -0,0 +1,79 @@ +.text + ldd [%r4 + %r7], %r11 /* 0xd6190007 */ + ldub [%r23], %r19 /* 0xe60dc000 */ + sub %r16, %r26, %r27 /* 0xb624001a */ + smulcc %r29, -$23, %r19 /* 0xa6df7fe9 */ + + add %r16, %r26, %r27 + add %r29, -$23, %r19 + addcc %r16, %r26, %r27 + addcc %r29, -$23, %r19 + and %r16, %r26, %r27 + and %r29, -$23, %r19 + andcc %r16, %r26, %r27 + andcc %r29, -$23, %r19 + andn %r16, %r26, %r27 + andn %r29, -$23, %r19 + andncc %r16, %r26, %r27 + andncc %r29, -$23, %r19 + ba $0x3 + be $0x3 + bg $0x3 + bge $0x3 + bl $0x3 + ble $0x3 + bne $0x3 + bz $0x3 + ld [%r4 + %r7], %r11 + ld [%r23], %r19 + ldd [%r4 + %r7], %r11 + ldd [%r23], %r19 + ldsb [%r4 + %r7], %r11 + ldsb [%r23], %r19 + ldsh [%r4 + %r7], %r11 + ldsh [%r23], %r19 + ldub [%r4 + %r7], %r11 + ldub [%r23], %r19 + lduh [%r4 + %r7], %r11 + lduh [%r23], %r19 + or %r16, %r26, %r27 + or %r29, -$23, %r19 + orcc %r16, %r26, %r27 + orcc %r29, -$23, %r19 + orn %r16, %r26, %r27 + orn %r29, -$23, %r19 + orncc %r16, %r26, %r27 + orncc %r29, -$23, %r19 + sdiv %r16, %r26, %r27 + sdiv %r29, -$23, %r19 + sdivcc %r16, %r26, %r27 + sdivcc %r29, -$23, %r19 + sethi $0x87654321, %r2 + smul %r16, %r26, %r27 + smul %r29, -$23, %r19 + smulcc %r16, %r26, %r27 + smulcc %r29, -$23, %r19 + st %r11, [%r4 + %r7] + st %r19, [%r23] + stb %r11, [%r4 + %r7] + stb %r19, [%r23] + std %r11, [%r4 + %r7] + std %r19, [%r23] + sth %r11, [%r4 + %r7] + sth %r19, [%r23] + udiv %r16, %r26, %r27 + udiv %r29, -$23, %r19 + udivcc %r16, %r26, %r27 + udivcc %r29, -$23, %r19 + umul %r16, %r26, %r27 + umul %r29, -$23, %r19 + umulcc %r16, %r26, %r27 + umulcc %r29, -$23, %r19 + xnor %r16, %r26, %r27 + xnor %r29, -$23, %r19 + xnorcc %r16, %r26, %r27 + xnorcc %r29, -$23, %r19 + xor %r16, %r26, %r27 + xor %r29, -$23, %r19 + xorcc %r16, %r26, %r27 + xorcc %r29, -$23, %r19