# vstvec.rs - source
Source of the Rust file `/home/runner/.cargo/git/checkouts/riscv-ab2abd16c438337b/11d43cf/src/register/hypervisorx64/vstvec.rs`.
Keywords: rust, rustlang, rust-lang

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47

    //! Virtual Supervisor Trap Vector Base Address Register.

    use bit_field::BitField;

    #[derive(Copy, Clone, Debug)]
    pub struct Vstvec {
        bits: usize,
    }
    impl Vstvec {
        #[inline]
        pub fn bits(&self) -> usize {
            return self.bits;
        }
        #[inline]
        pub fn from_bits(x: usize) -> Self {
            return Vstvec { bits: x };
        }
        #[inline]
        pub unsafe fn write(&self) {
            _write(self.bits);
        }
        ///
        #[inline]
        pub fn base(&self) -> usize {
            self.bits.get_bits(2..64)
        }
        #[inline]
        pub fn set_base(&mut self, val: usize) {
            self.bits.set_bits(2..64, val);
        }
        ///
        #[inline]
        pub fn mode(&self) -> usize {
            self.bits.get_bits(0..2)
        }
        #[inline]
        pub fn set_mode(&mut self, val: usize) {
            self.bits.set_bits(0..2, val);
        }
    }
    read_csr_as!(Vstvec, 517, __read_vstvec);
    write_csr!(517, __write_vstvec);
    set!(517, __set_vstvec);
    clear!(517, __clear_vstvec);
    // bit ops

    // enums