Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
lrusecurity
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Touzeau
lrusecurity
Commits
1ce3603c
Commit
1ce3603c
authored
Aug 01, 2019
by
Julien Balette-Pape
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Passage à AccMatcher
parent
49a96f13
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
49 additions
and
50 deletions
+49
-50
CMakeLists.txt
CMakeLists.txt
+1
-1
src/Graphic/AccMatching.cpp
src/Graphic/AccMatching.cpp
+9
-9
src/Graphic/AccMatching.h
src/Graphic/AccMatching.h
+31
-0
src/Graphic/DotModificator.cpp
src/Graphic/DotModificator.cpp
+1
-1
src/Graphic/DotModificator.h
src/Graphic/DotModificator.h
+4
-4
src/Graphic/InstMatching.h
src/Graphic/InstMatching.h
+0
-32
src/lrusecurity_Displayer.cpp
src/lrusecurity_Displayer.cpp
+3
-3
No files found.
CMakeLists.txt
View file @
1ce3603c
...
@@ -16,7 +16,7 @@ set(SOURCES "src/lrusecurity.cpp"
...
@@ -16,7 +16,7 @@ set(SOURCES "src/lrusecurity.cpp"
"src/Prev_Under/lrusecurity_ExistHitPrevUDomain.cpp"
"src/Prev_Under/lrusecurity_ExistHitPrevUDomain.cpp"
"src/Prev_Under/lrusecurity_ExistHitPrevUAdapter.cpp"
"src/Prev_Under/lrusecurity_ExistHitPrevUAdapter.cpp"
"src/lrusecurity_Displayer.cpp"
"src/lrusecurity_Displayer.cpp"
"src/Graphic/
Inst
Matching.cpp"
# Modification for Dot
"src/Graphic/
Acc
Matching.cpp"
# Modification for Dot
"src/Graphic/DotModificator.cpp"
"src/Graphic/DotModificator.cpp"
)
)
...
...
src/Graphic/
Inst
Matching.cpp
→
src/Graphic/
Acc
Matching.cpp
View file @
1ce3603c
#include "
Inst
Matching.h"
#include "
Acc
Matching.h"
using
namespace
otawa
;
using
namespace
otawa
;
namespace
lrusecurity
namespace
lrusecurity
{
{
void
Inst
Matcher
::
setupCFG
(
CFG
*
cfg
)
void
Acc
Matcher
::
setupCFG
(
CFG
*
cfg
)
{
{
CFG
::
BlockIter
iter_block
;
CFG
::
BlockIter
iter_block
;
...
@@ -13,24 +13,24 @@ void InstMatcher::setupCFG(CFG *cfg)
...
@@ -13,24 +13,24 @@ void InstMatcher::setupCFG(CFG *cfg)
Block
*
b
=
*
iter_block
;
Block
*
b
=
*
iter_block
;
if
(
b
->
isBasic
()){
if
(
b
->
isBasic
()){
BasicBlock
*
bb
=
b
->
toBasic
();
BasicBlock
*
bb
=
b
->
toBasic
();
BasicBlock
::
InstIter
iter_inst
;
const
Bag
<
icache
::
Access
>&
bag
=
otawa
::
icache
::
ACCESSES
(
bb
)
;
for
(
i
ter_inst
=
bb
->
begin
();
iter_inst
!=
bb
->
end
();
iter_inst
++
){
for
(
i
nt
i
=
0
;
i
<
bag
.
size
();
i
++
){
insert
(
*
iter_inst
,
bb
);
insert
(
&
bag
[
i
]
,
bb
);
}
}
}
}
}
}
}
}
void
Inst
Matcher
::
setupColl
(
CFGCollection
*
collection
)
void
Acc
Matcher
::
setupColl
(
CFGCollection
*
collection
)
{
{
for
(
int
i
=
0
;
i
<
collection
->
count
();
i
++
)
{
for
(
int
i
=
0
;
i
<
collection
->
count
();
i
++
)
{
Inst
Matcher
::
setupCFG
(
*
collection
[
i
]);
Acc
Matcher
::
setupCFG
(
*
collection
[
i
]);
}
}
}
}
otawa
::
BasicBlock
*
InstMatcher
::
match_instruction
(
otawa
::
Inst
*
instruction
)
otawa
::
BasicBlock
*
AccMatcher
::
match_access
(
const
otawa
::
icache
::
Access
*
access
)
{
{
auto
search
=
this
->
_match
.
find
(
instruction
);
auto
search
=
this
->
_match
.
find
(
access
);
if
(
search
!=
_match
.
end
())
if
(
search
!=
_match
.
end
())
return
search
->
second
;
return
search
->
second
;
...
...
src/Graphic/AccMatching.h
0 → 100644
View file @
1ce3603c
#ifndef LRUSECURITY_ACC_MATCHING_H
#define LRUSECURITY_ACC_MATCHING_H
#include <otawa/cfg/features.h>
#include <otawa/cfg/CFG.h>
#include <otawa/prog/Inst.h>
#include <otawa/icache/features.h>
#include <map>
namespace
lrusecurity
{
class
AccMatcher
{
public:
AccMatcher
(
void
){};
void
setupColl
(
otawa
::
CFGCollection
*
coll
);
void
setupCFG
(
otawa
::
CFG
*
cfg
);
inline
void
insert
(
const
otawa
::
icache
::
Access
*
acc
,
otawa
::
BasicBlock
*
bb
){
_match
.
insert
({
acc
,
bb
});};
otawa
::
BasicBlock
*
match_access
(
const
otawa
::
icache
::
Access
*
access
);
inline
void
clean
(
void
){
_match
=
std
::
map
<
const
otawa
::
icache
::
Access
*
,
otawa
::
BasicBlock
*>
();};
private:
std
::
map
<
const
otawa
::
icache
::
Access
*
,
otawa
::
BasicBlock
*>
_match
;
};
}
// namespace lrusecurity
#endif
/* ifndef LRUSECURITY_ACC_MATCHING_H */
src/Graphic/DotModificator.cpp
View file @
1ce3603c
...
@@ -29,7 +29,7 @@ void DotModificator::modify(otawa::CFG *cfg, const otawa::icache::Access *access
...
@@ -29,7 +29,7 @@ void DotModificator::modify(otawa::CFG *cfg, const otawa::icache::Access *access
if
(
access
){
if
(
access
){
// On récupère le bloc correspondant à l'accès grâce à l'InstMatcher
// On récupère le bloc correspondant à l'accès grâce à l'InstMatcher
otawa
::
BasicBlock
*
bb_match
=
_intM
->
match_access
(
access
);
otawa
::
BasicBlock
*
bb_match
=
getMatcher
()
->
match_access
(
access
);
// Copie de l'adresse de l'accès pour affichage
// Copie de l'adresse de l'accès pour affichage
string
acc_addr
=
_
<<
access
->
address
();
string
acc_addr
=
_
<<
access
->
address
();
...
...
src/Graphic/DotModificator.h
View file @
1ce3603c
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
#include <otawa/icache/features.h>
#include <otawa/icache/features.h>
#include <otawa/base.h>
#include <otawa/base.h>
#include <otawa/cfg/CFG.h>
#include <otawa/cfg/CFG.h>
#include "
Inst
Matching.h"
#include "
Acc
Matching.h"
namespace
lrusecurity
namespace
lrusecurity
{
{
...
@@ -12,15 +12,15 @@ namespace lrusecurity
...
@@ -12,15 +12,15 @@ namespace lrusecurity
class
DotModificator
class
DotModificator
{
{
public:
public:
DotModificator
(
const
char
*
dot_file
,
InstMatcher
*
match
)
:
_filename
(
dot_file
),
_int
M
(
match
),
_count
(
0
){};
DotModificator
(
const
char
*
dot_file
,
AccMatcher
*
match
)
:
_filename
(
dot_file
),
_acc
M
(
match
),
_count
(
0
){};
void
modify
(
otawa
::
CFG
*
cfg
,
const
otawa
::
icache
::
Access
*
access
,
otawa
::
Address
address
);
void
modify
(
otawa
::
CFG
*
cfg
,
const
otawa
::
icache
::
Access
*
access
,
otawa
::
Address
address
);
void
finish
(
void
);
void
finish
(
void
);
inline
InstMatcher
*
getMatcher
(
void
){
return
_int
M
;};
inline
AccMatcher
*
getMatcher
(
void
){
return
_acc
M
;};
inline
bool
isFirst
(
void
){
return
_count
==
0
;};
inline
bool
isFirst
(
void
){
return
_count
==
0
;};
private:
private:
const
char
*
_filename
;
const
char
*
_filename
;
InstMatcher
*
_int
M
;
AccMatcher
*
_acc
M
;
int
_count
;
int
_count
;
};
};
...
...
src/Graphic/InstMatching.h
deleted
100644 → 0
View file @
49a96f13
#ifndef LRUSECURITY_INST_MATCHING_H
#define LRUSECURITY_INST_MATCHING_H
#include <otawa/cfg/features.h>
#include <otawa/cfg/CFG.h>
#include <otawa/prog/Inst.h>
#include <otawa/icache/features.h>
#include <map>
namespace
lrusecurity
{
class
InstMatcher
{
public:
InstMatcher
(
void
){};
void
setupCFG
(
otawa
::
CFG
*
cfg
);
void
setupColl
(
otawa
::
CFGCollection
*
collection
);
inline
void
insert
(
otawa
::
Inst
*
inst
,
otawa
::
BasicBlock
*
bb
){
_match
.
insert
({
inst
,
bb
});};
otawa
::
BasicBlock
*
match_instruction
(
otawa
::
Inst
*
instruction
);
inline
otawa
::
BasicBlock
*
match_access
(
const
otawa
::
icache
::
Access
*
access
){
return
match_instruction
(
access
->
instruction
());};
inline
void
clean
(
void
){
_match
=
std
::
map
<
otawa
::
Inst
*
,
otawa
::
BasicBlock
*>
();};
private:
std
::
map
<
otawa
::
Inst
*
,
otawa
::
BasicBlock
*>
_match
;
};
}
// namespace lrusecurity
#endif
/* ifndef LRUSECURITY_INST_MATCHING_H */
src/lrusecurity_Displayer.cpp
View file @
1ce3603c
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
#include <set>
#include <set>
#include <iterator>
#include <iterator>
#include "Graphic/
Inst
Matching.h"
#include "Graphic/
Acc
Matching.h"
#include "Graphic/DotModificator.h"
#include "Graphic/DotModificator.h"
//#include "SecCFGOutput.h"
//#include "SecCFGOutput.h"
...
@@ -30,7 +30,7 @@ public:
...
@@ -30,7 +30,7 @@ public:
_stream
(
nullptr
),
_stream
(
nullptr
),
_line
(
false
),
_line
(
false
),
// Modification pour affichage en dot
// Modification pour affichage en dot
_modificator
(
new
DotModificator
(
"result.dot"
,
new
Inst
Matcher
))
//TODO: changer l'accès au fichier
_modificator
(
new
DotModificator
(
"result.dot"
,
new
Acc
Matcher
))
//TODO: changer l'accès au fichier
{
{
}
}
...
@@ -79,7 +79,7 @@ protected:
...
@@ -79,7 +79,7 @@ protected:
virtual
void
processCFG
(
WorkSpace
*
ws
,
CFG
*
cfg
)
override
virtual
void
processCFG
(
WorkSpace
*
ws
,
CFG
*
cfg
)
override
{
{
Inst
Matcher
*
match
=
getModificator
()
->
getMatcher
();
Acc
Matcher
*
match
=
getModificator
()
->
getMatcher
();
match
->
setupCFG
(
cfg
);
match
->
setupCFG
(
cfg
);
_out
<<
"FUNCTION "
<<
cfg
->
label
()
<<
io
::
endl
;
_out
<<
"FUNCTION "
<<
cfg
->
label
()
<<
io
::
endl
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment