示例#1
0
    /// <summary>
    /// Raise exception on function return
    /// </summary>
    /// <returns>Masked return address</returns>
    BLACKBONE_API ptr_t hookReturn()
    {
        ptr_t val = returnAddress();
        SET_BIT( val, (_wordSize * 8 - 1) );
        if (returnAddress( val ) == false)
            return 0;

        return val;
    }
示例#2
0
    /// <summary>
    /// Remove exception on return
    /// </summary>
    /// <returns>Return address</returns>
    BLACKBONE_API ptr_t unhookReturn()
    {
        auto val = returnAddress();
        RESET_BIT( val, (_wordSize * 8 - 1) );
        if (!returnAddress( val ))
            return 0;

        return val;
    }
示例#3
0
AccountConfigView::AccountConfigView(BRect rect, BMailAccountSettings* account)
	:
	BBox(rect),
	fAccount(account)
{
	SetLabel(B_TRANSLATE("Account settings"));

	rect = Bounds().InsetByCopy(8, 8);
	rect.top += 10;
	CenterContainer *view = new CenterContainer(rect, false);
	view->SetSpacing(5);

	// determine font height
	font_height fontHeight;
	view->GetFontHeight(&fontHeight);
	int32 height = (int32)(fontHeight.ascent + fontHeight.descent
		+ fontHeight.leading) + 5;

	rect = view->Bounds();
	rect.bottom = height + 5;

	BString accountName(B_TRANSLATE("Account name:"));
	BString realName(B_TRANSLATE("Real name:"));
	BString returnAddress(B_TRANSLATE("Return address:"));
	float labelWidth = view->StringWidth(accountName.String()) + (float)6;
	if (labelWidth < (view->StringWidth(realName.String()) + (float)6))
		labelWidth = view->StringWidth(realName.String()) + (float)6;
	if (labelWidth < (view->StringWidth(returnAddress.String()) + (float)6))
		labelWidth = view->StringWidth(returnAddress.String()) + (float)6;
	view->AddChild(fNameControl = new BTextControl(rect, NULL,
		accountName.String(), NULL,
		new BMessage(kMsgAccountNameChanged)));
	fNameControl->SetDivider(labelWidth);
	view->AddChild(fRealNameControl = new BTextControl(rect, NULL,
		realName.String(), NULL, NULL));
	fRealNameControl->SetDivider(labelWidth);
	view->AddChild(fReturnAddressControl = new BTextControl(rect, NULL,
		returnAddress.String(), NULL, NULL));
	fReturnAddressControl->SetDivider(labelWidth);
//			control->TextView()->HideTyping(true);

	float w, h;
	view->GetPreferredSize(&w, &h);
	ResizeTo(w + 15, h + 22);
	view->ResizeTo(w, h);

	AddChild(view);
}
示例#4
0
Symbol* genAccessVariable(FILE* yyout,cstr name, int symType, SymbolInfo* atribute)
{	
	Symbol* variable = searchVariable(symType, name);
	int isFloat_ = isFloat( variable );
	int reg;
	int height = returnVariableHeight( symType, name );
	
	//When trying to access an array variable outside a block
	//we can use expression register so we do not have to assign a new one
	if( atribute->info == TYPE_ARRAY && !isFloat_ && height == 0 ){
		reg = ((ExtraInfo*)(atribute->exprSymbol->info))->nRegister;
	}else{
		reg = assignRegisters( isFloat_ );
	}
	
	cstr regStr = getRegStr( isFloat_ );

	int elementSize = 0;	
	if (isFloat_ == 0) reg = checkOverflow(yyout, reg, TYPE_INTEGER);
	else reg = checkOverflow(yyout, reg, TYPE_FLOAT);
	
	Symbol* returnSymbol = createExtraInfoSymbol(reg, isFloat_);	
	ExtraInfo* aux = (ExtraInfo*)(returnSymbol->info); 	
	aux->nRegister = reg;
	aux->variable = variable;

	
		
	if(atribute->info == SYM_CLASS_VARIABLE){
		//varSymbol gets the Symbol of the variable
		aux->variable = getClassVar(aux->variable,atribute->name);
	}			

	if( atribute->info == TYPE_ARRAY ){
		elementSize = ((Type*)(((Type*)(((Variable*)(aux->variable->info))->type->info))->arrayInfo->type->info))->size;
	}	
	if( symType == SYM_VARIABLE )
	{
		int accessRegister = genFrameAccess( yyout, height, reg, isFloat_ );
		if(((Variable*)(aux->variable->info))->symSubtype == SYM_LOCAL){
			if( atribute->info == TYPE_ARRAY ){
				int expReg = ((ExtraInfo*)(atribute->exprSymbol->info))->nRegister;
				fprintf(yyout, "\tR%d = R%d * %d; //Calculate array %s position\n",expReg, expReg,
					elementSize, aux->variable->name);
				fprintf(yyout, "\tR%d = R%d - %d; //Calculate local %s position\n",expReg, expReg,
					returnAddress(symType,aux->variable->name), aux->variable->name);						
				fprintf(yyout,"\t%s%d = %c(R%d + R%d); //%s[expr] = expr\n",regStr, reg, 
					pointerType(aux->variable), accessRegister, expReg, aux->variable->name);	
					
				if( !(atribute->info == TYPE_ARRAY && !isFloat_ && height == 0) ){	
					freeRegister( expReg, 0 );	
				}	
				freeSymbol(atribute->exprSymbol);	
			}else{
					fprintf(yyout,"\t%s%d = %c(R%d - %d); //Loading value of var %s\n",regStr, reg, 
						pointerType(aux->variable), accessRegister, returnAddress(symType,aux->variable->name),
						aux->variable->name);
			}	
		}else{
			if( atribute->info == TYPE_ARRAY ){
				int expReg = ((ExtraInfo*)(atribute->exprSymbol->info))->nRegister;
				fprintf(yyout, "\tR%d = R%d * %d; //Calculate array %s position\n",expReg, expReg,
					elementSize, aux->variable->name);
				fprintf(yyout, "\tR%d = R%d + %d; //Calculate local %s position\n",expReg, expReg,
					returnAddress(symType,aux->variable->name), aux->variable->name);						
				fprintf(yyout,"\t%s%d = %c(R%d + R%d); //%s[expr] = expr\n",regStr, reg, 
					pointerType(aux->variable), accessRegister, expReg, aux->variable->name);
				if( !(atribute->info == TYPE_ARRAY && !isFloat_ && height == 0) ){	
					freeRegister( expReg, 0 );	
				}		
				freeSymbol(atribute->exprSymbol);
			}else{
				fprintf(yyout,"\t%s%d = %c(R%d + %d); //Loading value of var %s\n",regStr,reg, 
					pointerType(aux->variable), accessRegister, 
					returnAddress(symType,aux->variable->name),	aux->variable->name);
			}			
		}
		
		if( accessRegister != 6 ){
			freeRegister( accessRegister, 0 );
		}	
		
	}else{
		if( symType == SYM_GLOBAL )
		{
			if( atribute->info == TYPE_ARRAY ){
				int expReg = ((ExtraInfo*)(atribute->exprSymbol->info))->nRegister;
				fprintf(yyout, "\tR%d = R%d * %d; //Calculate array %s position\n",expReg, expReg,
					elementSize, aux->variable->name);
				fprintf(yyout,"\t%s%d = %c(0x%x + R%d); //Loading value of var %s[expr]\n",regStr, reg, pointerType(aux->variable),
					returnAddress(symType,aux->variable->name), expReg, aux->variable->name);
				if( !(atribute->info == TYPE_ARRAY && !isFloat_ && height == 0) ){	
					freeRegister( expReg, 0 );	
				}	
				freeSymbol(atribute->exprSymbol);
			}else{			
			fprintf(yyout,"\t%s%d = %c(0x%x); //Loading value of var %s\n", regStr, reg, pointerType(aux->variable), 
				returnAddress(symType,aux->variable->name), aux->variable->name);	
			}
		//FIXME Las constantes van aqui			
		}else{
		}
	}	
	freeSymbolInfo(atribute);
	return returnSymbol;
}