(info: &core::panic::PanicInfo)
| 10 | /// This function halts all other harts in the system and clear the confidential memory. |
| 11 | #[panic_handler] |
| 12 | fn panic(info: &core::panic::PanicInfo) -> ! { |
| 13 | // TODO: halt all other harts and make sure the below code executes exclusively on one hart |
| 14 | debug!("Ops security monitor panicked!"); |
| 15 | match info.location() { |
| 16 | Some(p) => debug!("Line {}, file {}: {}", p.line(), p.file(), info.message()), |
| 17 | None => debug!("no information available."), |
| 18 | } |
| 19 | debug!("Cleaning up..."); |
| 20 | // Clear the content of the confidential memory. |
| 21 | // Safety: |
| 22 | // 1) The initialization of the confidential memory guarantees that this memory |
| 23 | // region is aligned to the smalles possible page size, thus it is aligned to usize. |
| 24 | // Also the size of the memory is a multiply of usize, so below code will never write |
| 25 | // outside the confidential memory region. |
| 26 | // 2) TODO: we must guarantee that only one hardware thread calls this method. Specifically |
| 27 | // that there is no panic! executed on two different harts at the same time. |
| 28 | unsafe { MemoryLayout::read().clear_confidential_memory() }; |
| 29 | |
| 30 | // sleep or loop forever since there is nothing else we can do |
| 31 | loop { |
| 32 | put_hart_to_sleep(); |
| 33 | } |
| 34 | } |
nothing calls this directly
no test coverage detected