コード例 #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);
    }
}
コード例 #2
0
ファイル: armsupp.cpp プロジェクト: IRntGreat/citra
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;
}
コード例 #3
0
ファイル: armsupp.cpp プロジェクト: IRntGreat/citra
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);
    }
}
コード例 #4
0
ファイル: armsupp.cpp プロジェクト: IRntGreat/citra
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;
}
コード例 #5
0
void
ARMul_STC (ARMul_State * state, ARMword instr, ARMword address)
{
    unsigned cpab;
    ARMword data;

    UNDEF_LSCPCBaseWb;

    if (! CP_ACCESS_ALLOWED (state, CPNum))
    {
        ARMul_UndefInstr (state, instr);
        return;
    }

    if (ADDREXCEPT (address) || VECTORACCESS (address))
        INTERNALABORT (address);

    cpab = (state->STC[CPNum]) (state, ARMul_FIRST, instr, &data);
    while (cpab == ARMul_BUSY)
    {
        ARMul_Icycles (state, 1, 0);
        if (IntPending (state))
        {
            cpab = (state->STC[CPNum]) (state, ARMul_INTERRUPT, instr, 0);
            return;
        }
        else
            cpab = (state->STC[CPNum]) (state, ARMul_BUSY, instr, &data);
    }

    if (cpab == ARMul_CANT)
    {
        CPTAKEABORT;
        return;
    }
#ifndef MODE32
    if (ADDREXCEPT (address) || VECTORACCESS (address))
        INTERNALABORT (address);
#endif
    BUSUSEDINCPCN;
    if (BIT (21))
        LSBase = state->Base;
    cpab = (state->STC[CPNum]) (state, ARMul_DATA, instr, &data);
    ARMul_StoreWordN (state, address, data);

    while (cpab == ARMul_INC)
    {
        address += 4;
        cpab = (state->STC[CPNum]) (state, ARMul_DATA, instr, &data);
        ARMul_StoreWordN (state, address, data);
    }

    if (state->abortSig || state->Aborted)
        TAKEABORT;
}
コード例 #6
0
ファイル: armsupp.cpp プロジェクト: IRntGreat/citra
void
ARMul_MCR (ARMul_State * state, ARMword instr, ARMword source)
{
    unsigned cpab;
    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 (CPNum == 15 && source == 0) //Cache flush
    {
        return;
    }

    //printf("SKYEYE ARMul_MCR, CPnum is %x, source %x\n",CPNum, source);
    //if (!CP_ACCESS_ALLOWED (state, CPNum)) {
    if (!state->MCR[CPNum]) {
        //chy 2004-07-19 should fix in the future ????!!!!
        DEBUG("SKYEYE ARMul_MCR, ACCESS_not ALLOWed, UndefinedInstr  CPnum is %x, source %x\n",CPNum, source);
        ARMul_UndefInstr (state, instr);
        return;
    }

    //DEBUG("SKYEYE ARMul_MCR p%d, %d, r%d, c%d, c%d, %d\n", CPNum, cpopc, rd, cn, cm, cp);
    //DEBUG("plutoo: MCR not implemented\n");
    //exit(1);
    //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) {
        DEBUG("SKYEYE ARMul_MCR, CANT, UndefinedInstr %x CPnum is %x, source %x\n", instr, CPNum, source); //ichfly todo
        //ARMul_Abort (state, ARMul_UndefinedInstrV);
    } else {
        BUSUSEDINCPCN;
        ARMul_Ccycles (state, 1, 0);
    }
}
コード例 #7
0
ファイル: armsupp.cpp プロジェクト: Antidote/citra
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;
}
コード例 #8
0
ファイル: armsupp.c プロジェクト: Kozakura/3dmoo
void
ARMul_MCR (ARMul_State * state, ARMword instr, ARMword source)
{
    unsigned cpab;
    u32 num = CPNum;

    //printf("SKYEYE ARMul_MCR, CPnum is %x, source %x\n",CPNum, source);
    //if (!CP_ACCESS_ALLOWED (state, CPNum)) {
    if (!state->MCR[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;
    }

    //DEBUG("plutoo: MCR not implemented\n");
    //exit(1);
    //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) {
        DEBUG("SKYEYE ARMul_MCR, CANT, UndefinedInstr %x CPnum is %x, source %x\n", instr, CPNum, source); //ichfly todo
        //ARMul_Abort (state, ARMul_UndefinedInstrV);
    } else {
        BUSUSEDINCPCN;
        ARMul_Ccycles (state, 1, 0);
    }
}
コード例 #9
0
ARMword
ARMul_MRC (ARMul_State * state, ARMword instr)
{
    unsigned cpab;
    ARMword result = 0;

    if (! CP_ACCESS_ALLOWED (state, CPNum))
    {
        ARMul_UndefInstr (state, instr);
        return result;
    }

    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);
        /* Parent will destroy the flags otherwise.  */
        result = ECC;
    }
    else
    {
        BUSUSEDINCPCN;
        ARMul_Ccycles (state, 1, 0);
        ARMul_Icycles (state, 1, 0);
    }

    return result;
}
コード例 #10
0
ファイル: armsupp.c プロジェクト: aguirrem/skyeye
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;
}
コード例 #11
0
ファイル: armsupp.c プロジェクト: cherry-wb/skyeye
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  CPnum is %x, source %x\n", CPNum, source);
		ARMul_Abort (state, ARMul_UndefinedInstrV);
	}
	else {
		BUSUSEDINCPCN;
		ARMul_Ccycles (state, 1, 0);
	}
}
コード例 #12
0
ファイル: armsupp.cpp プロジェクト: IRntGreat/citra
void
ARMul_STC (ARMul_State * state, ARMword instr, ARMword address)
{
    unsigned cpab;
    ARMword data;

    UNDEF_LSCPCBaseWb;

    //printf("SKYEYE ARMul_STC, CPnum is %x, instr %x, addr %x\n",CPNum, instr, address);
    /*chy 2004-05-23 should update this function in the future,should concern dataabort */
//  skyeye_instr_debug=0;printf("SKYEYE  debug end!!!!\n");
// chy 2004-05-25 , fix it now,so needn't printf
//  printf("SKYEYE ARMul_STC, should update this function!!!!!\n");

    //exit(-1);
    //if (!CP_ACCESS_ALLOWED (state, CPNum)) {
    if (!state->STC[CPNum]) {
        /*
           printf
           ("SKYEYE ARMul_STC,NOT ALLOW, undefinstr,  CPnum is %x, instr %x, addr %x\n",
           CPNum, instr, address);
         */
        ARMul_UndefInstr (state, instr);
        return;
    }

    /*if (ADDREXCEPT (address) || VECTORACCESS (address))
          INTERNALABORT (address);*/

    cpab = (state->STC[CPNum]) (state, ARMul_FIRST, instr, &data);
    while (cpab == ARMul_BUSY) {
        ARMul_Icycles (state, 1, 0);
        if (IntPending (state)) {
            cpab = (state->STC[CPNum]) (state, ARMul_INTERRUPT,
                                        instr, 0);
            return;
        } else
            cpab = (state->STC[CPNum]) (state, ARMul_BUSY, instr,
                                        &data);
    }

    if (cpab == ARMul_CANT) {
        /*
           printf
           ("SKYEYE ARMul_STC,CANT, undefinstr,  CPnum is %x, instr %x, addr %x\n",
           CPNum, instr, address);
         */
        CPTAKEABORT;
        return;
    }
    /*#ifndef MODE32
    	if (ADDREXCEPT (address) || VECTORACCESS (address))
    		INTERNALABORT (address);
                    #endif*/
    BUSUSEDINCPCN;
//chy 2004-05-25
    /*
      if (BIT (21))
        LSBase = state->Base;
    */
    cpab = (state->STC[CPNum]) (state, ARMul_DATA, instr, &data);
    ARMul_StoreWordN (state, address, data);
    //chy 2004-05-25
    if (state->abortSig || state->Aborted)
        goto L_stc_takeabort;

    while (cpab == ARMul_INC) {
        address += 4;
        cpab = (state->STC[CPNum]) (state, ARMul_DATA, instr, &data);
        ARMul_StoreWordN (state, address, data);
        //chy 2004-05-25
        if (state->abortSig || state->Aborted)
            goto L_stc_takeabort;
    }
//chy 2004-05-25
L_stc_takeabort:
    if (BIT (21)) {
        if (!
                ((state->abortSig || state->Aborted)
                 && state->lateabtSig == LOW))
            LSBase = state->Base;
    }

    if (state->abortSig || state->Aborted)
        TAKEABORT;
}
コード例 #13
0
ファイル: armsupp.c プロジェクト: aguirrem/skyeye
void
ARMul_LDC (ARMul_State * state, ARMword instr, ARMword address)
{
	unsigned cpab;
	ARMword data;

	UNDEF_LSCPCBaseWb;
	//printf("SKYEYE ARMul_LDC, CPnum is %x, instr %x, addr %x\n",CPNum, instr, address);
/*chy 2004-05-23 should update this function in the future,should concern dataabort*/
// chy 2004-05-25 , fix it now,so needn't printf 
//  printf("SKYEYE ARMul_LDC, should update this function!!!!!\n");
	//exit(-1);

	if (!CP_ACCESS_ALLOWED (state, CPNum)) {
		/* 
		   printf
		   ("SKYEYE ARMul_LDC,NOT ALLOW, underinstr, CPnum is %x, instr %x, addr %x\n",
		   CPNum, instr, address);
		 */
		ARMul_UndefInstr (state, instr);
		return;
	}

	if (ADDREXCEPT (address))
		INTERNALABORT (address);

	cpab = (state->LDC[CPNum]) (state, ARMul_FIRST, instr, 0);
	while (cpab == ARMul_BUSY) {
		ARMul_Icycles (state, 1, 0);

		if (IntPending (state)) {
			cpab = (state->LDC[CPNum]) (state, ARMul_INTERRUPT,
						    instr, 0);
			return;
		}
		else
			cpab = (state->LDC[CPNum]) (state, ARMul_BUSY, instr,
						    0);
	}
	if (cpab == ARMul_CANT) {
		/* 
		   printf
		   ("SKYEYE ARMul_LDC,NOT CAN, underinstr, CPnum is %x, instr %x, addr %x\n",
		   CPNum, instr, address);
		 */
		CPTAKEABORT;
		return;
	}

	cpab = (state->LDC[CPNum]) (state, ARMul_TRANSFER, instr, 0);
	data = ARMul_LoadWordN (state, address);
	//chy 2004-05-25      
	if (state->abortSig || state->Aborted)
		goto L_ldc_takeabort;

	BUSUSEDINCPCN;
//chy 2004-05-25
/*
  if (BIT (21))
    LSBase = state->Base;
*/

	cpab = (state->LDC[CPNum]) (state, ARMul_DATA, instr, data);

	while (cpab == ARMul_INC) {
		address += 4;
		data = ARMul_LoadWordN (state, address);
		//chy 2004-05-25  
		if (state->abortSig || state->Aborted)
			goto L_ldc_takeabort;

		cpab = (state->LDC[CPNum]) (state, ARMul_DATA, instr, data);
	}

//chy 2004-05-25
      L_ldc_takeabort:
	if (BIT (21)) {
		if (!
		    ((state->abortSig || state->Aborted)
		     && state->lateabtSig == LOW))
			LSBase = state->Base;
	}

	if (state->abortSig || state->Aborted)
		TAKEABORT;
}