Change-Id: I8022d937477668253c613e97c3a579ae65084b1e
This commit is contained in:
Horst Schirmeier
2014-02-09 18:54:21 +01:00
parent 5df364dea2
commit 277958b31b
45 changed files with 430 additions and 444 deletions

1
.gitignore vendored
View File

@ -53,4 +53,3 @@ debuggers/openocd/src/startup.tcl
debuggers/openocd/src/startup_tcl.c debuggers/openocd/src/startup_tcl.c
debuggers/openocd/src/target/xscale_debug.h debuggers/openocd/src/target/xscale_debug.h
debuggers/openocd/stamp-h1 debuggers/openocd/stamp-h1

View File

@ -1,7 +1,7 @@
# Find FTDI library # Find FTDI library
# Defines: # Defines:
# FTDI_FOUND # FTDI_FOUND
# FTDI_INCLUDE_DIR # FTDI_INCLUDE_DIR
# FTDI_LIBRARY # FTDI_LIBRARY
# #
@ -13,7 +13,7 @@ FIND_LIBRARY(FTDI_LIBRARY NAMES ftdi
ENV LD_LIBRARY_PATH ENV LD_LIBRARY_PATH
) )
# handle the QUIETLY and REQUIRED arguments and set FTDI_FOUND to TRUE if # handle the QUIETLY and REQUIRED arguments and set FTDI_FOUND to TRUE if
# all listed variables are TRUE # all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs) INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(FTDI DEFAULT_MSG FTDI_LIBRARY FTDI_INCLUDE_DIR) FIND_PACKAGE_HANDLE_STANDARD_ARGS(FTDI DEFAULT_MSG FTDI_LIBRARY FTDI_INCLUDE_DIR)

View File

@ -1,11 +1,11 @@
if(BUILD_PANDA) if(BUILD_PANDA)
message(STATUS "[${PROJECT_NAME}] Building Pandaboard variant ...") message(STATUS "[${PROJECT_NAME}] Building Pandaboard variant ...")
SET(VARIANT panda) SET(VARIANT panda)
find_package(FTDI REQUIRED) find_package(FTDI REQUIRED)
set(openocd_library_dependencies ${openocd_library_dependencies} ${FTDI_LIBRARY}) set(openocd_library_dependencies ${openocd_library_dependencies} ${FTDI_LIBRARY})
# FIXME: some libraries still need to be located the "cmake way" # FIXME: some libraries still need to be located the "cmake way"
set(openocd_library_dependencies ${openocd_library_dependencies} -ldl) set(openocd_library_dependencies ${openocd_library_dependencies} -ldl)
@ -27,37 +27,36 @@ if(BUILD_PANDA)
# make sure aspects don't fail to match in entry.cc # make sure aspects don't fail to match in entry.cc
#include_directories(${PROJECT_SOURCE_DIR}/src/core ${CMAKE_BINARY_DIR}/src/core) #include_directories(${PROJECT_SOURCE_DIR}/src/core ${CMAKE_BINARY_DIR}/src/core)
# an executable needs at least one source file, so we hand over an empty .cc file to make cmake happy. # an executable needs at least one source file, so we hand over an empty .cc file to make cmake happy.
set(srces ${openocd_src_dir}/openocd_wrapper.cc) set(srces ${openocd_src_dir}/openocd_wrapper.cc)
set (srces ${srces} set (srces ${srces}
${openocd_src_dir}/opcode_parser/arm-addressmode.c ${openocd_src_dir}/opcode_parser/arm-addressmode.c
${openocd_src_dir}/opcode_parser/arm-condition.c ${openocd_src_dir}/opcode_parser/arm-condition.c
${openocd_src_dir}/opcode_parser/arm-opcode-coprocessor.c ${openocd_src_dir}/opcode_parser/arm-opcode-coprocessor.c
${openocd_src_dir}/opcode_parser/arm-opcode-data.c ${openocd_src_dir}/opcode_parser/arm-opcode-data.c
${openocd_src_dir}/opcode_parser/arm-opcode-ldmstm-branch.c ${openocd_src_dir}/opcode_parser/arm-opcode-ldmstm-branch.c
${openocd_src_dir}/opcode_parser/arm-opcode-ldrstr.c ${openocd_src_dir}/opcode_parser/arm-opcode-ldrstr.c
${openocd_src_dir}/opcode_parser/arm-opcode.c) ${openocd_src_dir}/opcode_parser/arm-opcode.c)
add_executable(fail-client ${srces}) add_executable(fail-client ${srces})
target_link_libraries(fail-client ${openocd_src_dir}/src/.libs/libopenocd.a ${openocd_src_dir}/jimtcl/libjim.a fail ${openocd_library_dependencies}) target_link_libraries(fail-client ${openocd_src_dir}/src/.libs/libopenocd.a ${openocd_src_dir}/jimtcl/libjim.a fail ${openocd_library_dependencies})
add_dependencies(fail-client libfailopenocd_external) add_dependencies(fail-client libfailopenocd_external)
# ensure, elf path is set for enabling openocd to read elf symbols # ensure, elf path is set for enabling openocd to read elf symbols
if(EXISTS $ENV{FAIL_ELF_PATH}) if(EXISTS $ENV{FAIL_ELF_PATH})
SET(PANDA_ELF_PATH $ENV{FAIL_ELF_PATH}) message(STATUS "[Fail*] PandaBoard ELF under test: $ENV{FAIL_ELF_PATH}")
message(STATUS "[Fail*] PandaBoard ELF under test: ${PANDA_ELF_PATH}")
else() else()
message(FATAL_ERROR "Please set the FAIL_ELF_PATH enviroment variable to the binary under test.") message(FATAL_ERROR "Please set the FAIL_ELF_PATH environment variable to the binary under test.")
endif() endif()
# copy the conf-files to build directory # copy the conf-files to build directory
# TODO: copy to install path on install!? # TODO: copy to install path on install!?
file(COPY ${openocd_src_dir}/tcl/ DESTINATION oocd_conf/ PATTERN openocd EXCLUDE) file(COPY ${openocd_src_dir}/tcl/ DESTINATION oocd_conf/ PATTERN openocd EXCLUDE)
get_filename_component(OOCD_CONF_FILES_PATH ${CMAKE_BINARY_DIR}/oocd_conf/ REALPATH) get_filename_component(OOCD_CONF_FILES_PATH ${CMAKE_BINARY_DIR}/oocd_conf/ REALPATH)
configure_file(${openocd_src_dir}/openocd.cfg openocd.cfg COPYONLY) configure_file(${openocd_src_dir}/openocd.cfg openocd.cfg COPYONLY)
get_filename_component(OOCD_CONF_FILE_PATH ${CMAKE_BINARY_DIR}/openocd.cfg REALPATH) get_filename_component(OOCD_CONF_FILE_PATH ${CMAKE_BINARY_DIR}/openocd.cfg REALPATH)
configure_file(${openocd_src_dir}/openocd_wrapper.hpp.in configure_file(${openocd_src_dir}/openocd_wrapper.hpp.in

View File

@ -150,21 +150,21 @@ static std::vector<struct mem_range> mmu_watch_del_waiting_list;
static std::vector<struct mem_range> mmu_watch; static std::vector<struct mem_range> mmu_watch;
/* /*
* Timer related structures * Timer related structures
*/ */
#define P_MAX_TIMERS 32 #define P_MAX_TIMERS 32
struct timer{ struct timer{
bool inUse; // Timer slot is in-use (currently registered). bool inUse; // Timer slot is in-use (currently registered).
uint64_t timeToFire; // Time to fire next in microseconds uint64_t timeToFire; // Time to fire next in microseconds
struct timeval time_begin; // Timer value at activation of timer struct timeval time_begin; // Timer value at activation of timer
bool active; // 0=inactive, 1=active. bool active; // 0=inactive, 1=active.
p_timer_handler_t funct; // A callback function for when the p_timer_handler_t funct; // A callback function for when the
// timer fires. // timer fires.
void *this_ptr; // The this-> pointer for C++ callbacks void *this_ptr; // The this-> pointer for C++ callbacks
// has to be stored as well. // has to be stored as well.
bool freezed; bool freezed;
#define PMaxTimerIDLen 32 #define PMaxTimerIDLen 32
char id[PMaxTimerIDLen]; // String ID of timer. char id[PMaxTimerIDLen]; // String ID of timer.
}; };
static struct timer timers[P_MAX_TIMERS]; static struct timer timers[P_MAX_TIMERS];
@ -678,7 +678,7 @@ int main(int argc, char *argv[])
exit(-1); exit(-1);
} }
#else #else
if(!getHaltingWatchpoint(&halt)) { if (!getHaltingWatchpoint(&halt)) {
LOG << "FATAL ERROR: Can't determine memory-access address of halt cause" << endl; LOG << "FATAL ERROR: Can't determine memory-access address of halt cause" << endl;
exit(-1); exit(-1);
} }
@ -687,26 +687,26 @@ int main(int argc, char *argv[])
// Get meta information and fire MemoryAccess event // Get meta information and fire MemoryAccess event
int iswrite; int iswrite;
switch (halt.type) { switch (halt.type) {
case HALT_TYPE_WP_READ: case HALT_TYPE_WP_READ:
iswrite = 0; iswrite = 0;
break; break;
case HALT_TYPE_WP_WRITE: case HALT_TYPE_WP_WRITE:
iswrite = 1; iswrite = 1;
break; break;
case HALT_TYPE_WP_READWRITE: case HALT_TYPE_WP_READWRITE:
LOG << "We should not get a READWRITE as trigger of" LOG << "We should not get a READWRITE as trigger of"
"a watchpoint!" << endl; "a watchpoint!" << endl;
iswrite = 1; iswrite = 1;
break; break;
default: default:
LOG << "FATAL ERROR: Can't determine memory-access type of halt cause" << endl; LOG << "FATAL ERROR: Can't determine memory-access type of halt cause" << endl;
exit(-1); exit(-1);
break; break;
} }
freeze_timers(); freeze_timers();
LOG << "WATCHPOINT EVENT ADDR: " << hex << halt.address << dec LOG << "WATCHPOINT EVENT ADDR: " << hex << halt.address << dec
<< " LENGTH: " << halt.addr_len << " TYPE: " << " LENGTH: " << halt.addr_len << " TYPE: "
<< (iswrite?'W':'R') << endl; << (iswrite?'W':'R') << endl;
fail::simulator.onMemoryAccess(NULL, halt.address, halt.addr_len, iswrite, pc); fail::simulator.onMemoryAccess(NULL, halt.address, halt.addr_len, iswrite, pc);
unfreeze_timers(); unfreeze_timers();
@ -721,7 +721,7 @@ int main(int argc, char *argv[])
break; break;
default: default:
LOG << "FATAL ERROR: Target halted in unexpected cpu state " LOG << "FATAL ERROR: Target halted in unexpected cpu state "
<< current_dr << endl; << current_dr << endl;
exit (-1); exit (-1);
break; break;
} }
@ -731,19 +731,19 @@ int main(int argc, char *argv[])
update_timers(); update_timers();
} }
/* === FINISHING UP === */ /* === FINISHING UP === */
unregister_all_commands(cmd_ctx, NULL); unregister_all_commands(cmd_ctx, NULL);
/* free commandline interface */ /* free commandline interface */
command_done(cmd_ctx); command_done(cmd_ctx);
adapter_quit(); adapter_quit();
fclose(file); fclose(file);
LOG << "finished" << endl; LOG << "finished" << endl;
exit(oocdw_exCode); exit(oocdw_exCode);
} }
void oocdw_finish(int exCode) void oocdw_finish(int exCode)
@ -758,7 +758,7 @@ void oocdw_set_halt_condition(struct halt_condition *hc)
assert((hc != NULL) && "No halt condition defined"); assert((hc != NULL) && "No halt condition defined");
if (hc->type == HALT_TYPE_BP) { /* BREAKPOINT */ if (hc->type == HALT_TYPE_BP) { /* BREAKPOINT */
LOG << "Adding BP " << hex << hc->address << dec << ":" << hc->addr_len << endl; LOG << "Adding BP " << hex << hc->address << dec << ":" << hc->addr_len << endl;
if (!free_breakpoints) { if (!free_breakpoints) {
LOG << "FATAL ERROR: No free breakpoints left" << endl; LOG << "FATAL ERROR: No free breakpoints left" << endl;
@ -771,13 +771,13 @@ void oocdw_set_halt_condition(struct halt_condition *hc)
} }
free_breakpoints--; free_breakpoints--;
} else if (hc->type == HALT_TYPE_SINGLESTEP) { /* SINGLE STEP */ } else if (hc->type == HALT_TYPE_SINGLESTEP) { /* SINGLE STEP */
// Just set flag, so single step will be executed in according // Just set flag, so single step will be executed in according
// main loop stage // main loop stage
single_step_requested = true; single_step_requested = true;
} else if ((hc->type == HALT_TYPE_WP_READ) || } else if ((hc->type == HALT_TYPE_WP_READ) ||
(hc->type == HALT_TYPE_WP_WRITE) || (hc->type == HALT_TYPE_WP_WRITE) ||
(hc->type == HALT_TYPE_WP_READWRITE)) { /* WATCHPOINT */ (hc->type == HALT_TYPE_WP_READWRITE)) { /* WATCHPOINT */
// Use MMU for watching ? // Use MMU for watching ?
if ((hc->addr_len > 4) || !free_watchpoints) { if ((hc->addr_len > 4) || !free_watchpoints) {
@ -834,17 +834,17 @@ void oocdw_delete_halt_condition(struct halt_condition *hc)
assert((hc != NULL) && "No halt condition defined"); assert((hc != NULL) && "No halt condition defined");
// Remove halt condition from pandaboard // Remove halt condition from pandaboard
if (hc->type == HALT_TYPE_BP) { /* BREAKPOINT */ if (hc->type == HALT_TYPE_BP) { /* BREAKPOINT */
LOG << "Removing BP " << hex << hc->address << dec << ":" LOG << "Removing BP " << hex << hc->address << dec << ":"
<< hc->addr_len << endl; << hc->addr_len << endl;
breakpoint_remove(target_a9, hc->address); breakpoint_remove(target_a9, hc->address);
free_breakpoints++; free_breakpoints++;
} else if (hc->type == HALT_TYPE_SINGLESTEP) { /* SINGLE STEP */ } else if (hc->type == HALT_TYPE_SINGLESTEP) { /* SINGLE STEP */
// Do nothing. Single-stepping event hits one time and // Do nothing. Single-stepping event hits one time and
// extinguishes itself automatically // extinguishes itself automatically
} else if ((hc->type == HALT_TYPE_WP_READWRITE) || } else if ((hc->type == HALT_TYPE_WP_READWRITE) ||
(hc->type == HALT_TYPE_WP_READ) || (hc->type == HALT_TYPE_WP_READ) ||
(hc->type == HALT_TYPE_WP_WRITE)) { /* WATCHPOINT */ (hc->type == HALT_TYPE_WP_WRITE)) { /* WATCHPOINT */
struct mem_range mr; struct mem_range mr;
mr.address = hc->address; mr.address = hc->address;
@ -876,7 +876,7 @@ void oocdw_delete_halt_condition(struct halt_condition *hc)
// Remove hardware watchpoint // Remove hardware watchpoint
watchpoint_remove(target_a9, hc->address); watchpoint_remove(target_a9, hc->address);
free_watchpoints++; free_watchpoints++;
LOG << hex << "Removing WP " << hc->address << ":" << hc->addr_len LOG << hex << "Removing WP " << hc->address << ":" << hc->addr_len
<< ":" << ((hc->type == HALT_TYPE_WP_READ) ? "R" : << ":" << ((hc->type == HALT_TYPE_WP_READ) ? "R" :
(hc->type == HALT_TYPE_WP_WRITE) ? "W" : "R/W") << dec << endl; (hc->type == HALT_TYPE_WP_WRITE) ? "W" : "R/W") << dec << endl;
} }
@ -956,44 +956,44 @@ void oocdw_reboot()
LOG << "Rebooting device" << endl; LOG << "Rebooting device" << endl;
reboot_success = true; reboot_success = true;
// If target is not halted, reset will result in freeze // If target is not halted, reset will result in freeze
if (target_a9->state != TARGET_HALTED) { if (target_a9->state != TARGET_HALTED) {
if (!oocdw_halt_target(target_a9)) { if (!oocdw_halt_target(target_a9)) {
reboot_success = false; reboot_success = false;
if (fail_counter++ > 4) { if (fail_counter++ > 4) {
LOG << "FATAL ERROR: Rebooting not possible" << endl; LOG << "FATAL ERROR: Rebooting not possible" << endl;
exit(-1); exit(-1);
} }
usleep(100*1000); usleep(100*1000);
continue; continue;
} }
} }
/* /*
* Clear all halt conditions * Clear all halt conditions
*/ */
breakpoint_clear_target(target_a9); breakpoint_clear_target(target_a9);
watchpoint_clear_target(target_a9); watchpoint_clear_target(target_a9);
/* /*
* Reset state structures * Reset state structures
*/ */
free_watchpoints = 4; free_watchpoints = 4;
free_breakpoints = 6; free_breakpoints = 6;
mmu_recovery_needed = false; mmu_recovery_needed = false;
mmu_watch.clear(); mmu_watch.clear();
mmu_watch_add_waiting_list.clear(); mmu_watch_add_waiting_list.clear();
mmu_watch_del_waiting_list.clear(); mmu_watch_del_waiting_list.clear();
// Standard configuration: Sections only, all mapped // Standard configuration: Sections only, all mapped
for (int i = 0; i < 4096; i++) { for (int i = 0; i < 4096; i++) {
if (mmu_conf[i].type == DESCRIPTOR_PAGE) { if (mmu_conf[i].type == DESCRIPTOR_PAGE) {
delete[] mmu_conf[i].second_lvl_mapped; delete[] mmu_conf[i].second_lvl_mapped;
mmu_conf[i].type = DESCRIPTOR_SECTION; mmu_conf[i].type = DESCRIPTOR_SECTION;
} }
mmu_conf[i].mapped = true; mmu_conf[i].mapped = true;
} }
/* /*
* The actual reset command executed by OpenOCD jimtcl-engine * The actual reset command executed by OpenOCD jimtcl-engine
@ -1351,7 +1351,7 @@ void oocdw_read_from_memory(uint32_t address, uint32_t chunk_size,
uint32_t chunk_num, uint8_t *data) uint32_t chunk_num, uint8_t *data)
{ {
if (target_read_memory(target_a9, address, chunk_size, chunk_num, data)) { if (target_read_memory(target_a9, address, chunk_size, chunk_num, data)) {
LOG << "FATAL ERROR: Reading from memory failed. Addr: " << hex LOG << "FATAL ERROR: Reading from memory failed. Addr: " << hex
<< address << dec << " chunk-size: " << chunk_size << address << dec << " chunk-size: " << chunk_size
<< " chunk_num: " << chunk_num << endl; << " chunk_num: " << chunk_num << endl;
exit(-1); exit(-1);
@ -1757,7 +1757,7 @@ static void force_page_alignment_mem_range (std::vector<struct mem_range> &in,
static bool compareByAddress(const struct mem_range &a, const struct mem_range &b) static bool compareByAddress(const struct mem_range &a, const struct mem_range &b)
{ {
return a.address < b.address; return a.address < b.address;
} }
static void merge_mem_ranges (std::vector<struct mem_range> &in_out) static void merge_mem_ranges (std::vector<struct mem_range> &in_out)
@ -1768,7 +1768,7 @@ static void merge_mem_ranges (std::vector<struct mem_range> &in_out)
std::vector<struct mem_range>::iterator it, next_it; std::vector<struct mem_range>::iterator it, next_it;
it = in_out.begin(); it = in_out.begin();
next_it = it; next_it++; next_it = it; next_it++;
while(it != in_out.end() && next_it != in_out.end()) { while (it != in_out.end() && next_it != in_out.end()) {
if ((it->address + it->width) >= next_it->address) { if ((it->address + it->width) >= next_it->address) {
uint32_t additive_width = (next_it->address - it->address) + next_it->width; uint32_t additive_width = (next_it->address - it->address) + next_it->width;
if (additive_width > it->width) { if (additive_width > it->width) {
@ -1872,7 +1872,7 @@ static bool update_mmu_watch_add()
first_lvl->second_lvl_mapped[i] = true; first_lvl->second_lvl_mapped[i] = true;
descr_content = (((cand_it->index - (cand_it->index % 256)) + i) << 12) | 0x32; descr_content = (((cand_it->index - (cand_it->index % 256)) + i) << 12) | 0x32;
buffer_for_chunked_write.push_back(std::pair<uint32_t, uint32_t>( buffer_for_chunked_write.push_back(std::pair<uint32_t, uint32_t>(
pageTableAddress + (i * 4), pageTableAddress + (i * 4),
descr_content)); descr_content));
} }
first_lvl->type = DESCRIPTOR_PAGE; first_lvl->type = DESCRIPTOR_PAGE;
@ -1885,7 +1885,7 @@ static bool update_mmu_watch_add()
if (first_lvl->second_lvl_mapped[cand_it->index % 256]) { if (first_lvl->second_lvl_mapped[cand_it->index % 256]) {
uint32_t descr_content = (cand_it->index << 12) | 0x30; uint32_t descr_content = (cand_it->index << 12) | 0x30;
buffer_for_chunked_write.push_back(std::pair<uint32_t, uint32_t>( buffer_for_chunked_write.push_back(std::pair<uint32_t, uint32_t>(
sym_addr_PageTableSecondLevel + (cand_it->index * 4), sym_addr_PageTableSecondLevel + (cand_it->index * 4),
descr_content)); descr_content));
first_lvl->second_lvl_mapped[cand_it->index % 256] = false; first_lvl->second_lvl_mapped[cand_it->index % 256] = false;
invalidate = true; invalidate = true;
@ -1908,7 +1908,7 @@ static bool update_mmu_watch_add()
if (first_lvl->type == DESCRIPTOR_SECTION) { if (first_lvl->type == DESCRIPTOR_SECTION) {
if (first_lvl->mapped) { if (first_lvl->mapped) {
uint32_t descr_content = (cand_it->index << 20) | 0xc00; uint32_t descr_content = (cand_it->index << 20) | 0xc00;
uint32_t descr_addr = sym_addr_PageTableFirstLevel + (cand_it->index * 4); uint32_t descr_addr = sym_addr_PageTableFirstLevel + (cand_it->index * 4);
buffer_for_chunked_write.push_back( buffer_for_chunked_write.push_back(
std::pair<uint32_t, uint32_t>(descr_addr,descr_content)); std::pair<uint32_t, uint32_t>(descr_addr,descr_content));
@ -2035,7 +2035,7 @@ static bool update_mmu_watch_remove()
uint32_t pageTableAddress = sym_addr_PageTableSecondLevel + ((cand_it->index - (cand_it->index % 256)) * 4); uint32_t pageTableAddress = sym_addr_PageTableSecondLevel + ((cand_it->index - (cand_it->index % 256)) * 4);
uint32_t descr_content = pageTableAddress | 0x1e9; uint32_t descr_content = pageTableAddress | 0x1e9;
uint32_t target_address = sym_addr_PageTableFirstLevel + ((cand_it->index / 256) * 4); uint32_t target_address = sym_addr_PageTableFirstLevel + ((cand_it->index / 256) * 4);
LOG << "Writing to " << hex << target_address << dec << endl; LOG << "Writing to " << hex << target_address << dec << endl;
oocdw_write_to_memory(target_address, 4, 1, (unsigned char*)(&descr_content), true); oocdw_write_to_memory(target_address, 4, 1, (unsigned char*)(&descr_content), true);
invalidate = true; invalidate = true;
@ -2046,7 +2046,7 @@ static bool update_mmu_watch_remove()
first_lvl->second_lvl_mapped[i] = false; first_lvl->second_lvl_mapped[i] = false;
descr_content = (((cand_it->index - (cand_it->index % 256)) + i) << 12) | 0x30; descr_content = (((cand_it->index - (cand_it->index % 256)) + i) << 12) | 0x30;
buffer_for_chunked_write.push_back(std::pair<uint32_t, uint32_t>( buffer_for_chunked_write.push_back(std::pair<uint32_t, uint32_t>(
pageTableAddress + (i * 4), pageTableAddress + (i * 4),
descr_content)); descr_content));
} }
first_lvl->type = DESCRIPTOR_PAGE; first_lvl->type = DESCRIPTOR_PAGE;
@ -2056,7 +2056,7 @@ static bool update_mmu_watch_remove()
if (!first_lvl->second_lvl_mapped[cand_it->index % 256]) { if (!first_lvl->second_lvl_mapped[cand_it->index % 256]) {
uint32_t descr_content = (cand_it->index << 12) | 0x32; uint32_t descr_content = (cand_it->index << 12) | 0x32;
buffer_for_chunked_write.push_back(std::pair<uint32_t, uint32_t>( buffer_for_chunked_write.push_back(std::pair<uint32_t, uint32_t>(
sym_addr_PageTableSecondLevel + (cand_it->index * 4), sym_addr_PageTableSecondLevel + (cand_it->index * 4),
descr_content)); descr_content));
first_lvl->second_lvl_mapped[cand_it->index % 256] = true; first_lvl->second_lvl_mapped[cand_it->index % 256] = true;
} }
@ -2078,7 +2078,7 @@ static bool update_mmu_watch_remove()
if (first_lvl->type == DESCRIPTOR_SECTION) { if (first_lvl->type == DESCRIPTOR_SECTION) {
if (!first_lvl->mapped) { if (!first_lvl->mapped) {
uint32_t descr_content = (cand_it->index << 20) | 0xc02; uint32_t descr_content = (cand_it->index << 20) | 0xc02;
uint32_t descr_addr = sym_addr_PageTableFirstLevel + (cand_it->index * 4); uint32_t descr_addr = sym_addr_PageTableFirstLevel + (cand_it->index * 4);
LOG << "Write to " << hex << descr_addr << dec << endl; LOG << "Write to " << hex << descr_addr << dec << endl;
oocdw_write_to_memory(descr_addr, 4, 1, (unsigned char*)(&descr_content), true); oocdw_write_to_memory(descr_addr, 4, 1, (unsigned char*)(&descr_content), true);
LOG << "Writing entry at " << hex << descr_addr << " content: " << descr_content << dec << endl; LOG << "Writing entry at " << hex << descr_addr << " content: " << descr_content << dec << endl;

View File

@ -8,17 +8,17 @@
#define OOCD_CONF_FILES_PATH "@OOCD_CONF_FILES_PATH@" #define OOCD_CONF_FILES_PATH "@OOCD_CONF_FILES_PATH@"
enum halt_type { enum halt_type {
HALT_TYPE_BP, HALT_TYPE_BP,
HALT_TYPE_WP_READWRITE, HALT_TYPE_WP_READWRITE,
HALT_TYPE_WP_READ, HALT_TYPE_WP_READ,
HALT_TYPE_WP_WRITE, HALT_TYPE_WP_WRITE,
HALT_TYPE_SINGLESTEP, HALT_TYPE_SINGLESTEP,
}; };
struct halt_condition { struct halt_condition {
enum halt_type type; enum halt_type type;
uint32_t address; uint32_t address;
uint32_t addr_len; uint32_t addr_len;
}; };
/* /*
@ -48,7 +48,7 @@ void oocdw_write_reg(uint32_t reg_num, uint32_t data);
/* /*
* Set a halt condition * Set a halt condition
* *
* Halt conditions can be Break- and Watchpoints as well as single-steps * Halt conditions can be Break- and Watchpoints as well as single-steps
* @param hc Pointer to struct defining new halt condition * @param hc Pointer to struct defining new halt condition
*/ */
@ -56,7 +56,7 @@ void oocdw_set_halt_condition(struct halt_condition *hc);
/* /*
* Remove a halt condition * Remove a halt condition
* *
* Halt conditions can be Break- and Watchpoints as well as single-steps * Halt conditions can be Break- and Watchpoints as well as single-steps
* @param hc Pointer to struct defining to be deleted halt condition * @param hc Pointer to struct defining to be deleted halt condition
*/ */
@ -69,7 +69,7 @@ bool oocdw_halt_target(struct target *target);
/* /*
* Target reboot * Target reboot
* *
* The target gets reset and will be navigated to a dynamic instruction * The target gets reset and will be navigated to a dynamic instruction
* right before main entry. Afterwards a new experiment can be executed. * right before main entry. Afterwards a new experiment can be executed.
*/ */
@ -77,18 +77,18 @@ void oocdw_reboot();
/* /*
* Finish OpenOCD execution * Finish OpenOCD execution
* *
* Function will be called by simulator.terminate() and will simply * Function will be called by simulator.terminate() and will simply
* set a finish-flag. Afterwards a coroutine-switch must be called, so * set a finish-flag. Afterwards a coroutine-switch must be called, so
* the actual finishing will be done in the OpenOCD-Wrapper coroutine. * the actual finishing will be done in the OpenOCD-Wrapper coroutine.
* Before returning, another coroutine-switch is called, so the * Before returning, another coroutine-switch is called, so the
* experiment is able to exit in desired state. * experiment is able to exit in desired state.
*/ */
void oocdw_finish(int exCode = EXIT_SUCCESS); void oocdw_finish(int exCode = EXIT_SUCCESS);
/* /*
* Read data from pandaboard memory * Read data from pandaboard memory
* *
* @param address Start address of memory region to be read * @param address Start address of memory region to be read
* @param chunk_size Size of chunks, which will be read * @param chunk_size Size of chunks, which will be read
* @param chunk_num Number of chunks to be read * @param chunk_num Number of chunks to be read
@ -99,7 +99,7 @@ void oocdw_read_from_memory(uint32_t address, uint32_t chunk_size,
/* /*
* Write data to pandaboard memory * Write data to pandaboard memory
* *
* @param address Start address of memory region to be written * @param address Start address of memory region to be written
* @param chunk_size Size of chunks, which will be written * @param chunk_size Size of chunks, which will be written
* @param chunk_num Number of chunks to be written * @param chunk_num Number of chunks to be written
@ -114,29 +114,29 @@ void oocdw_write_to_memory(uint32_t address, uint32_t chunk_size,
typedef void (*p_timer_handler_t)(void *); typedef void (*p_timer_handler_t)(void *);
/* /*
* Register new timer * Register new timer
* *
* @param this_ptr This pointer for calling object method * @param this_ptr This pointer for calling object method
* @param funct Callback to call if timer expired (object method) * @param funct Callback to call if timer expired (object method)
* @param useconds Number of microseconds until timer expires * @param useconds Number of microseconds until timer expires
* @param active Sets if timer is initially active * @param active Sets if timer is initially active
* @param id String representation of timer * @param id String representation of timer
* @returns Timer index (ID) or -1 if no timer slot left * @returns Timer index (ID) or -1 if no timer slot left
*/ */
int oocdw_register_timer(void *this_ptr, p_timer_handler_t funct, int oocdw_register_timer(void *this_ptr, p_timer_handler_t funct,
uint64_t useconds, bool active, const char *id); uint64_t useconds, bool active, const char *id);
/* /*
* Unregister timer * Unregister timer
* *
* @param timerID Timer index (ID), which defines the timer to be * @param timerID Timer index (ID), which defines the timer to be
* unregistered * unregistered
*/ */
bool oocdw_unregisterTimer(unsigned timerID); bool oocdw_unregisterTimer(unsigned timerID);
/* /*
* Deactivate timer * Deactivate timer
* *
* @param timerID Timer index (ID), which defines the timer to be * @param timerID Timer index (ID), which defines the timer to be
* deactivated. * deactivated.
*/ */
void oocdw_deactivate_timer(unsigned timer_index); void oocdw_deactivate_timer(unsigned timer_index);

View File

@ -274,4 +274,4 @@ A campaign experiment to use with the lra-panda-dijkstra experiment-target.
- It will create a result table for the possible experiment outcomes - It will create a result table for the possible experiment outcomes
'OK','ERR_WRONG_RESULT','ERR_TRAP','ERR_TIMEOUT' and 'ERR_OUTSIDE_TEXT'. 'OK','ERR_WRONG_RESULT','ERR_TRAP','ERR_TIMEOUT' and 'ERR_OUTSIDE_TEXT'.
'ERR_OUTSIDE_TEXT' describes any memory accesses which went outside the 'ERR_OUTSIDE_TEXT' describes any memory accesses which went outside the
application memory. application memory.

View File

@ -12,7 +12,7 @@ set(PROTOS
) )
## Set concrete implementation of InjectionPointMessage ## Set concrete implementation of InjectionPointMessage
# ToDo: Define seperate symbol, so it can also be used in other build types # TODO: Define separate symbol, so it can also be used in other build types
if(CONFIG_INJECTIONPOINT_HOPS) if(CONFIG_INJECTIONPOINT_HOPS)
set(PROTOS ${PROTOS} InjectionPointHopsMessage.proto) set(PROTOS ${PROTOS} InjectionPointHopsMessage.proto)
set(CONCRETE_INJECTION_POINT InjectionPointHopsMessage.proto) set(CONCRETE_INJECTION_POINT InjectionPointHopsMessage.proto)

View File

@ -2,18 +2,18 @@ message InjectionPointMessage {
// Costs of the hop chain on the PandaBoard // Costs of the hop chain on the PandaBoard
// ToDo: Could be eliminated, but it is nice for evaluation // ToDo: Could be eliminated, but it is nice for evaluation
optional uint32 costs = 3; optional uint32 costs = 3;
// If checkpoint must be used for this hop chain, id is set properly // If checkpoint must be used for this hop chain, id is set properly
optional uint32 checkpoint_id = 1; optional uint32 checkpoint_id = 1;
// If we need to knwo the target dynamic instruction offset, // If we need to know the target dynamic instruction offset,
// here it is // here it is
optional uint32 target_trace_position = 4; optional uint32 target_trace_position = 4;
// Repeated groups can't be defined as notempty, so a manual // Repeated groups can't be defined as non-empty, so a manual
// non-empty check is required at usage // non-empty check is required at usage
// As we assume hops to always watch addresses of length 1, we // As we assume hops to always watch addresses of length 1, we
// don't encode the length in here // don't encode the length in here
repeated group Hops = 2 { repeated group Hops = 2 {

View File

@ -6,17 +6,17 @@ set(SRCS
# only compile concrete implementation of InjectionPoint # only compile concrete implementation of InjectionPoint
if(CONFIG_INJECTIONPOINT_HOPS) if(CONFIG_INJECTIONPOINT_HOPS)
set (SRCS ${SRCS} InjectionPointHops.cc) set (SRCS ${SRCS} InjectionPointHops.cc)
else(CONFIG_INJECTIONPOINT_HOPS) else(CONFIG_INJECTIONPOINT_HOPS)
set (SRCS ${SRCS} InjectionPointSteps.cc) set (SRCS ${SRCS} InjectionPointSteps.cc)
endif(CONFIG_INJECTIONPOINT_HOPS) endif(CONFIG_INJECTIONPOINT_HOPS)
add_library(fail-cpn ${SRCS}) add_library(fail-cpn ${SRCS})
# if hop-chains need to be calculated by the server, we # if hop-chains need to be calculated by the server, we
# the smarthopping module # the smarthopping module
if(CONFIG_INJECTIONPOINT_HOPS) if(CONFIG_INJECTIONPOINT_HOPS)
add_dependencies(fail-cpn fail-smarthops) add_dependencies(fail-cpn fail-smarthops)
endif(CONFIG_INJECTIONPOINT_HOPS) endif(CONFIG_INJECTIONPOINT_HOPS)
add_dependencies(fail-cpn fail-comm) add_dependencies(fail-cpn fail-comm)

View File

@ -35,7 +35,7 @@ bool DatabaseCampaign::run() {
CommandLine::option_handle PRUNER = cmd.addOption("p", "prune-method", Arg::Required, CommandLine::option_handle PRUNER = cmd.addOption("p", "prune-method", Arg::Required,
"-p/--prune-method \tWhich import method to use (default: basic)"); "-p/--prune-method \tWhich import method to use (default: basic)");
if(!cmd.parse()) { if (!cmd.parse()) {
log_send << "Error parsing arguments." << std::endl; log_send << "Error parsing arguments." << std::endl;
exit(-1); exit(-1);
} }
@ -82,7 +82,7 @@ bool DatabaseCampaign::run() {
std::vector<Database::Variant> variants = db->get_variants(variant, benchmark); std::vector<Database::Variant> variants = db->get_variants(variant, benchmark);
for (std::vector<Database::Variant>::const_iterator it = variants.begin(); for (std::vector<Database::Variant>::const_iterator it = variants.begin();
it != variants.end(); ++it) { it != variants.end(); ++it) {
if(!run_variant(*it)) { if (!run_variant(*it)) {
log_send << "run_variant failed for " << it->variant << "/" << it->benchmark <<std::endl; log_send << "run_variant failed for " << it->variant << "/" << it->benchmark <<std::endl;
return false; return false;
} }
@ -133,12 +133,13 @@ bool DatabaseCampaign::run_variant(Database::Variant variant) {
MYSQL_RES *pilots = db->query_stream ((sql_select + sql_body).c_str()); MYSQL_RES *pilots = db->query_stream ((sql_select + sql_body).c_str());
log_send << "Found " << experiment_count << " unfinished experiments in database. (" log_send << "Found " << experiment_count << " unfinished experiments in database. ("
<< variant.variant << "/" << variant.benchmark << ")" << std::endl; << variant.variant << "/" << variant.benchmark << ")" << std::endl;
// abstraction of injection point // abstraction of injection point:
// must not be initialized in loop, because hop chain calculator would loose state after loop pass // must not be initialized in loop, because hop chain calculator would lose
// and so for every hop chain it would have to begin calculating at trace instruction zero // state after loop pass and so for every hop chain it would have to begin
// calculating at trace instruction zero
ConcreteInjectionPoint ip; ConcreteInjectionPoint ip;
sent_pilots = 0; sent_pilots = 0;

View File

@ -58,7 +58,7 @@ class SmartHops;
/** /**
* \class InjectionPointHops * \class InjectionPointHops
* *
* Concrete injection point which contains a hop chain to the target * Concrete injection point which contains a hop chain to the target
* trace instruction. * trace instruction.
*/ */
class InjectionPointHops : public InjectionPointBase { class InjectionPointHops : public InjectionPointBase {
@ -79,7 +79,7 @@ public:
m_curr_instr2(-1), m_initialized(false) {} m_curr_instr2(-1), m_initialized(false) {}
virtual ~InjectionPointHops(); virtual ~InjectionPointHops();
/** /**
* Parses a hop chain from a injection instruction (trace offset). * Parses a hop chain from a injection instruction (trace offset).
* @param instr1 trace instruction offset of beginning of equivalence class * @param instr1 trace instruction offset of beginning of equivalence class
@ -101,7 +101,7 @@ typedef InjectionPointHops ConcreteInjectionPoint;
class InjectionPointSteps : public InjectionPointBase { class InjectionPointSteps : public InjectionPointBase {
public: public:
virtual ~InjectionPointSteps() {} virtual ~InjectionPointSteps() {}
/** /**
* Parses a trace offset from a injection instruction (trace offset), * Parses a trace offset from a injection instruction (trace offset),
* so it effectively just stores the value in the protobuf message. * so it effectively just stores the value in the protobuf message.

View File

@ -6,10 +6,10 @@
namespace fail { namespace fail {
InjectionPointHops::~InjectionPointHops() { InjectionPointHops::~InjectionPointHops() {
if (m_initialized) if (m_initialized) {
delete m_sa; delete m_sa;
}
} }
void InjectionPointHops::init() void InjectionPointHops::init()
@ -17,11 +17,11 @@ void InjectionPointHops::init()
m_sa = new SmartHops(); m_sa = new SmartHops();
char * elfpath = getenv("FAIL_TRACE_PATH"); char * elfpath = getenv("FAIL_TRACE_PATH");
if(elfpath == NULL){ if (elfpath == NULL) {
m_log << "FAIL_TRACE_PATH not set :(" << std::endl; m_log << "FAIL_TRACE_PATH not set :(" << std::endl;
exit(-1); exit(-1);
}else{ } else {
m_sa->init((const char*)elfpath); m_sa->init((const char*) elfpath);
} }
m_initialized = true; m_initialized = true;
@ -74,7 +74,7 @@ void InjectionPointHops::parseFromInjectionInstr(unsigned instr1, unsigned instr
if (!m_sa->calculateFollowingHop(m, new_curr_instr2)) { if (!m_sa->calculateFollowingHop(m, new_curr_instr2)) {
m_log << "FATAL ERROR: Trace does not contain enough instructions (no instruction with offset " m_log << "FATAL ERROR: Trace does not contain enough instructions (no instruction with offset "
<< new_curr_instr2 << ")" << std::endl; << new_curr_instr2 << ")" << std::endl;
exit(-1); exit(-1);
} }
m_results.push_back(m); m_results.push_back(m);
@ -93,7 +93,7 @@ void InjectionPointHops::parseFromInjectionInstr(unsigned instr1, unsigned instr
if (search == search_end) { if (search == search_end) {
m_ip = *search; m_ip = *search;
} else { } else {
for(;search != search_end; search++) { for (;search != search_end; search++) {
if (!search->has_costs()) { if (!search->has_costs()) {
m_log << "FATAL ERROR: Costs must be delivered in order to calculate minimum costs" << std::endl; m_log << "FATAL ERROR: Costs must be delivered in order to calculate minimum costs" << std::endl;
exit(-1); exit(-1);

View File

@ -1,6 +1,6 @@
// Architecture.hpp: wraps architecture definition headers // Architecture.hpp: wraps architecture definition headers
#ifndef __ARCHITECTURE_HPP__ #ifndef __ARCHITECTURE_HPP__
#define __ARCHITECTURE_HPP__ #define __ARCHITECTURE_HPP__
#include "config/FailConfig.hpp" #include "config/FailConfig.hpp"

View File

@ -58,7 +58,7 @@ elseif(BUILD_T32)
) )
endif(BUILD_ARM) endif(BUILD_ARM)
elseif(BUILD_PANDA) elseif(BUILD_PANDA)
include_directories(${PROJECT_SOURCE_DIR}/debuggers/openocd) include_directories(${PROJECT_SOURCE_DIR}/debuggers/openocd)
set(SRCS set(SRCS
CPU.cc CPU.cc
CPUState.cc CPUState.cc
@ -82,28 +82,28 @@ if(BUILD_X86)
set(SRCS ${SRCS} set(SRCS ${SRCS}
x86/X86Architecture.cc x86/X86Architecture.cc
) )
set(ARCH_TOOL_PREFIX "" CACHE PATH "Setup prefix for binutils, e.g., arm-none-eabi- or tricore-, ..") set(ARCH_TOOL_PREFIX "" CACHE PATH "Setup prefix for binutils, e.g., arm-none-eabi- or tricore-, ..")
elseif(BUILD_ARM) elseif(BUILD_ARM)
set(SRCS ${SRCS} set(SRCS ${SRCS}
arm/ArmArchitecture.cc arm/ArmArchitecture.cc
) )
set(ARCH_TOOL_PREFIX "arm-none-eabi-" CACHE PATH "Setup prefix for binutils, e.g., arm-none-eabi- or tricore-, ..") set(ARCH_TOOL_PREFIX "arm-none-eabi-" CACHE PATH "Setup prefix for binutils, e.g., arm-none-eabi- or tricore-, ..")
endif(BUILD_X86) endif(BUILD_X86)
if(BUILD_GEM5) if(BUILD_GEM5)
message(STATUS "[${PROJECT_NAME}] Generating SConscript in ${CMAKE_CURRENT_BINARY_DIR}/gem5") message(STATUS "[${PROJECT_NAME}] Generating SConscript in ${CMAKE_CURRENT_BINARY_DIR}/gem5")
set(additional_libs "") set(additional_libs "")
foreach(exp ${EXPERIMENTS_ACTIVATED}) foreach(exp ${EXPERIMENTS_ACTIVATED})
set(additional_libs "${additional_libs} '-lfail-${exp}',") set(additional_libs "${additional_libs} '-lfail-${exp}',")
endforeach(exp) endforeach(exp)
foreach(plug ${PLUGINS_ACTIVATED}) foreach(plug ${PLUGINS_ACTIVATED})
set(additional_libs "${additional_libs} '-lfail-${plug}',") set(additional_libs "${additional_libs} '-lfail-${plug}',")
endforeach(plug) endforeach(plug)
set(GEM5_SAL_SRCS "'${CMAKE_CURRENT_SOURCE_DIR}/gem5/Gem5Wrapper.cc'") set(GEM5_SAL_SRCS "'${CMAKE_CURRENT_SOURCE_DIR}/gem5/Gem5Wrapper.cc'")
configure_file(gem5/SConscript.in ${CMAKE_CURRENT_BINARY_DIR}/gem5/SConscript) configure_file(gem5/SConscript.in ${CMAKE_CURRENT_BINARY_DIR}/gem5/SConscript)
endif(BUILD_GEM5) endif(BUILD_GEM5)
# Don't include these sources if perf-stuff is disabled # Don't include these sources if perf-stuff is disabled
# (reduces compiler overhead): # (reduces compiler overhead):

View File

@ -9,7 +9,7 @@ regdata_t PandaArmCPU::getRegisterContent(const Register* reg) const
regdata_t data; regdata_t data;
oocdw_read_reg(reg->getId(), &data); oocdw_read_reg(reg->getId(), &data);
return data; return data;
} }

View File

@ -1,5 +1,5 @@
#ifndef __PANDA_ARM_CPU_HPP__ #ifndef __PANDA_ARM_CPU_HPP__
#define __PANDA_ARM_CPU_HPP__ #define __PANDA_ARM_CPU_HPP__
#include "../arm/ArmArchitecture.hpp" #include "../arm/ArmArchitecture.hpp"
#include "../arm/ArmCPUState.hpp" #include "../arm/ArmCPUState.hpp"
@ -33,7 +33,7 @@ public:
*/ */
regdata_t getRegisterContent(const Register* reg) const; regdata_t getRegisterContent(const Register* reg) const;
/** /**
* Sets the register content for the \a current Pandaboard CPU. * Sets the register content for the \a current Pandaboard CPU.
* @param reg the (initialized) register object whose content should be set * @param reg the (initialized) register object whose content should be set
* @param value the new content of the register \c reg * @param value the new content of the register \c reg
*/ */

View File

@ -1,5 +1,5 @@
#ifndef __PANDA_BREAKPOINTS_AH__ #ifndef __PANDA_BREAKPOINTS_AH__
#define __PANDA_BREAKPOINTS_AH__ #define __PANDA_BREAKPOINTS_AH__
#include "config/FailConfig.hpp" #include "config/FailConfig.hpp"
#include "config/VariantConfig.hpp" #include "config/VariantConfig.hpp"
@ -11,38 +11,40 @@
aspect PandaBreakpoints aspect PandaBreakpoints
{ {
advice "fail::BPSingleListener" : slice class
{
public:
bool onAddition()
{
// Setup Breakpoint on Pandaboard
struct halt_condition hc;
if (m_WatchInstrPtr == ANY_ADDR) {
hc.type = HALT_TYPE_SINGLESTEP;
} else {
hc.type = HALT_TYPE_BP;
}
hc.address = m_WatchInstrPtr;
hc.addr_len= 4; // Thumb? => 2
oocdw_set_halt_condition(&hc);
return true;
}
void onDeletion() advice "fail::BPSingleListener" : slice class
{ {
// Delete Breakpoint on Pandaboard public:
struct halt_condition hc; bool onAddition()
if (m_WatchInstrPtr == ANY_ADDR) { {
hc.type = HALT_TYPE_SINGLESTEP; // Setup Breakpoint on Pandaboard
} else { struct halt_condition hc;
hc.type = HALT_TYPE_BP; if (m_WatchInstrPtr == ANY_ADDR) {
} hc.type = HALT_TYPE_SINGLESTEP;
hc.address = m_WatchInstrPtr; } else {
hc.addr_len= 4; // Thumb? => 2 hc.type = HALT_TYPE_BP;
oocdw_delete_halt_condition(&hc);
} }
}; hc.address = m_WatchInstrPtr;
hc.addr_len = 4; // Thumb? => 2
oocdw_set_halt_condition(&hc);
return true;
}
void onDeletion()
{
// Delete Breakpoint on Pandaboard
struct halt_condition hc;
if (m_WatchInstrPtr == ANY_ADDR) {
hc.type = HALT_TYPE_SINGLESTEP;
} else {
hc.type = HALT_TYPE_BP;
}
hc.address = m_WatchInstrPtr;
hc.addr_len = 4; // Thumb? => 2
oocdw_delete_halt_condition(&hc);
}
};
}; };
#endif // BUILD_PANDA && CONFIG_EVENT_BREAKPOINTS #endif // BUILD_PANDA && CONFIG_EVENT_BREAKPOINTS

View File

@ -5,13 +5,14 @@
*/ */
#ifndef __PANDA_CONFIG_HPP__ #ifndef __PANDA_CONFIG_HPP__
#define __PANDA_CONFIG_HPP__ #define __PANDA_CONFIG_HPP__
namespace fail { namespace fail {
typedef uint32_t host_address_t; //!< the host memory address type
typedef uint32_t guest_address_t; //!< the guest memory address type typedef uint32_t host_address_t; //!< the host memory address type
typedef uint32_t register_data_t; //!< register data type (32 bit) typedef uint32_t guest_address_t; //!< the guest memory address type
typedef int timer_t; //!< type of timer IDs typedef uint32_t register_data_t; //!< register data type (32 bit)
typedef int timer_t; //!< type of timer IDs
} // end-of-namespace: fail } // end-of-namespace: fail

View File

@ -9,7 +9,7 @@
#include "openocd_wrapper.hpp" #include "openocd_wrapper.hpp"
#if defined(CONFIG_FIRE_INTERRUPTS) #if defined(CONFIG_FIRE_INTERRUPTS)
#error Firing intterupts not implemented for Pandaboard #error Firing interrupts not implemented for Pandaboard
#endif #endif
#if defined(CONFIG_SR_REBOOT) || defined(CONFIG_SR_RESTORE) || defined(CONFIG_SR_SAVE) #if defined(CONFIG_SR_REBOOT) || defined(CONFIG_SR_RESTORE) || defined(CONFIG_SR_SAVE)
@ -56,16 +56,7 @@ void PandaController::onTimerTrigger(void* thisPtr)
bool PandaController::save(const std::string& path) bool PandaController::save(const std::string& path)
{ {
// ToDo (PORT): Save // TODO
/*int stat;
stat = mkdir(path.c_str(), 0777);
if (!(stat == 0 || errno == EEXIST)) {
return false;
// std::cout << "[FAIL] Can not create target-directory to save!" << std::endl;
// TODO: (Non-)Verbose-Mode? Log-level? Maybe better: use return value to indicate failure?
}*/
return true; return true;
} }
@ -73,11 +64,7 @@ bool PandaController::save(const std::string& path)
void PandaController::restore(const std::string& path) void PandaController::restore(const std::string& path)
{ {
clearListeners(); clearListeners();
/*restore_bochs_request = true; // TODO
BX_CPU(0)->async_event |= 1;
sr_path = path;*/
// ToDo (PORT): Restore
} }
void PandaController::reboot() void PandaController::reboot()

View File

@ -1,5 +1,5 @@
#ifndef __PANDA_CONTROLLER_HPP__ #ifndef __PANDA_CONTROLLER_HPP__
#define __PANDA_CONTROLLER_HPP__ #define __PANDA_CONTROLLER_HPP__
#include <string> #include <string>
#include <cassert> #include <cassert>

View File

@ -1,5 +1,5 @@
#ifndef __PANDA_LISTENER_HPP__ #ifndef __PANDA_LISTENER_HPP__
#define __PANDA_LISTENER_HPP__ #define __PANDA_LISTENER_HPP__
namespace fail { namespace fail {

View File

@ -1,5 +1,5 @@
#ifndef __PANDA_MEMORY_HPP__ #ifndef __PANDA_MEMORY_HPP__
#define __PANDA_MEMORY_HPP__ #define __PANDA_MEMORY_HPP__
#include "../Memory.hpp" #include "../Memory.hpp"
@ -19,7 +19,7 @@ public:
* Constructs a new MemoryManager object and initializes * Constructs a new MemoryManager object and initializes
* it's attributes appropriately. * it's attributes appropriately.
*/ */
PandaMemoryManager() : MemoryManager() { } PandaMemoryManager() : MemoryManager() { }
/** /**
* Retrieves the size of the available simulated memory. * Retrieves the size of the available simulated memory.
* @return the size of the memory pool in bytes * @return the size of the memory pool in bytes

View File

@ -1,5 +1,5 @@
#ifndef __PANDA_TIMER_AH__ #ifndef __PANDA_TIMER_AH__
#define __PANDA_TIMER_AH__ #define __PANDA_TIMER_AH__
#include "config/VariantConfig.hpp" #include "config/VariantConfig.hpp"
#include "config/FailConfig.hpp" #include "config/FailConfig.hpp"
@ -10,40 +10,42 @@
#include "PandaListener.hpp" #include "PandaListener.hpp"
aspect PandaTimer { aspect PandaTimer {
advice "fail::TimerListener" : slice class {
public: advice "fail::TimerListener" : slice class {
bool onAddition() public:
{ bool onAddition()
// Register the timer listener in the Bochs simulator: {
timer_id_t id = m_registerTimer(this); // Register the timer listener in the Bochs simulator:
if (id == -1) { timer_id_t id = m_registerTimer(this);
setId(INVALID_TIMER); if (id == -1) {
return false; // unable to register the timer (error in Bochs' function call) setId(INVALID_TIMER);
} return false; // unable to register the timer (error in Bochs' function call)
setId(id);
return true;
} }
void onDeletion() setId(id);
{ return true;
// Unregister the time listener: }
m_unregisterTimer(this); void onDeletion()
} {
private: // Unregister the time listener:
timer_id_t m_registerTimer(TimerListener* pev) m_unregisterTimer(this);
{ }
assert(pev != NULL && "FATAL ERROR: TimerListener object ptr cannot be NULL!"); private:
return static_cast<timer_id_t>( timer_id_t m_registerTimer(TimerListener* pev)
oocdw_register_timer(pev, fail::onTimerTrigger, {
pev->getTimeout() /*timeout in microseconds*/, assert(pev != NULL && "FATAL ERROR: TimerListener object ptr cannot be NULL!");
true /*start immediately*/, "Fail*: PandaController"/*name*/)); return static_cast<timer_id_t>(
} oocdw_register_timer(pev, fail::onTimerTrigger,
bool m_unregisterTimer(TimerListener* pev) pev->getTimeout() /*timeout in microseconds*/,
{ true /*start immediately*/, "Fail*: PandaController"/*name*/));
assert(pev != NULL && "FATAL ERROR: TimerListener object ptr cannot be NULL!"); }
oocdw_deactivate_timer(static_cast<unsigned>(pev->getId())); bool m_unregisterTimer(TimerListener* pev)
return oocdw_unregisterTimer(static_cast<unsigned>(pev->getId())); {
} assert(pev != NULL && "FATAL ERROR: TimerListener object ptr cannot be NULL!");
}; oocdw_deactivate_timer(static_cast<unsigned>(pev->getId()));
return oocdw_unregisterTimer(static_cast<unsigned>(pev->getId()));
}
};
}; };
#endif // BUILD_PANDA && CONFIG_EVENT_BREAKPOINTS #endif // BUILD_PANDA && CONFIG_EVENT_BREAKPOINTS

View File

@ -1,5 +1,5 @@
#ifndef __PANDA_WATCHPOINTS_AH__ #ifndef __PANDA_WATCHPOINTS_AH__
#define __PANDA_WATCHPOINTS_AH__ #define __PANDA_WATCHPOINTS_AH__
#include "config/FailConfig.hpp" #include "config/FailConfig.hpp"
#include "config/VariantConfig.hpp" #include "config/VariantConfig.hpp"
@ -11,49 +11,56 @@
aspect PandaWatchpoints aspect PandaWatchpoints
{ {
advice "fail::MemAccessListener" : slice class
advice "fail::MemAccessListener" : slice class
{
int m_t32access;
public:
bool onAddition()
{ {
int m_t32access; // Setup Watchpoint on Pandaboard (if it can't be realized as WP, MMU will be utilized)
public: struct halt_condition hc;
bool onAddition()
{
// Setup Watchpoint on Pandaboard (if it cant be realized as WP, mmu will be utilzed)
struct halt_condition hc;
switch(m_WatchType) {
case MemAccessEvent::MEM_READ: hc.type = HALT_TYPE_WP_READ; break;
case MemAccessEvent::MEM_WRITE: hc.type = HALT_TYPE_WP_WRITE; break;
case MemAccessEvent::MEM_READWRITE: hc.type = HALT_TYPE_WP_READWRITE; break;
default: return false;
}
hc.address = m_WatchAddr;
hc.addr_len = m_WatchWidth;
oocdw_set_halt_condition(&hc); switch (m_WatchType) {
case MemAccessEvent::MEM_READ:
return true; hc.type = HALT_TYPE_WP_READ; break;
case MemAccessEvent::MEM_WRITE:
hc.type = HALT_TYPE_WP_WRITE; break;
case MemAccessEvent::MEM_READWRITE:
hc.type = HALT_TYPE_WP_READWRITE; break;
default: return false;
} }
void onDeletion() hc.address = m_WatchAddr;
{ hc.addr_len = m_WatchWidth;
// Remove Watchpoint from Pandaboard (if it was realized by mmu, it will be reprogrammed)
struct halt_condition hc; oocdw_set_halt_condition(&hc);
switch(m_WatchType) { return true;
case MemAccessEvent::MEM_READ: hc.type = HALT_TYPE_WP_READ; break; }
case MemAccessEvent::MEM_WRITE: hc.type = HALT_TYPE_WP_WRITE; break;
case MemAccessEvent::MEM_READWRITE: hc.type = HALT_TYPE_WP_READWRITE; break; void onDeletion()
default: return; // ToDo: Error handling {
} // Remove Watchpoint from Pandaboard (if it was realized by MMU, it will be reprogrammed)
struct halt_condition hc;
hc.address = m_WatchAddr;
hc.addr_len = m_WatchWidth; switch (m_WatchType) {
case MemAccessEvent::MEM_READ:
// ToDo: Error handling hc.type = HALT_TYPE_WP_READ; break;
oocdw_delete_halt_condition(&hc); case MemAccessEvent::MEM_WRITE:
hc.type = HALT_TYPE_WP_WRITE; break;
case MemAccessEvent::MEM_READWRITE:
hc.type = HALT_TYPE_WP_READWRITE; break;
default: return; // ToDo: Error handling
} }
};
hc.address = m_WatchAddr;
hc.addr_len = m_WatchWidth;
// ToDo: Error handling
oocdw_delete_halt_condition(&hc);
}
};
}; };

View File

@ -66,8 +66,8 @@ mark_as_advanced(FAIL_OBJDUMP)
# compile smarthops calculator if needed # compile smarthops calculator if needed
if(CONFIG_INJECTIONPOINT_HOPS) if(CONFIG_INJECTIONPOINT_HOPS)
add_subdirectory(smarthops) add_subdirectory(smarthops)
set(ADDITIONAL_LIBS fail-smarthops) set(ADDITIONAL_LIBS fail-smarthops)
endif(CONFIG_INJECTIONPOINT_HOPS) endif(CONFIG_INJECTIONPOINT_HOPS)
add_library(fail-util ${SRCS}) add_library(fail-util ${SRCS})
@ -78,4 +78,3 @@ option(BUILD_LLVM_DISASSEMBLER "Build the LLVM-based disassembler (LLVM 3.3 pref
if (BUILD_LLVM_DISASSEMBLER) if (BUILD_LLVM_DISASSEMBLER)
add_subdirectory(llvmdisassembler) add_subdirectory(llvmdisassembler)
endif (BUILD_LLVM_DISASSEMBLER) endif (BUILD_LLVM_DISASSEMBLER)

View File

@ -31,7 +31,7 @@ void SmartHops::convertToIPM(std::vector<result_tuple > &result, unsigned costs,
} }
ipm.set_costs(costs); ipm.set_costs(costs);
for(;it_hop != result.end(); for (; it_hop != result.end();
it_hop++) { it_hop++) {
InjectionPointMessage_Hops *hop = ipm.add_hops(); InjectionPointMessage_Hops *hop = ipm.add_hops();
hop->set_address(it_hop->first.first); hop->set_address(it_hop->first.first);
@ -116,7 +116,7 @@ bool SmartHops::calculateFollowingHop(InjectionPointMessage &ip, unsigned instru
continue; continue;
} }
// Deltion of unnecessary hops // Deletion of unnecessary hops
/* /*
* |----------------| * |----------------|

View File

@ -30,8 +30,8 @@ public:
// ToDo: If you want to use checkoints as additional hop-chain-element, you may switch // ToDo: If you want to use checkoints as additional hop-chain-element, you may switch
// m_use_checkpoints to true, but there will be additional changes needed for this to fully work. // m_use_checkpoints to true, but there will be additional changes needed for this to fully work.
// The sal must, for example, generate CPs at the given positions // The sal must, for example, generate CPs at the given positions
SmartHops() : m_trace_pos(0), m_costs(0), m_next_cp_id(0), m_log("SmartHops", false), m_use_watchpoints(true), SmartHops() : m_trace_pos(0), m_costs(0), m_next_cp_id(0), m_log("SmartHops", false), m_use_watchpoints(true),
m_use_weights(true), m_use_checkpoints(false), m_cp_thresh(0), m_cost_cp(0), m_rollback_thresh(0){} m_use_weights(true), m_use_checkpoints(false), m_cp_thresh(0), m_cost_cp(0), m_rollback_thresh(0) {}
/** /**
* Initializes the used TraceReader with given trace file path * Initializes the used TraceReader with given trace file path
@ -44,24 +44,24 @@ public:
* @param filename Path to the trace file * @param filename Path to the trace file
* @returns \c true if calculation succeeded and \c false if it did not * @returns \c true if calculation succeeded and \c false if it did not
*/ */
bool calculateFollowingHop(InjectionPointMessage &ip, unsigned instruction_offset); bool calculateFollowingHop(InjectionPointMessage &ip, unsigned instruction_offset);
private: private:
/** /**
* Converts internal representation of a hop chain to a * Converts internal representation of a hop chain to a
* InjectionPointMessage. The delivered InjectionPointMessage is * InjectionPointMessage. The delivered InjectionPointMessage is
* cleared before parsing. * cleared before parsing.
* @param result Internal representation of a hop chain * @param result Internal representation of a hop chain
* @param costs Costs of the hop chain (extracted from cost model) * @param costs Costs of the hop chain (extracted from cost model)
* @param ipm InjectionPointMessage to which the hop chain is parsed * @param ipm InjectionPointMessage to which the hop chain is parsed
*/ */
void convertToIPM(std::vector<result_tuple > &result, unsigned costs, InjectionPointMessage &ipm); void convertToIPM(std::vector<result_tuple > &result, unsigned costs, InjectionPointMessage &ipm);
unsigned int m_trace_pos; unsigned int m_trace_pos;
unsigned int m_costs; unsigned int m_costs;
TraceReader m_trace_reader; TraceReader m_trace_reader;
unsigned int m_next_cp_id; unsigned int m_next_cp_id;
Logger m_log; Logger m_log;
bool m_use_watchpoints; bool m_use_watchpoints;
@ -77,10 +77,10 @@ private:
unsigned int m_rollback_thresh; unsigned int m_rollback_thresh;
std::map<trace_event_tuple_t, trace_pos_t> m_last_positions; std::map<trace_event_tuple_t, trace_pos_t> m_last_positions;
std::vector<checkpoint_tuple_t > m_checkpoints; std::vector<checkpoint_tuple_t > m_checkpoints;
std::vector<trace_event_tuple_t > m_trace_events; std::vector<trace_event_tuple_t > m_trace_events;
std::vector<result_tuple > m_result; std::vector<result_tuple > m_result;
}; };

View File

@ -53,7 +53,7 @@ bool TraceReader::openTraceFile(const char *filename, unsigned int num_inst)
} }
bool TraceReader::getNextTraceEvents(trace_pos_t& trace_pos, bool TraceReader::getNextTraceEvents(trace_pos_t& trace_pos,
std::vector<trace_event_tuple_t >& trace_events) std::vector<trace_event_tuple_t >& trace_events)
{ {
// Stop after fixed number of instructions, if given as command line argument // Stop after fixed number of instructions, if given as command line argument
if ((m_max_num_inst > 0) && (m_current_position > m_max_num_inst)) { if ((m_max_num_inst > 0) && (m_current_position > m_max_num_inst)) {
@ -86,15 +86,15 @@ bool TraceReader::getNextTraceEvents(trace_pos_t& trace_pos,
ev_avail = true; ev_avail = true;
break; break;
} }
// Add a trace_event for every byte in memory access. // Add a trace_event for every byte in memory access.
// This breaks down the calculations to multiple // This breaks down the calculations to multiple
// memory accesses of length 1. No more complexity // memory accesses of length 1. No more complexity
// is needed in hop calculations. // is needed in hop calculations.
if (ev.has_width()) { if (ev.has_width()) {
for (unsigned int i = 0; i < ev.width(); i++) { for (unsigned int i = 0; i < ev.width(); i++) {
trace_events.push_back( trace_events.push_back(
trace_event_tuple_t(ev.memaddr() + i, trace_event_tuple_t(ev.memaddr() + i,
ev.accesstype() == ev.READ ? ACCESS_READ : ACCESS_WRITE)); ev.accesstype() == ev.READ ? ACCESS_READ : ACCESS_WRITE));
} }
} }

View File

@ -14,11 +14,11 @@
namespace fail { namespace fail {
typedef enum { typedef enum {
ACCESS_NONE , ACCESS_NONE,
ACCESS_READ , ACCESS_READ,
ACCESS_WRITE , ACCESS_WRITE,
ACCESS_READORWRITE , // some architectures can't distinguish read and write WPs in general (e.g. x86) ACCESS_READORWRITE, // some architectures can't distinguish read and write WPs in general (e.g. x86)
ACCESS_CHECKPOINT , ACCESS_CHECKPOINT,
} mem_access_type_e; } mem_access_type_e;
typedef uint32_t address_t; typedef uint32_t address_t;
@ -26,33 +26,32 @@ typedef uint32_t trace_pos_t;
typedef std::pair<address_t, mem_access_type_e> trace_event_tuple_t; typedef std::pair<address_t, mem_access_type_e> trace_event_tuple_t;
class TraceReader { class TraceReader {
public: public:
TraceReader() : m_current_position(1),
ps(0),
normal_stream(0),
gz_stream(0),
m_max_num_inst(0),
ev_avail(false),
m_log("TraceReader", false) {}
TraceReader() : m_current_position(1), ~TraceReader();
ps(0),
normal_stream(0),
gz_stream(0),
m_max_num_inst(0),
ev_avail(false),
m_log("TraceReader", false) {}
~TraceReader(); // Returns ACCESS_NONE in mem_access if current instruction does not access memory
bool getNextTraceEvents(trace_pos_t& trace_pos,
std::vector<trace_event_tuple_t >& trace_events);
// Returns ACCESS_NONE in mem_access if current instruction does not access memory bool openTraceFile(const char *filename, unsigned int num_inst = 0);
bool getNextTraceEvents(trace_pos_t& trace_pos, private:
std::vector<trace_event_tuple_t >& trace_events); unsigned int m_current_position;
ProtoIStream* ps;
std::ifstream *normal_stream;
igzstream *gz_stream;
unsigned int m_max_num_inst;
Trace_Event ev;
bool ev_avail;
bool openTraceFile(const char *filename, unsigned int num_inst = 0); Logger m_log;
private:
unsigned int m_current_position;
ProtoIStream* ps;
std::ifstream *normal_stream;
igzstream *gz_stream;
unsigned int m_max_num_inst;
Trace_Event ev;
bool ev_avail;
Logger m_log;
}; };
} // end of namespace } // end of namespace

View File

@ -5,7 +5,7 @@ configure_file(../instantiate-experiment.ah.in
) )
## Setup desired protobuf descriptions HERE ## ## Setup desired protobuf descriptions HERE ##
set(MY_PROTOS set(MY_PROTOS
lra_simple.proto lra_simple.proto
) )

View File

@ -11,9 +11,9 @@ using namespace std;
using namespace fail; using namespace fail;
using namespace google::protobuf; using namespace google::protobuf;
void LraSimpleCampaign::cb_send_pilot(DatabaseCampaignMessage pilot) { void LraSimpleCampaign::cb_send_pilot(DatabaseCampaignMessage pilot)
{
LraSimpleExperimentData *data = new LraSimpleExperimentData; LraSimpleExperimentData *data = new LraSimpleExperimentData;
data->msg.mutable_fsppilot()->CopyFrom(pilot); data->msg.mutable_fsppilot()->CopyFrom(pilot);
campaignmanager.addParam(data); campaignmanager.addParam(data);
} }

View File

@ -14,7 +14,7 @@ public:
}; };
class LraSimpleCampaign : public fail::DatabaseCampaign { class LraSimpleCampaign : public fail::DatabaseCampaign {
virtual const google::protobuf::Descriptor * cb_result_message() virtual const google::protobuf::Descriptor * cb_result_message()
{ return google::protobuf::DescriptorPool::generated_pool()->FindMessageTypeByName("LraSimpleProtoMsg"); } { return google::protobuf::DescriptorPool::generated_pool()->FindMessageTypeByName("LraSimpleProtoMsg"); }
virtual void cb_send_pilot(DatabaseCampaignMessage pilot); virtual void cb_send_pilot(DatabaseCampaignMessage pilot);

View File

@ -54,7 +54,6 @@ int32_t correct_result[100] = {
0, 0, 0, 0 0, 0, 0, 0
}; };
// ToDo: Move this functionality to SimulatorController // ToDo: Move this functionality to SimulatorController
bool LRASimplePandaExperiment::navigateToInjectionPoint(ConcreteInjectionPoint &ip) { bool LRASimplePandaExperiment::navigateToInjectionPoint(ConcreteInjectionPoint &ip) {
Logger log_nav("navigator", false); Logger log_nav("navigator", false);
@ -66,11 +65,10 @@ bool LRASimplePandaExperiment::navigateToInjectionPoint(ConcreteInjectionPoint &
if (ipm.has_checkpoint_id()) { if (ipm.has_checkpoint_id()) {
// ToDo: Load CP state! // ToDo: Load CP state!
log_nav << "FATAL ERROR: CPs not yet implemented!" << endl; log_nav << "FATAL ERROR: CPs not yet implemented!" << endl;
simulator.terminate(1); simulator.terminate(1);
} }
log_nav << "Navigating to next instruction at navigational costs of " << ipm.costs() << endl; log_nav << "Navigating to next instruction at navigational costs of " << ipm.costs() << endl;
log_nav << "Length of hop-chain: " << ipm.hops_size() << endl; log_nav << "Length of hop-chain: " << ipm.hops_size() << endl;
@ -110,7 +108,6 @@ bool LRASimplePandaExperiment::navigateToInjectionPoint(ConcreteInjectionPoint &
log_nav << "FATAL ERROR: Unexpected event while navigating!" << endl; log_nav << "FATAL ERROR: Unexpected event while navigating!" << endl;
simulator.terminate(1); simulator.terminate(1);
} }
} }
#else #else
// Step nav // Step nav
@ -195,7 +192,7 @@ bool LRASimplePandaExperiment::run()
while (true) { while (true) {
logger << "asking jobserver for parameters. Undone: "<<jobClient->getNumberOfUndoneJobs() << endl; logger << "asking jobserver for parameters. Undone: "<<jobClient->getNumberOfUndoneJobs() << endl;
LraSimpleExperimentData param; LraSimpleExperimentData param;
if(!jobClient->getParam(param)){ if (!jobClient->getParam(param)) {
logger << "Dying." << endl; // We were told to die. logger << "Dying." << endl; // We were told to die.
simulator.terminate(1); simulator.terminate(1);
} }
@ -203,17 +200,17 @@ bool LRASimplePandaExperiment::run()
logger << "New param" << param.msg.DebugString() << endl; logger << "New param" << param.msg.DebugString() << endl;
// Get input data from Jobserver // Get input data from Jobserver
unsigned injection_instr = param.msg.fsppilot().injection_instr(); unsigned injection_instr = param.msg.fsppilot().injection_instr();
address_t data_address = param.msg.fsppilot().data_address(); address_t data_address = param.msg.fsppilot().data_address();
// unsigned data_width = param.msg.fsppilot().data_width(); // unsigned data_width = param.msg.fsppilot().data_width();
ConcreteInjectionPoint ip; ConcreteInjectionPoint ip;
ip.parseFromCampaignMessage(param.msg.fsppilot()); ip.parseFromCampaignMessage(param.msg.fsppilot());
for (unsigned experiment_id = 0; experiment_id < LRASP_NUM_EXP_PER_PILOT; ++experiment_id) { for (unsigned experiment_id = 0; experiment_id < LRASP_NUM_EXP_PER_PILOT; ++experiment_id) {
LraSimpleProtoMsg_Result *result = param.msg.add_result(); LraSimpleProtoMsg_Result *result = param.msg.add_result();
executed_jobs ++; executed_jobs ++;
WallclockTimer timer; WallclockTimer timer;
timer.startTimer(); timer.startTimer();
/******************** /********************
@ -255,7 +252,6 @@ bool LRASimplePandaExperiment::run()
// Alternatively for single-bit-flips: // Alternatively for single-bit-flips:
// data ^= 1 << experiment_id; // data ^= 1 << experiment_id;
logger << "Injection bitflips at address " << hex << data_address << dec << endl; logger << "Injection bitflips at address " << hex << data_address << dec << endl;
timer.startTimer(); timer.startTimer();
@ -321,7 +317,7 @@ bool LRASimplePandaExperiment::run()
BaseListener* ev = simulator.resume(); BaseListener* ev = simulator.resume();
if (ev == &ev_timeout) { if (ev == &ev_timeout) {
logger << "Timeout!" << endl; logger << "Timeout!" << endl;
result->set_resulttype(result->ERR_TIMEOUT); result->set_resulttype(result->ERR_TIMEOUT);
} else if (ev == &ev_trap) { } else if (ev == &ev_trap) {
logger << "Trap!" << endl; logger << "Trap!" << endl;
@ -332,7 +328,7 @@ bool LRASimplePandaExperiment::run()
ev == &ev_unauth_mem_acc_4) { ev == &ev_unauth_mem_acc_4) {
result->set_resulttype(result->ERR_OUTSIDE_TEXT); result->set_resulttype(result->ERR_OUTSIDE_TEXT);
logger << hex << "Unauthorized memory access (" << ((((MemAccessListener*)ev)->getTriggerAccessType() == fail::MemAccessEvent::MEM_READ) ? "R" : "W") << logger << hex << "Unauthorized memory access (" << ((((MemAccessListener*)ev)->getTriggerAccessType() == fail::MemAccessEvent::MEM_READ) ? "R" : "W") <<
") at instruction " << ((MemAccessListener*)ev)->getTriggerInstructionPointer() << " access address: " << ") at instruction " << ((MemAccessListener*)ev)->getTriggerInstructionPointer() << " access address: " <<
((MemAccessListener*)ev)->getTriggerAddress() << dec << endl; ((MemAccessListener*)ev)->getTriggerAddress() << dec << endl;
} else if (ev == &ev_func_end) { } else if (ev == &ev_func_end) {
@ -357,12 +353,12 @@ bool LRASimplePandaExperiment::run()
result->set_experiment_number(executed_jobs); result->set_experiment_number(executed_jobs);
simulator.clearListeners(); simulator.clearListeners();
} }
jobClient->sendResult(param); jobClient->sendResult(param);
logger << param.debugString(); logger << param.debugString();
} }
logger << "jobClient.getNumberOfUndoneJobs() = " << jobClient->getNumberOfUndoneJobs() << "executed_jobs = " << executed_jobs << endl; logger << "jobClient.getNumberOfUndoneJobs() = " << jobClient->getNumberOfUndoneJobs() << "executed_jobs = " << executed_jobs << endl;

View File

@ -1,6 +1,6 @@
#ifndef __LRA_SIMPLE_PANDA_EXPERIMENT_HPP__ #ifndef __LRA_SIMPLE_PANDA_EXPERIMENT_HPP__
#define __LRA_SIMPLE_PANDA_EXPERIMENT_HPP__ #define __LRA_SIMPLE_PANDA_EXPERIMENT_HPP__
#include "efw/ExperimentFlow.hpp" #include "efw/ExperimentFlow.hpp"
#include "cpn/InjectionPoint.hpp" #include "cpn/InjectionPoint.hpp"
#include "util/ElfReader.hpp" #include "util/ElfReader.hpp"

View File

@ -6,25 +6,24 @@ message LraSimpleProtoMsg {
repeated group Result = 2 { repeated group Result = 2 {
enum ResultType { enum ResultType {
OK = 1; OK = 1;
ERR_WRONG_RESULT = 2; ERR_WRONG_RESULT = 2;
ERR_TRAP = 3; ERR_TRAP = 3;
ERR_TIMEOUT = 4; ERR_TIMEOUT = 4;
ERR_OUTSIDE_TEXT = 5; ERR_OUTSIDE_TEXT = 5;
} }
//required int32 bitoffset = 1 [(sql_primary_key) = true]; //required int32 bitoffset = 1 [(sql_primary_key) = true];
required uint32 experiment_number = 1 [(sql_primary_key) = true]; required uint32 experiment_number = 1 [(sql_primary_key) = true];
required ResultType resulttype = 2; required ResultType resulttype = 2;
// Times for evaluation // Times for evaluation
required float time_init = 3; required float time_init = 3;
required float time_nav = 4; required float time_nav = 4;
required float time_inject = 5; required float time_inject = 5;
required float time_aftermath = 6; required float time_aftermath = 6;
} }
} }

View File

@ -8,8 +8,9 @@
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
fail::CommandLine &cmd = fail::CommandLine::Inst(); fail::CommandLine &cmd = fail::CommandLine::Inst();
for (int i = 1; i < argc; ++i) for (int i = 1; i < argc; ++i) {
cmd.add_args(argv[i]); cmd.add_args(argv[i]);
}
LraSimpleCampaign c; LraSimpleCampaign c;
if (fail::campaignmanager.runCampaign(&c)) { if (fail::campaignmanager.runCampaign(&c)) {

View File

@ -27,9 +27,9 @@ if(BUILD_CONVERT_TRACE)
endif(BUILD_CONVERT_TRACE) endif(BUILD_CONVERT_TRACE)
if(BUILD_COMPUTE_HOPS) if(BUILD_COMPUTE_HOPS)
add_subdirectory(compute-hops) add_subdirectory(compute-hops)
endif(BUILD_COMPUTE_HOPS) endif(BUILD_COMPUTE_HOPS)
if(BUILD_DUMP_HOPS) if(BUILD_DUMP_HOPS)
add_subdirectory(dump-hops) add_subdirectory(dump-hops)
endif(BUILD_DUMP_HOPS) endif(BUILD_DUMP_HOPS)

View File

@ -5,19 +5,18 @@
class ResultCollector; class ResultCollector;
class BasicAlgorithm { class BasicAlgorithm {
public: public:
/** /**
* *
* @returns boolean value for calculation success * @returns boolean value for calculation success
*/ */
virtual bool calculateAllHops(fail::TraceReader& trace) = 0; virtual bool calculateAllHops(fail::TraceReader& trace) = 0;
BasicAlgorithm(ResultCollector *rc) {m_resultCollector = rc;} BasicAlgorithm(ResultCollector *rc) { m_resultCollector = rc; }
virtual ~BasicAlgorithm() {} virtual ~BasicAlgorithm() {}
protected: protected:
ResultCollector *m_resultCollector; ResultCollector *m_resultCollector;
}; };
#endif // __BASIC_ALGORITHM__HPP #endif // __BASIC_ALGORITHM__HPP

View File

@ -5,7 +5,7 @@ set(SRCS
) )
if(NOT CONFIG_INJECTIONPOINT_HOPS) if(NOT CONFIG_INJECTIONPOINT_HOPS)
message (FATAL_ERROR "For building the compute-hops tool you need to enable CONFIG_INJECTIONPOINT_HOPS") message (FATAL_ERROR "For building the compute-hops tool you need to enable CONFIG_INJECTIONPOINT_HOPS")
endif() endif()
add_executable(compute-hops main.cc ${SRCS}) add_executable(compute-hops main.cc ${SRCS})

View File

@ -74,7 +74,7 @@ ResultCollector::addResult(std::vector<result_tuple >& res, unsigned int costs)
if (ps) { if (ps) {
InjectionPointMessage hc; InjectionPointMessage hc;
hc.set_costs(costs); hc.set_costs(costs);
hc.set_target_trace_position(res.back().second); hc.set_target_trace_position(res.back().second);
// If checkpoint at beginning of hop-chain, add its id to InjectionPointMessage // If checkpoint at beginning of hop-chain, add its id to InjectionPointMessage
std::vector<result_tuple >::iterator it_hop = res.begin(); std::vector<result_tuple >::iterator it_hop = res.begin();
if (it_hop != res.end() && it_hop->first.second == ACCESS_CHECKPOINT) { if (it_hop != res.end() && it_hop->first.second == ACCESS_CHECKPOINT) {
@ -82,7 +82,7 @@ ResultCollector::addResult(std::vector<result_tuple >& res, unsigned int costs)
it_hop++; it_hop++;
} }
for(;it_hop != res.end(); for (; it_hop != res.end();
it_hop++) { it_hop++) {
InjectionPointMessage_Hops *hop = hc.add_hops(); InjectionPointMessage_Hops *hop = hc.add_hops();
hop->set_address(it_hop->first.first); hop->set_address(it_hop->first.first);
@ -111,7 +111,7 @@ ResultCollector::addResult(std::vector<result_tuple >& res, unsigned int costs)
} }
ps->writeMessage(&hc); ps->writeMessage(&hc);
} else { } else {
for(std::vector<result_tuple >::iterator it_hop = res.begin(); for (std::vector<result_tuple >::iterator it_hop = res.begin();
it_hop != res.end(); it_hop != res.end();
it_hop++) { it_hop++) {
address_t add = it_hop->first.first; address_t add = it_hop->first.first;

View File

@ -45,7 +45,7 @@ public:
m_checkpoint_count(1), m_checkpoint_count(1),
m_it_mean_costs(0), m_it_mean_costs(0),
m_max_costs(0), m_max_costs(0),
ps(0){} ps(0) {}
void void
addResult(std::vector<result_tuple >& res, unsigned int costs); addResult(std::vector<result_tuple >& res, unsigned int costs);
@ -87,5 +87,3 @@ private:
}; };
#endif /* STATISTICSCOLLECTOR_HPP_ */ #endif /* STATISTICSCOLLECTOR_HPP_ */

View File

@ -1,7 +1,6 @@
#ifndef SIMPLE_ALGORITHM__HPP #ifndef SIMPLE_ALGORITHM__HPP
#define SIMPLE_ALGORITHM__HPP #define SIMPLE_ALGORITHM__HPP
//#include <vector>
#include <map> #include <map>
#include "BasicAlgorithm.hpp" #include "BasicAlgorithm.hpp"
@ -16,15 +15,14 @@ public:
SimpleAlgorithm(ResultCollector *rc) : BasicAlgorithm(rc) {} SimpleAlgorithm(ResultCollector *rc) : BasicAlgorithm(rc) {}
virtual ~SimpleAlgorithm() {} virtual ~SimpleAlgorithm() {}
bool calculateAllHops(TraceReader& trace); bool calculateAllHops(TraceReader& trace);
private: private:
// Count occurences // Count occurences
//map<trace_event_tuple_t, vector<trace_pos_t> > m_occurences; //map<trace_event_tuple_t, vector<trace_pos_t> > m_occurences;
std::map<trace_event_tuple_t, unsigned long > m_occurences; std::map<trace_event_tuple_t, unsigned long> m_occurences;
std::map<trace_event_tuple_t, unsigned long > m_occ_cp; std::map<trace_event_tuple_t, unsigned long> m_occ_cp;
}; };
#endif // SIMPLE_ALGORITHM__HPP #endif // SIMPLE_ALGORITHM__HPP

View File

@ -71,7 +71,7 @@ bool SmartAlgorithm::calculateAllHops(TraceReader& trace)
continue; continue;
} }
// Deltion of unnecessary hops // Deletion of unnecessary hops
/* /*
* |----------------| * |----------------|

View File

@ -21,19 +21,19 @@ public:
SmartAlgorithm(ResultCollector *rc) : BasicAlgorithm(rc), m_next_cp_id(0) {} SmartAlgorithm(ResultCollector *rc) : BasicAlgorithm(rc), m_next_cp_id(0) {}
virtual ~SmartAlgorithm() {} virtual ~SmartAlgorithm() {}
bool calculateAllHops(TraceReader& trace); bool calculateAllHops(TraceReader& trace);
private: private:
bool bool
occurenceInPosIntervall(unsigned int intervall_low, occurenceInPosIntervall(unsigned int intervall_low,
unsigned int intervall_high, unsigned int intervall_high,
address_t add, address_t add,
mem_access_type_e acc); mem_access_type_e acc);
std::map<trace_event_tuple_t, trace_pos_t> m_last_positions; std::map<trace_event_tuple_t, trace_pos_t> m_last_positions;
std::vector<checkpoint_tuple_t > m_checkpoints; std::vector<checkpoint_tuple_t > m_checkpoints;
unsigned int m_next_cp_id; unsigned int m_next_cp_id;
}; };
#endif // SMART_ALGORITHM__HPP #endif // SMART_ALGORITHM__HPP

View File

@ -37,7 +37,6 @@ Logger LOG("hop-calculator", false);
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
// Manually fill the command line option parser // Manually fill the command line option parser
CommandLine &cmd = CommandLine::Inst(); CommandLine &cmd = CommandLine::Inst();
@ -239,7 +238,7 @@ int main(int argc, char *argv[])
if (cmd[CHECKPOINT_OUTPUT_FILE].count() > 0) { if (cmd[CHECKPOINT_OUTPUT_FILE].count() > 0) {
std::string filename(cmd[CHECKPOINT_OUTPUT_FILE].first()->arg); std::string filename(cmd[CHECKPOINT_OUTPUT_FILE].first()->arg);
g_cp_ofstream.open(filename.c_str()); g_cp_ofstream.open(filename.c_str());
if(!g_cp_ofstream.is_open()) { if (!g_cp_ofstream.is_open()) {
LOG << "Unable to open cp_out_file " << filename << std::endl; LOG << "Unable to open cp_out_file " << filename << std::endl;
exit(-1); exit(-1);
} }
@ -282,32 +281,32 @@ int main(int argc, char *argv[])
BasicAlgorithm *algo; BasicAlgorithm *algo;
switch (algorithm) { switch (algorithm) {
case ALGO_SMART: case ALGO_SMART:
algo = new SmartAlgorithm(&rc); algo = new SmartAlgorithm(&rc);
break; break;
case ALGO_SIMPLE: case ALGO_SIMPLE:
algo = new SimpleAlgorithm(&rc); algo = new SimpleAlgorithm(&rc);
break; break;
default: default:
break; break;
} }
rc.startTimer(); rc.startTimer();
algo->calculateAllHops(trace); algo->calculateAllHops(trace);
rc.stopTimer(); rc.stopTimer();
rc.finish(); rc.finish();
// ToDo: close output file if not stdout // ToDo: close output file if not stdout
if (outFile != &std::cout) { if (outFile != &std::cout) {
((std::ofstream*)outFile)->close(); ((std::ofstream*)outFile)->close();
delete (std::ofstream*)outFile; delete (std::ofstream*)outFile;
} }
if (g_use_checkpoints) { if (g_use_checkpoints) {
g_cp_ofstream.close(); g_cp_ofstream.close();
} }
return 0; return 0;
} }