static void dump_unknown_task(struct hle_t* hle, unsigned int sum) { char filename[256]; uint32_t ucode = *dmem_u32(hle, TASK_UCODE); uint32_t ucode_data = *dmem_u32(hle, TASK_UCODE_DATA); uint32_t data_ptr = *dmem_u32(hle, TASK_DATA_PTR); sprintf(&filename[0], "task_%x.log", sum); dump_task(hle, filename); /* dump ucode_boot */ sprintf(&filename[0], "ucode_boot_%x.bin", sum); dump_binary(hle, filename, (void*)dram_u32(hle, *dmem_u32(hle, TASK_UCODE_BOOT)), *dmem_u32(hle, TASK_UCODE_BOOT_SIZE)); /* dump ucode */ if (ucode != 0) { sprintf(&filename[0], "ucode_%x.bin", sum); dump_binary(hle, filename, (void*)dram_u32(hle, ucode), 0xf80); } /* dump ucode_data */ if (ucode_data != 0) { sprintf(&filename[0], "ucode_data_%x.bin", sum); dump_binary(hle, filename, (void*)dram_u32(hle, ucode_data), *dmem_u32(hle, TASK_UCODE_DATA_SIZE)); } /* dump data */ if (data_ptr != 0) { sprintf(&filename[0], "data_%x.bin", sum); dump_binary(hle, filename, (void*)dram_u32(hle, data_ptr), *dmem_u32(hle, TASK_DATA_SIZE)); } }
static void handle_unknown_task(unsigned int sum) { char filename[256]; const OSTask_t * const task = get_task(); RSP_DEBUG_MESSAGE(M64MSG_WARNING, "unknown OSTask: sum %x PC:%x", sum, *rspInfo.SP_PC_REG); sprintf(&filename[0], "task_%x.log", sum); dump_task(filename, task); // dump ucode_boot sprintf(&filename[0], "ucode_boot_%x.bin", sum); dump_binary(filename, rspInfo.RDRAM + (task->ucode_boot & 0x7fffff), task->ucode_boot_size); // dump ucode if (task->ucode != 0) { sprintf(&filename[0], "ucode_%x.bin", sum); dump_binary(filename, rspInfo.RDRAM + (task->ucode & 0x7fffff), 0xf80); } // dump ucode_data if (task->ucode_data != 0) { sprintf(&filename[0], "ucode_data_%x.bin", sum); dump_binary(filename, rspInfo.RDRAM + (task->ucode_data & 0x7fffff), task->ucode_data_size); } // dump data if (task->data_ptr != 0) { sprintf(&filename[0], "data_%x.bin", sum); dump_binary(filename, rspInfo.RDRAM + (task->data_ptr & 0x7fffff), task->data_size); } }
static void handle_unknown_task(unsigned int sum) { char filename[256]; uint32_t ucode = *dmem_u32(TASK_UCODE); uint32_t ucode_data = *dmem_u32(TASK_UCODE_DATA); uint32_t data_ptr = *dmem_u32(TASK_DATA_PTR); DebugMessage(M64MSG_WARNING, "unknown OSTask: sum %x PC:%x", sum, *rsp.SP_PC_REG); sprintf(&filename[0], "task_%x.log", sum); dump_task(filename); /* dump ucode_boot */ sprintf(&filename[0], "ucode_boot_%x.bin", sum); dump_binary(filename, (void*)dram_u32(*dmem_u32(TASK_UCODE_BOOT)), *dmem_u32(TASK_UCODE_BOOT_SIZE)); /* dump ucode */ if (ucode != 0) { sprintf(&filename[0], "ucode_%x.bin", sum); dump_binary(filename, (void*)dram_u32(ucode), 0xf80); } /* dump ucode_data */ if (ucode_data != 0) { sprintf(&filename[0], "ucode_data_%x.bin", sum); dump_binary(filename, (void*)dram_u32(ucode_data), *dmem_u32(TASK_UCODE_DATA_SIZE)); } /* dump data */ if (data_ptr != 0) { sprintf(&filename[0], "data_%x.bin", sum); dump_binary(filename, (void*)dram_u32(data_ptr), *dmem_u32(TASK_DATA_SIZE)); } }
/* Systemd socket for self dump */ int socket_dump(void) { int n, ret; char core_file[CORE_FILE_NAME_SZ]; struct ucred client_info; /* Fetching the Socket ID from systemd */ n = sd_listen_fds(0); if (n > 1) { gencore_log("Too many file descriptors received.\n"); return -1; } else if (n == 1) new_sock = SD_LISTEN_FDS_START + 0; else return -1; /* Receive the message */ ret = receive_core_filename(core_file); if (ret) return -1; /* Fetch client PID */ ret = get_client_pid(&client_info); if (ret) return -1; /* Dump process */ ret = dump_task(&client_info, core_file); if (ret) return -1; return 0; }
/* Services requests */ int service_request(void) { int ret; char core_file[CORE_FILE_NAME_SZ]; struct ucred client_info; /* Handles stopping of the servicing process */ signal(SIGTERM, sig_handler_service_proc); signal(SIGSEGV, sig_handler_service_proc); signal(SIGPIPE, sig_handler_service_proc); /* Receive the message */ ret = receive_core_filename(core_file); if (ret) goto cleanup; /* Fetch client PID */ ret = get_client_pid(&client_info); if (ret) goto cleanup; /* Dump process */ ret = dump_task(&client_info, core_file); if (ret) goto cleanup; cleanup: close(new_sock); if (ret == -1) exit(EXIT_FAILURE); exit(EXIT_SUCCESS); }
void dump_tasks(void) { for (int i = 0; i < MP_ARRAY_SIZE(emu_tasks); i++) { if (emu_tasks[i].qlen) { dump_task(i + FIRST_PRIO, &emu_tasks[i]); } } printf("====\n"); }
void schedule(){ int i, done; int *pData = (int *)(corenum() * 512 + 0x4000); Task *pre_task = s_processor->cur_task; Task *task_to_run= rm_schedule(timer, s_processor); int t = timer%10; putchar(48+t); putchar(10); if(task_to_run!=NULL){ myprintf("%s\n",task_to_run->name); } timer++; for(i=0;i<3;i++) dump_task(s_processor->tasks+i); /* pre_task=s_tasks+currentTask;*/ //currentTask = (currentTask + 1) %3; //task_to_run=s_tasks+currentTask; if (task_to_run != pre_task){ if (pre_task != NULL){ //switch task //save previous task state for (i = 0; i < 32; i++){ pre_task->saved_state[i] = pData[i]; } } if (task_to_run != NULL){ //restore current task state for (i = 0; i < 32; i++){ pData[i] = task_to_run->saved_state[i]; //is_idle=0; } } /* else*/ //{ //pData[31]=idle; //is_idle=1; /*}*/ } }
void finalize() { // vypsat statistiky if(node == 0) { srpprintf(node, "-----"); srpprintf(node, "uloha:"); dump_task(stdout, t); } // sesynchronizovat pozici v programu // rezie uklidu a vypisu uz me nezajima MPI_Barrier(MPI_COMM_WORLD); tend = MPI_Wtime(); if(node_solver) { // vypis reseni srpprintf(node, "prohledano stavu: %d (orezano: %d)", cc, co); if(!solution) { srpprintf(node, "reseni nebylo nalezeno!"); } else { srpprintf(node, "reseni nalezeno p=%d", solution->p); dump_hist(stdout, solution->h); } srpprintf(node, "cas: %fs", tend-tbeg); // uklid stack_item_destroy(solution); stack_destroy(s); task_destroy(t); task_destroy(tf); } // finalizace MPI srpdebug("mpi", node, "finalizace <uzel=%d/%d>", node, node_count); MPI_Finalize(); // konec exit(EXIT_SUCCESS); }
static void handle_unknown_task(uint32_t sum) { #if 0 char filename[256]; uint32_t ucode = *dmem_u32(TASK_UCODE); uint32_t ucode_data = *dmem_u32(TASK_UCODE_DATA); uint32_t data_ptr = *dmem_u32(TASK_DATA_PTR); RSP_DEBUG_MESSAGE(M64MSG_WARNING, "unknown OSTask: sum %x PC:%x", sum, *rspInfo.SP_PC_REG); sprintf(&filename[0], "task_%x.log", sum); dump_task(filename); // dump ucode_boot sprintf(&filename[0], "ucode_boot_%x.bin", sum); dump_binary(filename, (void*)dram_u32(*dmem_u32(TASK_UCODE_BOOT)), *dmem_u32(TASK_UCODE_BOOT_SIZE)); // dump ucode if (ucode != 0) { sprintf(&filename[0], "ucode_%x.bin", sum); dump_binary(filename, (void*)dram_u32(ucode), 0xf80); } // dump ucode_data if (ucode_data != 0) { sprintf(&filename[0], "ucode_data_%x.bin", sum); dump_binary(filename, (void*)dram_u32(ucode_data), *dmem_u32(TASK_UCODE_DATA_SIZE)); } // dump data if (data_ptr != 0) { sprintf(&filename[0], "data_%x.bin", sum); dump_binary(filename, (void*)dram_u32(data_ptr), *dmem_u32(TASK_DATA_SIZE)); } #endif }
static Val forward_agegroup0_chunk_to_agegroup1 (Agegroup* ag1, Val v, Task* task, int caller) { // 'task' arg is only for debugging, can be removed in production use. // ===================================== // // Forward pair/record/vector/string 'v' from agegroup0 to agegroup 1. // This involves: // // o Duplicating v in the appropriate agegroup 1 to-space buffer. // o Setting v's tagword to FORWARDED_CHUNK_TAGWORD. // o Setting v's first slot to point to the duplicate. // o Returning a pointer to the duplicate. Val* new_chunk; Vunt len_in_words; Sib* sib; Val* chunk = PTR_CAST(Val*, v); Val tagword = chunk[-1]; switch (GET_BTAG_FROM_TAGWORD( tagword )) { // case PAIRS_AND_RECORDS_BTAG: // len_in_words = GET_LENGTH_IN_WORDS_FROM_TAGWORD( tagword ); #ifdef NO_PAIR_STRIP // 'NO_PAIR_STRIP' appears nowhere else in the codebase. sib = ag1->sib[RO_POINTERS_SIB]; #else if (len_in_words != 2) { sib = ag1->sib[ RO_POINTERS_SIB ]; // This v is not a pair, so fall through to default code. } else { // // This v is a pair, so we'll use special-case code. sib = ag1->sib[ RO_CONSCELL_SIB ]; // We'll copy it into the dedicated pairs-only sib in agegroup1. new_chunk = sib->tospace.first_free; // Where to copy it in that sib. sib->tospace.first_free += 2; // Allocate the space for it. new_chunk[0] = chunk[0]; // Copy first word of pair. new_chunk[1] = chunk[1]; // Copy second word of pair. // Notice that we don't need to copy the tagword -- it is implicit in the fact that we're in the pairsib. // Set up the forward pointer in the old pair: // chunk[-1] = FORWARDED_CHUNK_TAGWORD; chunk[0] = (Val)(Vunt)new_chunk; return PTR_CAST( Val, new_chunk ); // Done! } #endif break; case RO_VECTOR_HEADER_BTAG: case RW_VECTOR_HEADER_BTAG: // len_in_words = 2; // sib = ag1->sib[ RO_POINTERS_SIB ]; break; // Fall through to generic-case code. case RW_VECTOR_DATA_BTAG: // len_in_words = GET_LENGTH_IN_WORDS_FROM_TAGWORD( tagword ); // sib = ag1->sib[ RW_POINTERS_SIB ]; // The RW_POINTERS_SIB allows updates, which the RO_POINTERS_SIB does not. break; // Fall through to generic-case code. case FOUR_BYTE_ALIGNED_NONPOINTER_DATA_BTAG: // len_in_words = GET_LENGTH_IN_WORDS_FROM_TAGWORD( tagword ); // sib = ag1->sib[ NONPTR_DATA_SIB ]; break; // Fall through to generic-case code. case EIGHT_BYTE_ALIGNED_NONPOINTER_DATA_BTAG: // len_in_words = GET_LENGTH_IN_WORDS_FROM_TAGWORD( tagword ); // sib = ag1->sib[ NONPTR_DATA_SIB ]; // #ifdef ALIGN_FLOAT64S # ifdef CHECK_HEAP if (((Vunt)sib->tospace.first_free & WORD_BYTESIZE) == 0) { // *sib->tospace.first_free++ = (Val) 0; } # else sib->tospace.first_free = (Val*) (((Vunt)sib->tospace.first_free) | WORD_BYTESIZE); # endif #endif break; // Fall through to generic-case code. case WEAK_POINTER_OR_SUSPENSION_BTAG: // return forward_special_chunk ( ag1, chunk, tagword ); case FORWARDED_CHUNK_BTAG: // return PTR_CAST( Val, FOLLOW_FORWARDING_POINTER(chunk)); // We've already copied this one to agegroup1, so just return pointer to copy. default: log_if("bad chunk tag %d, chunk = %#x, tagword = %#x -- forward_agegroup0_chunk_to_agegroup1() in src/c/heapcleaner/heapclean-agegroup0.c", GET_BTAG_FROM_TAGWORD(tagword), chunk, tagword); log_if("forward_agegroup0_chunk_to_agegroup1 was called by %s", caller ? "process_task_heap_changelog" : "forward_to_agegroup1_if_in_agegroup0"); dump_task(task,"forward_agegroup0_chunk_to_agegroup1/default"); die ("bad chunk tag %d, chunk = %#x, tagword = %#x -- forward_agegroup0_chunk_to_agegroup1() in src/c/heapcleaner/heapclean-agegroup0.c", GET_BTAG_FROM_TAGWORD(tagword), chunk, tagword); exit(1); // Cannot execute -- just to quiet gcc -Wall. } // Make an agegroup1 copy of the chunk // in the appropriate agegroup1 sib (buffer): // new_chunk = sib->tospace.first_free; // Figure out where copy will be located. sib->tospace.first_free += (len_in_words + 1); // Allocate space needed by the copy. *new_chunk++ = tagword; // Install tagword at start of copy. (Note that 'sib' cannot be RO_CONSCELL_SIB, we handled that case above.) ASSERT( sib->tospace.first_free <= sib->tospace.limit ); COPYLOOP(chunk, new_chunk, len_in_words); // Copy over the rest of the chunk. // COPYLOOP def in src/c/heapcleaner/copy-loop.h // Set up the forwarding pointer in the original // to the copy and return the new chunk: // chunk[-1] = FORWARDED_CHUNK_TAGWORD; chunk[ 0] = (Val) (Vunt) new_chunk; return PTR_CAST( Val, new_chunk ); } // fun forward_agegroup0_chunk_to_agegroup1