twizzler_security/
gates.rs

1#[derive(Clone, Copy, PartialEq, Eq, Debug)]
2pub struct Gates {
3    pub offset: u64,
4    pub length: u64,
5    pub align: u64,
6}
7
8//NOTE: ask daniel about this
9static MAX_LEN: u64 = 1e9 as u64;
10
11pub enum GatesError {
12    OutsideBounds,
13    Unaligned,
14}
15
16impl Gates {
17    pub fn new(offset: u64, length: u64, align: u64) -> Self {
18        Gates {
19            offset,
20            length,
21            align,
22        }
23    }
24}
25
26impl Default for Gates {
27    fn default() -> Self {
28        //NOTE: verify with daniel that these are the default values for gates
29        Gates {
30            offset: 0,
31            length: MAX_LEN,
32            align: 1,
33        }
34    }
35}