Beispiel #1
0
int test_args(void)
{
    char buf[50];
    int i, ret = 0, inst;

    for (i = 0; i < 32; i++) {
        inst = mips_create_r_format(OP_SPECIAL, i, i, i, 0, OP_FUNC_ADD);
        sprintf(buf, "add $%d, $%d, $%d", i, i, i);
        ret += test_inst(buf, buf, inst);
    }

    for (i = 0; i < 32; i++) {
        inst = mips_create_r_format(OP_SPECIAL, i, i, i, 0, OP_FUNC_ADD);
        sprintf(buf, "add $%s, $%s, $%s", mips_reg_names_strs[i], mips_reg_names_strs[i], mips_reg_names_strs[i]);
        ret += test_inst(buf, buf, inst);
    }

    for (i = 0; i < 32; i++) {
        inst = mips_create_r_format(OP_SPECIAL, 0, 0, 0, i, OP_FUNC_SLLV);
        sprintf(buf, "sllv $0, $0, $%s", mips_reg_names_strs[i]);
        ret += test_inst(buf, buf, inst);
    }

    inst = mips_create_j_format(OP_J, 0x03FFFFFF);
    sprintf(buf, "j 0x0FFFFFFC");
    ret += test_inst(buf, buf, inst);

    inst = mips_create_i_format(OP_ADDI, 0, 0, 0xFFFF);
    sprintf(buf, "addi $0, $0, -1");
    ret += test_inst(buf, buf, inst);

    return ret;
}
Beispiel #2
0
void ldrb_inst(int inst, ARMProc *proc) {
	int i;
	int address;
	int (*func)(int, ARMProc *);
	int rd;
	int data;
	int **rd_ptr;

	if(!check_condition(proc, inst))
                return;

	ls_addr_modes = ls_addressing_dict();
	rd = getbits(inst, 12, 4);

	rd_ptr = &proc->r0;
	rd_ptr += rd;

	for(i = 0; i < LS_ADDRESSING_NUMBER; i++) {
                if(test_inst(ls_addr_modes[i], inst)) {
                        func = ls_addr_modes[i]->execute;
                        address = (*func)(inst, proc);
			break;
                }
        }

	data = read_mem(proc, address, 1);
	**rd_ptr = data;
}
Beispiel #3
0
void ldr_inst(int inst, ARMProc *proc) {
	int i;
	int address;
	int rd;
	int **rd_ptr;
	int (*func)(int, ARMProc *);
	int data;

	if(!check_condition(proc, inst))
                return;

	ls_addr_modes = ls_addressing_dict();

	for(i = 0; i < LS_ADDRESSING_NUMBER; i++) {
                if(test_inst(ls_addr_modes[i], inst)) {
			printf("Addressing mode: %d\n", i);
                        func = ls_addr_modes[i]->execute;
                        address = (*func)(inst, proc);
			break;
                }
        }

	rd = getbits(inst, 12, 4);
	rd_ptr = &proc->r0;
	rd_ptr += rd;

	data = read_mem(proc, address, 4);

	if(rd == 15) {
		**rd_ptr = data & 0xfffffffe;
	} else {
		**rd_ptr = data;
	}
}
void ExceptionTest::uncaught_except()
{
  int uncaught_result = -1;
  {
    UncaughtClassTest test_inst(uncaught_result);
    CPPUNIT_ASSERT( uncaught_result == -1 );
  }
  CPPUNIT_ASSERT( uncaught_result == 0 );

  {
    try {
      uncaught_result = -1;
      UncaughtClassTest test_inst(uncaught_result);
      throw "exception";
    }
    catch (...) {
    }
  }
  CPPUNIT_ASSERT( uncaught_result == 1 );
}
Beispiel #5
0
void ExceptionTest::uncaught_except()
{
#if !defined (STLPORT) || !defined (_STLP_NO_UNCAUGHT_EXCEPT_SUPPORT)
  int uncaught_result = -1;
  {
    UncaughtClassTest test_inst(uncaught_result);
    CPPUNIT_ASSERT( uncaught_result == -1 );
  }
  CPPUNIT_ASSERT( uncaught_result == 0 );

  {
    try {
      uncaught_result = -1;
      UncaughtClassTest test_inst(uncaught_result);
      throw "exception";
    }
    catch (...) {
    }
  }
  CPPUNIT_ASSERT( uncaught_result == 1 );
#endif
}
Beispiel #6
0
void ldm1_inst(int inst, ARMProc *proc) {
	int i;
	LSMAddrResult *result;
	LSMAddrResult *(*func)(int, ARMProc *);
	int register_list;
	int address;
	int start_address;
	int end_address;
	int value;
	int **reg;

	if(!check_condition(proc, inst))
                return;

	register_list = getbits(inst, 0, 16);
	lsm_addr_modes = lsm_addressing_dict();
	reg = &proc->r0;

	for(i = 0; i < LSM_ADDRESSING_NUMBER; i++) {
                if(test_inst(lsm_addr_modes[i], inst)) {
                        func = lsm_addr_modes[i]->execute;
                        result = (*func)(inst, proc);
			break;
                }
        }

	start_address = result->start_address;
	end_address   = result->end_address;

	address = start_address;

	for(i = 0; i < 15; i++) {
		if(getbit(register_list, i)) {
			**(reg + i) = read_mem(proc, address, 4);
			address += 4;
		}
	}

	if(getbit(register_list, 15)) {
		value = read_mem(proc, address, 4);
		*proc->pc = value & 0xFFFFFFFE;
		address += 4;
	}

	if(end_address != address - 4) {
		fprintf(stderr, "Load memory error");
	}

}