#include #include #include #include // a pointer to the symbol table I generate extern void* mu_sym_table; //extern int32_t mu_retval; // //int32_t muentry_get_retval(){ // return mu_retval; //} // a function to resolve symbol names to their address, using mu_sym_table\ // which is valued by the c_resolve_sym function, according to \ // mu_sym_table_root // actually this function will search for the symbol in one idX_sym_table void * resolve_symbol_in_current_context(const unsigned char * input_symbol_name){ unsigned long i = 0, j=0; unsigned long num_of_syms = 0; unsigned long cur_len = 0; unsigned long input_len = 0; unsigned char cur_char = 0; unsigned long cur_add = 0; unsigned char is_different = 0; while(input_symbol_name[input_len] != 0){ input_len++; } if( (mu_sym_table == NULL) || (input_len == 0)){ printf("**********\n****ERROR!!!****\nC_RESOLVE_SYMBOL: extern mu sym table is null!\n*********\n"); assert(0); } // a copy of mu_sym_table, to keep mu_sym_table from changing // unsigned char * sym_table_current = (unsigned char *) get_sym_table_pointer(); unsigned char * sym_table_current = (unsigned char *) &mu_sym_table; // printf("C_RESOLVE_SYMBOL --> Step 1\n"); // printf("C_RESOLVE_SYMBOL --> Current mu_sym_table = %p\n", sym_table_current); // printf("C_RESOLVE_SYMBOL --> Current vm = %p\n", get_vm_pointer()); // read the total number of symbols from the first line of sym table num_of_syms = *((unsigned long*)sym_table_current); // printf("RESOLVE_SYM --> number of symbols = %d\n", num_of_syms); // go 8 bytes forward, to skip the current .quad sym_table_current += 8; for(i=0; i