Example #1
0
bool MC_WriteBuffer (MemoryCache *mc, address adr, SIZE_T size, BYTE* inbuf)
{
	SIZE_T i;
	// FIXME: это временное решение. и тормозное, конечно
	for (i=0; i<size; i++)
		if (MC_WriteByte (mc, adr+i, inbuf[i])==false)
			return false;
	return true;
};
Example #2
0
bool Da_op_set_value_of_op (struct Da_op* op, obj *val, CONTEXT * ctx, struct MemoryCache *mem, unsigned ins_prefixes, address FS, bool clear_high_tetra_if_ExX) 
{
    address adr;

    switch (op->type)
    {
        case DA_OP_TYPE_REGISTER:
            //L ("%s() line %d clear_high_tetra_if_ExX=%d\n", __FUNCTION__, __LINE__, clear_high_tetra_if_ExX);
            X86_register_set_value (op->reg, ctx, val, clear_high_tetra_if_ExX);
            return true;

        case DA_OP_TYPE_VALUE_IN_MEMORY:
            adr=(address)Da_op_calc_adr_of_op(op, ctx, mem, ins_prefixes, FS);

            switch (op->value_width_in_bits)
            {
                case 8:
                    if (MC_WriteByte (mem, adr, obj_get_as_byte(val))==false)
                        goto COPY_FAILED;
                    return true;
                case 16:
                    if (MC_WriteWyde (mem, adr, obj_get_as_wyde(val))==false)
                        goto COPY_FAILED;
                    return true;
                case 32:
                    if (MC_WriteTetrabyte (mem, adr, obj_get_as_tetra(val))==false)
                        goto COPY_FAILED;
                    return true;
                case 64:
                    if (MC_WriteOctabyte (mem, adr, obj_get_as_octa(val))==false)
                        goto COPY_FAILED;
                    return true;
                case 128:
                    {
                        //val.dump();
                        byte * xmm=obj_get_as_xmm(val);
                        //L ("%s(). writing to adr=0x%x\n", __FUNCTION__, adr);
                        //L_print_buf (xmm, 16);
                        if (MC_WriteBuffer (mem, adr, 16, xmm)==false)
                            goto COPY_FAILED;
                        return true;
                    }

                default:
                    oassert(!"unsupported value_width_in_bits");
                    fatal_error();
            };

        default:
            oassert(!"unsupported type");
            fatal_error();
    };
COPY_FAILED:
    //L ("%s(): Error writing at 0x" PRI_ADR_HEX ". Copy failed.\n", __FUNCTION__, adr);
    return false;
};