Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

vm_ppc_new.c File Reference

#include "vm_local.h"

Include dependency graph for vm_ppc_new.c:

Include dependency graph

Go to the source code of this file.

Defines

#define assertInteger(depth)   assert(opStackRegType[depth] == 1)
#define DEBUG_VM   0
#define OP_STACK_MAX_DEPTH   12
#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 = 0x7c00042e, 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 = 0x7c00052e, 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 (char *opname, int i)
void Inst (char *opname, int opcode, int destReg, int aReg, int bReg)
void Inst4 (char *opname, int opcode, int destReg, int aReg, int bReg, int cReg)
void InstImm (char *opname, int opcode, int destReg, int aReg, int immediate)
void InstImmU (char *opname, int opcode, int destReg, int aReg, int immediate)
void loadOpStack (int depth)
void ltop ()
void ltopandsecond ()
void makeFloat (int depth)
void makeInteger (int depth)
void spillOpStack (int depth)
int VM_CallCompiled (vm_t *vm, int *args)
void VM_Compile (vm_t *vm, vmHeader_t *header)

Variables

unsigned * buf
bytecode
int compiledOfs
int instruction
double itofConvert [2]
bytejused
int oc0
int oc1
int opStackFloatRegisters [OP_STACK_MAX_DEPTH]
int opStackIntRegisters [OP_STACK_MAX_DEPTH]
unsigned int * opStackLoadInstructionAddr [OP_STACK_MAX_DEPTH]
int opStackRegType [OP_STACK_MAX_DEPTH]
int pass
int pc
int pop0
int pop1
vm_ttvm


Define Documentation

#define assertInteger depth   )     assert(opStackRegType[depth] == 1)
 

Definition at line 715 of file vm_ppc_new.c.

Referenced by VM_Compile().

#define DEBUG_VM   0
 

Definition at line 29 of file vm_ppc_new.c.

#define OP_STACK_MAX_DEPTH   12
 

Definition at line 158 of file vm_ppc_new.c.

Referenced by VM_Compile().

#define RG_ASMCALL   r7
 

Definition at line 149 of file vm_ppc_new.c.

#define RG_CVM   r10
 

Definition at line 152 of file vm_ppc_new.c.

#define RG_EA   r14
 

Definition at line 155 of file vm_ppc_new.c.

#define RG_INSTRUCTIONS   r8
 

Definition at line 150 of file vm_ppc_new.c.

#define RG_MEMBASE   r5
 

Definition at line 147 of file vm_ppc_new.c.

#define RG_MEMMASK   r6
 

Definition at line 148 of file vm_ppc_new.c.

#define RG_NUM_INSTRUCTIONS   r9
 

Definition at line 151 of file vm_ppc_new.c.

#define RG_OPSTACK   r4
 

Definition at line 146 of file vm_ppc_new.c.

#define RG_REAL_STACK   r1
 

Definition at line 144 of file vm_ppc_new.c.

#define RG_SECOND   r13
 

Definition at line 154 of file vm_ppc_new.c.

#define RG_STACK   r3
 

Definition at line 145 of file vm_ppc_new.c.

#define RG_TOP   r12
 

Definition at line 153 of file vm_ppc_new.c.


Enumeration Type Documentation

enum ppcOpcodes_t
 

Enumeration values:
PPC_TDI 
PPC_TWI 
PPC_MULLI 
PPC_SUBFIC 
PPC_CMPI 
PPC_CMPLI 
PPC_ADDIC 
PPC_ADDIC_ 
PPC_ADDI 
PPC_ADDIS 
PPC_BC 
PPC_SC 
PPC_B 
PPC_MCRF 
PPC_BCLR 
PPC_RFID 
PPC_CRNOR 
PPC_RFI 
PPC_CRANDC 
PPC_ISYNC 
PPC_CRXOR 
PPC_CRNAND 
PPC_CREQV 
PPC_CRORC 
PPC_CROR 
PPC_BCCTR 
PPC_RLWIMI 
PPC_RLWINM 
PPC_RLWNM 
PPC_ORI 
PPC_ORIS 
PPC_XORI 
PPC_XORIS 
PPC_ANDI_ 
PPC_ANDIS_ 
PPC_RLDICL 
PPC_RLDICR 
PPC_RLDIC 
PPC_RLDIMI 
PPC_RLDCL 
PPC_RLDCR 
PPC_CMP 
PPC_TW 
PPC_SUBFC 
PPC_MULHDU 
PPC_ADDC 
PPC_MULHWU 
PPC_MFCR 
PPC_LWAR 
PPC_LDX 
PPC_LWZX 
PPC_SLW 
PPC_CNTLZW 
PPC_SLD 
PPC_AND 
PPC_CMPL 
PPC_SUBF 
PPC_LDUX 
PPC_DCBST 
PPC_LWZUX 
PPC_CNTLZD 
PPC_ANDC 
PPC_TD 
PPC_MULHD 
PPC_MULHW 
PPC_MTSRD 
PPC_MFMSR 
PPC_LDARX 
PPC_DCBF 
PPC_LBZX 
PPC_NEG 
PPC_MTSRDIN 
PPC_LBZUX 
PPC_NOR 
PPC_SUBFE 
PPC_ADDE 
PPC_MTCRF 
PPC_MTMSR 
PPC_STDX 
PPC_STWCX_ 
PPC_STWX 
PPC_MTMSRD 
PPC_STDUX 
PPC_STWUX 
PPC_SUBFZE 
PPC_ADDZE 
PPC_MTSR 
PPC_STDCX_ 
PPC_STBX 
PPC_SUBFME 
PPC_MULLD 
PPC_ADDME 
PPC_MULLW 
PPC_MTSRIN 
PPC_DCBTST 
PPC_STBUX 
PPC_ADD 
PPC_DCBT 
PPC_LHZX 
PPC_EQV 
PPC_TLBIE 
PPC_ECIWX 
PPC_LHZUX 
PPC_XOR 
PPC_MFSPR 
PPC_LWAX 
PPC_LHAX 
PPC_TLBIA 
PPC_MFTB 
PPC_LWAUX 
PPC_LHAUX 
PPC_STHX 
PPC_ORC 
PPC_SRADI 
PPC_SLBIE 
PPC_ECOWX 
PPC_STHUX 
PPC_OR 
PPC_DIVDU 
PPC_DIVWU 
PPC_MTSPR 
PPC_DCBI 
PPC_NAND 
PPC_DIVD 
PPC_DIVW 
PPC_SLBIA 
PPC_MCRXR 
PPC_LSWX 
PPC_LWBRX 
PPC_LFSX 
PPC_SRW 
PPC_SRD 
PPC_TLBSYNC 
PPC_LFSUX 
PPC_MFSR 
PPC_LSWI 
PPC_SYNC 
PPC_LFDX 
PPC_LFDUX 
PPC_MFSRIN 
PPC_STSWX 
PPC_STWBRX 
PPC_STFSX 
PPC_STFSUX 
PPC_STSWI 
PPC_STFDX 
PPC_DCBA 
PPC_STFDUX 
PPC_LHBRX 
PPC_SRAW 
PPC_SRAD 
PPC_SRAWI 
PPC_EIEIO 
PPC_STHBRX 
PPC_EXTSH 
PPC_EXTSB 
PPC_ICBI 
PPC_STFIWX 
PPC_EXTSW 
PPC_DCBZ 
PPC_LWZ 
PPC_LWZU 
PPC_LBZ 
PPC_LBZU 
PPC_STW 
PPC_STWU 
PPC_STB 
PPC_STBU 
PPC_LHZ 
PPC_LHZU 
PPC_LHA 
PPC_LHAU 
PPC_STH 
PPC_STHU 
PPC_LMW 
PPC_STMW 
PPC_LFS 
PPC_LFSU 
PPC_LFD 
PPC_LFDU 
PPC_STFS 
PPC_STFSU 
PPC_STFD 
PPC_STFDU 
PPC_LD 
PPC_LDU 
PPC_LWA 
PPC_FDIVS 
PPC_FSUBS 
PPC_FADDS 
PPC_FSQRTS 
PPC_FRES 
PPC_FMULS 
PPC_FMSUBS 
PPC_FMADDS 
PPC_FNMSUBS 
PPC_FNMADDS 
PPC_STD 
PPC_STDU 
PPC_FCMPU 
PPC_FRSP 
PPC_FCTIW 
PPC_FCTIWZ 
PPC_FDIV 
PPC_FSUB 
PPC_FADD 
PPC_FSQRT 
PPC_FSEL 
PPC_FMUL 
PPC_FRSQRTE 
PPC_FMSUB 
PPC_FMADD 
PPC_FNMSUB 
PPC_FNMADD 
PPC_FCMPO 
PPC_MTFSB1 
PPC_FNEG 
PPC_MCRFS 
PPC_MTFSB0 
PPC_FMR 
PPC_MTFSFI 
PPC_FNABS 
PPC_FABS 
PPC_MFFS 
PPC_MTFSF 
PPC_FCTID 
PPC_FCTIDZ 
PPC_FCFID 

Definition at line 188 of file vm_ppc_new.c.

00188              {
00189     PPC_TDI     = 0x08000000,
00190     PPC_TWI     = 0x0c000000,
00191     PPC_MULLI   = 0x1c000000,
00192     PPC_SUBFIC  = 0x20000000,
00193     PPC_CMPI    = 0x28000000,
00194     PPC_CMPLI   = 0x2c000000,
00195     PPC_ADDIC   = 0x30000000,
00196     PPC_ADDIC_  = 0x34000000,
00197     PPC_ADDI    = 0x38000000,
00198     PPC_ADDIS   = 0x3c000000,
00199     PPC_BC      = 0x40000000,
00200     PPC_SC      = 0x44000000,
00201     PPC_B       = 0x48000000,
00202 
00203     PPC_MCRF    = 0x4c000000,
00204     PPC_BCLR    = 0x4c000020,
00205     PPC_RFID    = 0x4c000000,
00206     PPC_CRNOR   = 0x4c000000,
00207     PPC_RFI     = 0x4c000000,
00208     PPC_CRANDC  = 0x4c000000,
00209     PPC_ISYNC   = 0x4c000000,
00210     PPC_CRXOR   = 0x4c000000,
00211     PPC_CRNAND  = 0x4c000000,
00212     PPC_CREQV   = 0x4c000000,
00213     PPC_CRORC   = 0x4c000000,
00214     PPC_CROR    = 0x4c000000,
00215 //------------
00216     PPC_BCCTR   = 0x4c000420,
00217     PPC_RLWIMI  = 0x50000000,
00218     PPC_RLWINM  = 0x54000000,
00219     PPC_RLWNM   = 0x5c000000,
00220     PPC_ORI     = 0x60000000,
00221     PPC_ORIS    = 0x64000000,
00222     PPC_XORI    = 0x68000000,
00223     PPC_XORIS   = 0x6c000000,
00224     PPC_ANDI_   = 0x70000000,
00225     PPC_ANDIS_  = 0x74000000,
00226     PPC_RLDICL  = 0x78000000,
00227     PPC_RLDICR  = 0x78000000,
00228     PPC_RLDIC   = 0x78000000,
00229     PPC_RLDIMI  = 0x78000000,
00230     PPC_RLDCL   = 0x78000000,
00231     PPC_RLDCR   = 0x78000000,
00232     PPC_CMP     = 0x7c000000,
00233     PPC_TW      = 0x7c000000,
00234     PPC_SUBFC   = 0x7c000010,
00235     PPC_MULHDU  = 0x7c000000,
00236     PPC_ADDC    = 0x7c000014,
00237     PPC_MULHWU  = 0x7c000000,
00238     PPC_MFCR    = 0x7c000000,
00239     PPC_LWAR    = 0x7c000000,
00240     PPC_LDX     = 0x7c000000,
00241     PPC_LWZX    = 0x7c00002e,
00242     PPC_SLW     = 0x7c000030,
00243     PPC_CNTLZW  = 0x7c000000,
00244     PPC_SLD     = 0x7c000000,
00245     PPC_AND     = 0x7c000038,
00246     PPC_CMPL    = 0x7c000040,
00247     PPC_SUBF    = 0x7c000050,
00248     PPC_LDUX    = 0x7c000000,
00249 //------------
00250     PPC_DCBST   = 0x7c000000,
00251     PPC_LWZUX   = 0x7c00006c,
00252     PPC_CNTLZD  = 0x7c000000,
00253     PPC_ANDC    = 0x7c000000,
00254     PPC_TD      = 0x7c000000,
00255     PPC_MULHD   = 0x7c000000,
00256     PPC_MULHW   = 0x7c000000,
00257     PPC_MTSRD   = 0x7c000000,
00258     PPC_MFMSR   = 0x7c000000,
00259     PPC_LDARX   = 0x7c000000,
00260     PPC_DCBF    = 0x7c000000,
00261     PPC_LBZX    = 0x7c0000ae,
00262     PPC_NEG     = 0x7c000000,
00263     PPC_MTSRDIN = 0x7c000000,
00264     PPC_LBZUX   = 0x7c000000,
00265     PPC_NOR     = 0x7c0000f8,
00266     PPC_SUBFE   = 0x7c000000,
00267     PPC_ADDE    = 0x7c000000,
00268     PPC_MTCRF   = 0x7c000000,
00269     PPC_MTMSR   = 0x7c000000,
00270     PPC_STDX    = 0x7c000000,
00271     PPC_STWCX_  = 0x7c000000,
00272     PPC_STWX    = 0x7c00012e,
00273     PPC_MTMSRD  = 0x7c000000,
00274     PPC_STDUX   = 0x7c000000,
00275     PPC_STWUX   = 0x7c00016e,
00276     PPC_SUBFZE  = 0x7c000000,
00277     PPC_ADDZE   = 0x7c000000,
00278     PPC_MTSR    = 0x7c000000,
00279     PPC_STDCX_  = 0x7c000000,
00280     PPC_STBX    = 0x7c0001ae,
00281     PPC_SUBFME  = 0x7c000000,
00282     PPC_MULLD   = 0x7c000000,
00283 //------------
00284     PPC_ADDME   = 0x7c000000,
00285     PPC_MULLW   = 0x7c0001d6,
00286     PPC_MTSRIN  = 0x7c000000,
00287     PPC_DCBTST  = 0x7c000000,
00288     PPC_STBUX   = 0x7c000000,
00289     PPC_ADD     = 0x7c000214,
00290     PPC_DCBT    = 0x7c000000,
00291     PPC_LHZX    = 0x7c00022e,
00292     PPC_EQV     = 0x7c000000,
00293     PPC_TLBIE   = 0x7c000000,
00294     PPC_ECIWX   = 0x7c000000,
00295     PPC_LHZUX   = 0x7c000000,
00296     PPC_XOR     = 0x7c000278,
00297     PPC_MFSPR   = 0x7c0002a6,
00298     PPC_LWAX    = 0x7c000000,
00299     PPC_LHAX    = 0x7c000000,
00300     PPC_TLBIA   = 0x7c000000,
00301     PPC_MFTB    = 0x7c000000,
00302     PPC_LWAUX   = 0x7c000000,
00303     PPC_LHAUX   = 0x7c000000,
00304     PPC_STHX    = 0x7c00032e,
00305     PPC_ORC     = 0x7c000338,
00306     PPC_SRADI   = 0x7c000000,
00307     PPC_SLBIE   = 0x7c000000,
00308     PPC_ECOWX   = 0x7c000000,
00309     PPC_STHUX   = 0x7c000000,
00310     PPC_OR      = 0x7c000378,
00311     PPC_DIVDU   = 0x7c000000,
00312     PPC_DIVWU   = 0x7c000396,
00313     PPC_MTSPR   = 0x7c0003a6,
00314     PPC_DCBI    = 0x7c000000,
00315     PPC_NAND    = 0x7c000000,
00316     PPC_DIVD    = 0x7c000000,
00317 //------------
00318     PPC_DIVW    = 0x7c0003d6,
00319     PPC_SLBIA   = 0x7c000000,
00320     PPC_MCRXR   = 0x7c000000,
00321     PPC_LSWX    = 0x7c000000,
00322     PPC_LWBRX   = 0x7c000000,
00323     PPC_LFSX    = 0x7c00042e,
00324     PPC_SRW     = 0x7c000430,
00325     PPC_SRD     = 0x7c000000,
00326     PPC_TLBSYNC = 0x7c000000,
00327     PPC_LFSUX   = 0x7c000000,
00328     PPC_MFSR    = 0x7c000000,
00329     PPC_LSWI    = 0x7c000000,
00330     PPC_SYNC    = 0x7c000000,
00331     PPC_LFDX    = 0x7c000000,
00332     PPC_LFDUX   = 0x7c000000,
00333     PPC_MFSRIN  = 0x7c000000,
00334     PPC_STSWX   = 0x7c000000,
00335     PPC_STWBRX  = 0x7c000000,
00336     PPC_STFSX   = 0x7c00052e,
00337     PPC_STFSUX  = 0x7c000000,
00338     PPC_STSWI   = 0x7c000000,
00339     PPC_STFDX   = 0x7c000000,
00340     PPC_DCBA    = 0x7c000000,
00341     PPC_STFDUX  = 0x7c000000,
00342     PPC_LHBRX   = 0x7c000000,
00343     PPC_SRAW    = 0x7c000630,
00344     PPC_SRAD    = 0x7c000000,
00345     PPC_SRAWI   = 0x7c000000,
00346     PPC_EIEIO   = 0x7c000000,
00347     PPC_STHBRX  = 0x7c000000,
00348     PPC_EXTSH   = 0x7c000734,
00349     PPC_EXTSB   = 0x7c000774,
00350     PPC_ICBI    = 0x7c000000,
00351 //------------
00352     PPC_STFIWX  = 0x7c0007ae,
00353     PPC_EXTSW   = 0x7c000000,
00354     PPC_DCBZ    = 0x7c000000,
00355     PPC_LWZ     = 0x80000000,
00356     PPC_LWZU    = 0x84000000,
00357     PPC_LBZ     = 0x88000000,
00358     PPC_LBZU    = 0x8c000000,
00359     PPC_STW     = 0x90000000,
00360     PPC_STWU    = 0x94000000,
00361     PPC_STB     = 0x98000000,
00362     PPC_STBU    = 0x9c000000,
00363     PPC_LHZ     = 0xa0000000,
00364     PPC_LHZU    = 0xa4000000,
00365     PPC_LHA     = 0xa8000000,
00366     PPC_LHAU    = 0xac000000,
00367     PPC_STH     = 0xb0000000,
00368     PPC_STHU    = 0xb4000000,
00369     PPC_LMW     = 0xb8000000,
00370     PPC_STMW    = 0xbc000000,
00371     PPC_LFS     = 0xc0000000,
00372     PPC_LFSU    = 0xc4000000,
00373     PPC_LFD     = 0xc8000000,
00374     PPC_LFDU    = 0xcc000000,
00375     PPC_STFS    = 0xd0000000,
00376     PPC_STFSU   = 0xd4000000,
00377     PPC_STFD    = 0xd8000000,
00378     PPC_STFDU   = 0xdc000000,
00379     PPC_LD      = 0xe8000000,
00380     PPC_LDU     = 0xe8000001,
00381     PPC_LWA     = 0xe8000002,
00382     PPC_FDIVS   = 0xec000024,
00383     PPC_FSUBS   = 0xec000028,
00384     PPC_FADDS   = 0xec00002a,
00385 //------------
00386     PPC_FSQRTS  = 0xec000000,
00387     PPC_FRES    = 0xec000000,
00388     PPC_FMULS   = 0xec000032,
00389     PPC_FMSUBS  = 0xec000000,
00390     PPC_FMADDS  = 0xec000000,
00391     PPC_FNMSUBS = 0xec000000,
00392     PPC_FNMADDS = 0xec000000,
00393     PPC_STD     = 0xf8000000,
00394     PPC_STDU    = 0xf8000001,
00395     PPC_FCMPU   = 0xfc000000,
00396     PPC_FRSP    = 0xfc000018,
00397     PPC_FCTIW   = 0xfc000000,
00398     PPC_FCTIWZ  = 0xfc00001e,
00399     PPC_FDIV    = 0xfc000000,
00400     PPC_FSUB    = 0xfc000028,
00401     PPC_FADD    = 0xfc000000,
00402     PPC_FSQRT   = 0xfc000000,
00403     PPC_FSEL    = 0xfc000000,
00404     PPC_FMUL    = 0xfc000000,
00405     PPC_FRSQRTE = 0xfc000000,
00406     PPC_FMSUB   = 0xfc000000,
00407     PPC_FMADD   = 0xfc000000,
00408     PPC_FNMSUB  = 0xfc000000,
00409     PPC_FNMADD  = 0xfc000000,
00410     PPC_FCMPO   = 0xfc000000,
00411     PPC_MTFSB1  = 0xfc000000,
00412     PPC_FNEG    = 0xfc000050,
00413     PPC_MCRFS   = 0xfc000000,
00414     PPC_MTFSB0  = 0xfc000000,
00415     PPC_FMR     = 0xfc000000,
00416     PPC_MTFSFI  = 0xfc000000,
00417     PPC_FNABS   = 0xfc000000,
00418     PPC_FABS    = 0xfc000000,
00419 //------------
00420     PPC_MFFS    = 0xfc000000,
00421     PPC_MTFSF   = 0xfc000000,
00422     PPC_FCTID   = 0xfc000000,
00423     PPC_FCTIDZ  = 0xfc000000,
00424     PPC_FCFID   = 0xfc000000
00425     
00426 } ppcOpcodes_t;

enum regNums_t
 

Enumeration values:
R_REAL_STACK 
R_STACK 
R_OPSTACK 
R_MEMBASE 
R_MEMMASK 
R_ASMCALL 
R_INSTRUCTIONS 
R_NUM_INSTRUCTIONS 
R_CVM 
R_TOP 
R_SECOND 
R_EA 

Definition at line 121 of file vm_ppc_new.c.

00121              {
00122     R_REAL_STACK = 1,
00123     // registers 3-11 are the parameter passing registers
00124     
00125     // state
00126     R_STACK = 3,            // local
00127     R_OPSTACK,              // global
00128 
00129     // constants    
00130     R_MEMBASE,          // global
00131     R_MEMMASK,
00132     R_ASMCALL,          // global
00133     R_INSTRUCTIONS,     // global
00134     R_NUM_INSTRUCTIONS, // global
00135     R_CVM,              // currentVM
00136     
00137     // temps
00138     R_TOP = 11,
00139     R_SECOND = 12,
00140     R_EA = 2                // effective address calculation
00141      
00142 } regNums_t;


Function Documentation

void AsmCall void   ) 
 

Definition at line 194 of file vm_x86.c.

References callOpStack, callProgramStack, callSyscallNum, and instructionPointers.

00194                      {
00195     __asm__("doAsmCall:                 \n\t" \
00196             "   movl (%%edi),%%eax          \n\t" \
00197             "   subl $4,%%edi               \n\t" \
00198             "   orl %%eax,%%eax             \n\t" \
00199             "   jl systemCall               \n\t" \
00200             "   shll $2,%%eax               \n\t" \
00201             "   addl %3,%%eax               \n\t" \
00202             "   call *(%%eax)               \n\t" \
00203           " movl (%%edi),%%eax   \n\t" \
00204         " andl callMask, %%eax \n\t" \
00205             "   jmp doret                      \n\t" \
00206             "systemCall:                    \n\t" \
00207             "   negl %%eax                  \n\t" \
00208             "   decl %%eax                  \n\t" \
00209             "   movl %%eax,%0               \n\t" \
00210             "   movl %%esi,%1               \n\t" \
00211             "   movl %%edi,%2               \n\t" \
00212             "   pushl %%ecx                 \n\t" \
00213             "   pushl %%esi                 \n\t" \
00214             "   pushl %%edi                 \n\t" \
00215             "   call callAsmCall            \n\t" \
00216             "   popl %%edi                  \n\t" \
00217             "   popl %%esi                  \n\t" \
00218             "   popl %%ecx                  \n\t" \
00219             "   addl $4,%%edi               \n\t" \
00220             "doret:                         \n\t" \
00221             "   ret                         \n\t" \
00222             : "=rm" (callSyscallNum), "=rm" (callProgramStack), "=rm" (callOpStack) \
00223             : "rm" (instructionPointers) \
00224             : "ax", "di", "si", "cx" \
00225     );
00226 }

int Constant1 void   )  [static]
 

Definition at line 450 of file vm_ppc_new.c.

References code, pc, and v.

00450                               {
00451     int     v;
00452 
00453     v = code[pc];
00454     pc += 1;
00455     return v;
00456 }

int Constant4 void   )  [static]
 

Definition at line 442 of file vm_ppc_new.c.

References code, pc, and v.

00442                               {
00443     int     v;
00444 
00445     v = code[pc] | (code[pc+1]<<8) | (code[pc+2]<<16) | (code[pc+3]<<24);
00446     pc += 4;
00447     return v;
00448 }

void Emit4 char *  opname,
int  i
[static]
 

Definition at line 458 of file vm_ppc_new.c.

References buf, compiledOfs, i, opname(), pass, and printf().

00458                                          {
00459     #if DEBUG_VM
00460     if(pass == 1)
00461         printf("\t\t\t%p %s\t%08lx\n",&buf[compiledOfs],opname,i&0x3ffffff);
00462     #endif
00463     buf[ compiledOfs ] = i;
00464     compiledOfs++;
00465 }

Here is the call graph for this function:

void Inst char *  opname,
int  opcode,
int  destReg,
int  aReg,
int  bReg
[static]
 

Definition at line 467 of file vm_ppc_new.c.

References buf, compiledOfs, opname(), pass, printf(), and r.

Referenced by makeFloat(), makeInteger(), and VM_Compile().

00467                                                                               {
00468     unsigned        r;
00469 
00470     #if DEBUG_VM
00471     if(pass == 1)
00472         printf("\t\t\t%p %s\tr%d,r%d,r%d\n",&buf[compiledOfs],opname,destReg,aReg,bReg);
00473     #endif
00474     r = opcode | ( destReg << 21 ) | ( aReg << 16 ) | ( bReg << 11 ) ;
00475     buf[ compiledOfs ] = r;
00476     compiledOfs++;
00477 }

Here is the call graph for this function:

void Inst4 char *  opname,
int  opcode,
int  destReg,
int  aReg,
int  bReg,
int  cReg
[static]
 

Definition at line 479 of file vm_ppc_new.c.

References buf, compiledOfs, opname(), pass, printf(), and r.

Referenced by VM_Compile().

00479                                                                                          {
00480     unsigned        r;
00481 
00482     #if DEBUG_VM
00483     if(pass == 1)
00484         printf("\t\t\t%p %s\tr%d,r%d,r%d,r%d\n",&buf[compiledOfs],opname,destReg,aReg,bReg,cReg);
00485     #endif
00486     r = opcode | ( destReg << 21 ) | ( aReg << 16 ) | ( bReg << 11 ) | ( cReg << 6 );
00487     buf[ compiledOfs ] = r;
00488     compiledOfs++;
00489 }

Here is the call graph for this function:

void InstImm char *  opname,
int  opcode,
int  destReg,
int  aReg,
int  immediate
[static]
 

Definition at line 491 of file vm_ppc_new.c.

References buf, Com_Error(), compiledOfs, ERR_FATAL, opname(), pass, printf(), and r.

Referenced by fltopandsecond(), loadOpStack(), ltop(), ltopandsecond(), makeFloat(), makeInteger(), spillOpStack(), and VM_Compile().

00491                                                                                       {
00492     unsigned        r;
00493     
00494     if ( immediate > 32767 || immediate < -32768 ) {
00495         Com_Error( ERR_FATAL, "VM_Compile: immediate value %i out of range, opcode %x,%d,%d", immediate, opcode, destReg, aReg );
00496     }
00497     #if DEBUG_VM
00498     if(pass == 1)
00499         printf("\t\t\t%p %s\tr%d,r%d,0x%x\n",&buf[compiledOfs],opname,destReg,aReg,immediate);
00500     #endif
00501     r = opcode | ( destReg << 21 ) | ( aReg << 16 ) | ( immediate & 0xffff );
00502     buf[ compiledOfs ] = r;
00503     compiledOfs++;
00504 }

Here is the call graph for this function:

void InstImmU char *  opname,
int  opcode,
int  destReg,
int  aReg,
int  immediate
[static]
 

Definition at line 506 of file vm_ppc_new.c.

References buf, Com_Error(), compiledOfs, ERR_FATAL, opname(), pass, printf(), and r.

Referenced by VM_Compile().

00