MCPcopy Create free account
hub / github.com/IBM/ACE-RISCV / panic

Function panic

security-monitor/src/core/panic.rs:12–34  ·  view source on GitHub ↗
(info: &core::panic::PanicInfo)

Source from the content-addressed store, hash-verified

10/// This function halts all other harts in the system and clear the confidential memory.
11#[panic_handler]
12fn 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}

Callers

nothing calls this directly

Calls 2

put_hart_to_sleepFunction · 0.85

Tested by

no test coverage detected