From ac966f41ebc5a07c5ba469fb0b7b0c88de46b542 Mon Sep 17 00:00:00 2001 From: ceriel Date: Fri, 1 Feb 1991 15:38:19 +0000 Subject: [PATCH] Added end library and floating point processor support --- mach/m68k4/libem/.distr | 6 +- mach/m68k4/libem/LIST | 2 +- mach/m68k4/libem/Makefile | 20 ++- mach/m68k4/libem/edata.s | 9 ++ mach/m68k4/libem/em_end.s | 22 +++ mach/m68k4/libem/end.s | 13 +- mach/m68k4/libem/etext.s | 9 ++ mach/m68k4/libem/fp68881.s | 299 +++++++++++++++++++++++++++++++++++++ 8 files changed, 360 insertions(+), 20 deletions(-) create mode 100644 mach/m68k4/libem/edata.s create mode 100644 mach/m68k4/libem/em_end.s create mode 100644 mach/m68k4/libem/etext.s create mode 100644 mach/m68k4/libem/fp68881.s diff --git a/mach/m68k4/libem/.distr b/mach/m68k4/libem/.distr index 8702677e5..ce020b7c5 100644 --- a/mach/m68k4/libem/.distr +++ b/mach/m68k4/libem/.distr @@ -1,5 +1,9 @@ LIST Makefile compmodule -libem_s.a +em_end.s +etext.s +edata.s end.s +libem_s.a +READ_ME diff --git a/mach/m68k4/libem/LIST b/mach/m68k4/libem/LIST index d82cc1b50..e4a0f38d6 100644 --- a/mach/m68k4/libem/LIST +++ b/mach/m68k4/libem/LIST @@ -26,7 +26,7 @@ shp.s sig.s cms.s fat.s -fakfp.s +fp68881.s trp.s dia.s dvu.s diff --git a/mach/m68k4/libem/Makefile b/mach/m68k4/libem/Makefile index 0c32073b4..5457c453c 100644 --- a/mach/m68k4/libem/Makefile +++ b/mach/m68k4/libem/Makefile @@ -1,27 +1,33 @@ # $Header$ MACH=m68k4 -all: libem_o.a end.o +ASAR=aal +all: libem_o.a end.a install: all ../../install libem_o.a tail_em - ../../install end.o end_em + ../../install end.a end_em cmp: all -../../compare libem_o.a tail_em - -../../compare end.o end_em + -../../compare end.a end_em -end.o: end.s +end.a: em_end.s etext.s edata.s end.s + $(MACH) -I../../../h -c em_end.s + $(MACH) -I../../../h -c edata.s + $(MACH) -I../../../h -c etext.s $(MACH) -I../../../h -c end.s + $(ASAR) cr end.a em_end.o etext.o edata.o end.o libem_o.a: libem_s.a - ASAR=aal ; export ASAR ;\ + ASAR=$(ASAR) ; export ASAR ;\ march . libem_o.a clean: - rm -f *.o libem_o.a + rm -f *.o libem_o.a end.a + opr : make pr | opr pr: @arch pv libem_s.a | pr -h `pwd`/libem_s.a - @pr `pwd`/end.s + @pr `pwd`/em_end.s `pwd`/edata.s `pwd`/etext.s `pwd`/end.s diff --git a/mach/m68k4/libem/edata.s b/mach/m68k4/libem/edata.s new file mode 100644 index 000000000..f53adc109 --- /dev/null +++ b/mach/m68k4/libem/edata.s @@ -0,0 +1,9 @@ +.sect .text +.sect .rom +.sect .data +.sect .bss +.define _edata +.sect .data + .align 4 + .sect .data +_edata: diff --git a/mach/m68k4/libem/em_end.s b/mach/m68k4/libem/em_end.s new file mode 100644 index 000000000..a062368da --- /dev/null +++ b/mach/m68k4/libem/em_end.s @@ -0,0 +1,22 @@ +.sect .text +.sect .rom +.sect .data +.sect .bss +.define endtext,enddata,endbss,__end +.sect .text + .align 4 +.sect .rom + .align 4 +.sect .data + .align 4 +.sect .bss + .align 4 +.sect .end ! only for declaration of _end, __end and endbss. + + .sect .text +endtext: + .sect .data +enddata: + .sect .end +__end: +endbss: diff --git a/mach/m68k4/libem/end.s b/mach/m68k4/libem/end.s index 37e1cef2c..93a1e6e00 100644 --- a/mach/m68k4/libem/end.s +++ b/mach/m68k4/libem/end.s @@ -1,16 +1,7 @@ -.define endtext,enddata,endbss,_etext,_edata,_end .sect .text .sect .rom .sect .data .sect .bss -.sect .end ! only for declaration of _end and endbss. - - .sect .text -endtext: -_etext: - .sect .data -enddata: -_edata: - .sect .end +.define _end +.sect .end ! only for declaration of _end, __end and endbss. _end: -endbss: diff --git a/mach/m68k4/libem/etext.s b/mach/m68k4/libem/etext.s new file mode 100644 index 000000000..8c7453cb4 --- /dev/null +++ b/mach/m68k4/libem/etext.s @@ -0,0 +1,9 @@ +.sect .text +.sect .rom +.sect .data +.sect .bss +.define _etext +.sect .text + .align 4 + .sect .text +_etext: diff --git a/mach/m68k4/libem/fp68881.s b/mach/m68k4/libem/fp68881.s new file mode 100644 index 000000000..5ce44c5c8 --- /dev/null +++ b/mach/m68k4/libem/fp68881.s @@ -0,0 +1,299 @@ +.define .adf4, .adf8, .sbf4, .sbf8, .mlf4, .mlf8, .dvf4, .dvf8 +.define .ngf4, .ngf8, .fif4, .fif8, .fef4, .fef8 +.define .cif4, .cif8, .cuf4, .cuf8, .cfi, .cfu, .cff4, .cff8 +.define .cmf4, .cmf8 +.sect .text +.sect .rom +.sect .data +.sect .bss + +! $Header$ + +! Implement interface to floating point package for M68881 + + .sect .text +.adf4: + move.l (sp)+,a0 + fmove.s (sp),fp0 + fadd.s 4(sp),fp0 + fmove.s fp0,4(sp) + jmp (a0) + +.adf8: + move.l (sp)+,a0 + fmove.d (sp),fp0 + fadd.d 8(sp),fp0 + fmove.d fp0,8(sp) + jmp (a0) + +.sbf4: + move.l (sp)+,a0 + fmove.s (sp),fp0 + fmove.s 4(sp),fp1 + fsub fp0,fp1 + fmove.s fp1,4(sp) + jmp (a0) + +.sbf8: + move.l (sp)+,a0 + fmove.d (sp),fp0 + fmove.d 8(sp),fp1 + fsub fp0,fp1 + fmove.d fp1,8(sp) + jmp (a0) + +.mlf4: + move.l (sp)+,a0 + fmove.s (sp),fp0 + fmul.s 4(sp),fp0 + fmove.s fp0,4(sp) + jmp (a0) + +.mlf8: + move.l (sp)+,a0 + fmove.d (sp),fp0 + fmul.d 8(sp),fp0 + fmove.d fp0,8(sp) + jmp (a0) + +.dvf4: + move.l (sp)+,a0 + fmove.s (sp),fp0 + fmove.s 4(sp),fp1 + fdiv fp0,fp1 + fmove.s fp1,4(sp) + jmp (a0) + +.dvf8: + move.l (sp)+,a0 + fmove.d (sp),fp0 + fmove.d 8(sp),fp1 + fdiv fp0,fp1 + fmove.d fp1,8(sp) + jmp (a0) + +.ngf4: + fmove.s 4(sp),fp0 + fneg fp0 + fmove.s fp0,4(sp) + rts + +.ngf8: + fmove.d 4(sp),fp0 + fneg fp0 + fmove.d fp0,4(sp) + rts + +.fif4: + move.l (sp)+,a0 + move.l (sp),a1 + fmove.s 4(sp),fp0 + fmove.s 8(sp),fp1 + fmul fp0,fp1 + fintrz fp1,fp0 + fsub fp0,fp1 + fmove.s fp1,4(a1) + fmove.s fp0,(a1) + jmp (a0) + +.fif8: + move.l (sp)+,a0 + move.l (sp),a1 + fmove.d 4(sp),fp0 + fmove.d 12(sp),fp1 + fmul fp0,fp1 + fintrz fp1,fp0 + fsub fp0,fp1 + fmove.d fp1,8(a1) + fmove.d fp0,(a1) + jmp (a0) + +.fef4: + move.l (sp)+,a0 + move.l (sp),a1 + fmove.s 4(sp),fp0 + fgetexp fp0,fp1 + fmove.l fpsr,d0 + and.l #0x2000,d0 ! set if Infinity + beq 1f + move.l #129,(a1) + fmove.s 4(sp),fp0 + fblt 2f + move.l #0x3f000000,4(a1) + jmp (a0) +2: + move.l #0xbf000000,4(a1) + jmp (a0) +1: + fmove.l fp1,d0 + add.l #1,d0 + fgetman fp0 + fbne 1f + clr.l d0 + bra 2f +1: + fmove.l #2,fp1 + fdiv fp1,fp0 +2: + fmove.s fp0,4(a1) + move.l d0,(a1) + jmp (a0) + +.fef8: + move.l (sp)+,a0 + move.l (sp),a1 + fmove.d 4(sp),fp0 + fgetexp fp0,fp1 + fmove.l fpsr,d0 + and.l #0x2000,d0 ! set if Infinity + beq 1f + move.l #1025,(a1) + fmove.d 4(sp),fp0 + fblt 2f + move.l #0x3fe00000,4(a1) + clr.l 8(a1) + jmp (a0) +2: + move.l #0xbfe00000,4(a1) + clr.l 8(a1) + jmp (a0) +1: + fmove.l fp1,d0 + add.l #1,d0 + fgetman fp0 + fbne 1f + clr.l d0 + bra 2f +1: + fmove.l #2,fp1 + fdiv fp1,fp0 +2: + fmove.d fp0,4(a1) + move.l d0,(a1) + jmp (a0) + +.cif4: + move.l (sp)+,a0 + fmove.l 4(sp),fp0 + fmove.s fp0,4(sp) + jmp (a0) + +.cif8: + move.l (sp)+,a0 + fmove.l 4(sp),fp0 + fmove.d fp0,(sp) + jmp (a0) + +.cuf4: + move.l (sp)+,a0 + fmove.l 4(sp),fp0 + tst.l 4(sp) + bge 1f + fsub.l #-2147483648,fp0 + fsub.l #-2147483648,fp0 +1: + fmove.s fp0,4(sp) + jmp (a0) + +.cuf8: + move.l (sp)+,a0 + fmove.l 4(sp),fp0 + tst.l 4(sp) + bge 1f + fsub.l #-2147483648,fp0 + fsub.l #-2147483648,fp0 +1: + fmove.d fp0,(sp) + jmp (a0) + +.cfi: + move.l (sp)+,a0 + move.l 4(sp),d0 + cmp.l #4,d0 + bne 1f + fmove.s 8(sp),fp0 + fintrz fp0,fp0 + fmove.l fp0,8(sp) + jmp (a0) +1: + fmove.d 8(sp),fp0 + fintrz fp0,fp0 + fmove.l fp0,12(sp) + jmp (a0) + +.cfu: + move.l (sp)+,a0 + move.l 4(sp),d0 + cmp.l #4,d0 + bne 1f + fmove.s 8(sp),fp0 + fabs fp0 + cmp.l #0x4f000000,8(sp) + bge 2f + fintrz fp0,fp0 + fmove.l fp0,8(sp) + jmp (a0) +2: + fadd.l #-2147483648,fp0 + fintrz fp0,fp0 + fmove.l fp0,d0 + bchg #31,d0 + move.l d0,8(sp) + jmp (a0) +1: + fmove.d 8(sp),fp0 + fabs fp0 + cmp.l #0x41e00000,8(sp) + bge 1f + fintrz fp0,fp0 + fmove.l fp0,12(sp) + jmp (a0) +1: + fadd.l #-2147483648,fp0 + fintrz fp0,fp0 + fmove.l fp0,d0 + bchg #31,d0 + move.l d0,12(sp) + jmp (a0) + +.cff4: + move.l (sp)+,a0 + fmove.d (sp),fp0 + fmove.s fp0,4(sp) + jmp (a0) + +.cff8: + move.l (sp)+,a0 + fmove.s (sp),fp0 + fmove.d fp0,(sp) + jmp (a0) + +.cmf4: + move.l (sp)+,a0 + clr.l d0 + fmove.s (sp),fp0 + fmove.s 4(sp),fp1 + fcmp fp0,fp1 + fbeq 2f + fblt 1f + add.l #1,d0 + jmp (a0) +1: + sub.l #1,d0 +2: + jmp (a0) + +.cmf8: + move.l (sp)+,a0 + clr.l d0 + fmove.d (sp),fp0 + fmove.d 8(sp),fp1 + fcmp fp0,fp1 + fbeq 2f + fblt 1f + add.l #1,d0 + jmp (a0) +1: + sub.l #1,d0 +2: + jmp (a0) -- 2.34.1