File tree Expand file tree Collapse file tree 2 files changed +37
-0
lines changed
jingle_sleigh/src/varnode Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Original file line number Diff line number Diff line change 11pub mod display;
2+ mod pod;
23
34use crate :: space:: SharedSpaceInfo ;
45use crate :: SpaceType ;
56use std:: fmt:: Debug ;
67use std:: hash:: Hash ;
78use std:: ops:: Range ;
9+ use crate :: varnode:: pod:: PodVarNode ;
810
911/// A [`VarNode`] is `SLEIGH`'s generalization of an address. It describes a sized-location in
1012/// a given memory space.
@@ -41,6 +43,9 @@ impl VarNode {
4143 let other = other. offset ..( other. offset + other. size as u64 ) ;
4244 self_range. start <= other. start && self_range. end >= other. end
4345 }
46+ pub fn to_pod ( & self ) -> PodVarNode {
47+ self . into ( )
48+ }
4449}
4550
4651impl From < & VarNode > for Range < u64 > {
Original file line number Diff line number Diff line change 1+ use crate :: context:: SleighContext ;
2+ use crate :: VarNode ;
3+
4+ /// A "plain-old-data" version of a [VarNode], suitable for passing between threads
5+ /// and serialization/deserialization tasks.
6+ pub struct PodVarNode {
7+ space_index : usize ,
8+ size : usize ,
9+ offset : u64 ,
10+ }
11+
12+ impl From < & VarNode > for PodVarNode {
13+ fn from ( value : & VarNode ) -> Self {
14+ Self {
15+ size : value. size ,
16+ offset : value. offset ,
17+ space_index : value. space . index
18+ }
19+ }
20+ }
21+
22+ impl From < VarNode > for PodVarNode {
23+ fn from ( value : VarNode ) -> Self {
24+ ( & value) . into ( )
25+ }
26+ }
27+
28+ impl PodVarNode {
29+ pub fn to_varnode ( self , ctx : & SleighContext ) -> VarNode {
30+ todo ! ( "Hmmm, might need to think this through more" )
31+ }
32+ }
You can’t perform that action at this time.
0 commit comments