home *** CD-ROM | disk | FTP | other *** search
- #include "register.h"
- #include "symtab.h"
- #include "diblock.h"
- #include "instrn.h"
- #include "process.h"
-
- dinstrn *
- i_mfc1(dipc, rt, fs)
- dinstrn *dipc;
- int rt;
- int fs;
- {
- unsigned long t;
-
- procsget(CP1G(fs), t);
-
- procsput(rt, t);
-
- return dipc;
- }
-
- static
- dinstrn *
- c_mfhi(dipc)
- dinstrn *dipc;
- {
- *dipc->di_0 = P.p_state[R_HI];
-
- return dipc;
- }
-
- dinstrn *
- i_mfhi(dipc, rs, rt, rd, shamt, funct)
- dinstrn *dipc;
- int rs;
- int rt;
- int rd;
- int shamt;
- int funct;
- {
- unsigned long d;
-
- if (compile_ok)
- {
- if (rd == R_0)
- dipc->di_handler = c_noop;
- else
- {
- dipc->di_handler = c_mfhi;
- dipc->di_0 = &P.p_state[rd];
- }
-
- return (*dipc->di_handler)(dipc);
- }
-
- procsget(R_HI, d);
-
- procsput(rd, d);
-
- return dipc;
- }
-
- static
- dinstrn *
- c_mflo(dipc)
- dinstrn *dipc;
- {
- *dipc->di_0 = P.p_state[R_LO];
-
- return dipc;
- }
-
- dinstrn *
- i_mflo(dipc, rs, rt, rd, shamt, funct)
- dinstrn *dipc;
- int rs;
- int rt;
- int rd;
- int shamt;
- int funct;
- {
- unsigned long d;
-
- if (compile_ok)
- {
- if (rd == R_0)
- dipc->di_handler = c_noop;
- else
- {
- dipc->di_handler = c_mflo;
- dipc->di_0 = &P.p_state[rd];
- }
-
- return (*dipc->di_handler)(dipc);
- }
-
- procsget(R_LO, d);
-
- procsput(rd, d);
-
- return dipc;
- }
-
- dinstrn *
- i_movfmt(dipc, fmt, ft, fs, fd)
- dinstrn *dipc;
- int fmt;
- int ft;
- int fs;
- int fd;
- {
- float singles;
- double doubles;
-
- switch (fmt)
- {
- case FMT_SINGLE:
- procsget(CP1G(fs), *(unsigned long *)&singles);
-
- procsput(CP1G(fd), *(unsigned long *)&singles);
-
- break;
-
- case FMT_DOUBLE:
- /*
- * Note apparent reversal of words within
- * doubles here -- no idea why.
- */
- procsget(CP1G(fs), *((unsigned long *)&doubles + 1));
-
- procsget(CP1G(fs) + 1, *(unsigned long *)&doubles);
-
- procsput(CP1G(fd), *((unsigned long *)&doubles + 1));
-
- procsput(CP1G(fd) + 1, *(unsigned long *)&doubles);
- break;
-
- default:
- unrecognised(dipc);
- break;
- }
-
- return dipc;
- }
-
- dinstrn *
- i_mtc1(dipc, rt, fs)
- dinstrn *dipc;
- int rt;
- int fs;
- {
- unsigned long t;
-
- procsget(rt, t);
-
- procsput(CP1G(fs), t);
-
- return dipc;
- }
-
- dinstrn *
- i_mthi(dipc, rs, rt, rd, shamt, funct)
- dinstrn *dipc;
- int rs;
- int rt;
- int rd;
- int shamt;
- int funct;
- {
- unsigned long v;
-
- procsget(rs, v);
-
- procsput(R_HI, v);
-
- return dipc;
- }
-
- dinstrn *
- i_mtlo(dipc, rs, rt, rd, shamt, funct)
- dinstrn *dipc;
- int rs;
- int rt;
- int rd;
- int shamt;
- int funct;
- {
- unsigned long v;
-
- procsget(rs, v);
-
- procsput(R_LO, v);
-
- return dipc;
- }
-
- dinstrn *
- i_mulfmt(dipc, fmt, ft, fs, fd)
- dinstrn *dipc;
- int fmt;
- int ft;
- int fs;
- int fd;
- {
- float singles;
- float singlet;
- float singled;
- double doubles;
- double doublet;
- double doubled;
-
- switch (fmt)
- {
- case FMT_SINGLE:
- procsget(CP1G(fs), *(unsigned long *)&singles);
-
- procsget(CP1G(ft), *(unsigned long *)&singlet);
-
- singled = singles * singlet;
-
- procsput(CP1G(fd), *(unsigned long *)&singled);
-
- break;
-
- case FMT_DOUBLE:
- /*
- * Note apparent reversal of words within
- * doubles here -- no idea why.
- */
- procsget(CP1G(fs), *((unsigned long *)&doubles + 1));
-
- procsget(CP1G(fs) + 1, *(unsigned long *)&doubles);
-
- procsget(CP1G(ft), *((unsigned long *)&doublet + 1));
-
- procsget(CP1G(ft) + 1, *(unsigned long *)&doublet);
-
- doubled = doubles * doublet;
-
- procsput(CP1G(fd), *((unsigned long *)&doubled + 1));
-
- procsput(CP1G(fd) + 1, *(unsigned long *)&doubled);
- break;
-
- default:
- unrecognised(dipc);
- break;
- }
-
- return dipc;
- }
-
- dinstrn *
- i_mult(dipc, rs, rt, rd, shamt, funct)
- dinstrn *dipc;
- int rs;
- int rt;
- int rd;
- int shamt;
- int funct;
- {
- unsigned long s;
- unsigned long t;
- unsigned long hi;
- unsigned long lo;
-
- procsget(rs, s);
-
- procsget(rt, t);
-
- if (dmult(s, t, &hi, &lo) != -1)
- {
- procsput(R_HI, hi);
- procsput(R_LO, lo);
- }
-
- return dipc;
- }
-
- static
- dinstrn *
- c_multu(dipc)
- dinstrn *dipc;
- {
- (void)dmultu(*dipc->di_0, *dipc->di_1, &P.p_state[R_HI], &P.p_state[R_LO]);
-
- return dipc;
- }
-
- dinstrn *
- i_multu(dipc, rs, rt, rd, shamt, funct)
- dinstrn *dipc;
- int rs;
- int rt;
- int rd;
- int shamt;
- int funct;
- {
- unsigned long s;
- unsigned long t;
- unsigned long hi;
- unsigned long lo;
-
- if (compile_ok)
- {
- dipc->di_handler = c_multu;
- dipc->di_0 = &P.p_state[rs];
- dipc->di_1 = &P.p_state[rt];
-
- return (*dipc->di_handler)(dipc);
- }
-
- procsget(rs, s);
-
- procsget(rt, t);
-
- if (dmultu(s, t, &hi, &lo) != -1)
- {
- procsput(R_HI, hi);
- procsput(R_LO, lo);
- }
-
- return dipc;
- }
-