diff --git a/ceno_emul/src/platform.rs b/ceno_emul/src/platform.rs index d15e74db6..22c9fe6bb 100644 --- a/ceno_emul/src/platform.rs +++ b/ceno_emul/src/platform.rs @@ -16,11 +16,18 @@ pub struct Platform { } pub const CENO_PLATFORM: Platform = Platform { - rom_start: 0x2000_0000, - rom_end: 0x3000_0000 - 1, - ram_start: 0x0020_0000, - ram_end: 0x0040_0000 - 1, - unsafe_ecall_nop: false, + // rom_start: 0x2000_0000, + // rom_end: 0x3000_0000 - 1, + // ram_start: 0x0020_0000, + // ram_end: 0x0040_0000 - 1, + // unsafe_ecall_nop: false, + + // SP1 + rom_start: 0x0020_0800, + rom_end: 0x0020a110 - 1, + ram_start: 0x0001_0000, + ram_end: 0x8001_0000 - 1, + unsafe_ecall_nop: true, }; impl Platform { @@ -118,7 +125,7 @@ impl Platform { } pub fn can_execute(&self, addr: Addr) -> bool { - self.is_rom(addr) + true // self.is_rom(addr) } // Environment calls. @@ -147,6 +154,15 @@ impl Platform { pub const fn code_success(&self) -> u32 { 0 } + + pub fn format_segment(&self, addr: u32) -> String { + format!( + "{}{}{}", + if self.can_read(addr) { "R" } else { "-" }, + if self.can_write(addr) { "W" } else { "-" }, + if self.can_execute(addr) { "X" } else { "-" }, + ) + } } #[cfg(test)] diff --git a/ceno_zkvm/examples/fibonacci_elf.rs b/ceno_zkvm/examples/fibonacci_elf.rs index db61722fe..80336ad16 100644 --- a/ceno_zkvm/examples/fibonacci_elf.rs +++ b/ceno_zkvm/examples/fibonacci_elf.rs @@ -56,13 +56,7 @@ fn main() { .with(flame_layer.with_threads_collapsed(true)); tracing::subscriber::set_global_default(subscriber).unwrap(); - let sp1_platform = Platform { - rom_start: 0x0020_0800, - rom_end: 0x003f_ffff, - ram_start: 0x0020_0000, - ram_end: 0xffff_ffff, - unsafe_ecall_nop: true, - }; + let sp1_platform = CENO_PLATFORM.clone(); const STACK_TOP: u32 = 0x0020_0400; const STACK_SIZE: u32 = 1;