mirror of
https://github.com/Noratrieb/rustv32i.git
synced 2026-01-15 22:05:01 +01:00
cleanup
This commit is contained in:
parent
42c4d826f1
commit
7026e5c1b8
3 changed files with 485 additions and 478 deletions
12
src/main.rs
12
src/main.rs
|
|
@ -1,8 +1,9 @@
|
|||
use emu::{Memory, Reg};
|
||||
use eyre::{OptionExt, bail};
|
||||
use eyre::{OptionExt, bail, eyre};
|
||||
|
||||
mod elf;
|
||||
mod emu;
|
||||
mod inst;
|
||||
|
||||
// 2 MiB
|
||||
const MEMORY_SIZE: usize = 2 << 21;
|
||||
|
|
@ -69,7 +70,14 @@ fn main() -> eyre::Result<()> {
|
|||
|
||||
ecall_handler: Box::new(ecall_handler),
|
||||
};
|
||||
emu.start_linux().unwrap();
|
||||
|
||||
match emu.start_linux() {
|
||||
emu::Error::Exit { code } => {
|
||||
eprintln!("exited with code {code}");
|
||||
}
|
||||
emu::Error::Trap(cause) => eprintln!("program trapped: {cause}"),
|
||||
e => return Err(eyre!("error: {e:?}")),
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue