File tree Expand file tree Collapse file tree 3 files changed +30
-0
lines changed
Expand file tree Collapse file tree 3 files changed +30
-0
lines changed Original file line number Diff line number Diff line change 1+ pub mod run_context;
Original file line number Diff line number Diff line change 1+ use crate :: memory:: address:: MemoryAddress ;
2+
3+ #[ derive( Debug ) ]
4+ pub struct RunContext {
5+ /// The address in memory of the current instruction to be executed.
6+ pub ( crate ) pc : MemoryAddress ,
7+ /// Points to the beginning of the stack frame of the current function.
8+ ///
9+ /// The value of `fp` stays the same fopr all the instructions in the same invocation of a function.
10+ pub ( crate ) fp : MemoryAddress ,
11+ }
12+
13+ impl RunContext {
14+ #[ must_use]
15+ pub const fn new ( pc : MemoryAddress , fp : MemoryAddress ) -> Self {
16+ Self { pc, fp }
17+ }
18+
19+ #[ must_use]
20+ pub const fn pc ( & self ) -> & MemoryAddress {
21+ & self . pc
22+ }
23+
24+ #[ must_use]
25+ pub const fn fp ( & self ) -> & MemoryAddress {
26+ & self . fp
27+ }
28+ }
Original file line number Diff line number Diff line change 1+ pub mod context;
12pub mod memory;
You can’t perform that action at this time.
0 commit comments