Example #1
0
void debugger(Inst inst)
{
    char c;
    char regName[32];
    Register reg;

    insDump(inst);
    while (1) {
	switch (c = getchar()) {
	case 'n':
	    getchar();
	    return;
	case 'p':
	    scanf("%s", regName);
	    if (!regLookup(regName, &reg))
		printf("reg %s not defined\n", regName);
	    else
		regDisplayToCurrentPort(reg);
	    getchar();
	    break;
	default:
	    return;
	}
    }
}
Example #2
0
static void expandRegisterExp(RegisterExp regExp)
{
    Register reg;
    char* regName = rexGetName(regExp);
    if (!regLookup(regName, &reg)) {
	printf("Allocating register %s\n", regName);
	reg = regAllocate(regName);
    }
    rexSetReg(regExp, reg);
}
Example #3
0
void hwRegGoalSet(volatile void *addr, int val)
{
	DV_REG_T *pReg = regLookup(addr);
	if(pReg != NULL)
	{
		pReg->goal = val;
	}
	else
	{
		DV_DBG("%s: invalid addr: 0x%p\n", __FUNCTION__, addr);
    }
}
Example #4
0
//函数功能: 写1个整形类型的寄存器
//函数参数: addr - 寄存器地址
inline void hwRegWrite32(u32 data, volatile void *addr)
{
	DV_REG_T *pCell = regLookup(addr);
	
	if(pCell != NULL)
	{
		pCell->data = data;
	}
	else
	{
		DV_DBG("%s: invalid addr: 0x%p\n", __FUNCTION__, addr);
        BUG();
	}
}
Example #5
0
//函数功能: 读取1个短整形类型的寄存器
//函数参数: addr - 寄存器地址
//返回值:   寄存器值。
inline u16 hwRegRead16(const volatile void *addr)
{
	DV_REG_T *pCell = regLookup(addr);
	
	if(pCell != NULL)
	{
		return pCell->data;
	}
	else
	{
		DV_DBG("%s: invalid addr: 0x%p\n", __FUNCTION__, addr);
        BUG();
		return 0;
	}
}
Example #6
0
void executeInst(Inst inst)
{
#if 0
    Register exp;
    regLookup("exp", &exp);
    insDump(inst);
    regPrint(exp);
    printf("\n");
#ifdef STACK_GUARDED
#if 0
    printStack();
#endif
#endif
#endif
    switch (insGetType(inst)) {
    case INST_ASSIGN:
	execAssign(inst);
	break;
    case INST_PERFORM:
	execPerform(inst);
	break;
    case INST_TEST:
	execTest(inst);
	break;
    case INST_LABEL:
    case INST_COMMENT:
	rsAdvancePc();
	break;
    case INST_BRANCH:
	if (isFlagSet())
	    execJump(insGetBranch(inst));
	else
	    rsAdvancePc();
	break;
    case INST_GOTO:
	execJump(insGetGoto(inst));
	break;
    case INST_SAVE:
	execSave(inst);
	break;
    case INST_RESTORE:
	execRestore(inst);
	break;
    default:
	printf("Unknown instruction type\n");
	break;
    }
}