cpn/database: include data_width in the fsppilot during prune step
During the prune step the data_width of the injected location was not propagated before. It is now stored in fsppilot (database layout change!) and sent in the fsppilot protobuf message. Change-Id: I0562f6fc8957adea0f8a9fb63469ca5e3f4b7b2d
This commit is contained in:
@ -11,6 +11,7 @@ message DatabaseCampaignMessage {
|
|||||||
required int32 injection_instr = 4 [(sql_ignore) = true];
|
required int32 injection_instr = 4 [(sql_ignore) = true];
|
||||||
optional int32 injection_instr_absolute = 5 [(sql_ignore) = true];
|
optional int32 injection_instr_absolute = 5 [(sql_ignore) = true];
|
||||||
required int32 data_address = 6 [(sql_ignore) = true];
|
required int32 data_address = 6 [(sql_ignore) = true];
|
||||||
required string variant = 7 [(sql_ignore) = true];
|
required int32 data_width = 7 [(sql_ignore) = true];
|
||||||
required string benchmark = 8 [(sql_ignore) = true];
|
required string variant = 8 [(sql_ignore) = true];
|
||||||
|
required string benchmark = 9 [(sql_ignore) = true];
|
||||||
}
|
}
|
||||||
@ -112,7 +112,7 @@ void DatabaseCampaign::collect_result_thread() {
|
|||||||
bool DatabaseCampaign::run_variant(Database::Variant variant) {
|
bool DatabaseCampaign::run_variant(Database::Variant variant) {
|
||||||
/* Gather all unfinished jobs */
|
/* Gather all unfinished jobs */
|
||||||
int experiment_count;
|
int experiment_count;
|
||||||
std::string sql_select = "SELECT pilot_id, g.fspmethod_id, g.variant_id, p.injection_instr, p.injection_instr_absolute, g.data_address ";
|
std::string sql_select = "SELECT pilot_id, g.fspmethod_id, g.variant_id, p.injection_instr, p.injection_instr_absolute, g.data_address, p.data_width ";
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss << " FROM fspgroup g"
|
ss << " FROM fspgroup g"
|
||||||
<< " INNER JOIN fsppilot p ON p.id = g.pilot_id "
|
<< " INNER JOIN fsppilot p ON p.id = g.pilot_id "
|
||||||
@ -140,6 +140,7 @@ bool DatabaseCampaign::run_variant(Database::Variant variant) {
|
|||||||
unsigned pilot_id = atoi(row[0]);
|
unsigned pilot_id = atoi(row[0]);
|
||||||
unsigned injection_instr = atoi(row[3]);
|
unsigned injection_instr = atoi(row[3]);
|
||||||
unsigned data_address = atoi(row[5]);
|
unsigned data_address = atoi(row[5]);
|
||||||
|
unsigned data_width = atoi(row[6]);
|
||||||
|
|
||||||
|
|
||||||
DatabaseCampaignMessage pilot;
|
DatabaseCampaignMessage pilot;
|
||||||
@ -149,11 +150,14 @@ bool DatabaseCampaign::run_variant(Database::Variant variant) {
|
|||||||
pilot.set_injection_instr(injection_instr);
|
pilot.set_injection_instr(injection_instr);
|
||||||
pilot.set_variant(variant.variant);
|
pilot.set_variant(variant.variant);
|
||||||
pilot.set_benchmark(variant.benchmark);
|
pilot.set_benchmark(variant.benchmark);
|
||||||
|
|
||||||
if (row[4]) {
|
if (row[4]) {
|
||||||
unsigned injection_instr_absolute = atoi(row[4]);
|
unsigned injection_instr_absolute = atoi(row[4]);
|
||||||
pilot.set_injection_instr_absolute(injection_instr_absolute);
|
pilot.set_injection_instr_absolute(injection_instr_absolute);
|
||||||
}
|
}
|
||||||
pilot.set_data_address(data_address);
|
pilot.set_data_address(data_address);
|
||||||
|
pilot.set_data_width(data_width);
|
||||||
|
|
||||||
|
|
||||||
this->cb_send_pilot(pilot);
|
this->cb_send_pilot(pilot);
|
||||||
|
|
||||||
|
|||||||
@ -30,11 +30,11 @@ public:
|
|||||||
// <reg> | <offset>
|
// <reg> | <offset>
|
||||||
return (id << 4) | (offset / 8);
|
return (id << 4) | (offset / 8);
|
||||||
}
|
}
|
||||||
// does not recreate width or mask
|
|
||||||
static reginfo_t fromDataAddress(int addr) {
|
static reginfo_t fromDataAddress(int addr, int width) {
|
||||||
int id = addr >> 4;
|
int id = addr >> 4;
|
||||||
byte_t offset = (addr & 0xf) * 8;
|
byte_t offset = (addr & 0xf) * 8;
|
||||||
return reginfo_t(id, 0, offset);
|
return reginfo_t(id, width * 8, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
reginfo_t(int id=-1, regwidth_t width = 32, byte_t offs = 0)
|
reginfo_t(int id=-1, regwidth_t width = 32, byte_t offs = 0)
|
||||||
|
|||||||
@ -15,9 +15,9 @@ bool BasicPruner::prune_all() {
|
|||||||
std::string injection_instr = this->use_instr1 ? "instr1" : "instr2";
|
std::string injection_instr = this->use_instr1 ? "instr1" : "instr2";
|
||||||
std::string injection_instr_absolute = this->use_instr1 ? "instr1_absolute" : "instr2_absolute";
|
std::string injection_instr_absolute = this->use_instr1 ? "instr1_absolute" : "instr2_absolute";
|
||||||
|
|
||||||
ss << "INSERT INTO fsppilot (known_outcome, variant_id, instr2, injection_instr, injection_instr_absolute, data_address, fspmethod_id) "
|
ss << "INSERT INTO fsppilot (known_outcome, variant_id, instr2, injection_instr, injection_instr_absolute, data_address, data_width, fspmethod_id) "
|
||||||
"SELECT 0, variant_id, instr2, " << injection_instr << ", " << injection_instr_absolute << ", "
|
"SELECT 0, variant_id, instr2, " << injection_instr << ", " << injection_instr_absolute << ", "
|
||||||
" data_address, " << m_method_id << " "
|
" data_address, width, " << m_method_id << " "
|
||||||
"FROM trace "
|
"FROM trace "
|
||||||
"WHERE variant_id IN (" << m_variant_id_query << ") AND accesstype = 'R'";
|
"WHERE variant_id IN (" << m_variant_id_query << ") AND accesstype = 'R'";
|
||||||
if (!db->query(ss.str().c_str())) return false;
|
if (!db->query(ss.str().c_str())) return false;
|
||||||
@ -30,9 +30,9 @@ bool BasicPruner::prune_all() {
|
|||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
while ((row = mysql_fetch_row(res))) {
|
while ((row = mysql_fetch_row(res))) {
|
||||||
// single entry for known outcome (write access)
|
// single entry for known outcome (write access)
|
||||||
ss << "INSERT INTO fsppilot (known_outcome, variant_id, instr2, injection_instr, injection_instr_absolute, data_address, fspmethod_id) "
|
ss << "INSERT INTO fsppilot (known_outcome, variant_id, instr2, injection_instr, injection_instr_absolute, data_address, data_width, fspmethod_id) "
|
||||||
"SELECT 1, variant_id, instr2, " << injection_instr << ", " << injection_instr_absolute << ", "
|
"SELECT 1, variant_id, instr2, " << injection_instr << ", " << injection_instr_absolute << ", "
|
||||||
" data_address, " << m_method_id << " "
|
" data_address, width, " << m_method_id << " "
|
||||||
"FROM trace "
|
"FROM trace "
|
||||||
"WHERE variant_id = " << row[0] << " AND accesstype = 'W' "
|
"WHERE variant_id = " << row[0] << " AND accesstype = 'W' "
|
||||||
"LIMIT 1";
|
"LIMIT 1";
|
||||||
|
|||||||
@ -57,6 +57,7 @@ bool Pruner::create_database() {
|
|||||||
" injection_instr int(10) unsigned NOT NULL,"
|
" injection_instr int(10) unsigned NOT NULL,"
|
||||||
" injection_instr_absolute int(10) unsigned,"
|
" injection_instr_absolute int(10) unsigned,"
|
||||||
" data_address int(10) unsigned NOT NULL,"
|
" data_address int(10) unsigned NOT NULL,"
|
||||||
|
" data_width int(10) unsigned NOT NULL,"
|
||||||
" fspmethod_id int(11) NOT NULL,"
|
" fspmethod_id int(11) NOT NULL,"
|
||||||
" PRIMARY KEY (id),"
|
" PRIMARY KEY (id),"
|
||||||
" KEY fspmethod_id (fspmethod_id,variant_id,data_address,instr2)"
|
" KEY fspmethod_id (fspmethod_id,variant_id,data_address,instr2)"
|
||||||
|
|||||||
Reference in New Issue
Block a user