#include "vm_local.h"
Include dependency graph for vm_ppc.c:

Go to the source code of this file.
Defines | |
| #define | RG_ASMCALL r7 |
| #define | RG_CVM r10 |
| #define | RG_EA r14 |
| #define | RG_INSTRUCTIONS r8 |
| #define | RG_MEMBASE r5 |
| #define | RG_MEMMASK r6 |
| #define | RG_NUM_INSTRUCTIONS r9 |
| #define | RG_OPSTACK r4 |
| #define | RG_REAL_STACK r1 |
| #define | RG_SECOND r13 |
| #define | RG_STACK r3 |
| #define | RG_TOP r12 |
Enumerations | |
| enum | ppcOpcodes_t { PPC_TDI = 0x08000000, PPC_TWI = 0x0c000000, PPC_MULLI = 0x1c000000, PPC_SUBFIC = 0x20000000, PPC_CMPI = 0x28000000, PPC_CMPLI = 0x2c000000, PPC_ADDIC = 0x30000000, PPC_ADDIC_ = 0x34000000, PPC_ADDI = 0x38000000, PPC_ADDIS = 0x3c000000, PPC_BC = 0x40000000, PPC_SC = 0x44000000, PPC_B = 0x48000000, PPC_MCRF = 0x4c000000, PPC_BCLR = 0x4c000020, PPC_RFID = 0x4c000000, PPC_CRNOR = 0x4c000000, PPC_RFI = 0x4c000000, PPC_CRANDC = 0x4c000000, PPC_ISYNC = 0x4c000000, PPC_CRXOR = 0x4c000000, PPC_CRNAND = 0x4c000000, PPC_CREQV = 0x4c000000, PPC_CRORC = 0x4c000000, PPC_CROR = 0x4c000000, PPC_BCCTR = 0x4c000420, PPC_RLWIMI = 0x50000000, PPC_RLWINM = 0x54000000, PPC_RLWNM = 0x5c000000, PPC_ORI = 0x60000000, PPC_ORIS = 0x64000000, PPC_XORI = 0x68000000, PPC_XORIS = 0x6c000000, PPC_ANDI_ = 0x70000000, PPC_ANDIS_ = 0x74000000, PPC_RLDICL = 0x78000000, PPC_RLDICR = 0x78000000, PPC_RLDIC = 0x78000000, PPC_RLDIMI = 0x78000000, PPC_RLDCL = 0x78000000, PPC_RLDCR = 0x78000000, PPC_CMP = 0x7c000000, PPC_TW = 0x7c000000, PPC_SUBFC = 0x7c000010, PPC_MULHDU = 0x7c000000, PPC_ADDC = 0x7c000014, PPC_MULHWU = 0x7c000000, PPC_MFCR = 0x7c000000, PPC_LWAR = 0x7c000000, PPC_LDX = 0x7c000000, PPC_LWZX = 0x7c00002e, PPC_SLW = 0x7c000030, PPC_CNTLZW = 0x7c000000, PPC_SLD = 0x7c000000, PPC_AND = 0x7c000038, PPC_CMPL = 0x7c000040, PPC_SUBF = 0x7c000050, PPC_LDUX = 0x7c000000, PPC_DCBST = 0x7c000000, PPC_LWZUX = 0x7c00006c, PPC_CNTLZD = 0x7c000000, PPC_ANDC = 0x7c000000, PPC_TD = 0x7c000000, PPC_MULHD = 0x7c000000, PPC_MULHW = 0x7c000000, PPC_MTSRD = 0x7c000000, PPC_MFMSR = 0x7c000000, PPC_LDARX = 0x7c000000, PPC_DCBF = 0x7c000000, PPC_LBZX = 0x7c0000ae, PPC_NEG = 0x7c000000, PPC_MTSRDIN = 0x7c000000, PPC_LBZUX = 0x7c000000, PPC_NOR = 0x7c0000f8, PPC_SUBFE = 0x7c000000, PPC_ADDE = 0x7c000000, PPC_MTCRF = 0x7c000000, PPC_MTMSR = 0x7c000000, PPC_STDX = 0x7c000000, PPC_STWCX_ = 0x7c000000, PPC_STWX = 0x7c00012e, PPC_MTMSRD = 0x7c000000, PPC_STDUX = 0x7c000000, PPC_STWUX = 0x7c00016e, PPC_SUBFZE = 0x7c000000, PPC_ADDZE = 0x7c000000, PPC_MTSR = 0x7c000000, PPC_STDCX_ = 0x7c000000, PPC_STBX = 0x7c0001ae, PPC_SUBFME = 0x7c000000, PPC_MULLD = 0x7c000000, PPC_ADDME = 0x7c000000, PPC_MULLW = 0x7c0001d6, PPC_MTSRIN = 0x7c000000, PPC_DCBTST = 0x7c000000, PPC_STBUX = 0x7c000000, PPC_ADD = 0x7c000214, PPC_DCBT = 0x7c000000, PPC_LHZX = 0x7c00022e, PPC_EQV = 0x7c000000, PPC_TLBIE = 0x7c000000, PPC_ECIWX = 0x7c000000, PPC_LHZUX = 0x7c000000, PPC_XOR = 0x7c000278, PPC_MFSPR = 0x7c0002a6, PPC_LWAX = 0x7c000000, PPC_LHAX = 0x7c000000, PPC_TLBIA = 0x7c000000, PPC_MFTB = 0x7c000000, PPC_LWAUX = 0x7c000000, PPC_LHAUX = 0x7c000000, PPC_STHX = 0x7c00032e, PPC_ORC = 0x7c000338, PPC_SRADI = 0x7c000000, PPC_SLBIE = 0x7c000000, PPC_ECOWX = 0x7c000000, PPC_STHUX = 0x7c000000, PPC_OR = 0x7c000378, PPC_DIVDU = 0x7c000000, PPC_DIVWU = 0x7c000396, PPC_MTSPR = 0x7c0003a6, PPC_DCBI = 0x7c000000, PPC_NAND = 0x7c000000, PPC_DIVD = 0x7c000000, PPC_DIVW = 0x7c0003d6, PPC_SLBIA = 0x7c000000, PPC_MCRXR = 0x7c000000, PPC_LSWX = 0x7c000000, PPC_LWBRX = 0x7c000000, PPC_LFSX = 0x7c000000, PPC_SRW = 0x7c000430, PPC_SRD = 0x7c000000, PPC_TLBSYNC = 0x7c000000, PPC_LFSUX = 0x7c000000, PPC_MFSR = 0x7c000000, PPC_LSWI = 0x7c000000, PPC_SYNC = 0x7c000000, PPC_LFDX = 0x7c000000, PPC_LFDUX = 0x7c000000, PPC_MFSRIN = 0x7c000000, PPC_STSWX = 0x7c000000, PPC_STWBRX = 0x7c000000, PPC_STFSX = 0x7c000000, PPC_STFSUX = 0x7c000000, PPC_STSWI = 0x7c000000, PPC_STFDX = 0x7c000000, PPC_DCBA = 0x7c000000, PPC_STFDUX = 0x7c000000, PPC_LHBRX = 0x7c000000, PPC_SRAW = 0x7c000630, PPC_SRAD = 0x7c000000, PPC_SRAWI = 0x7c000000, PPC_EIEIO = 0x7c000000, PPC_STHBRX = 0x7c000000, PPC_EXTSH = 0x7c000734, PPC_EXTSB = 0x7c000774, PPC_ICBI = 0x7c000000, PPC_STFIWX = 0x7c0007ae, PPC_EXTSW = 0x7c000000, PPC_DCBZ = 0x7c000000, PPC_LWZ = 0x80000000, PPC_LWZU = 0x84000000, PPC_LBZ = 0x88000000, PPC_LBZU = 0x8c000000, PPC_STW = 0x90000000, PPC_STWU = 0x94000000, PPC_STB = 0x98000000, PPC_STBU = 0x9c000000, PPC_LHZ = 0xa0000000, PPC_LHZU = 0xa4000000, PPC_LHA = 0xa8000000, PPC_LHAU = 0xac000000, PPC_STH = 0xb0000000, PPC_STHU = 0xb4000000, PPC_LMW = 0xb8000000, PPC_STMW = 0xbc000000, PPC_LFS = 0xc0000000, PPC_LFSU = 0xc4000000, PPC_LFD = 0xc8000000, PPC_LFDU = 0xcc000000, PPC_STFS = 0xd0000000, PPC_STFSU = 0xd4000000, PPC_STFD = 0xd8000000, PPC_STFDU = 0xdc000000, PPC_LD = 0xe8000000, PPC_LDU = 0xe8000001, PPC_LWA = 0xe8000002, PPC_FDIVS = 0xec000024, PPC_FSUBS = 0xec000028, PPC_FADDS = 0xec00002a, PPC_FSQRTS = 0xec000000, PPC_FRES = 0xec000000, PPC_FMULS = 0xec000032, PPC_FMSUBS = 0xec000000, PPC_FMADDS = 0xec000000, PPC_FNMSUBS = 0xec000000, PPC_FNMADDS = 0xec000000, PPC_STD = 0xf8000000, PPC_STDU = 0xf8000001, PPC_FCMPU = 0xfc000000, PPC_FRSP = 0xfc000018, PPC_FCTIW = 0xfc000000, PPC_FCTIWZ = 0xfc00001e, PPC_FDIV = 0xfc000000, PPC_FSUB = 0xfc000028, PPC_FADD = 0xfc000000, PPC_FSQRT = 0xfc000000, PPC_FSEL = 0xfc000000, PPC_FMUL = 0xfc000000, PPC_FRSQRTE = 0xfc000000, PPC_FMSUB = 0xfc000000, PPC_FMADD = 0xfc000000, PPC_FNMSUB = 0xfc000000, PPC_FNMADD = 0xfc000000, PPC_FCMPO = 0xfc000000, PPC_MTFSB1 = 0xfc000000, PPC_FNEG = 0xfc000050, PPC_MCRFS = 0xfc000000, PPC_MTFSB0 = 0xfc000000, PPC_FMR = 0xfc000000, PPC_MTFSFI = 0xfc000000, PPC_FNABS = 0xfc000000, PPC_FABS = 0xfc000000, PPC_MFFS = 0xfc000000, PPC_MTFSF = 0xfc000000, PPC_FCTID = 0xfc000000, PPC_FCTIDZ = 0xfc000000, PPC_FCFID = 0xfc000000 } |
| enum | regNums_t { R_REAL_STACK = 1, R_STACK = 3, R_OPSTACK, R_MEMBASE, R_MEMMASK, R_ASMCALL, R_INSTRUCTIONS, R_NUM_INSTRUCTIONS, R_CVM, R_TOP = 11, R_SECOND = 12, R_EA = 2 } |
Functions | |
| void | AsmCall (void) |
| int | Constant1 (void) |
| int | Constant4 (void) |
| void | Emit4 (int i) |
| void | fltopandsecond () |
| void | Inst (int opcode, int destReg, int aReg, int bReg) |
| void | Inst4 (int opcode, int destReg, int aReg, int bReg, int cReg) |
| void | InstImm (int opcode, int destReg, int aReg, int immediate) |
| void | InstImmU (int opcode, int destReg, int aReg, int immediate) |
| void | ltop () |
| void | ltopandsecond () |
| int | VM_CallCompiled (vm_t *vm, int *args) |
| void | VM_Compile (vm_t *vm, vmHeader_t *header) |
Variables | |
| unsigned * | buf |
| byte * | code |
| int | compiledOfs |
| int | instruction |
| double | itofConvert [2] |
| byte * | jused |
| int | oc0 |
| int | oc1 |
| int | pass |
| int | pc |
| int | pop0 |
| int | pop1 |
| qboolean | rtopped |
| vm_t * | tvm |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 67 of file vm_ppc.c. 00067 {
00068 PPC_TDI = 0x08000000,
00069 PPC_TWI = 0x0c000000,
00070 PPC_MULLI = 0x1c000000,
00071 PPC_SUBFIC = 0x20000000,
00072 PPC_CMPI = 0x28000000,
00073 PPC_CMPLI = 0x2c000000,
00074 PPC_ADDIC = 0x30000000,
00075 PPC_ADDIC_ = 0x34000000,
00076 PPC_ADDI = 0x38000000,
00077 PPC_ADDIS = 0x3c000000,
00078 PPC_BC = 0x40000000,
00079 PPC_SC = 0x44000000,
00080 PPC_B = 0x48000000,
00081
00082 PPC_MCRF = 0x4c000000,
00083 PPC_BCLR = 0x4c000020,
00084 PPC_RFID = 0x4c000000,
00085 PPC_CRNOR = 0x4c000000,
00086 PPC_RFI = 0x4c000000,
00087 PPC_CRANDC = 0x4c000000,
00088 PPC_ISYNC = 0x4c000000,
00089 PPC_CRXOR = 0x4c000000,
00090 PPC_CRNAND = 0x4c000000,
00091 PPC_CREQV = 0x4c000000,
00092 PPC_CRORC = 0x4c000000,
00093 PPC_CROR = 0x4c000000,
00094 //------------
00095 PPC_BCCTR = 0x4c000420,
00096 PPC_RLWIMI = 0x50000000,
00097 PPC_RLWINM = 0x54000000,
00098 PPC_RLWNM = 0x5c000000,
00099 PPC_ORI = 0x60000000,
00100 PPC_ORIS = 0x64000000,
00101 PPC_XORI = 0x68000000,
00102 PPC_XORIS = 0x6c000000,
00103 PPC_ANDI_ = 0x70000000,
00104 PPC_ANDIS_ = 0x74000000,
00105 PPC_RLDICL = 0x78000000,
00106 PPC_RLDICR = 0x78000000,
00107 PPC_RLDIC = 0x78000000,
00108 PPC_RLDIMI = 0x78000000,
00109 PPC_RLDCL = 0x78000000,
00110 PPC_RLDCR = 0x78000000,
00111 PPC_CMP = 0x7c000000,
00112 PPC_TW = 0x7c000000,
00113 PPC_SUBFC = 0x7c000010,
00114 PPC_MULHDU = 0x7c000000,
00115 PPC_ADDC = 0x7c000014,
00116 PPC_MULHWU = 0x7c000000,
00117 PPC_MFCR = 0x7c000000,
00118 PPC_LWAR = 0x7c000000,
00119 PPC_LDX = 0x7c000000,
00120 PPC_LWZX = 0x7c00002e,
00121 PPC_SLW = 0x7c000030,
00122 PPC_CNTLZW = 0x7c000000,
00123 PPC_SLD = 0x7c000000,
00124 PPC_AND = 0x7c000038,
00125 PPC_CMPL = 0x7c000040,
00126 PPC_SUBF = 0x7c000050,
00127 PPC_LDUX = 0x7c000000,
00128 //------------
00129 PPC_DCBST = 0x7c000000,
00130 PPC_LWZUX = 0x7c00006c,
00131 PPC_CNTLZD = 0x7c000000,
00132 PPC_ANDC = 0x7c000000,
00133 PPC_TD = 0x7c000000,
00134 PPC_MULHD = 0x7c000000,
00135 PPC_MULHW = 0x7c000000,
00136 PPC_MTSRD = 0x7c000000,
00137 PPC_MFMSR = 0x7c000000,
00138 PPC_LDARX = 0x7c000000,
00139 PPC_DCBF = 0x7c000000,
00140 PPC_LBZX = 0x7c0000ae,
00141 PPC_NEG = 0x7c000000,
00142 PPC_MTSRDIN = 0x7c000000,
00143 PPC_LBZUX = 0x7c000000,
00144 PPC_NOR = 0x7c0000f8,
00145 PPC_SUBFE = 0x7c000000,
00146 PPC_ADDE = 0x7c000000,
00147 PPC_MTCRF = 0x7c000000,
00148 PPC_MTMSR = 0x7c000000,
00149 PPC_STDX = 0x7c000000,
00150 PPC_STWCX_ = 0x7c000000,
00151 PPC_STWX = 0x7c00012e,
00152 PPC_MTMSRD = 0x7c000000,
00153 PPC_STDUX = 0x7c000000,
00154 PPC_STWUX = 0x7c00016e,
00155 PPC_SUBFZE = 0x7c000000,
00156 PPC_ADDZE = 0x7c000000,
00157 PPC_MTSR = 0x7c000000,
00158 PPC_STDCX_ = 0x7c000000,
00159 PPC_STBX = 0x7c0001ae,
00160 PPC_SUBFME = 0x7c000000,
00161 PPC_MULLD = 0x7c000000,
00162 //------------
00163 PPC_ADDME = 0x7c000000,
00164 PPC_MULLW = 0x7c0001d6,
00165 PPC_MTSRIN = 0x7c000000,
00166 PPC_DCBTST = 0x7c000000,
00167 PPC_STBUX = 0x7c000000,
00168 PPC_ADD = 0x7c000214,
00169 PPC_DCBT = 0x7c000000,
00170 PPC_LHZX = 0x7c00022e,
00171 PPC_EQV = 0x7c000000,
00172 PPC_TLBIE = 0x7c000000,
00173 PPC_ECIWX = 0x7c000000,
00174 PPC_LHZUX = 0x7c000000,
00175 PPC_XOR = 0x7c000278,
00176 PPC_MFSPR = 0x7c0002a6,
00177 PPC_LWAX = 0x7c000000,
00178 PPC_LHAX = 0x7c000000,
00179 PPC_TLBIA = 0x7c000000,
00180 PPC_MFTB = 0x7c000000,
00181 PPC_LWAUX = 0x7c000000,
00182 PPC_LHAUX = 0x7c000000,
00183 PPC_STHX = 0x7c00032e,
00184 PPC_ORC = 0x7c000338,
00185 PPC_SRADI = 0x7c000000,
00186 PPC_SLBIE = 0x7c000000,
00187 PPC_ECOWX = 0x7c000000,
00188 PPC_STHUX = 0x7c000000,
00189 PPC_OR = 0x7c000378,
00190 PPC_DIVDU = 0x7c000000,
00191 PPC_DIVWU = 0x7c000396,
00192 PPC_MTSPR = 0x7c0003a6,
00193 PPC_DCBI = 0x7c000000,
00194 PPC_NAND = 0x7c000000,
00195 PPC_DIVD = 0x7c000000,
00196 //------------
00197 PPC_DIVW = 0x7c0003d6,
00198 PPC_SLBIA = 0x7c000000,
00199 PPC_MCRXR = 0x7c000000,
00200 PPC_LSWX = 0x7c000000,
00201 PPC_LWBRX = 0x7c000000,
00202 PPC_LFSX = 0x7c000000,
00203 PPC_SRW = 0x7c000430,
00204 PPC_SRD = 0x7c000000,
00205 PPC_TLBSYNC = 0x7c000000,
00206 PPC_LFSUX = 0x7c000000,
00207 PPC_MFSR = 0x7c000000,
00208 PPC_LSWI = 0x7c000000,
00209 PPC_SYNC = 0x7c000000,
00210 PPC_LFDX = 0x7c000000,
00211 PPC_LFDUX = 0x7c000000,
00212 PPC_MFSRIN = 0x7c000000,
00213 PPC_STSWX = 0x7c000000,
00214 PPC_STWBRX = 0x7c000000,
00215 PPC_STFSX = 0x7c000000,
00216 PPC_STFSUX = 0x7c000000,
00217 PPC_STSWI = 0x7c000000,
00218 PPC_STFDX = 0x7c000000,
00219 PPC_DCBA = 0x7c000000,
00220 PPC_STFDUX = 0x7c000000,
00221 PPC_LHBRX = 0x7c000000,
00222 PPC_SRAW = 0x7c000630,
00223 PPC_SRAD = 0x7c000000,
00224 PPC_SRAWI = 0x7c000000,
00225 PPC_EIEIO = 0x7c000000,
00226 PPC_STHBRX = 0x7c000000,
00227 PPC_EXTSH = 0x7c000734,
00228 PPC_EXTSB = 0x7c000774,
00229 PPC_ICBI = 0x7c000000,
00230 //------------
00231 PPC_STFIWX = 0x7c0007ae,
00232 PPC_EXTSW = 0x7c000000,
00233 PPC_DCBZ = 0x7c000000,
00234 PPC_LWZ = 0x80000000,
00235 PPC_LWZU = 0x84000000,
00236 PPC_LBZ = 0x88000000,
00237 PPC_LBZU = 0x8c000000,
00238 PPC_STW = 0x90000000,
00239 PPC_STWU = 0x94000000,
00240 PPC_STB = 0x98000000,
00241 PPC_STBU = 0x9c000000,
00242 PPC_LHZ = 0xa0000000,
00243 PPC_LHZU = 0xa4000000,
00244 PPC_LHA = 0xa8000000,
00245 PPC_LHAU = 0xac000000,
00246 PPC_STH = 0xb0000000,
00247 PPC_STHU = 0xb4000000,
00248 PPC_LMW = 0xb8000000,
00249 PPC_STMW = 0xbc000000,
00250 PPC_LFS = 0xc0000000,
00251 PPC_LFSU = 0xc4000000,
00252 PPC_LFD = 0xc8000000,
00253 PPC_LFDU = 0xcc000000,
00254 PPC_STFS = 0xd0000000,
00255 PPC_STFSU = 0xd4000000,
00256 PPC_STFD = 0xd8000000,
00257 PPC_STFDU = 0xdc000000,
00258 PPC_LD = 0xe8000000,
00259 PPC_LDU = 0xe8000001,
00260 PPC_LWA = 0xe8000002,
00261 PPC_FDIVS = 0xec000024,
00262 PPC_FSUBS = 0xec000028,
00263 PPC_FADDS = 0xec00002a,
00264 //------------
00265 PPC_FSQRTS = 0xec000000,
00266 PPC_FRES = 0xec000000,
00267 PPC_FMULS = 0xec000032,
00268 PPC_FMSUBS = 0xec000000,
00269 PPC_FMADDS = 0xec000000,
00270 PPC_FNMSUBS = 0xec000000,
00271 PPC_FNMADDS = 0xec000000,
00272 PPC_STD = 0xf8000000,
00273 PPC_STDU = 0xf8000001,
00274 PPC_FCMPU = 0xfc000000,
00275 PPC_FRSP = 0xfc000018,
00276 PPC_FCTIW = 0xfc000000,
00277 PPC_FCTIWZ = 0xfc00001e,
00278 PPC_FDIV = 0xfc000000,
00279 PPC_FSUB = 0xfc000028,
00280 PPC_FADD = 0xfc000000,
00281 PPC_FSQRT = 0xfc000000,
00282 PPC_FSEL = 0xfc000000,
00283 PPC_FMUL = 0xfc000000,
00284 PPC_FRSQRTE = 0xfc000000,
00285 PPC_FMSUB = 0xfc000000,
00286 PPC_FMADD = 0xfc000000,
00287 PPC_FNMSUB = 0xfc000000,
00288 PPC_FNMADD = 0xfc000000,
00289 PPC_FCMPO = 0xfc000000,
00290 PPC_MTFSB1 = 0xfc000000,
00291 PPC_FNEG = 0xfc000050,
00292 PPC_MCRFS = 0xfc000000,
00293 PPC_MTFSB0 = 0xfc000000,
00294 PPC_FMR = 0xfc000000,
00295 PPC_MTFSFI = 0xfc000000,
00296 PPC_FNABS = 0xfc000000,
00297 PPC_FABS = 0xfc000000,
00298 //------------
00299 PPC_MFFS = 0xfc000000,
00300 PPC_MTFSF = 0xfc000000,
00301 PPC_FCTID = 0xfc000000,
00302 PPC_FCTIDZ = 0xfc000000,
00303 PPC_FCFID = 0xfc000000
00304
00305 } ppcOpcodes_t;
|
|
|
Definition at line 30 of file vm_ppc.c. 00030 {
00031 R_REAL_STACK = 1,
00032 // registers 3-11 are the parameter passing registers
00033
00034 // state
00035 R_STACK = 3, // local
00036 R_OPSTACK, // global
00037
00038 // constants
00039 R_MEMBASE, // global
00040 R_MEMMASK,
00041 R_ASMCALL, // global
00042 R_INSTRUCTIONS, // global
00043 R_NUM_INSTRUCTIONS, // global
00044 R_CVM, // currentVM
00045
00046 // temps
00047 R_TOP = 11,
00048 R_SECOND = 12,
00049 R_EA = 2 // effective address calculation
00050
00051 } regNums_t;
|
|
|
Definition at line 1318 of file vm_ppc.c. References add. Referenced by VM_CallCompiled(). 01318 {
01319
01320 // pop off the destination instruction
01321
01322 lwz r12,0(r4) // RG_TOP, 0(RG_OPSTACK)
01323
01324 addi r4,r4,-4 // RG_OPSTACK, RG_OPSTACK, -4
01325
01326
01327
01328 // see if it is a system trap
01329
01330 cmpwi r12,0 // RG_TOP, 0
01331
01332 bc 12,0, systemTrap
01333
01334
01335
01336 // calling another VM function, so lookup in instructionPointers
01337
01338 slwi r12,r12,2 // RG_TOP,RG_TOP,2
01339
01340 // FIXME: range check
01341
01342 lwzx r12, r8, r12 // RG_TOP, RG_INSTRUCTIONS(RG_TOP)
01343
01344 mtctr r12 // RG_TOP
01345
01346
01347
01348 bcctr 20,0 // when it hits a leave, it will branch to the current link register
01349
01350
01351
01352 // calling a system trap
01353
01354 systemTrap:
01355
01356 // convert to positive system call number
01357
01358 subfic r12,r12,-1
01359
01360
01361
01362 // save all our registers, including the current link register
01363
01364 mflr r13 // RG_SECOND // copy off our link register
01365
01366 addi r1,r1,-92 // required 24 byets of linkage, 32 bytes of parameter, plus our saves
01367
01368 stw r3,56(r1) // RG_STACK, -36(REAL_STACK)
01369
01370 stw r4,60(r1) // RG_OPSTACK, 4(RG_REAL_STACK)
01371
01372 stw r5,64(r1) // RG_MEMBASE, 8(RG_REAL_STACK)
01373
01374 stw r6,68(r1) // RG_MEMMASK, 12(RG_REAL_STACK)
01375
01376 stw r7,72(r1) // RG_ASMCALL, 16(RG_REAL_STACK)
01377
01378 stw r8,76(r1) // RG_INSTRUCTIONS, 20(RG_REAL_STACK)
01379
01380 stw r9,80(r1) // RG_NUM_INSTRUCTIONS, 24(RG_REAL_STACK)
01381
01382 stw r10,84(r1) // RG_VM, 28(RG_REAL_STACK)
01383
01384 stw r13,88(r1) // RG_SECOND, 32(RG_REAL_STACK) // link register
01385
01386
01387
01388 // save the vm stack position to allow recursive VM entry
01389
01390 addi r13,r3,-4 // RG_TOP, RG_STACK, -4
01391
01392 stw r13,0(r10) //RG_TOP, VM_OFFSET_PROGRAM_STACK(RG_VM)
01393
01394
01395
01396 // save the system call number as the 0th parameter
01397
01398 add r3,r3,r5 // r3, RG_STACK, RG_MEMBASE // r3 is the first parameter to vm->systemCalls
01399
01400 stwu r12,4(r3) // RG_TOP, 4(r3)
01401
01402
01403
01404 // make the system call with the address of all the VM parms as a parameter
01405
01406 // vm->systemCalls( &parms )
01407
01408 lwz r12,4(r10) // RG_TOP, VM_OFFSET_SYSTEM_CALL(RG_VM)
01409
01410
01411
01412 // perform macos cross fragment fixup crap
01413
01414 lwz r9,0(r12)
01415
01416 stw r2,52(r1) // save old TOC
01417
01418 lwz r2,4(r12)
01419
01420
01421
01422 mtctr r9 // RG_TOP
01423
01424 bcctrl 20,0
01425
01426
01427
01428 lwz r2,52(r1) // restore TOC
01429
01430
01431
01432 mr r12,r3 // RG_TOP, r3
01433
01434
01435
01436 // pop our saved registers
01437
01438 lwz r3,56(r1) // RG_STACK, 0(RG_REAL_STACK)
01439
01440 lwz r4,60(r1) // RG_OPSTACK, 4(RG_REAL_STACK)
01441
01442 lwz r5,64(r1) // RG_MEMBASE, 8(RG_REAL_STACK)
01443
01444 lwz r6,68(r1) // RG_MEMMASK, 12(RG_REAL_STACK)
01445
01446 lwz r7,72(r1) // RG_ASMCALL, 16(RG_REAL_STACK)
01447
01448 lwz r8,76(r1) // RG_INSTRUCTIONS, 20(RG_REAL_STACK)
01449
01450 lwz r9,80(r1) // RG_NUM_INSTRUCTIONS, 24(RG_REAL_STACK)
01451
01452 lwz r10,84(r1) // RG_VM, 28(RG_REAL_STACK)
01453
01454 lwz r13,88(r1) // RG_SECOND, 32(RG_REAL_STACK)
01455
01456 addi r1,r1,92 // RG_REAL_STACK, RG_REAL_STACK, 36
01457
01458
01459
01460 // restore the old link register
01461
01462 mtlr r13 // RG_SECOND
01463
01464
01465
01466 // save off the return value
01467
01468 stwu r12,4(r4) // RG_TOP, 0(RG_OPSTACK)
01469
01470
01471
01472 blr
01473
01474 }
|
|
|
Definition at line 328 of file vm_ppc.c. Referenced by VM_Compile().
|
|
|
Definition at line 320 of file vm_ppc.c. Referenced by VM_Compile(). 00320 {
00321 int v;
00322
00323 v = code[pc] | (code[pc+1]<<8) | (code[pc+2]<<16) | (code[pc+3]<<24);
00324 pc += 4;
00325 return v;
00326 }
|
|
|
Definition at line 336 of file vm_ppc.c. References buf, and compiledOfs. 00336 {
00337 buf[ compiledOfs ] = i;
00338 compiledOfs++;
00339 }
|
|
|
Definition at line 424 of file vm_ppc.c. References InstImm(), PPC_ADDI, PPC_LFS, R_OPSTACK, R_SECOND, R_TOP, and rtopped. Referenced by VM_Compile(). 00424 {
00425 InstImm( PPC_LFS, R_TOP, R_OPSTACK, 0 ); // get value from opstack
00426 InstImm( PPC_LFS, R_SECOND, R_OPSTACK, -4 ); // get value from opstack
00427 InstImm( PPC_ADDI, R_OPSTACK, R_OPSTACK, -8 );
00428 rtopped = qfalse;
00429 return;
00430 }
|
Here is the call graph for this function:

|
||||||||||||||||||||
|
Definition at line 341 of file vm_ppc.c. References buf, compiledOfs, and r. 00341 {
00342 unsigned r;
00343
00344 r = opcode | ( destReg << 21 ) | ( aReg << 16 ) | ( bReg << 11 ) ;
00345 buf[ compiledOfs ] = r;
00346 compiledOfs++;
00347 }
|
|
||||||||||||||||||||||||
|
Definition at line 349 of file vm_ppc.c. References buf, compiledOfs, and r. 00349 {
00350 unsigned r;
00351
00352 r = opcode | ( destReg << 21 ) | ( aReg << 16 ) | ( bReg << 11 ) | ( cReg << 6 );
00353 buf[ compiledOfs ] = r;
00354 compiledOfs++;
00355 }
|
|
||||||||||||||||||||
|
Definition at line 357 of file vm_ppc.c. References buf, Com_Error(), compiledOfs, ERR_FATAL, and r. 00357 {
00358 unsigned r;
00359
00360 if ( immediate > 32767 || immediate < -32768 ) {
00361 Com_Error( ERR_FATAL, "VM_Compile: immediate value %i out of range, opcode %x,%d,%d", immediate, opcode, destReg, aReg );
00362 }
00363 r = opcode | ( destReg << 21 ) | ( aReg << 16 ) | ( immediate & 0xffff );
00364 buf[ compiledOfs ] = r;
00365 compiledOfs++;
00366 }
|
Here is the call graph for this function:

|
||||||||||||||||||||
|
Definition at line 368 of file vm_ppc.c. References buf, Com_Error(), compiledOfs, ERR_FATAL, and r. 00368 {
00369 unsigned r;
00370
00371 if ( immediate > 0xffff || immediate < 0 ) {
00372 Com_Error( ERR_FATAL, "VM_Compile: immediate value %i out of range", immediate );
00373 }
00374 r = opcode | ( destReg << 21 ) | ( aReg << 16 ) | ( immediate & 0xffff );
00375 buf[ compiledOfs ] = r;
00376 compiledOfs++;
00377 }
|
Here is the call graph for this function:

|
|
Definition at line 386 of file vm_ppc.c. References InstImm(), PPC_LWZ, R_OPSTACK, R_TOP, and rtopped. Referenced by ltopandsecond(), and VM_Compile(). 00386 {
00387 if (rtopped == qfalse) {
00388 InstImm( PPC_LWZ, R_TOP, R_OPSTACK, 0 ); // get value from opstack
00389 }
00390 }
|
Here is the call graph for this function:

|
|
Definition at line 392 of file vm_ppc.c. References buf, compiledOfs, InstImm(), vm_s::instructionPointers, jused, ltop(), pass, PPC_ADDI, PPC_LWZ, PPC_STW, PPC_STWU, R_OPSTACK, R_SECOND, R_TOP, rtopped, and tvm. Referenced by VM_Compile(). 00392 {
00393 if (pass>=0 && buf[compiledOfs-1] == (PPC_STWU | R_TOP<<21 | R_OPSTACK<<16 | 4 ) && jused[instruction]==0 ) {
00394 compiledOfs--;
00395 if (!pass) {
00396 tvm->instructionPointers[instruction] = compiledOfs * 4;
00397 }
00398 InstImm( PPC_LWZ, R_SECOND, R_OPSTACK, 0 ); // get value from opstack
00399 InstImm( PPC_ADDI, R_OPSTACK, R_OPSTACK, -4 );
00400 } else if (pass>=0 && buf[compiledOfs-1] == (PPC_STW | R_TOP<<21 | R_OPSTACK<<16 | 0 ) && jused[instruction]==0 ) {
00401 compiledOfs--;
00402 if (!pass) {
00403 tvm->instructionPointers[instruction] = compiledOfs * 4;
00404 }
00405 InstImm( PPC_LWZ, R_SECOND, R_OPSTACK, -4 ); // get value from opstack
00406 InstImm( PPC_ADDI, R_OPSTACK, R_OPSTACK, -8 );
00407 } else {
00408 ltop(); // get value from opstack
00409 InstImm( PPC_LWZ, R_SECOND, R_OPSTACK, -4 ); // get value from opstack
00410 InstImm( PPC_ADDI, R_OPSTACK, R_OPSTACK, -8 );
00411 }
00412 rtopped = qfalse;
00413 }
|
Here is the call graph for this function:
