void pick(volatile uint64_t** addrs, int step) { uint8_t* buf = (uint8_t*) addrs[0]; uint64_t phys1 = get_physical_addr((uint64_t)buf); // printf("%zx -> %zx\n",(uint64_t) buf, phys1); for (size_t i = 0; i < 64*1024*1024-4096; i += 4096) { uint64_t phys2 = get_physical_addr((uint64_t)(eviction_ptr + i)); if (phys1 != phys2 && in_same_cache_set(phys1, phys2, -1)) { addrs[found] = (uint64_t*)(eviction_ptr+i); // printf("%zx -> %zx\n",(uint64_t) eviction_ptr+i, phys2); found++; } } fflush(stdout); }
MIPS_instr peek_next_src(void) { unsigned int old_address=address; long long int * old_rdword=rdword; long long dyna_rdword; rdword = &dyna_rdword; if(cur_src+4==cf->start_address) // can happen when the rec checks for previous delay slot { address = get_physical_addr(cf->start_address); assert(address!=PHY_INVALID_ADDR); address -= 4; } else { assert(cur_src>=cf->start_address && cur_src<cf->end_address+4); // the rec can go 1 op past function end address = get_physical_addr(cur_src); assert(address!=PHY_INVALID_ADDR); } if(address<0x80000000 || address>=0xc0000000) { // we are outside physical range, not much we can do... return 0; } read_word_in_memory(); MIPS_instr mips=dyna_rdword; // printf("mips %08x %08x\n",address,mips); address=old_address; rdword=old_rdword; return mips; }
/* Get the physical address which the virtual one points to */ ACPI_STATUS AcpiOsGetPhysicalAddress(void *LogicalAddress, ACPI_PHYSICAL_ADDRESS *PhysicalAddress) { u32 phys = 0; if( get_physical_addr(current->t_dir, LogicalAddress, &phys) != 0 ){ *PhysicalAddress = 0; return AE_BAD_PARAMETER; } *PhysicalAddress = (ACPI_PHYSICAL_ADDRESS)phys; return AE_OK; }
//Initialisation function that is used to ensure that the lock is set up correctly and that all the elements are zeroed. void applist_initialise_list(void) { applist_state_t * state_structure; state_structure = applist_fetch_list_state(); state_structure->lock = 0; //Set it up the lock applist_entry_t blank_entry; blank_entry.AppID = 0; blank_entry.HW_SW = 0; blank_entry.app_state_phys_addr = 0; blank_entry.app_log_phys_addr = 0; blank_entry.alive = 0; //fetch the physical address for the app_state virtual address. int pid = getpid(); printf("\tPID of application: %d\n", pid); printf("\tVirt address %p\n", state_structure->list_head); int64_t applist_phys_addr = get_physical_addr(pid, state_structure); printf("\tPhys_address %016llX\n", applist_phys_addr); state_structure->phys_addr = applist_phys_addr; #if (HHB_QUERY == 1) HHB_query applist_test; applist_test = setup_hhbquery(); //setup the device *((unsigned int *)applist_test.Bus_a_BaseAddress + 5) = (unsigned int)applist_phys_addr; XHwhb hwhb_device; hwhb_device = setup_XHwhb(); XHwhb_SetApp_list_addr(&hwhb_device, (unsigned int)applist_phys_addr); #endif int i; for(i=0; i<LIST_SIZE;i++) { //applist_register_app(&blank_entry); //Enter a blank entry into every location state_structure->list_head[i] = blank_entry; } return; }