GenericTracing/-Experiment: add SDC detection

This change adds detection of SDCs to GenericTracing and
GenericExperiment via Bochs's I/O port E9.

Change-Id: Ie036aa97468b45cad94b6c8f73d1ef2d227547b2
This commit is contained in:
Michael Lenz
2016-02-10 12:15:01 +01:00
committed by Horst Schirmeier
parent ad558abeb6
commit d46b81eb3d
5 changed files with 85 additions and 2 deletions

View File

@ -67,6 +67,8 @@ void GenericTracing::parseOptions() {
"--serial-port \tListen to a given I/O address (default: 0x3F8)");
CommandLine::option_handle SERIAL_FILE = cmd.addOption("", "serial-file", Arg::Required,
"--serial-file \tSave the serial output to file");
CommandLine::option_handle E9_FILE = cmd.addOption("", "e9-file", Arg::Required,
"--e9-file FILE \tData logged via port 0xE9 is stored in this file");
if (!cmd.parse()) {
cerr << "Error parsing arguments." << endl;
@ -228,6 +230,14 @@ void GenericTracing::parseOptions() {
serial_file = "";
}
if (cmd[E9_FILE]) {
e9_file = std::string(cmd[E9_FILE].first()->arg);
m_log << "port E9 output is written to: " << e9_file << std::endl;
} else {
e9_file = "";
}
if (m_elf != NULL) {
m_log << "start/save symbol: " << start_symbol << " 0x" << std::hex << start_address << std::endl;
m_log << "stop symbol: " << stop_symbol << " 0x" << std::hex << stop_address << std::endl;
@ -287,6 +297,12 @@ bool GenericTracing::run()
simulator.addFlow(&sol);
}
SerialOutputLogger e9_sol(0xE9);
if (e9_file != "") {
simulator.addFlow(&e9_sol);
}
////////////////////////////////////////////////////////////////
// Step 2: Continue to the stop point
simulator.addListener(&l_stop_symbol);
@ -314,6 +330,17 @@ bool GenericTracing::run()
of_serial.close();
}
if (e9_file != "") {
simulator.removeFlow(&e9_sol);
ofstream of_e9(e9_file.c_str(), ios::out|ios::binary);
if (!of_e9.fail()) {
of_e9 << e9_sol.getOutput();
} else {
m_log << "failed to write " << e9_file << endl;
}
of_e9.close();
}
simulator.clearListeners();
simulator.terminate();

View File

@ -28,6 +28,8 @@ class GenericTracing : public fail::ExperimentFlow {
fail::guest_address_t serial_port;
std::string serial_file;
std::string e9_file;
fail::Logger m_log;
fail::ElfReader *m_elf;