()
| 355 | |
| 356 | /// Debug read. ROM and MMIO go direct, RAM goes through the caches and so |
| 357 | /// perturbs cache stats: use `peek_bytes_raw` when that matters. |
| 358 | pub fn peek_bytes(&mut self, addr: u64, len: usize) -> Vec<u8> { |
| 359 | (0..len as u64) |
| 360 | .map(|i| match addr + i { |
| 361 | a if a >= ROM_BASE && a <= ROM_END => self.rom.read_byte(a).unwrap_or(0), |
| 362 | a if a >= UART_BASE && a <= UART_END => { |
| 363 | self.uart.read_byte(a - UART_BASE).unwrap_or(0) |
| 364 | } |
| 365 | a if a >= CLINT_BASE && a <= CLINT_END => { |
| 366 | self.clint.read_byte(a - CLINT_BASE).unwrap_or(0) |
| 367 | } |
| 368 | a if a >= PLIC_BASE && a <= PLIC_END => { |
| 369 | self.plic.read_byte(a - PLIC_BASE).unwrap_or(0) |
| 370 | } |
| 371 | a if a >= FB_BASE && a <= FB_END => self |
| 372 | .framebuffer |
| 373 | .pixels() |
| 374 | .get((a - FB_BASE) as usize) |
nothing calls this directly
no test coverage detected