This commit is contained in:
ceriel 1991-09-06 16:01:22 +00:00
parent 8caa154b25
commit ad1ff9d44c
4 changed files with 739 additions and 0 deletions

122
mach/arm/cv/dl.c Normal file
View file

@ -0,0 +1,122 @@
static char rcsid[] = "$Header$";
#define MAXBYTE 24
#include <stdio.h>
#include <out.h>
char hex[] = "0123456789ABCDEF";
FILE *fp, *fopen();
char **s;
int bytes, bytcnt, checksum;
long pc;
struct outhead ohead;
struct outsect sect[MAXSECT];
main (argc,argv)
int argc;
char *argv[];
{
if (argc != 2) fatal ("usage: %s filename\n",argv[0]);
if (! rd_open (*++argv))
fatal ("can't open %s\n",*argv);
else {
s = argv;
convert ();
}
}
convert ()
{
int i;
rd_ohead(&ohead);
if (ohead.oh_flags & HF_LINK) {
fatal("%s contains unresolved references\n",s);
}
rd_sect(sect, ohead.oh_nsect);
for (i = 0; i < ohead.oh_nsect; i++) {
rd_outsect(i);
pc = sect[i].os_base;
while (sect[i].os_size) {
unsigned int sz = 8096, fl;
extern char *calloc();
register char *buf;
char *pbuf;
if (sz > sect[i].os_size) sz = sect[i].os_size;
sect[i].os_size -= sz;
pbuf = buf = calloc(sz, 1);
if (fl = sect[i].os_flen) {
if (fl > sz) fl = sz;
sect[i].os_flen -= fl;
rd_emit(buf, (long) fl);
}
while (sz > 0) {
int p = bytcnt = sz < MAXBYTE ? sz : MAXBYTE;
checksum = 0;
sz -= p;
if (pc > 0xffffL)
S2record (buf);
else S1record (buf);
buf += p;
}
free(pbuf);
}
}
printf ("S9030000FC\n");
}
S2record (buf)
char *buf;
{
printf ("S2");
bytcnt += 4;
outbyte (bytcnt);
outbyte ((int) (pc >> 16));
outbyte ((int) (pc >> 8));
outbyte ((int) pc);
record ();
}
S1record (buf)
char *buf;
{
printf ("S1");
bytcnt += 3;
outbyte (bytcnt);
outbyte ((int) (pc >> 8));
outbyte((int) pc);
record (buf);
}
record (buf)
register char *buf;
{
while (bytcnt != 0)
{
outbyte (*buf++);
pc ++;
}
outbyte (~checksum);
putchar ('\n');
putchar (0);
putchar (0);
}
outbyte (b)
int b;
{
checksum = (checksum + b) & 0377;
putchar (hex[(b>>4) & 017]);
putchar (hex[b & 017]);
-- bytcnt;
}
rd_fatal() { fatal("Read error\n"); }
fatal (s,a)
{
printf (s,a);
exit (-1);
}

189
mach/i86/as/testfp.s Normal file
View file

@ -0,0 +1,189 @@
.sect .text; .sect .rom; .sect .data;
.sect .data
.define _m_a_i_n
blablabla:
.space 100
.sect .text
_m_a_i_n:
! no operands
f2xm1
fabs
fchs
fclex
fcompp
fdecstp
fdisi
feni
fincstp
finit
fld1
fldl2e
fldl2t
fldlg2
fldln2
fldpi
fldz
fnop
fpatan
fprem
fptan
frndint
fscale
fsqrt
ftst
fxam
fxtract
fyl2x
fyl2pi
! memory operand
fiadds (blablabla)
fiaddl (blablabla)
fadds (blablabla)
faddd (blablabla)
fbld (blablabla)
fbstp (blablabla)
ficoms (blablabla)
ficoml (blablabla)
fcoms (blablabla)
fcomd (blablabla)
ficomps (blablabla)
ficompl (blablabla)
fcomps (blablabla)
fcompd (blablabla)
fidivs (blablabla)
fidivl (blablabla)
fdivs (blablabla)
fdivd (blablabla)
fidivrs (blablabla)
fidivrl (blablabla)
fdivrs (blablabla)
fdivrd (blablabla)
filds (blablabla)
fildl (blablabla)
flds (blablabla)
fldd (blablabla)
fldx (blablabla)
fldcw (blablabla)
fldenv (blablabla)
fimuls (blablabla)
fimull (blablabla)
fmuls (blablabla)
fmuld (blablabla)
frstor (blablabla)
fsave (blablabla)
fists (blablabla)
fistl (blablabla)
fsts (blablabla)
fstd (blablabla)
fistps (blablabla)
fistpl (blablabla)
fstps (blablabla)
fstpd (blablabla)
fstpx (blablabla)
fstcw (blablabla)
fstenv (blablabla)
fstsw (blablabla)
fisubs (blablabla)
fisubl (blablabla)
fsubs (blablabla)
fsubd (blablabla)
fisubrs (blablabla)
fisubrl (blablabla)
fsubrs (blablabla)
fsubrd (blablabla)
! again, memory operand
fiadds 8(bp)
fiaddl 8(bp)
fadds 8(bp)
faddd 8(bp)
fbld 8(bp)
fbstp 8(bp)
ficoms 8(bp)
ficoml 8(bp)
fcoms 8(bp)
fcomd 8(bp)
ficomps 8(bp)
ficompl 8(bp)
fcomps 8(bp)
fcompd 8(bp)
fidivs 8(bp)
fidivl 8(bp)
fdivs 8(bp)
fdivd 8(bp)
fidivrs 8(bp)
fidivrl 8(bp)
fdivrs 8(bp)
fdivrd 8(bp)
filds 8(bp)
fildl 8(bp)
flds 8(bp)
fldd 8(bp)
fldx 8(bp)
fldcw 8(bp)
fldenv 8(bp)
fimuls 8(bp)
fimull 8(bp)
fmuls 8(bp)
fmuld 8(bp)
frstor 8(bp)
fsave 8(bp)
fists 8(bp)
fistl 8(bp)
fsts 8(bp)
fstd 8(bp)
fistps 8(bp)
fistpl 8(bp)
fstps 8(bp)
fstpd 8(bp)
fstpx 8(bp)
fstcw 8(bp)
fstenv 8(bp)
fstsw 8(bp)
fisubs 8(bp)
fisubl 8(bp)
fsubs 8(bp)
fsubd 8(bp)
fisubrs 8(bp)
fisubrl 8(bp)
fsubrs 8(bp)
fsubrd 8(bp)
! one FP stack argument
fld st
fst st
fstp st
fxch st
fcom st
fcomp st
ffree st
fld st(4)
fst st(4)
fstp st(4)
fxch st(4)
fcom st(4)
fcomp st(4)
ffree st(4)
! two FP stack arguments
fadd st(4),st
faddp st(4),st
fdiv st(4),st
fdivp st(4),st
fdivr st(4),st
fdivrp st(4),st
fmul st(4),st
fmulp st(4),st
fsub st(4),st
fsubp st(4),st
fsubr st(4),st
fsubrp st(4),st
fadd st,st(4)
faddp st,st(4)
fmul st,st(4)
fmulp st,st(4)

213
mach/m68020/as/testfp.s Normal file
View file

@ -0,0 +1,213 @@
.sect .text ; .sect .rom ; .sect .data ; .sect .bss ; .sect .text
! test for Motorola MC68881 floating point processor instructions
! compare result of disassembled output with source.
blablabla:
! dyadic instructions
fadd.l (12,a6),fp0
fadd fp0,fp1
fcmp.l (12,a6),fp0
fcmp fp0,fp1
fdiv.l (12,a6),fp0
fdiv fp0,fp1
fmod.l (12,a6),fp0
fmod fp0,fp1
fmul.l (12,a6),fp0
fmul fp0,fp1
frem.l (12,a6),fp0
frem fp0,fp1
fscale.l (12,a6),fp0
fscale fp0,fp1
fsgldiv.l (12,a6),fp0
fsgldiv fp0,fp1
fsglmul.l (12,a6),fp0
fsglmul fp0,fp1
fsub.l (12,a6),fp0
fsub fp0,fp1
!monadic instructions
fabs.p (12,a6),fp1
fabs.x fp1,fp2
fabs fp1
facos.p (12,a6),fp1
facos.x fp1,fp2
facos fp1
fasin.p (12,a6),fp1
fasin.x fp1,fp2
fasin fp1
fatan.p (12,a6),fp1
fatan.x fp1,fp2
fatan fp1
fatanh.p (12,a6),fp1
fatanh.x fp1,fp2
fatanh fp1
fcos.p (12,a6),fp1
fcos.x fp1,fp2
fcos fp1
fcosh.p (12,a6),fp1
fcosh.x fp1,fp2
fcosh fp1
fetox.p (12,a6),fp1
fetox.x fp1,fp2
fetox fp1
fetoxm1.p (12,a6),fp1
fetoxm1.x fp1,fp2
fetoxm1 fp1
fgetexp.p (12,a6),fp1
fgetexp.x fp1,fp2
fgetexp fp1
fgetman.p (12,a6),fp1
fgetman.x fp1,fp2
fgetman fp1
fint.p (12,a6),fp1
fint.x fp1,fp2
fint fp1
fintrz.p (12,a6),fp1
fintrz.x fp1,fp2
fintrz fp1
flogn.p (12,a6),fp1
flogn.x fp1,fp2
flogn fp1
flognp1.p (12,a6),fp1
flognp1.x fp1,fp2
flognp1 fp1
flog10.p (12,a6),fp1
flog10.x fp1,fp2
flog10 fp1
flog2.p (12,a6),fp1
flog2.x fp1,fp2
flog2 fp1
fneg.p (12,a6),fp1
fneg.x fp1,fp2
fneg fp1
fsin.p (12,a6),fp1
fsin.x fp1,fp2
fsin fp1
fsinh.p (12,a6),fp1
fsinh.x fp1,fp2
fsinh fp1
fsqrt.p (12,a6),fp1
fsqrt.x fp1,fp2
fsqrt fp1
ftan.p (12,a6),fp1
ftan.x fp1,fp2
ftan fp1
ftanh.p (12,a6),fp1
ftanh.x fp1,fp2
ftanh fp1
ftentox.p (12,a6),fp1
ftentox.x fp1,fp2
ftentox fp1
ftwotox.p (12,a6),fp1
ftwotox.x fp1,fp2
ftwotox fp1
!sincos
fsincos.s (12,a6),fp0:fp1
fsincos.x fp2,fp0:fp1
!some moves
fmove.l (12,a6),fp0
fmove.l fp1,(12,a6)
fmove.p fp0,(12,a6){d0}
fmove.p fp0,(12,a6){#4}
fmove.l (12,a6),fpcr
!fmove.l a0,fpcr ! error
fmove.l a0,fpiar
fmovecr #1,fp1
!fmovem.x d1,(a0)+ ! error
fmovem.x d1,-(a0)
fmovem.x fp0-fp3/fp5,-(a0)
!fmovem.x -(a0),fp0-fp3/fp5 ! error
fmovem.x (a0)+,fp0-fp3/fp5
!some branches
fbeq blablabla
fbne blablabla
fbgt blablabla
fbngt blablabla
fbge blablabla
fbnge blablabla
fblt blablabla
fbnlt blablabla
fble blablabla
fbnle blablabla
fbgl blablabla
fbngl blablabla
fbgle blablabla
fbngle blablabla
fbogt blablabla
fbule blablabla
fboge blablabla
fbult blablabla
fbolt blablabla
fbuge blablabla
fbole blablabla
fbugt blablabla
fbogl blablabla
fbueq blablabla
fbor blablabla
fbun blablabla
fbf blablabla
fbt blablabla
fbsf blablabla
fbst blablabla
fbseq blablabla
fbsne blablabla
fdbgl d4,blablabla
!nop
fnop
!fscc
fsult d4
!ftst
ftst.p (12,a6)
ftst fp0
!save/restore
fsave (12,a6)
! fsave (a5)+ ! error
frestore (12,a6)
! frestore -(a5) ! error
!trap
ftrapeq
ftrapeq.l #4
ftrapeq.w #4

215
mach/m68k2/as/testfp.s Normal file
View file

@ -0,0 +1,215 @@
.sect .text ; .sect .rom ; .sect .data ; .sect .bss ; .sect .text
! test for Motorola MC68881 floating point processor instructions
! compare result of disassembled output with source.
.define _m_a_i_n
_m_a_i_n:
blablabla:
! dyadic instructions
fadd.l 12(a6),fp0
fadd fp0,fp1
fcmp.l 12(a6),fp0
fcmp fp0,fp1
fdiv.l 12(a6),fp0
fdiv fp0,fp1
fmod.l 12(a6),fp0
fmod fp0,fp1
fmul.l 12(a6),fp0
fmul fp0,fp1
frem.l 12(a6),fp0
frem fp0,fp1
fscale.l 12(a6),fp0
fscale fp0,fp1
fsgldiv.l 12(a6),fp0
fsgldiv fp0,fp1
fsglmul.l 12(a6),fp0
fsglmul fp0,fp1
fsub.l 12(a6),fp0
fsub fp0,fp1
!monadic instructions
fabs.p 12(a6),fp1
fabs.x fp1,fp2
fabs fp1
facos.p 12(a6),fp1
facos.x fp1,fp2
facos fp1
fasin.p 12(a6),fp1
fasin.x fp1,fp2
fasin fp1
fatan.p 12(a6),fp1
fatan.x fp1,fp2
fatan fp1
fatanh.p 12(a6),fp1
fatanh.x fp1,fp2
fatanh fp1
fcos.p 12(a6),fp1
fcos.x fp1,fp2
fcos fp1
fcosh.p 12(a6),fp1
fcosh.x fp1,fp2
fcosh fp1
fetox.p 12(a6),fp1
fetox.x fp1,fp2
fetox fp1
fetoxm1.p 12(a6),fp1
fetoxm1.x fp1,fp2
fetoxm1 fp1
fgetexp.p 12(a6),fp1
fgetexp.x fp1,fp2
fgetexp fp1
fgetman.p 12(a6),fp1
fgetman.x fp1,fp2
fgetman fp1
fint.p 12(a6),fp1
fint.x fp1,fp2
fint fp1
fintrz.p 12(a6),fp1
fintrz.x fp1,fp2
fintrz fp1
flogn.p 12(a6),fp1
flogn.x fp1,fp2
flogn fp1
flognp1.p 12(a6),fp1
flognp1.x fp1,fp2
flognp1 fp1
flog10.p 12(a6),fp1
flog10.x fp1,fp2
flog10 fp1
flog2.p 12(a6),fp1
flog2.x fp1,fp2
flog2 fp1
fneg.p 12(a6),fp1
fneg.x fp1,fp2
fneg fp1
fsin.p 12(a6),fp1
fsin.x fp1,fp2
fsin fp1
fsinh.p 12(a6),fp1
fsinh.x fp1,fp2
fsinh fp1
fsqrt.p 12(a6),fp1
fsqrt.x fp1,fp2
fsqrt fp1
ftan.p 12(a6),fp1
ftan.x fp1,fp2
ftan fp1
ftanh.p 12(a6),fp1
ftanh.x fp1,fp2
ftanh fp1
ftentox.p 12(a6),fp1
ftentox.x fp1,fp2
ftentox fp1
ftwotox.p 12(a6),fp1
ftwotox.x fp1,fp2
ftwotox fp1
!sincos
fsincos.s 12(a6),fp0:fp1
fsincos.x fp2,fp0:fp1
!some moves
fmove.l 12(a6),fp0
fmove.l fp1,12(a6)
fmove.p fp0,12(a6){d0}
fmove.p fp0,12(a6){#4}
fmove.l 12(a6),fpcr
!fmove.l a0,fpcr ! error
fmove.l a0,fpiar
fmovecr #1,fp1
!fmovem.x d1,(a0)+ ! error
fmovem.x d1,-(a0)
fmovem.x fp0-fp3/fp5,-(a0)
!fmovem.x -(a0),fp0-fp3/fp5 ! error
fmovem.x (a0)+,fp0-fp3/fp5
!some branches
fbeq blablabla
fbne blablabla
fbgt blablabla
fbngt blablabla
fbge blablabla
fbnge blablabla
fblt blablabla
fbnlt blablabla
fble blablabla
fbnle blablabla
fbgl blablabla
fbngl blablabla
fbgle blablabla
fbngle blablabla
fbogt blablabla
fbule blablabla
fboge blablabla
fbult blablabla
fbolt blablabla
fbuge blablabla
fbole blablabla
fbugt blablabla
fbogl blablabla
fbueq blablabla
fbor blablabla
fbun blablabla
fbf blablabla
fbt blablabla
fbsf blablabla
fbst blablabla
fbseq blablabla
fbsne blablabla
fdbgl d4,blablabla
!nop
fnop
!fscc
fsult d4
!ftst
ftst.p 12(a6)
ftst fp0
!save/restore
fsave 12(a6)
! fsave (a5)+ ! error
frestore 12(a6)
! frestore -(a5) ! error
!trap
ftrapeq
ftrapeq.l #4
ftrapeq.w #4