diff --git a/arm/arm9cpu.c b/arm/arm9cpu.c index b46bbfc..df4b980 100644 --- a/arm/arm9cpu.c +++ b/arm/arm9cpu.c @@ -553,7 +553,7 @@ ARM9_InitRegs(ARM9 *arm) { fprintf(stderr,"- Register Pointers initialized\n"); } -CycleTimer htimer; +static CycleTimer htimer; void hello_proc(void *cd) { diff --git a/arm/idecode_arm.c b/arm/idecode_arm.c index c8f0140..a2234d6 100644 --- a/arm/idecode_arm.c +++ b/arm/idecode_arm.c @@ -50,7 +50,7 @@ typedef struct IDecoder { } IDecoder; static Instruction *imem; -InstructionProc **iProcTab; +InstructionProc **ARM_iProcTab; static IDecoder *idecoder; static int alloc_pointer=0; @@ -1735,8 +1735,8 @@ IDecoder_New() { } } fprintf(stderr,"- Instruction decoder Initialized: "); - iProcTab = sg_calloc(sizeof(InstructionProc *)*(INSTR_INDEX_MAX+1)); - if(!iProcTab) { + ARM_iProcTab = sg_calloc(sizeof(InstructionProc *)*(INSTR_INDEX_MAX+1)); + if(!ARM_iProcTab) { fprintf(stderr,"Out of Memory"); exit(378); } @@ -1745,7 +1745,7 @@ IDecoder_New() { if(instr == NULL) { instr = &undefined; } - iProcTab[i] = instr->proc; + ARM_iProcTab[i] = instr->proc; } fprintf(stderr,"\n"); // fprintf(stderr,"\nMedium Nr of Instructions %f\n",(float)sum/validcount); diff --git a/arm/idecode_arm.h b/arm/idecode_arm.h index 9771fd8..e7610c8 100644 --- a/arm/idecode_arm.h +++ b/arm/idecode_arm.h @@ -14,7 +14,7 @@ struct ARM9; typedef void InstructionProc(void); -extern InstructionProc **iProcTab; +extern InstructionProc **ARM_iProcTab; typedef struct Instruction { uint32_t mask; @@ -30,7 +30,7 @@ Instruction * InstructionFind(uint32_t icode); static inline InstructionProc * InstructionProcFind(uint32_t icode) { int index=INSTR_INDEX(icode); - InstructionProc *proc=iProcTab[index]; + InstructionProc *proc=ARM_iProcTab[index]; return proc; } #endif diff --git a/c16x/idecode_c16x.c b/c16x/idecode_c16x.c index e022a10..5689a44 100644 --- a/c16x/idecode_c16x.c +++ b/c16x/idecode_c16x.c @@ -5,7 +5,7 @@ #include #include "sgstring.h" -C16x_Instruction **iTab; +C16x_Instruction **C16x_iTab; static C16x_Instruction instrlist[] = { {0x00,0xff,"add_rw_rw",2,c16x_add_rw_rw}, @@ -209,22 +209,22 @@ void C16x_IDecoderNew() { int icode; fprintf(stderr,"Initialize C16x Instruction decoder\n"); - iTab=(C16x_Instruction **)sg_calloc(0x100*sizeof(C16x_Instruction*)); + C16x_iTab=(C16x_Instruction **)sg_calloc(0x100*sizeof(C16x_Instruction*)); for(icode=0;icode<256;icode++) { int j; C16x_Instruction *instr; for (j=0;(instr=&instrlist[j])->name;j++) { if((icode & instr->mask) == instr->opcode) { - if(iTab[icode]) { + if(C16x_iTab[icode]) { fprintf(stderr,"Instruction already exists for icode 0x%02x, instr->name %s\n",icode,instr->name); } else { - iTab[icode]=instr; + C16x_iTab[icode]=instr; } } } - if(!iTab[icode]) { + if(!C16x_iTab[icode]) { //fprintf(stderr,"Warning, no instruction for icode 0x%02x\n",icode); - iTab[icode]=&illegal_opcode; + C16x_iTab[icode]=&illegal_opcode; } } diff --git a/c16x/idecode_c16x.h b/c16x/idecode_c16x.h index 4c7076c..13129b3 100644 --- a/c16x/idecode_c16x.h +++ b/c16x/idecode_c16x.h @@ -13,9 +13,9 @@ typedef struct C16x_Instruction { struct Instruction *next; } C16x_Instruction; -extern C16x_Instruction **iTab; +extern C16x_Instruction **C16x_iTab; static inline C16x_Instruction * C16x_FindInstruction(uint8_t opcode) { - return iTab[opcode]; + return C16x_iTab[opcode]; } diff --git a/coldfire/idecode_cf.c b/coldfire/idecode_cf.c index d96dd36..42476b9 100644 --- a/coldfire/idecode_cf.c +++ b/coldfire/idecode_cf.c @@ -19,7 +19,7 @@ #include "instructions_cf.h" #include "sgstring.h" -InstructionProc **iProcTab; +InstructionProc **CF_iProcTab; typedef struct IDecoder { Instruction *instr[0x10000]; } IDecoder; @@ -154,14 +154,14 @@ CF_IDecoderNew() { int nr_instructions = sizeof(instrlist) / sizeof(Instruction); IDecoder *idec = sg_new(IDecoder); s_idec = idec; - iProcTab = sg_calloc(0x10000 * sizeof(InstructionProc *)); + CF_iProcTab = sg_calloc(0x10000 * sizeof(InstructionProc *)); for(i=0;i<0x10000;i++) { for(j=0;jmask) == instr->icode) { if(!idec->instr[i]) { idec->instr[i] = instr; - iProcTab[i] = instr->proc; + CF_iProcTab[i] = instr->proc; } else { uint16_t mask = idec->instr[i]->mask & instr->mask; if(idec->instr[i]->mask == instr->mask) { @@ -174,7 +174,7 @@ CF_IDecoderNew() { */ } else if(mask == idec->instr[i]->mask) { idec->instr[i] = instr; - iProcTab[i] = instr->proc; + CF_iProcTab[i] = instr->proc; } else { fprintf(stderr,"Can not decide %s(%04x) %s(%04x) \n",instr->name,instr->mask,idec->instr[i]->name,idec->instr[i]->mask); } @@ -183,7 +183,7 @@ CF_IDecoderNew() { } if(idec->instr[i] == NULL) { idec->instr[i] = &instr_undefined; - iProcTab[i] = cf_undefined; + CF_iProcTab[i] = cf_undefined; } } fprintf(stderr,"Coldfire Instruction decoder created\n"); diff --git a/coldfire/idecode_cf.h b/coldfire/idecode_cf.h index 60403c4..f3ddf6e 100644 --- a/coldfire/idecode_cf.h +++ b/coldfire/idecode_cf.h @@ -1,7 +1,7 @@ #include typedef void InstructionProc(void); -extern InstructionProc **iProcTab; +extern InstructionProc **CF_iProcTab; typedef struct Instruction { @@ -15,7 +15,7 @@ void CF_IDecoderNew(); static inline InstructionProc * InststructionProcFind(uint16_t icode) { - return iProcTab[icode]; + return CF_iProcTab[icode]; } Instruction *CF_InstructionFind(uint16_t icode); diff --git a/m16c/idecode_m16c.c b/m16c/idecode_m16c.c index cc9ef84..da77ca0 100644 --- a/m16c/idecode_m16c.c +++ b/m16c/idecode_m16c.c @@ -8,8 +8,8 @@ #include "sgstring.h" #include "sglib.h" -M16C_InstructionProc **iProcTab; -M16C_Instruction **iTab; +M16C_InstructionProc **M16C_iProcTab; +M16C_Instruction **M16c_iTab; static M16C_Instruction instrlist[] = { {0xfef0,0x76f0,"abs.size_dst",2 ,m16c_abs_size_dst}, @@ -307,8 +307,8 @@ M16C_IDecoderNew() { int i,j; int onecount1,onecount2; - iProcTab=(M16C_InstructionProc**)sg_calloc(0x10000*sizeof(M16C_InstructionProc*)); - iTab=sg_calloc(0x10000*sizeof(M16C_Instruction*)); + M16C_iProcTab=(M16C_InstructionProc**)sg_calloc(0x10000*sizeof(M16C_InstructionProc*)); + M16c_iTab=sg_calloc(0x10000*sizeof(M16C_Instruction*)); fprintf(stderr,"Allocated M16C Instruction decoder table\n"); for(j=0;instrlist[j].proc;j++) { M16C_Instruction *instr = &instrlist[j]; @@ -327,8 +327,8 @@ M16C_IDecoderNew() } #endif if((i & instr->mask) == instr->icode) { - if(iTab[i]) { - M16C_Instruction *instr2 = iTab[i]; + if(M16c_iTab[i]) { + M16C_Instruction *instr2 = M16c_iTab[i]; specmask1 = instr->mask; specmask2 = instr2->mask; onecount1 = SGLib_OnecountU32(instr->mask); @@ -336,19 +336,19 @@ M16C_IDecoderNew() fprintf(stderr,"Collission %s, %s\n",instr->name,instr2->name); #if 0 if(instr->len > instr2->len) { - iTab[i] = instr; - iProcTab[i] = instr->proc; + M16c_iTab[i] = instr; + M16C_iProcTab[i] = instr->proc; } else if(instr2->len > instr->len) { - iTab[i] = instr2; - iProcTab[i] = instr2->proc; + M16c_iTab[i] = instr2; + M16C_iProcTab[i] = instr2->proc; } else #endif if(onecount1 > onecount2) { - iTab[i] = instr; - iProcTab[i] = instr->proc; + M16c_iTab[i] = instr; + M16C_iProcTab[i] = instr->proc; } else if(onecount2 > onecount1) { - iTab[i] = instr2; - iProcTab[i] = instr2->proc; + M16c_iTab[i] = instr2; + M16C_iProcTab[i] = instr2->proc; } else { fprintf(stderr,"Can not decide %s, %s\n",instr->name,instr2->name); } @@ -360,25 +360,25 @@ M16C_IDecoderNew() specmask2 |= 0xff00; } if((specmask2 & specmask1) == specmask1) { - iTab[i] = instr2; - iProcTab[i] = instr2->proc; + M16c_iTab[i] = instr2; + M16C_iProcTab[i] = instr2->proc; } else if((specmask2 & specmask1) == specmask2) { - iTab[i] = instr; - iProcTab[i] = instr->proc; + M16c_iTab[i] = instr; + M16C_iProcTab[i] = instr->proc; } else { fprintf(stdout,"%04x: no instruction is more specific %s %s %04x %04x %d %d\n",i,instr->name,instr2->name,instr->icode,instr2->icode,instr->len,instr2->len); exit(18); } #endif } else { - iTab[i] = instr; - iProcTab[i] = instr->proc; + M16c_iTab[i] = instr; + M16C_iProcTab[i] = instr->proc; } } } - if(iTab[i] == NULL) { - iTab[i] = &undefined_instr; - iProcTab[i] = (&undefined_instr)->proc; + if(M16c_iTab[i] == NULL) { + M16c_iTab[i] = &undefined_instr; + M16C_iProcTab[i] = (&undefined_instr)->proc; } } } diff --git a/m16c/idecode_m16c.h b/m16c/idecode_m16c.h index 56148e8..a41004d 100644 --- a/m16c/idecode_m16c.h +++ b/m16c/idecode_m16c.h @@ -10,18 +10,18 @@ typedef struct M16C_Instruction { M16C_InstructionProc *proc; } M16C_Instruction; -extern M16C_InstructionProc **iProcTab; -extern M16C_Instruction **iTab; +extern M16C_InstructionProc **M16C_iProcTab; +extern M16C_Instruction **M16c_iTab; void M16C_IDecoderNew(void); static inline M16C_Instruction * M16C_InstructionFind(uint16_t icode) { - return iTab[icode]; + return M16c_iTab[icode]; } static inline M16C_InstructionProc * M16C_InstructionProcFind(uint16_t icode) { - return iProcTab[icode]; + return M16C_iProcTab[icode]; } diff --git a/m16c/m16c_cpu.h b/m16c/m16c_cpu.h index 7ac4bac..5b25602 100644 --- a/m16c/m16c_cpu.h +++ b/m16c/m16c_cpu.h @@ -94,7 +94,7 @@ typedef struct M16C_Cpu { uint32_t vector_reset; } M16C_Cpu; -M16C_Cpu gm16c; +extern M16C_Cpu gm16c; #if __BYTE_ORDER == __BIG_ENDIAN #define M16C_REG_R0H (*((uint8_t *)(&gm16c.regs.r0))) diff --git a/m32c/cpu_m32c.h b/m32c/cpu_m32c.h index 2a8484b..35eb379 100644 --- a/m32c/cpu_m32c.h +++ b/m32c/cpu_m32c.h @@ -148,7 +148,7 @@ typedef struct M32C_Cpu { SigNode *sigPRC[4]; } M32C_Cpu; -M32C_Cpu gm32c; +extern M32C_Cpu gm32c; #define M32C_REG(name) ((gm32c).reg_##name) #define M32C_BANKREG(name) ((gm32c).regs.reg_##name) diff --git a/mcs51/cpu_mcs51.c b/mcs51/cpu_mcs51.c index 5f0f49d..fd1e4d0 100644 --- a/mcs51/cpu_mcs51.c +++ b/mcs51/cpu_mcs51.c @@ -11,6 +11,8 @@ #include "mainloop_events.h" #include "loader.h" +MCS51Cpu g_mcs51; + static inline void CheckSignals(void) { diff --git a/mcs51/cpu_mcs51.h b/mcs51/cpu_mcs51.h index cab0fdf..a8cd3e5 100644 --- a/mcs51/cpu_mcs51.h +++ b/mcs51/cpu_mcs51.h @@ -31,7 +31,7 @@ typedef struct MCS51Cpu { #define SET_REG_PC(val) ((g_mcs51.pc) = (val)) #define PSW (g_mcs51.psw) -MCS51Cpu g_mcs51; +extern MCS51Cpu g_mcs51; static inline void MCS51_SetPSW(uint8_t val) { diff --git a/sh4/cpu_sh4.c b/sh4/cpu_sh4.c index ca64acd..0744141 100644 --- a/sh4/cpu_sh4.c +++ b/sh4/cpu_sh4.c @@ -1104,7 +1104,7 @@ intevt_write(void *clientData,uint32_t value,uint32_t address,int rqlen) } -CycleTimer htimer; +static CycleTimer htimer; static void hello_proc(void *clientData) {