Skip to content

Commit

Permalink
feat: expose ROM so it can be changed externally
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelspark committed Dec 26, 2022
1 parent 54f1020 commit 897f2cf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/bus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ pub struct Bus {
pub uart: Uart,
pub virtio: Virtio,
dram: Dram,
rom: Rom,
pub rom: Rom,
}

impl Bus {
Expand Down
4 changes: 4 additions & 0 deletions src/rom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,10 @@ impl Rom {
Self { data: rom }
}

pub fn new_with_data(data: Vec<u8>) -> Rom {
Rom { data }
}

/// Load `size`-bit data from the memory.
pub fn read(&self, addr: u64, size: u8) -> Result<u64, Exception> {
match size {
Expand Down

0 comments on commit 897f2cf

Please sign in to comment.