Pause/Resume now works as I changed the MOESI_SLE-cache.sm file. In MOESI_SLE-cache.sm, I adapted the x_markTransactionalStore action to now stop taking logs when the transaction is paused.
The other method to achieve the same effect would be doing the following:
add the SIMICS_set_program_counter_LA to the interface.C file under $GEMS/ruby/simics directory.
void SIMICS_set_program_counter_LA(int procID, Address newPC) {
conf_object_t *cpu = SIM_proc_no_2_ptr(procID);
assert(cpu != NULL);
physical_address_t paddr;
paddr = (physical_address_t) newPC.getAddress();
WARN_EXPR(paddr);
WARN_MSG("In set program counter LA");
SIM_set_program_counter(cpu, paddr);
}
now add setHandlerAddress() method into TransactionManager.C file under $GEMS/ruby/simics directory:
void TransactionManager::setHandlerAddress(){
int gn = SIMICS_get_register_number(m_chip_ptr->getID(), "g2");
uint64 tl = SIMICS_read_register(m_chip_ptr->getID(), gn);
m_handlerAddress = Address((physical_address_t)tl); // tl is logical address
WARN_MSG("setting handler address");
WARN_EXPR(tl);
DEBUG_MSG(CACHE_COMP, MedPrio, "setting handler address");
}
This method should be called when there is a set handler magic call is received by Simics.
Finally, in the benchmark program, add the following method as a helper function.
void tm_handler_stub(){
printf("hello world!\nI just aborted and I am the stub\n");
RUBY_MAGIC_CALL(Do_Breakpoint, 0);
}
in the main method where transaction is called, add
void *handler_address = &tm_handler_stub ;
asm volatile (
"mov %0,%%g2" ::"r"(handler_address)
);
SET_ABORT_HANDLER; // this is a magic call that I assume is defined in the transaction.h
and now it is good to go !
For those who wonder how the tm_handler_stub is going to be useful, the answer is that magic calls can be made in that method which could change the PC again, for example, to start the aborted transaction.
Enjoy hacking the Simics!
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment