unsigned IntPending (ARMul_State * state) { if (state->Exception) { /* Any exceptions. */ if (state->NresetSig == LOW) { ARMul_Abort (state, ARMul_ResetV); return TRUE; } else if (!state->NfiqSig && !FFLAG) { ARMul_Abort (state, ARMul_FIQV); return TRUE; } else if (!state->NirqSig && !IFLAG) { ARMul_Abort (state, ARMul_IRQV); return TRUE; } } return FALSE; }
ARMword ARMul_MRC(ARMul_State *state,ARMword instr) {unsigned cpab ; ARMword result = 0 ; cpab = (state->MRC[CPNum])(state,ARMul_FIRST,instr,&result) ; while (cpab == ARMul_BUSY) { ARMul_Icycles(state,1,0) ; if (IntPending(state)) { cpab = (state->MRC[CPNum])(state,ARMul_INTERRUPT,instr,0) ; return(0) ; } else cpab = (state->MRC[CPNum])(state,ARMul_BUSY,instr,&result) ; } if (cpab == ARMul_CANT) { ARMul_Abort(state,ARMul_UndefinedInstrV) ; result = ECC ; /* Parent will destroy the flags otherwise */ } else { BUSUSEDINCPCN ; ARMul_Ccycles(state,1,0) ; ARMul_Icycles(state,1,0) ; } return(result) ; }
void ARMul_UndefInstr (ARMul_State * state, ARMword instr) { std::string disasm = ARM_Disasm::Disassemble(state->pc, instr); ERROR_LOG(ARM11, "Undefined instruction!! Disasm: %s Opcode: 0x%x", disasm.c_str(), instr); ARMul_Abort (state, ARMul_UndefinedInstrV); }
void ARMul_UndefInstr (ARMul_State * state, ARMword instr ATTRIBUTE_UNUSED) { SKYEYE_LOG_IN_CLR(RED, "In %s, line = %d, undef instr: 0x%x\n", __func__, __LINE__, instr); ARMul_Abort (state, ARMul_UndefinedInstrV); }
void ARMul_CDP (ARMul_State * state, ARMword instr) { unsigned cpab; //if (!CP_ACCESS_ALLOWED (state, CPNum)) { if (!state->CDP[CPNum]) { ARMul_UndefInstr (state, instr); return; } cpab = (state->CDP[CPNum]) (state, ARMul_FIRST, instr); while (cpab == ARMul_BUSY) { ARMul_Icycles (state, 1, 0); if (IntPending (state)) { cpab = (state->CDP[CPNum]) (state, ARMul_INTERRUPT, instr); return; } else cpab = (state->CDP[CPNum]) (state, ARMul_BUSY, instr); } if (cpab == ARMul_CANT) ARMul_Abort (state, ARMul_UndefinedInstrV); else BUSUSEDN; }
void ARMul_MCRR (ARMul_State * state, ARMword instr, ARMword source1, ARMword source2) { unsigned cpab; //if (!CP_ACCESS_ALLOWED (state, CPNum)) { if (!state->MCRR[CPNum]) { ARMul_UndefInstr (state, instr); return; } cpab = (state->MCRR[CPNum]) (state, ARMul_FIRST, instr, source1, source2); while (cpab == ARMul_BUSY) { ARMul_Icycles (state, 1, 0); if (IntPending (state)) { cpab = (state->MCRR[CPNum]) (state, ARMul_INTERRUPT, instr, 0, 0); return; } else cpab = (state->MCRR[CPNum]) (state, ARMul_BUSY, instr, source1, source2); } if (cpab == ARMul_CANT) { printf ("In %s, CoProcesscor returned CANT, CPnum is %x, instr %x, source %x %x\n", __FUNCTION__, CPNum, instr, source1, source2); ARMul_Abort (state, ARMul_UndefinedInstrV); } else { BUSUSEDINCPCN; ARMul_Ccycles (state, 1, 0); } }
void ARMul_MCR (ARMul_State * state, ARMword instr, ARMword source) { unsigned cpab; if (! CP_ACCESS_ALLOWED (state, CPNum)) { ARMul_UndefInstr (state, instr); return; } cpab = (state->MCR[CPNum]) (state, ARMul_FIRST, instr, source); while (cpab == ARMul_BUSY) { ARMul_Icycles (state, 1, 0); if (IntPending (state)) { cpab = (state->MCR[CPNum]) (state, ARMul_INTERRUPT, instr, 0); return; } else cpab = (state->MCR[CPNum]) (state, ARMul_BUSY, instr, source); } if (cpab == ARMul_CANT) ARMul_Abort (state, ARMul_UndefinedInstrV); else { BUSUSEDINCPCN; ARMul_Ccycles (state, 1, 0); } }
void ARMul_UndefInstr (ARMul_State * state, ARMword instr) { /*SKYEYE_LOG_IN_CLR(RED, "In %s, line = %d, undef instr: 0x%x\n", __func__, __LINE__, instr);*/ ARMul_Abort (state, ARMul_UndefinedInstrV); }
void ARMul_UndefInstr (ARMul_State * state, ARMword instr) { char buff[512]; ARM_Disasm disasm = ARM_Disasm(); disasm.disasm(state->pc, instr, buff); ERROR_LOG(ARM11, "Undefined instruction!! Disasm: %s Opcode: 0x%x", buff, instr); ARMul_Abort (state, ARMul_UndefinedInstrV); }
ARMword ARMul_MRC (ARMul_State * state, ARMword instr) { int cm = BITS(0, 3) & 0xf; int cp = BITS(5, 7) & 0x7; int rd = BITS(12, 15) & 0xf; int cn = BITS(16, 19) & 0xf; int cpopc = BITS(21, 23) & 0x7; if (cn == 13 && cm == 0 && cp == 3) { //c13,c0,3; returns CPU svc buffer ARMword result = HLE::CallMRC(instr); if (result != -1) { return result; } } //DEBUG("SKYEYE ARMul_MRC p%d, %d, r%d, c%d, c%d, %d\n", CPNum, cpopc, rd, cn, cm, cp); //DEBUG("plutoo: MRC not implemented\n"); //return; unsigned cpab; ARMword result = 0; //printf("SKYEYE ARMul_MRC, CPnum is %x, instr %x\n",CPNum, instr); //if (!CP_ACCESS_ALLOWED (state, CPNum)) { if (!state->MRC[CPNum]) { //chy 2004-07-19 should fix in the future????!!!! DEBUG("SKYEYE ARMul_MRC,NOT ALLOWed UndefInstr CPnum is %x, instr %x\n", CPNum, instr); ARMul_UndefInstr (state, instr); return -1; } cpab = (state->MRC[CPNum]) (state, ARMul_FIRST, instr, &result); while (cpab == ARMul_BUSY) { ARMul_Icycles (state, 1, 0); if (IntPending (state)) { cpab = (state->MRC[CPNum]) (state, ARMul_INTERRUPT, instr, 0); return (0); } else cpab = (state->MRC[CPNum]) (state, ARMul_BUSY, instr, &result); } if (cpab == ARMul_CANT) { printf ("SKYEYE ARMul_MRC,CANT UndefInstr CPnum is %x, instr %x\n", CPNum, instr); ARMul_Abort (state, ARMul_UndefinedInstrV); /* Parent will destroy the flags otherwise. */ result = ECC; } else { BUSUSEDINCPCN; ARMul_Ccycles (state, 1, 0); ARMul_Icycles (state, 1, 0); } return result; }
static void arm_dyncom_syscall(cpu_t* cpu, uint32_t num){ arm_core_t* core = (arm_core_t*)cpu->cpu_data; sky_pref_t* pref = get_skyeye_pref(); if(pref->user_mode_sim) arm_dyncom_SWI(core, num); else ARMul_Abort(core,ARMul_SWIV); }
ARMword ARMul_MRC (ARMul_State * state, ARMword instr) { unsigned cpab; ARMword result = HLE::CallMRC(instr); if (result != -1) { return result; } //printf("SKYEYE ARMul_MRC, CPnum is %x, instr %x\n",CPNum, instr); if (!CP_ACCESS_ALLOWED (state, CPNum)) { //chy 2004-07-19 should fix in the future????!!!! //printf("SKYEYE ARMul_MRC,NOT ALLOWed UndefInstr CPnum is %x, instr %x\n",CPNum, instr); ARMul_UndefInstr (state, instr); return -1; } cpab = (state->MRC[CPNum]) (state, ARMul_FIRST, instr, &result); while (cpab == ARMul_BUSY) { ARMul_Icycles (state, 1, 0); if (IntPending (state)) { cpab = (state->MRC[CPNum]) (state, ARMul_INTERRUPT, instr, 0); return (0); } else cpab = (state->MRC[CPNum]) (state, ARMul_BUSY, instr, &result); } if (cpab == ARMul_CANT) { printf ("SKYEYE ARMul_MRC,CANT UndefInstr CPnum is %x, instr %x\n", CPNum, instr); ARMul_Abort (state, ARMul_UndefinedInstrV); /* Parent will destroy the flags otherwise. */ result = ECC; } else { BUSUSEDINCPCN; ARMul_Ccycles (state, 1, 0); ARMul_Icycles (state, 1, 0); } return result; }
void ARMul_MRRC (ARMul_State * state, ARMword instr, ARMword * dest1, ARMword * dest2) { unsigned cpab; ARMword result1 = 0; ARMword result2 = 0; if (!CP_ACCESS_ALLOWED (state, CPNum)) { ARMul_UndefInstr (state, instr); return; } cpab = (state->MRRC[CPNum]) (state, ARMul_FIRST, instr, &result1, &result2); while (cpab == ARMul_BUSY) { ARMul_Icycles (state, 1, 0); if (IntPending (state)) { cpab = (state->MRRC[CPNum]) (state, ARMul_INTERRUPT, instr, 0, 0); return; } else cpab = (state->MRRC[CPNum]) (state, ARMul_BUSY, instr, &result1, &result2); } if (cpab == ARMul_CANT) { printf ("In %s, CoProcesscor returned CANT, CPnum is %x, instr %x\n", __FUNCTION__, CPNum, instr); ARMul_Abort (state, ARMul_UndefinedInstrV); } else { BUSUSEDINCPCN; ARMul_Ccycles (state, 1, 0); ARMul_Icycles (state, 1, 0); } *dest1 = result1; *dest2 = result2; }
void ARMul_MCR (ARMul_State * state, ARMword instr, ARMword source) { unsigned cpab; //printf("SKYEYE ARMul_MCR, CPnum is %x, source %x\n",CPNum, source); if (!CP_ACCESS_ALLOWED (state, CPNum)) { //chy 2004-07-19 should fix in the future ????!!!! //printf("SKYEYE ARMul_MCR, ACCESS_not ALLOWed, UndefinedInstr CPnum is %x, source %x\n",CPNum, source); ARMul_UndefInstr (state, instr); return; } cpab = (state->MCR[CPNum]) (state, ARMul_FIRST, instr, source); while (cpab == ARMul_BUSY) { ARMul_Icycles (state, 1, 0); if (IntPending (state)) { cpab = (state->MCR[CPNum]) (state, ARMul_INTERRUPT, instr, 0); return; } else cpab = (state->MCR[CPNum]) (state, ARMul_BUSY, instr, source); } if (cpab == ARMul_CANT) { printf ("SKYEYE ARMul_MCR, CANT, UndefinedInstr %x CPnum is %x, source %x\n", instr, CPNum, source); ARMul_Abort (state, ARMul_UndefinedInstrV); } else { BUSUSEDINCPCN; ARMul_Ccycles (state, 1, 0); } }
void ARMul_UndefInstr(ARMul_State *state,ARMword instr) { ARMul_Abort(state,ARMul_UndefinedInstrV) ; }
void ARMul_UndefInstr (ARMul_State * state, ARMword instr ATTRIBUTE_UNUSED) { ARMul_Abort (state, ARMul_UndefinedInstrV); }
void arm_dyncom_Abort(ARMul_State * state, ARMword vector) { ARMul_Abort(state, vector); }