fcall.c
Go to the documentation of this file.
00001 /****************************************************************/
00002 /* machine dependent compiled code runtime routines
00003 /*      for sun3, sun4 and vax ultrix
00004 /*      1987-Dec-23
00005 /*      Copyright Toshihiro MATSUI
00006 /****************************************************************/
00007 static char *rcsid="@(#)$Id$";
00008 
00009 #include "../c/eus.h"
00010 
00011 /* 
00012 /* s u n 4 / S P A R C
00013 */
00014 
00015 pointer fcallx(ctx,n,argv,fslot,sym)
00016 register context *ctx;
00017 int n;
00018 pointer *argv,sym;
00019 pointer (**fslot)();
00020 { eusinteger_t x;
00021   pointer fn;
00022   pointer (*subr)();
00023 
00024   fn=getfunc(ctx,sym);
00025 
00026   if (ispointer(fn) && (fn->cix==codecp.cix)) {
00027 #if x86_64
00028     x= (eusinteger_t)(fn->c.code.entry); x &= ~3L;
00029 #else
00030     x= (eusinteger_t)(fn->c.code.entry); x &= ~3;
00031 #endif
00032 #if ARM
00033     if (fn->c.code.entry2 != NIL) {
00034       x = x | (intval(fn->c.code.entry2)&0x0000ffff);
00035     }
00036 #endif
00037     subr=(pointer (*)())(x);
00038     *fslot= subr;
00039     return((*subr)(ctx,n,argv));
00040     }
00041   else return(ufuncall(ctx,sym,sym,(pointer)argv,0,n));}
00042 
00043 /*
00044 /*  s u n 3 / M 6 8 0 2 0 
00045 */
00046 
00047 #if sun3 || news || sanyo
00048 pointer fcall(n,argv,sym)
00049 int n;
00050 pointer argv[];
00051 pointer sym;
00052 { register int *r= &n;
00053   int x;
00054   pointer fn,result;
00055   pointer (*subr)();
00056 
00057   fn=getfunc(sym);
00058 
00059   if (ispointer(fn) && (fn->cix==codecp.cix)) {
00060     subr=(pointer (*)())
00061           ((int)(fn->c.code.codevec)+(intval(fn->c.code.entry)));
00062     x=r[-1];    /*return addr .i.e. next instruction address to be executed*/
00063     r=(int *)(x-4);     /*operand for the bsrl inst.*/
00064     if ((r[-1] & 0x0000ff00) == 0x6100) *r = (int)subr-x+4; /*bsr.l*/
00065     else  *r = (int)subr; /*news and SunOS4.0 uses jsr.l instead of bsr.l*/
00066 /* assembler format slightly differs between sun3 and news*/
00067 #if sun3
00068     asm("       cmpl    #0x12345678,d0\n");     /*purge cache*/
00069     asm("       cmpl    #0x12345678,d0\n");     /*purge cache*/
00070     asm("       cmpl    #0x12345678,d0\n");     /*purge cache*/
00071     asm("       cmpl    #0x12345678,d0\n");     /*purge cache*/
00072     asm("       cmpl    #0x12345678,d0\n");     /*purge cache*/
00073     asm("       cmpl    #0x12345678,d0\n");     /*purge cache*/
00074     asm("       cmpl    #0x12345678,d0\n");     /*purge cache*/
00075     asm("       cmpl    #0x12345678,d0\n");     /*purge cache*/
00076     asm("       cmpl    #0x12345678,d0\n");     /*purge cache*/
00077     asm("       cmpl    #0x12345678,d0\n");     /*purge cache*/
00078     asm("       cmpl    #0x12345678,d0\n");     /*purge cache*/
00079     asm("       cmpl    #0x12345678,d0\n");     /*purge cache*/
00080     asm("       cmpl    #0x12345678,d0\n");     /*purge cache*/
00081     asm("       cmpl    #0x12345678,d0\n");     /*purge cache*/
00082     asm("       cmpl    #0x12345678,d0\n");     /*purge cache*/
00083     asm("       cmpl    #0x12345678,d0\n");     /*purge cache*/
00084     asm("       cmpl    #0x12345678,d0\n");     /*purge cache*/
00085     asm("       cmpl    #0x12345678,d0\n");     /*purge cache*/
00086     asm("       cmpl    #0x12345678,d0\n");     /*purge cache*/
00087     asm("       cmpl    #0x12345678,d0\n");     /*purge cache*/
00088     asm("       cmpl    #0x12345678,d0\n");     /*purge cache*/
00089     asm("       cmpl    #0x12345678,d0\n");     /*purge cache*/
00090     asm("       cmpl    #0x12345678,d0\n");     /*purge cache*/
00091     asm("       cmpl    #0x12345678,d0\n");     /*purge cache*/
00092     asm("       cmpl    #0x12345678,d0\n");     /*purge cache*/
00093     asm("       cmpl    #0x12345678,d0\n");     /*purge cache*/
00094     asm("       cmpl    #0x12345678,d0\n");     /*purge cache*/
00095     asm("       cmpl    #0x12345678,d0\n");     /*purge cache*/
00096     asm("       cmpl    #0x12345678,d0\n");     /*purge cache*/
00097     asm("       cmpl    #0x12345678,d0\n");     /*purge cache*/
00098     asm("       cmpl    #0x12345678,d0\n");     /*purge cache*/
00099     asm("       cmpl    #0x12345678,d0\n");     /*purge cache*/
00100     asm("       cmpl    #0x12345678,d0\n");     /*purge cache*/
00101 #endif
00102 #if news
00103     asm("       cmp.l   #0x12345678,d0");       /*purge cache*/
00104     asm("       cmp.l   #0x12345678,d0");       /*purge cache*/
00105     asm("       cmp.l   #0x12345678,d0");       /*purge cache*/
00106     asm("       cmp.l   #0x12345678,d0");       /*purge cache*/
00107     asm("       cmp.l   #0x12345678,d0");       /*purge cache*/
00108     asm("       cmp.l   #0x12345678,d0");       /*purge cache*/
00109     asm("       cmp.l   #0x12345678,d0");       /*purge cache*/
00110     asm("       cmp.l   #0x12345678,d0");       /*purge cache*/
00111     asm("       cmp.l   #0x12345678,d0");       /*purge cache*/
00112     asm("       cmp.l   #0x12345678,d0");       /*purge cache*/
00113     asm("       cmp.l   #0x12345678,d0");       /*purge cache*/
00114     asm("       cmp.l   #0x12345678,d0");       /*purge cache*/
00115     asm("       cmp.l   #0x12345678,d0");       /*purge cache*/
00116     asm("       cmp.l   #0x12345678,d0");       /*purge cache*/
00117     asm("       cmp.l   #0x12345678,d0");       /*purge cache*/
00118     asm("       cmp.l   #0x12345678,d0");       /*purge cache*/
00119     asm("       cmp.l   #0x12345678,d0");       /*purge cache*/
00120     asm("       cmp.l   #0x12345678,d0");       /*purge cache*/
00121     asm("       cmp.l   #0x12345678,d0");       /*purge cache*/
00122     asm("       cmp.l   #0x12345678,d0");       /*purge cache*/
00123     asm("       cmp.l   #0x12345678,d0");       /*purge cache*/
00124     asm("       cmp.l   #0x12345678,d0");       /*purge cache*/
00125     asm("       cmp.l   #0x12345678,d0");       /*purge cache*/
00126     asm("       cmp.l   #0x12345678,d0");       /*purge cache*/
00127     asm("       cmp.l   #0x12345678,d0");       /*purge cache*/
00128     asm("       cmp.l   #0x12345678,d0");       /*purge cache*/
00129     asm("       cmp.l   #0x12345678,d0");       /*purge cache*/
00130     asm("       cmp.l   #0x12345678,d0");       /*purge cache*/
00131     asm("       cmp.l   #0x12345678,d0");       /*purge cache*/
00132     asm("       cmp.l   #0x12345678,d0");       /*purge cache*/
00133     asm("       cmp.l   #0x12345678,d0");       /*purge cache*/
00134     asm("       cmp.l   #0x12345678,d0");       /*purge cache*/
00135 #endif
00136 #if sanyo
00137     asm("       cmp.l   %d0,&0x12345678");      /*purge cache*/
00138     asm("       cmp.l   %d0,&0x12345678");      /*purge cache*/
00139     asm("       cmp.l   %d0,&0x12345678");      /*purge cache*/
00140     asm("       cmp.l   %d0,&0x12345678");      /*purge cache*/
00141     asm("       cmp.l   %d0,&0x12345678");      /*purge cache*/
00142     asm("       cmp.l   %d0,&0x12345678");      /*purge cache*/
00143     asm("       cmp.l   %d0,&0x12345678");      /*purge cache*/
00144     asm("       cmp.l   %d0,&0x12345678");      /*purge cache*/
00145     asm("       cmp.l   %d0,&0x12345678");      /*purge cache*/
00146     asm("       cmp.l   %d0,&0x12345678");      /*purge cache*/
00147     asm("       cmp.l   %d0,&0x12345678");      /*purge cache*/
00148     asm("       cmp.l   %d0,&0x12345678");      /*purge cache*/
00149     asm("       cmp.l   %d0,&0x12345678");      /*purge cache*/
00150     asm("       cmp.l   %d0,&0x12345678");      /*purge cache*/
00151     asm("       cmp.l   %d0,&0x12345678");      /*purge cache*/
00152     asm("       cmp.l   %d0,&0x12345678");      /*purge cache*/
00153     asm("       cmp.l   %d0,&0x12345678");      /*purge cache*/
00154     asm("       cmp.l   %d0,&0x12345678");      /*purge cache*/
00155     asm("       cmp.l   %d0,&0x12345678");      /*purge cache*/
00156     asm("       cmp.l   %d0,&0x12345678");      /*purge cache*/
00157     asm("       cmp.l   %d0,&0x12345678");      /*purge cache*/
00158     asm("       cmp.l   %d0,&0x12345678");      /*purge cache*/
00159     asm("       cmp.l   %d0,&0x12345678");      /*purge cache*/
00160     asm("       cmp.l   %d0,&0x12345678");      /*purge cache*/
00161     asm("       cmp.l   %d0,&0x12345678");      /*purge cache*/
00162     asm("       cmp.l   %d0,&0x12345678");      /*purge cache*/
00163     asm("       cmp.l   %d0,&0x12345678");      /*purge cache*/
00164     asm("       cmp.l   %d0,&0x12345678");      /*purge cache*/
00165     asm("       cmp.l   %d0,&0x12345678");      /*purge cache*/
00166     asm("       cmp.l   %d0,&0x12345678");      /*purge cache*/
00167     asm("       cmp.l   %d0,&0x12345678");      /*purge cache*/
00168     asm("       cmp.l   %d0,&0x12345678");      /*purge cache*/
00169 #endif
00170     return((*subr)(n,argv)); }
00171   else return(ufuncall(sym,sym,argv,0,n));}
00172 
00173 #endif
00174 
00175 /*
00176 /*  V A X
00177 */
00178 
00179 #if vax
00180 pointer fcall(n,argv,sym)
00181 int n;
00182 pointer argv[];
00183 pointer sym;
00184 { pointer fn;
00185   pointer (*subr)();
00186   int *stackframe;
00187   int *returnaddress;
00188 
00189   fn=getfunc(sym);
00190 
00191   if (ispointer(fn) && (fn->cix==codecp.cix)) {
00192 
00193     subr=(pointer (*)())
00194           ((int)(fn->c.code.codevec)
00195            +((int)(fn->c.code.entry)>>2));
00196 
00197     stackframe= &n;
00198     returnaddress=(int *)stackframe[-2];
00199     returnaddress[-1]=(int)subr-(int)returnaddress;
00200     fn=(*subr)(n,argv);
00201     return(fn);    }
00202   else return(ufuncall(sym,sym,argv,0,n));}
00203 
00204 #endif
00205 
00206 /*
00207 #if mips && !IRIX
00208 pointer fcall(n,argv,sym)
00209 int n;
00210 register pointer argv[];
00211 register pointer sym;
00212 { pointer fn;
00213   pointer (*subr)();
00214 
00215   fn=getfunc(sym);
00216 
00217   if (ispointer(fn) && (fn->cix==codecp.cix)) {
00218 
00219     subr=(pointer (*)())
00220           ((int)(fn->c.code.codevec)
00221            +((int)(fn->c.code.entry)>>2));
00222 
00223     fn=(*subr)(n,argv);
00224     return(fn);    }
00225   else return(ufuncall(sym,sym,argv,0,n));}
00226 
00227 #endif
00228 */
00229 


euslisp
Author(s): Toshihiro Matsui
autogenerated on Thu Sep 3 2015 10:36:19