(&mut self, addr: u64, buf: &mut [u8])
| 816 | |
| 817 | impl IoMemory for FuzzwareNvicHandler { |
| 818 | fn read(&mut self, addr: u64, buf: &mut [u8]) -> icicle_vm::cpu::mem::MemResult<()> { |
| 819 | let value = unsafe { fuzzware::handle_sysctl_mmio_read(self.uc, addr, buf.len() as i32) }; |
| 820 | // This function is extremly hot so we specialize common output sizes, with the most common |
| 821 | // (4 byte access) first. |
| 822 | match buf.len() { |
| 823 | 4 => buf.copy_from_slice(&value.to_le_bytes()[..4]), |
| 824 | 1 => buf.copy_from_slice(&value.to_le_bytes()[..1]), |
| 825 | 2 => buf.copy_from_slice(&value.to_le_bytes()[..2]), |
| 826 | _ => buf.copy_from_slice(&value.to_le_bytes()[..buf.len()]), |
| 827 | } |
| 828 | Ok(()) |
| 829 | } |
| 830 | |
| 831 | fn write(&mut self, addr: u64, value: &[u8]) -> icicle_vm::cpu::mem::MemResult<()> { |
| 832 | // @fixme? Unlike fuzzware we don't passthrough writes. |
nothing calls this directly
no test coverage detected