void rwip_init(uint32_t error) { #if (NVDS_SUPPORT && DEEP_SLEEP) uint8_t length = 1; uint8_t sleep_enable; uint8_t ext_wakeup_enable; #endif //NVDS_SUPPORT && DEEP_SLEEP // Reset RW environment memset(&rwip_env, 0, sizeof(rwip_env)); ke_mem_heaps_used = KE_MEM_BLOCK_MAX; #if (KE_SUPPORT) // Initialize kernel ke_init(); // Initialize memory heap used by kernel. #if (KE_MEM_RW) // Memory allocated for environment variables //ke_mem_init(KE_MEM_ENV, (uint8_t*)rwip_heap_env, RWIP_HEAP_ENV_SIZE); ke_mem_init(KE_MEM_ENV,(uint8_t*)(jump_table_struct[rwip_heap_env_pos]), jump_table_struct[rwip_heap_env_size]); #if 1//(BLE_HOST_PRESENT) // Memory allocated for Attribute database //ke_mem_init(KE_MEM_ATT_DB, (uint8_t*)rwip_heap_db, RWIP_HEAP_DB_SIZE); ke_mem_init(KE_MEM_ATT_DB,(uint8_t*)(jump_table_struct[rwip_heap_db_pos]), jump_table_struct[rwip_heap_db_size]); #endif // (BLE_HOST_PRESENT) // Memory allocated for kernel messages //ke_mem_init(KE_MEM_KE_MSG, (uint8_t*)rwip_heap_msg, RWIP_HEAP_MSG_SIZE); ke_mem_init(KE_MEM_KE_MSG,(uint8_t*)(jump_table_struct[rwip_heap_msg_pos]), jump_table_struct[rwip_heap_msg_size]); // Non Retention memory block //ke_mem_init(KE_MEM_NON_RETENTION, (uint8_t*)rwip_heap_non_ret, RWIP_HEAP_NON_RET_SIZE); ke_mem_init(KE_MEM_NON_RETENTION, (uint8_t*)(jump_table_struct[rwip_heap_non_ret_pos]), jump_table_struct[rwip_heap_non_ret_size]); #endif // (KE_MEM_RW) #endif //KE_SUPPORT #if (GTL_ITF) // Initialize the Generic Transport Layer gtl_init(rwip_eif_get(RWIP_EIF_AHI)); #endif //GTL_ITF // Initialize RF #if (BT_EMB_PRESENT || BLE_EMB_PRESENT) rf_init(&rwip_rf); SetBits32(BLE_RADIOCNTL1_REG, XRFSEL, 3); #endif //BT_EMB_PRESENT || BLE_EMB_PRESENT #if (BT_EMB_PRESENT) // Initialize BT rwbt_init(); #endif //BT_EMB_PRESENT #if (BLE_EMB_PRESENT) // Initialize BLE rwble_init(); #endif //BLE_EMB_PRESENT #if (BLE_HOST_PRESENT) // Initialize BLE Host stack rwble_hl_init(); #endif //BLE_HOST_PRESENT #if (DISPLAY_SUPPORT) // Initialize display module display_init(); // Add some configuration information to display display_add_config(); #endif //DISPLAY_SUPPORT #if (NVDS_SUPPORT && DEEP_SLEEP) // Activate deep sleep feature if enabled in NVDS if(nvds_get(NVDS_TAG_SLEEP_ENABLE, &length, &sleep_enable) == NVDS_OK) { if(sleep_enable != 0) { rwip_env.sleep_enable = true; // Set max sleep duration depending on wake-up mode if(nvds_get(NVDS_TAG_EXT_WAKEUP_ENABLE, &length, &ext_wakeup_enable) == NVDS_OK) { if(ext_wakeup_enable != 0) { //vm rwip_env.ext_wakeup_enable = true; rwip_env.ext_wakeup_enable = ext_wakeup_enable; } } } } #endif //NVDS_SUPPORT && DEEP_SLEEP // If FW initializes due to FW reset, send the message to Host if(error != RESET_NO_ERROR) { #if (BT_EMB_PRESENT && HCIC_ITF) rwbt_send_message(error); #elif (BLE_EMB_PRESENT && HCIC_ITF) rwble_send_message(error); #elif (BLE_HOST_PRESENT && GTL_ITF) rwble_hl_send_message(error); #endif //BT_EMB_PRESENT / BLE_EMB_PRESENT } /* ************************************************************************************ * Application initialization ************************************************************************************ */ // vm moved to main // if(jump_table_struct[0]==TASK_APP) // Initialize APP // app_init(); func_check_mem_flag = 0;//false; }
int main(int argc, char **argv) { uint64_t t; int myargc = 2; ///char **myargv; // printf("\n argc val =%d",argc); /// argc = 2; //// argv[0] = "myself"; //char *name = "/home/prajakta/praj_multi2sim_RandD/guestos_multi2sim/mytest/simple"; //printf("\n The length of the hardcoded complete path of simple file is : %d\n", strlen(name)); //argv[1] = "/home/prajakta/praj_multi2sim_RandD/guestos_multi2sim/mytest/simple"; fprintf(stderr, "********************************************************"); fprintf(stderr, "\n WELCOME TO GUESTOS\n"); fprintf(stderr, "********************************************************\n"); //Subhajit Changes /* Options */ opt_init(); sim_reg_options(); /////////////////////////////////////// ///// p_reg_options(); /// cache_system_reg_options(); //// opt_check_options(&argc, argv); ///////////////////////////////////////////// /* Initialize */ ke_init(); boot(); ///// install_sighandler(); // printf("\n enter path:"); // fgets(user_prog_path,200,stdin); //for( ii=0;ii<strlen(user_prog_path);ii++) // argv[1][ii]=user_prog_path[ii]; //char * origargv= argv; //argv=argv++; //argv[1]=(char *)user_prog_path; //The following lines are written to take the file path from the user and removing the last string terminating character.... /* argv[1] = (char *)malloc(strlen( (user_prog_path) - 1) * sizeof(char)); for(i = 0; i < strlen(user_prog_path) - 1;i++) argv[1][i] = user_prog_path[i];*/ //argv=origargv; //argv=argv++; //// argv=user_prog_path; //argv=origargv; ///fgets(user_prog_path,max_path_length,stdin); shell(); if (*configfile) { /// printf("\n Entered inside checking\n\n") ; opt_check_config(configfile); } //////////printf("\n User entered path of binary in main : %s",user_prog_path); //strncpy(*(argv+1),user_prog_path,max_path_length); // strncpy(myargv[0],user_prog_path,200); // strcpy(argv[1],user_prog_path); //printf("\nafter strcpy"); //argv[1] = user_prog_path; //printf("\n\n\\nnnnnnnnnnnnnnnnnnnnnnnn"); // printf("\n Value of argv[1] is : %s\n\n\n", argv[1]); // printf("\n Length of file name in argv[1] = %d\n", strlen(argv[1])); //strncpy(argv[1],user_prog_path,max_path_length); ///////strcpy(argv[0],user_prog_path); ///printf("\n the rcvd pa ths is %s \n",user_prog_path); ///printf("\n the rcvd pa ths is %s \n",user_prog_path); ///printf("\n the rcvd pa ths is %s \n",user_prog_path); /* Load programs from configuration file and command line. */ /////// if (*ctxconfig) ld_load_prog_from_ctxconfig(ctxconfig); ///////////////////if (argc >= 1) /// ld_load_prog_from_cmdline(argc - 1, user_prog_path ); //////////// ld_load_prog_from_cmdline(argc - 1, argv + 1); /// ld_load_prog_from_cmdline(argc - 1, myargv); /* Simulation loop */ signal(SIGINT, &sim_signal_handler); signal(SIGABRT, &sim_signal_handler); signal(SIGFPE, &sim_signal_handler); signal(SIGUSR2, &sim_signal_handler); //raise(8); //raise(10); //raise(12); while (!sigint_received) { /* Break point */ if (break_point && ke->context_list_head->regs->eip == break_point) { regs_dump(ke->context_list_head->regs, stdout); break; } /* Run an instruction from each running context */ ke_run(); sim_inst += ke->running_count; if (!ke->context_list_head) break; /* Stop conditions */ sim_cycle++; if ((sim_cycle >= max_cycles && max_cycles) || (sim_inst >= max_inst && max_inst)) { regs_dump(isa_regs, stdout); ke_dump(stdout); break; } if (sim_cycle == inst_reset && inst_reset) isa_inst_stat_reset(); if (*inst_stop && !strcmp(isa_inst.format, inst_stop)) panic("instruction '%s' found", inst_stop); } /* Finalization */ ke_done(); ///opt_done(); ///debug_done(); mhandle_done(); return 0; }
int main(int argc, char **argv) { /* Initial information */ fprintf(stderr, "\n"); fprintf(stderr, "; Multi2Sim %s - A Simulation Framework for CPU-GPU Heterogeneous Computing\n", VERSION); fprintf(stderr, "; Please use command 'm2s --help' for a list of command-line options.\n"); fprintf(stderr, "; Last compilation: %s %s\n", __DATE__, __TIME__); fprintf(stderr, "\n"); /* Read command line */ sim_read_command_line(&argc, argv); /* CPU disassembler tool */ if (*cpu_disasm_file_name) ke_disasm(cpu_disasm_file_name); /* GPU disassembler tool */ if (*gpu_disasm_file_name) gk_disasm(gpu_disasm_file_name); /* OpenGL disassembler tool */ if (*opengl_disasm_file_name) gl_disasm(opengl_disasm_file_name, opengl_disasm_shader_index); /* GPU visualization tool */ if (*gpu_visual_file_name) vgpu_run(gpu_visual_file_name); /* Memory hierarchy visualization tool */ if (*visual_file_name) vmem_run(visual_file_name); /* Network simulation tool */ if (*net_sim_network_name) net_sim(net_debug_file_name); /* Debug */ debug_init(); isa_inst_debug_category = debug_new_category(isa_inst_debug_file_name); isa_call_debug_category = debug_new_category(isa_call_debug_file_name); elf_debug_category = debug_new_category(elf_debug_file_name); net_debug_category = debug_new_category(net_debug_file_name); ld_debug_category = debug_new_category(loader_debug_file_name); sys_debug_category = debug_new_category(syscall_debug_file_name); ctx_debug_category = debug_new_category(ctx_debug_file_name); mem_debug_category = debug_new_category(mem_debug_file_name); opencl_debug_category = debug_new_category(opencl_debug_file_name); gpu_isa_debug_category = debug_new_category(gpu_isa_debug_file_name); gpu_stack_debug_category = debug_new_category(gpu_stack_debug_file_name); /* GPU-REL */ gpu_faults_debug_category = debug_new_category(gpu_faults_debug_file_name); /* GPU-REL */ gpu_pipeline_debug_category = debug_new_category(gpu_pipeline_debug_file_name); error_debug_category = debug_new_category(error_debug_file_name); esim_debug_init(esim_debug_file_name); /* Trace */ trace_init(trace_file_name); mem_trace_category = trace_new_category(); /* Initialization for functional simulation */ esim_init(); ke_init(); net_init(); /* Initialization for detailed simulation */ if (cpu_sim_kind == cpu_sim_detailed) cpu_init(); if (gpu_sim_kind == gpu_sim_detailed) gpu_init(); /* Memory hierarchy initialization, done after we initialized CPU cores * and GPU compute units. */ mem_system_init(); /* Load programs */ cpu_load_progs(argc, argv, ctxconfig_file_name); /* Simulation loop */ if (ke->running_list_head) { if (cpu_sim_kind == cpu_sim_detailed) cpu_run(); else ke_run(); } /* Flush event-driven simulation */ esim_process_all_events(0); /* Dump statistics summary */ sim_stats_summary(); /* Finalization of memory system */ mem_system_done(); /* Finalization of detailed CPU simulation */ if (cpu_sim_kind == cpu_sim_detailed) { esim_debug_done(); cpu_done(); } /* Finalization of detailed GPU simulation */ if (gpu_sim_kind == gpu_sim_detailed) gpu_done(); /* Finalization */ net_done(); esim_done(); trace_done(); ke_done(); debug_done(); mhandle_done(); /* End */ return 0; }