A
Account1
Im working a compiler/simulator environment which generates asm code also
( I generate it runtime ). The scheduler run in C++ which calls generated
assembly code in the following way:
fn_asm = ( void(*)() )p_process->asm_code->memory; // the generated asm
code stored in p_process->asm_code->memory, this is a memory area
fn_asm(); // calling the generated asm routine
In the asm code there are calling of CBuilder routines (routines of my
project ) which I call in the following way
// calling new_transaction()
a[0] = '\xB8'; w = 1; val = (int)&function_array[_NEW_TRANSACTION];
p = get_symbol_value( val );
p2 = conc_opcode( a, p, w, 4 );
add_opcode( p2, w+4, asm_code ); add_dis( "mov EAX,
&new_transaction", "", 5 );
add_opcode( "\xFF\x10", 2, asm_code ); add_dis( "call
[EAX]", "", 2 );
free_params( d1, ";}" );
//
Previously I prepared "function_array"
function_array[_NEW_TRANSACTION] = (int)&new_transaction;
....
"function_array" contains addresses of CBuilder routines (routines of my
project ). Now I decided to convert my project to really OOP ( only C++
classes ) but I cant resolve the "function_array" situation.
"new_transaction" would be a method now.
Thanks
( I generate it runtime ). The scheduler run in C++ which calls generated
assembly code in the following way:
fn_asm = ( void(*)() )p_process->asm_code->memory; // the generated asm
code stored in p_process->asm_code->memory, this is a memory area
fn_asm(); // calling the generated asm routine
In the asm code there are calling of CBuilder routines (routines of my
project ) which I call in the following way
// calling new_transaction()
a[0] = '\xB8'; w = 1; val = (int)&function_array[_NEW_TRANSACTION];
p = get_symbol_value( val );
p2 = conc_opcode( a, p, w, 4 );
add_opcode( p2, w+4, asm_code ); add_dis( "mov EAX,
&new_transaction", "", 5 );
add_opcode( "\xFF\x10", 2, asm_code ); add_dis( "call
[EAX]", "", 2 );
free_params( d1, ";}" );
//
Previously I prepared "function_array"
function_array[_NEW_TRANSACTION] = (int)&new_transaction;
....
"function_array" contains addresses of CBuilder routines (routines of my
project ). Now I decided to convert my project to really OOP ( only C++
classes ) but I cant resolve the "function_array" situation.
"new_transaction" would be a method now.
Thanks