Go to the documentation of this file. 63 #ifndef isa_instructionset_ppc_h 64 #define isa_instructionset_ppc_h 77 #define PPC_REG_RA PPC_REG_R0 80 #define PPC_REG_SP PPC_REG_R1 81 #define PPC_REG_FP PPC_REG_R1 85 #define PPC_REG_R31 31 89 #define PPC_REG_LR (-1) 96 #define PPC_OPND_REG_S_MASK 0x03e00000 97 #define PPC_OPND_REG_S_SHIFT 21 98 #define PPC_OPND_REG_S(insn) \ 99 (((insn) & PPC_OPND_REG_S_MASK) >> PPC_OPND_REG_S_SHIFT) 101 #define PPC_OPND_REG_T_MASK PPC_OPND_REG_S_MASK 102 #define PPC_OPND_REG_T_SHIFT PPC_OPND_REG_S_SHIFT 103 #define PPC_OPND_REG_T(insn) PPC_OPND_REG_S(insn) 105 #define PPC_OPND_REG_A_MASK 0x001f0000 106 #define PPC_OPND_REG_A_SHIFT 16 107 #define PPC_OPND_REG_A(insn) \ 108 (((insn) & PPC_OPND_REG_A_MASK) >> PPC_OPND_REG_A_SHIFT) 110 #define PPC_OPND_REG_B_MASK 0x0000f800 111 #define PPC_OPND_REG_B_SHIFT 11 112 #define PPC_OPND_REG_B(insn) \ 113 (((insn) & PPC_OPND_REG_B_MASK) >> PPC_OPND_REG_B_SHIFT) 115 #define PPC_OPND_CC_MASK 0x00000001 116 #define PPC_OPND_CC_SHIFT 0 118 #define PPC_OPND_REG_SPR_MASK (PPC_OPND_REG_A_MASK | PPC_OPND_REG_B_MASK) 119 #define PPC_OPND_REG_SPR_SHIFT 16 120 #define PPC_OPND_REG_SPR(insn) \ 121 (((insn) & PPC_OPND_REG_SPR_MASK) >> PPC_OPND_REG_SPR_SHIFT) 124 #define PPC_OPND_DISP(x) (((int16_t)((x) & 0x0000ffff))) 125 #define PPC_OPND_DISP_DS(x) (((int16_t)((x) & 0x0000fffc))) 132 #define PPC_OP_D_MASK 0xfc000000 133 #define PPC_OP_DS_MASK 0xfc000003 134 #define PPC_OP_I_MASK 0xfc000003 135 #define PPC_OP_X_MASK 0xfc0007fe 136 #define PPC_OP_XFX_MASK 0xfc0007fe 137 #define PPC_OP_XFX_SPR_MASK (PPC_OP_XFX_MASK | PPC_OPND_REG_SPR_MASK) 139 #define PPC_OP_LWZ 0x80000000 141 #define PPC_OP_STW 0x90000000 142 #define PPC_OP_STD 0xf8000000 144 #define PPC_OP_STWU 0x94000000 145 #define PPC_OP_STDU 0xf8000001 147 #define PPC_OP_ADDI 0x38000000 148 #define PPC_OP_ADDIS 0x3c000000 149 #define PPC_OP_LIS PPC_OP_ADDIS 151 #define PPC_OP_STWUX 0x7c00016e 152 #define PPC_OP_STDUX 0x7c00016a 154 #define PPC_OP_OR 0x7c000378 155 #define PPC_OP_MR PPC_OP_OR 157 #define PPC_OP_BLR 0x4e800020 158 #define PPC_OP_BL 0x48000001 160 #define PPC_OP_MFSPR 0x7c0002a6 161 #define PPC_OP_MFLR 0x7c0802a6 163 #define PPC_OP_MTSPR 0x7c0003a6 164 #define PPC_OP_MTLR 0x7c0803a6 172 #define PPC_INSN_D_MASK 0xffff0000 173 #define PPC_INSN_DS_MASK 0xffff0003 174 #define PPC_INSN_X_MASK 0xfffffffe 175 #define PPC_INSN_XFX_MASK 0xfffffffe 177 #define PPC_INSN_D(opc, RS, RA, D) \ 178 ((opc) | ((RS) << PPC_OPND_REG_S_SHIFT) \ 179 | ((RA) << PPC_OPND_REG_A_SHIFT) \ 182 #define PPC_INSN_DS(opc, RS, RA, D) \ 183 ((opc) | ((RS) << PPC_OPND_REG_S_SHIFT) \ 184 | ((RA) << PPC_OPND_REG_A_SHIFT) \ 187 #define PPC_INSN_X(opc, RS, RA, RB, Rc) \ 188 ((opc) | ((RS) << PPC_OPND_REG_S_SHIFT) \ 189 | ((RA) << PPC_OPND_REG_A_SHIFT) \ 190 | ((RB) << PPC_OPND_REG_B_SHIFT) \ 193 #define PPC_INSN_XFX1(opc, RS) \ 194 ((opc) | ((RS) << PPC_OPND_REG_S_SHIFT)) 196 #define PPC_INSN_XFX2(opc, RS, SPR) \ 197 ((opc) | ((RS) << PPC_OPND_REG_S_SHIFT) \ 198 | ((SPR) << PPC_OPND_REG_SPR_SHIFT))