Skip to content
Snippets Groups Projects
Commit a6b56c9f authored by Bouquillon Fabien's avatar Bouquillon Fabien
Browse files

changement plugins vulnerability

parent 05066edf
Branches master
No related tags found
No related merge requests found
#cflags pour tout compiler #cflags pour tout compiler
CXXFLAGS=`otawa-config otawa/display --cflags` CXXFLAGS=`otawa-config otawa/display --cflags`
LDLIBS2=`otawa-config otawa/display otawa/classic_ecb otawa/ucb_otawa --libs` LDLIBS2=`otawa-config otawa/display otawa/classic_ecb otawa/ucb_otawa otawa/etime --libs` -Wl,-rpath,"/home/fabien/cristal/otawa/lib/otawa/otawa/"
CXXFLAGS += -std=c++11 -O0 -g -I ../include CXXFLAGS += -std=c++11 -O0 -g -I ../include
ARMCC=arm-none-eabi-gcc ARMCC=arm-none-eabi-gcc
all: application basic big_function all: application basic big_function application_task
application: application.o application: application.o
$(CXX) -o application application.o $(LDLIBS2) $(CXX) -o application application.o $(LDLIBS2) $(CXXFLAGS)
application.o: application.cpp application.h application.o: application.cpp application.h
application_task: application_task.o
$(CXX) -o application_task application_task.o $(LDLIBS2) $(CXXFLAGS)
application_task.o: application_task.cpp application.h
basic: basic_f_l_c.c basic: basic_f_l_c.c
$(ARMCC) -nostdlib -nostdinc -static -o basic basic_f_l_c.c $(ARMCC) -nostdlib -nostdinc -static -o basic basic_f_l_c.c
......
...@@ -14,9 +14,12 @@ ...@@ -14,9 +14,12 @@
#include <otawa/display/CFGOutput.h> #include <otawa/display/CFGOutput.h>
#include <otawa/cache/features.h> #include <otawa/cache/features.h>
#include <otawa/cache/cat2/CAT2Builder.h> #include <otawa/cache/cat2/CAT2Builder.h>
// edge time processors
#include <otawa/etime/features.h>
#include <elm/io/OutFileStream.h> #include <elm/io/OutFileStream.h>
#include <otawa/flowfact/features.h> #include <otawa/flowfact/features.h>
#include <multiset.h> //#include <multiset.h>
#include "../classic_ecb/include/classic_ecb.h" #include "../classic_ecb/include/classic_ecb.h"
#include "../ucb_otawa/include/ucb_otawa.h" #include "../ucb_otawa/include/ucb_otawa.h"
#include "application.h" #include "application.h"
...@@ -29,7 +32,27 @@ using namespace Mathset; ...@@ -29,7 +32,27 @@ using namespace Mathset;
int main(int argc, char **argv) { int main(int argc, char **argv) {
if (argc < 5) {
fprintf(stderr, "usage: %s <binary> <cache> <flow facts> <sortie>\n", argv[0]);
exit(1);
}
// //----------------------------- TRIVIAL
WorkSpace *ws_trivial = NULL;
PropList conf_trivial;
Manager manager_trivial;
NO_SYSTEM(conf_trivial) = true;
TASK_ENTRY(conf_trivial) = "main";
VERBOSE(conf_trivial) = true;
FLOW_FACTS_PATH(conf_trivial) = argv[3];
ws_trivial = manager_trivial.load(argv[1], conf_trivial);
ws_trivial->run("otawa::Virtualizer", conf_trivial);
ws_trivial->require(otawa::ipet::WCET_FEATURE, conf_trivial);
long wcet_trivial = ipet::WCET(ws_trivial);
// //-------------------------------------------------------------
WorkSpace *ws = NULL; WorkSpace *ws = NULL;
PropList conf; PropList conf;
Manager manager; Manager manager;
...@@ -37,35 +60,50 @@ int main(int argc, char **argv) { ...@@ -37,35 +60,50 @@ int main(int argc, char **argv) {
TASK_ENTRY(conf) = "main"; TASK_ENTRY(conf) = "main";
VERBOSE(conf) = true; VERBOSE(conf) = true;
if (argc < 5) {
fprintf(stderr, "usage: %s <binary> <cache> <flow facts> <sortie>\n", argv[0]);
exit(1);
}
CACHE_CONFIG_PATH(conf) = argv[2]; CACHE_CONFIG_PATH(conf) = argv[2];
FLOW_FACTS_PATH(conf) = argv[3]; FLOW_FACTS_PATH(conf) = argv[3];
PROCESSOR_PATH(conf) = "/home/fabien/cristal/otawa-plugins/application/hardware/pipeline/lpc2138.xml";
MEMORY_PATH(conf) = "/home/fabien/cristal/otawa-plugins/application/hardware/memory/lpc2138.xml";
otawa::etime::RECORD_TIME(conf) = true;
// Platform description
//CACHE_CONFIG_PATH(conf) = "/home/fabien/cristal/otawa-plugins/application/xmc4500/cache.xml";
//PROCESSOR_PATH(conf) = "/home/fabien/cristal/otawa-plugins/application/xmc4500/pipeline.xml";
ws = manager.load(argv[1], conf); ws = manager.load(argv[1], conf);
ws->run("otawa::Virtualizer", conf);
ws->require(otawa::ICACHE_CONSTRAINT2_FEATURE, conf);
//ws->require(otawa::ICACHE_ONLY_CONSTRAINT2_FEATURE, conf);
ws->require(otawa::etime::EDGE_TIME_FEATURE, conf);
ws->require(otawa::ipet::WCET_FEATURE, conf);
ws->require(DynFeature("otawa::ucb_otawa::UCB_OTAWA_FEATURE"), conf); ws->require(DynFeature("otawa::ucb_otawa::UCB_OTAWA_FEATURE"), conf);
ws->require(DynFeature("otawa::classic_ecb::CLASSIC_ECB_PROCESSOR"), conf); ws->require(DynFeature("otawa::classic_ecb::CLASSIC_ECB_PROCESSOR"), conf);
//ws->require(otawa::ipet::ILP_SYSTEM_FEATURE, conf); //ws->require(otawa::ipet::ILP_SYSTEM_FEATURE, conf);
ws->require(otawa::ICACHE_CONSTRAINT2_FEATURE, conf);
ws->require(otawa::ipet::WCET_FEATURE, conf);
long wcet = ipet::WCET(ws);
long wcet = ipet::WCET(ws) - wcet_trivial;
Multiset<int> ucbs = TOTAL_UCB(ws); Multiset<int> ucbs = TOTAL_UCB(ws);
Multiset<int> *ecbs = ECBS(ws); Multiset<int> *ecbs = ECBS(ws);
if(wcet > 1000000) {
return 0;
}
std::ofstream f(argv[4], std::ofstream::app); std::ofstream f(argv[4], std::ofstream::app);
f <<"(" << wcet << ", 10, 10 ," << std::endl << "{";
f <<"(" << argv[1] << "," << wcet << ", 10, 10 ," << std::endl << "{";
ecbs->to_string(f); ecbs->to_string(f);
f << "}," << std::endl << "{"; f << "}," << std::endl << "{";
ucbs.to_string(f); ucbs.to_string(f);
f << "}," << std::endl << "{"; f << "}," << std::endl << "{";
const CFGCollection *coll = INVOLVED_CFGS(ws); const CFGCollection *coll = INVOLVED_CFGS(ws);
Mathset::Multiset<Mathset::Multiset<int>> ucb_list = UCB_OTAWA(ws); Mathset::Multiset<Mathset::Multiset<int>> ucb_list = UCB_OTAWA(ws);
...@@ -78,7 +116,6 @@ int main(int argc, char **argv) { ...@@ -78,7 +116,6 @@ int main(int argc, char **argv) {
f << "})" << endl; f << "})" << endl;
f.close(); f.close();
const otawa::hard::CacheConfiguration *cf = otawa::hard::CACHE_CONFIGURATION_FEATURE.get(ws); const otawa::hard::CacheConfiguration *cf = otawa::hard::CACHE_CONFIGURATION_FEATURE.get(ws);
const otawa::hard::Cache* cache = cf->instCache(); const otawa::hard::Cache* cache = cf->instCache();
......
ARMCC=arm-none-eabi-gcc ARMCC=arm-linux-gnueabi-gcc
all: bs.exe cover.exe crc.exe fdct.exe fibcall.exe insertsort.exe janne_complex.exe jfdctint.exe lcdnum.exe matmult.exe ndes.exe nsichneu.exe all: bs.elf cover.elf crc.elf fdct.elf fibcall.elf insertsort.elf janne_complex.elf jfdctint.elf lcdnum.elf matmult.elf ndes.elf nsichneu.elf
%.exe: %.c %.elf: %.c
$(ARMCC) -nostdlib -nostdinc -static -g -O0 -o $@ $< $(ARMCC) -nostdlib -nostdinc -static -g3 -O0 -o $@ $<
orange --auto $< main -o $*.backup.ffx orange --auto $< main -o $*.backup.ffx
...@@ -20,5 +20,5 @@ clean-backup: ...@@ -20,5 +20,5 @@ clean-backup:
rm -f *.backup.ffx rm -f *.backup.ffx
clean-binary: clean-binary:
rm -f *.exe rm -f *.elf
...@@ -8,7 +8,7 @@ WARNING: otawa::FlowFactLoader 1.4.0:no flow fact file for fdct.exe ...@@ -8,7 +8,7 @@ WARNING: otawa::FlowFactLoader 1.4.0:no flow fact file for fdct.exe
<function label="fdct"> <!-- 0x00008000 (fdct.c:68) --> <function label="fdct"> <!-- 0x00008000 (fdct.c:68) -->
<loop label="fdct" offset="0x45c" maxcount="8" totalcount="8"> <!-- 0x0000845c (fdct.c:83) --> <loop label="fdct" offset="0x45c" maxcount="8" totalcount="8"> <!-- 0x0000845c (fdct.c:83) -->
</loop> </loop>
<loop label="fdct" offset="0xa28" maxcount="8" totalcount="8"> <!-- 0x00008a28 (fdct.c:161) --> <loop label="fdct" offset="0xa10" maxcount="8" totalcount="8"> <!-- 0x00008a28 (fdct.c:161) -->
</loop> </loop>
</function> </function>
......
...@@ -39,15 +39,23 @@ int main(int argc, char **argv) { ...@@ -39,15 +39,23 @@ int main(int argc, char **argv) {
WorkSpace *ws = NULL; WorkSpace *ws = NULL;
//WorkSpace *ws_trivial = NULL;
PropList conf; PropList conf;
//PropList conf_trivial;
Manager manager; Manager manager;
//Manager manager_trivial;
NO_SYSTEM(conf) = true; NO_SYSTEM(conf) = true;
TASK_ENTRY(conf) = "main"; TASK_ENTRY(conf) = "main";
VERBOSE(conf) = true; VERBOSE(conf) = true;
// NO_SYSTEM(conf_trivial) = true;
// TASK_ENTRY(conf_trivial) = "main";
// VERBOSE(conf_trivial) = true;
// Flow fact // Flow fact
std::cout << "-------------------- Configuration paths ----------------------" << std::endl; std::cout << "-------------------- Configuration paths ----------------------" << std::endl;
FLOW_FACTS_PATH(conf) = argv[2]; FLOW_FACTS_PATH(conf) = argv[2];
//FLOW_FACTS_PATH(conf_trivial) = argv[2];
// Platform description // Platform description
CACHE_CONFIG_PATH(conf) = "xmc4500/cache.xml"; CACHE_CONFIG_PATH(conf) = "xmc4500/cache.xml";
...@@ -59,16 +67,18 @@ int main(int argc, char **argv) { ...@@ -59,16 +67,18 @@ int main(int argc, char **argv) {
std::cout << "----------------------------Workspace building----------------------------------" << std::endl; std::cout << "----------------------------Workspace building----------------------------------" << std::endl;
ws = manager.load(argv[1], conf); ws = manager.load(argv[1], conf);
//ws_trivial = manager_trivial.load(argv[1], conf_trivial);
// CFG Building // CFG Building
std::cout << "----------------------------run virtualizer--------------------------------------" << std::endl; std::cout << "----------------------------run virtualizer--------------------------------------" << std::endl;
ws->run("otawa::Virtualizer", conf); ws->run("otawa::Virtualizer", conf);
//ws_trivial->run("otawa::Virtualizer", conf_trivial);
std::cout << "-------------------------------cache configuration-----------------------------------------" << std::endl; std::cout << "-------------------------------cache configuration-----------------------------------------" << std::endl;
ws->require(otawa::ICACHE_ONLY_CONSTRAINT2_FEATURE , conf); // ws->require(otawa::ICACHE_ONLY_CONSTRAINT2_FEATURE , conf);
std::cout << "-------------------------------edge time-----------------------------------------" << std::endl; std::cout << "-------------------------------edge time-----------------------------------------" << std::endl;
otawa::etime::RECORD_TIME(conf) = true; otawa::etime::RECORD_TIME(conf) = true;
//ws->require(otawa::ICACHE_ONLY_CONSTRAINT2_FEATURE, conf);
//ws->require(otawa::ICACHE_CONSTRAINT2_FEATURE , conf); //ws->require(otawa::ICACHE_CONSTRAINT2_FEATURE , conf);
ws->require(otawa::ICACHE_ONLY_CONSTRAINT2_FEATURE, conf);
ws->require(otawa::etime::EDGE_TIME_FEATURE, conf); ws->require(otawa::etime::EDGE_TIME_FEATURE, conf);
std::cout << "-------------------------------wcet----------------------------------------------" << std::endl; std::cout << "-------------------------------wcet----------------------------------------------" << std::endl;
...@@ -76,6 +86,10 @@ int main(int argc, char **argv) { ...@@ -76,6 +86,10 @@ int main(int argc, char **argv) {
ws->require(DynFeature("otawa::explo::EXPLO_FEATURE"), conf); ws->require(DynFeature("otawa::explo::EXPLO_FEATURE"), conf);
//ws_trivial->require(otawa::ipet::WCET_FEATURE, conf_trivial);
std::cout << "WCET:" << ipet::WCET(ws) << std::endl; std::cout << "WCET:" << ipet::WCET(ws) << std::endl;
// std::cout << "WCET:" << ipet::WCET(ws_trivial) << std::endl;
return 0; return 0;
} }
...@@ -261,12 +261,6 @@ namespace otawa { ...@@ -261,12 +261,6 @@ namespace otawa {
for(CFGCollection::Iter cfg_iter(*coll); cfg_iter(); cfg_iter++) { for(CFGCollection::Iter cfg_iter(*coll); cfg_iter(); cfg_iter++) {
CFG* tmp = *cfg_iter; CFG* tmp = *cfg_iter;
explo_cfg(tmp); explo_cfg(tmp);
/*std::cout << "EXIT: ";
std::vector<Block*> vector_blocks = get_last_blocks(tmp);
for(int i = 0; i < vector_blocks.size(); i++) {
std::cout << vector_blocks[i]->id() << " ";
}
*/
std::cout << std::endl; std::cout << std::endl;
} }
} }
......
...@@ -26,7 +26,7 @@ application: application.o ...@@ -26,7 +26,7 @@ application: application.o
application.o: application.cpp application.o: application.cpp
vulnerability.so: vulnerability.cpp include/vulnerability.h vulnerability.so: vulnerability.cpp include/vulnerability.h include/type.h
$(CXX) -fPIC -shared $(CXXFLAGS) -o vulnerability.so vulnerability.cpp $(LDLIBS) $(CXX) -fPIC -shared $(CXXFLAGS) -o vulnerability.so vulnerability.cpp $(LDLIBS)
##fin ##fin
......
No preview for this file type
No preview for this file type
...@@ -14,6 +14,9 @@ ...@@ -14,6 +14,9 @@
#include <otawa/proc/ProcessorPlugin.h> #include <otawa/proc/ProcessorPlugin.h>
#include <otawa/cfg/Dominance.h> #include <otawa/cfg/Dominance.h>
#include <otawa/otawa.h> #include <otawa/otawa.h>
#include "type.h"
namespace otawa { namespace vulnerability { namespace otawa { namespace vulnerability {
class VulnerabilityProcessor : public Processor { class VulnerabilityProcessor : public Processor {
public: public:
...@@ -35,5 +38,9 @@ extern Identifier<DAGHNode*> DAG_HNODE; ...@@ -35,5 +38,9 @@ extern Identifier<DAGHNode*> DAG_HNODE;
extern Identifier<unsigned long> VUL; extern Identifier<unsigned long> VUL;
extern Identifier<std::vector<Address>*> UCB_IN; extern Identifier<std::vector<Address>*> UCB_IN;
extern Identifier<std::vector<Address>*> UCB_OUT; extern Identifier<std::vector<Address>*> UCB_OUT;
} }
void start_rmb_lmb_computation(WorkSpace *ws);
extern Identifier<struct Memory_block *> MB_STRUCT;
}
}
#endif #endif
This diff is collapsed.
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment