ops.c
来自「<B>Digital的Unix操作系统VAX 4.2源码</B>」· C语言 代码 · 共 1,054 行 · 第 1/4 页
C
1,054 行
#define O_BISL2 0xC8 /* bit set long 2 operand */#define O_BISL3 0xC9 /* bit set long 3 operand */#define O_BICL2 0xCA /* bit clear long 2 operand */#define O_BICL3 0xCB /* bit clear long 3 operand */#define O_XORL2 0xCC /* exclusive or long 2 operand */#define O_XORL3 0xCD /* exclusive or long 3 operand */#define O_MNEGL 0xCE /* move negated long */#define O_CASEL 0xCF /* case long */#define O_MOVL 0xD0 /* move long */#define O_CMPL 0xD1 /* compare long */#define O_MCOML 0xD2 /* move complemented long */#define O_BITL 0xD3 /* bit test long */#define O_CLRL 0xD4 /* clear long (also CLRF) */#define O_TSTL 0xD5 /* test long */#define O_INCL 0xD6 /* increment long */#define O_DECL 0xD7 /* decrement long */#define O_ADWC 0xD8 /* add with carry */#define O_SBWC 0xD9 /* subtrace with carry */#define O_MTPR 0xDA /* move to processor register */#define O_MFPR 0xDB /* move from processor register */#define O_MOVPSL 0xDC /* move processor status longword */#define O_PUSHL 0xDD /* push long */#define O_MOVAL 0xDE /* move address of long (also MOVAF) */#define O_PUSHAL 0xDF /* push address of long (also PUSHAF) */#define O_BBS 0xE0 /* branch on bit set */#define O_BBC 0xE1 /* branch on bit clear */#define O_BBSS 0xE2 /* branch on bit set and set */#define O_BBCS 0xE3 /* branch on bit clear and set */#define O_BBSC 0xE4 /* branch on bit set and clear */#define O_BBCC 0xE5 /* branch on bit clear and clear */#define O_BBSSI 0xE6 /* branch on bit set and set interlocked */#define O_BBCCI 0xE7 /* branch on bit clear and clear interlocked */#define O_BLBS 0xE8 /* branch on low bit set */#define O_BLBC 0xE9 /* branch on low bit clear */#define O_FFS 0xEA /* find first set bit */#define O_FFC 0xEB /* find first clear bit */#define O_CMPV 0xEC /* compare field */#define O_CMPZV 0xED /* compare zero-extended field */#define O_EXTV 0xEE /* extract field */#define O_EXTZV 0xEF /* extract zero-extended field */#define O_INSV 0xF0 /* insert field */#define O_ACBL 0xF1 /* add compare and branch long */#define O_AOBLSS 0xF2 /* add one and branch on less */#define O_AOBLEQ 0xF3 /* add one and branch on less or equal */#define O_SOBGEQ 0xF4 /* subtract one and branch on gtr or equal */#define O_SOBGTR 0xF5 /* subtract one and branch on greater */#define O_CVTLB 0xF6 /* convert long to byte */#define O_CVTLW 0xF7 /* convert long to word */#define O_ASHP 0xF8 /* arithmetic shift and round packed */#define O_CVTLP 0xF9 /* convert long to packed */#define O_CALLG 0xFA /* call with general argument list */#define O_CALLS 0xFB /* call with stack */#define O_XFC 0xFC /* extended function call */#define O_ESCD 0xFD /* ESCD to DIGITAL */#define O_ESCE 0xFE /* ESCE to DIGITAL */#define O_ESCF 0xFF /* ESCF to DIGITAL *//* Vector instruction defines */#define O_MFVP 0x31#define O_VLDL 0x34#define O_VGATHL 0x35#define O_VLDQ 0x36#define O_VGATHQ 0x37#define O_VVADDL 0x80#define O_VSADDL 0x81#define O_VVADDG 0x82#define O_VSADDG 0x83#define O_VVADDF 0x84#define O_VSADDF 0x85#define O_VVADDD 0x86#define O_VSADDD 0x87#define O_VVSUBL 0x88#define O_VSSUBL 0x89#define O_VVSUBG 0x8a#define O_VSSUBG 0x8b#define O_VVSUBF 0x8c#define O_VSSUBF 0x8d#define O_VVSUBD 0x8e#define O_VSSUBD 0x8f#define O_VSTL 0x9c#define O_VSCATL 0x9d#define O_VSTQ 0x9e#define O_VSCATQ 0x9f#define O_VVMULL 0xa0#define O_VSMULL 0xa1#define O_VVMULG 0xa2#define O_VSMULG 0xa3#define O_VVMULF 0xa4#define O_VSMULF 0xa5#define O_VVMULD 0xa6#define O_VSMULD 0xa7#define O_VSYNC 0xa8#define O_MTVP 0xa9#define O_VVDIVG 0xaa#define O_VSDIVG 0xab#define O_VVDIVF 0xac#define O_VSDIVF 0xad#define O_VVDIVD 0xae#define O_VSDIVD 0xaf#define O_VVCMP 0xc0#define O_VVCMPL 0xc0#define O_VSCMPL 0xc1#define O_VVCMPG 0xc2#define O_VSCMPG 0xc3#define O_VVCMPF 0xc4#define O_VSCMPF 0xc5#define O_VVCMPD 0xc6#define O_VSCMPD 0xc7#define O_VVBISL 0xc8#define O_VSBISL 0xc9#define O_VVBICL 0xcc#define O_VSBICL 0xcd#define O_VVSRLL 0xe0#define O_VSSRLL 0xe1#define O_VVSLLL 0xe4#define O_VSSLLL 0xe5#define O_VVXORL 0xe8#define O_VSXORL 0xe9#define O_VVCVT 0xec#define O_IOTA 0xed#define O_VVMERGE 0xee#define O_VSMERGE 0xef#define FIRST_EOP 0x31/* * Opcode definitions. * * Much of this was taken from the assembler. *//* * Argument access types. */#define ACCR 0x10 /* read */#define ACCW 0x20 /* write */#define ACCM 0x30 /* modify */#define ACCB 0x40 /* branch displacement */#define ACCI 0x50 /* variable field */#define ACCA 0x80 /* address only *//* * Argument lengths. */#define TYPB 0 /* byte */#define TYPW 01 /* word */#define TYPL 02 /* long */#define TYPQ 03 /* quad */#define TYPO 04 /* octa */#define TYPF 05 /* floating */#define TYPD 06 /* D floating */#define TYPG 07 /* G floating */#define TYPH 010 /* H floating *//* * Addressing modes. */#define LITSHORT 0x0 /* short literals */#define LITUPTO31 0x1#define LITUPTO47 0x2#define LITUPTO63 0x3#define INDEX 0x4 /* i[r] */#define REG 0x5 /* r */#define REGDEF 0x6 /* (r) */#define AUTODEC 0x7 /* -(r) */#define AUTOINC 0x8 /* (r)+ */#define AUTOINCDEF 0x9 /* *(r)+ */#define BYTEDISP 0xA /* BD(r) */#define BYTEDISPDEF 0xB /* *BD(r) */#define WORDDISP 0xC /* WD(r) */#define WORDDISPDEF 0xD /* *WD(r) */#define LONGDISP 0xE /* LD(r) */#define LONGDISPDEF 0xF /* *LD(r) *//* * Vector instruction formats. */#define FMT1 1#define FMT2 2#define FMT3 3#define FMT4 4#define FMT5 5#define FMT6 6#define FMT7 7#define FMT8 8#define FMT9 9#define FMT10 10#define FMT11 11#define FMT12 12#define FMT13 13#define FMT14 14#define FMT15 15#define FMT16 16#define mi (1)#define exc (1)#define mtf (1<<1)#define moe (1<<2)#define vreg 1#define cmp 2#define cvt 3#define sync 0x04#define msync 0x05#define is_branch_disp(arg) ((arg & ACCB) != 0)#define typelen(arg) (arg & 0xF)#define regnm(mode) (mode & 0xF)#define addrmode(mode) (mode >> 4)/* * Operator information structure. */typedef struct { char *iname; char val; char fmt; char numargs; char argtype[6];} Optab;/* * Vector instruction control word. */typedef struct { unsigned vc:4; /* bits 0-3 */ unsigned vb:4; /* bits 4-7 */ unsigned va:4; /* bits 8-11 */ unsigned unused:1; /* bit 12 */ unsigned modifiers:3 ; /* bit 13-15 */} Ctrl_word;#endifpublic Optab optab[] = { {"halt", 0x00, 0, 0, 0, 0, 0, 0, 0, 0}, {"nop", 0x01, 0, 0, 0, 0, 0, 0, 0, 0}, {"rei", 0x02, 0, 0, 0, 0, 0, 0, 0, 0}, {"bpt", 0x03, 0, 0, 0, 0, 0, 0, 0, 0}, {"ret", 0x04, 0, 0, 0, 0, 0, 0, 0, 0}, {"rsb", 0x05, 0, 0, 0, 0, 0, 0, 0, 0}, {"ldpctx", 0x06, 0, 0, 0, 0, 0, 0, 0, 0}, {"svpctx", 0x07, 0, 0, 0, 0, 0, 0, 0, 0}, {"cvtps", 0x08, 0, 4, ACCR+TYPW, ACCA+TYPB, ACCR+TYPW, ACCA+TYPB, 0, 0}, {"cvtsp", 0x09, 0, 4, ACCR+TYPW, ACCA+TYPB, ACCR+TYPW, ACCA+TYPB, 0, 0}, {"index", 0x0a, 0, 6, ACCR+TYPL, ACCR+TYPL, ACCR+TYPL, ACCR+TYPL, ACCR+TYPL, ACCW+TYPL}, {"crc", 0x0b, 0, 4, ACCA+TYPB, ACCR+TYPL, ACCR+TYPW, ACCA+TYPB, 0, 0}, {"prober", 0x0c, 0, 3, ACCR+TYPB, ACCR+TYPW, ACCA+TYPB, 0, 0, 0}, {"probew", 0x0d, 0, 3, ACCR+TYPB, ACCR+TYPW, ACCA+TYPB, 0, 0, 0}, {"insque", 0x0e, 0, 2, ACCA+TYPB, ACCA+TYPB, 0, 0, 0, 0}, {"remque", 0x0f, 0, 2, ACCA+TYPB, ACCW+TYPL, 0, 0, 0, 0}, {"bsbb", 0x10, 0, 1, ACCB+TYPB, 0, 0, 0, 0, 0}, {"brb", 0x11, 0, 1, ACCB+TYPB, 0, 0, 0, 0, 0}, {"bneq", 0x12, 0, 1, ACCB+TYPB, 0, 0, 0, 0, 0}, {"beql", 0x13, 0, 1, ACCB+TYPB, 0, 0, 0, 0, 0}, {"bgtr", 0x14, 0, 1, ACCB+TYPB, 0, 0, 0, 0, 0}, {"bleq", 0x15, 0, 1, ACCB+TYPB, 0, 0, 0, 0, 0}, {"jsb", 0x16, 0, 1, ACCA+TYPB, 0, 0, 0, 0, 0},
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?