unsigned Processor::call_thiscall_args(Register* obj, const char* args, va_list ap) {
	std::stack<Argument> arg_stack;
	std::unordered_set<unsigned char> used_regs;
	Register esp(*this, ESP, sizeof(void*) * 8);

	unsigned argCount = 0, floatCount = 0, intCount = 0, regCount = 0, stackBytes = 0;

	//Set the object as first argument
	if(obj) {
		if(!isIntArg64Register(intCount, argCount))
			stackBytes += pushSize();
		++argCount;
		++intCount;
		arg_stack.push(obj);
	}

	//Read the arguments in...
	while(args && *args != '\0') {
		if(*args == 'r') {
			Register* reg = va_arg(ap,Register*);
			if(reg->xmm()) {
				if(!isFloatArg64Register(floatCount, argCount))
					stackBytes += pushSize();
				++floatCount;
			}
			else {
				if(!isIntArg64Register(intCount, argCount))
					stackBytes += pushSize();
				++intCount;
			}
			++regCount;
			arg_stack.push(reg);
		}
		else if(*args == 'm') {
Beispiel #2
0
void W::Vector::serialize(W::ByteArray& out) const
{
    pushSize(out);
    
    Vec::const_iterator itr = data->begin();
    Vec::const_iterator end = data->end();
    for (; itr != end; ++itr)
    {
        out.push((*itr)->getType());
        (*itr)->serialize(out);
    }
}
Beispiel #3
0
void W::Vocabulary::serialize(W::ByteArray& out) const
{
    pushSize(out);
    
    Map::const_iterator itr = data->begin();
    Map::const_iterator end = data->end();
    for (; itr != end; ++itr)
    {
        itr->first.serialize(out);
        out.push(itr->second->getType());
        itr->second->serialize(out);
    }
}