MCPcopy Create free account
hub / github.com/LPC4/Full-Stack / new

Method new

crates/virtual-machine/src/cpu/csr.rs:100–130  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

98
99impl CsrFile {
100 pub fn new() -> Self {
101 Self {
102 mstatus: 0,
103 // RV64IMAFD: MXL=2 (bits 63:62=0b10), A+D+F+I+M = 0x1129.
104 misa: 0x8000_0000_0000_1129,
105 medeleg: 0,
106 mideleg: 0,
107 mie: 0,
108 mtvec: 0,
109 mscratch: 0,
110 mepc: 0,
111 mcause: 0,
112 mtval: 0,
113 mip: 0,
114
115 stvec: 0,
116 sscratch: 0,
117 sepc: 0,
118 scause: 0,
119 stval: 0,
120 satp: 0, // Bare mode by default
121 pmpcfg0: 0,
122 pmpaddr0: 0,
123
124 cycle: 0,
125 instret: 0,
126
127 fflags: 0,
128 frm: 0,
129 }
130 }
131
132 pub fn read(&self, addr: u16) -> Result<u64, VmError> {
133 use addr::{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected