()
| 25 | } |
| 26 | |
| 27 | fn get_shell_protocol() -> &'static ShellProtocol { |
| 28 | let handle = boot::get_handle_for_protocol::<Shell>().expect("No Shell handles"); |
| 29 | |
| 30 | // Use GetProtocol instead of Exclusive since we're running inside the shell |
| 31 | let shell = unsafe { |
| 32 | boot::open_protocol::<Shell>( |
| 33 | OpenProtocolParams { |
| 34 | handle, |
| 35 | agent: boot::image_handle(), |
| 36 | controller: None, |
| 37 | }, |
| 38 | OpenProtocolAttributes::GetProtocol, |
| 39 | ) |
| 40 | .expect("Failed to open Shell protocol") |
| 41 | }; |
| 42 | |
| 43 | // SAFETY: The Shell wrapper contains the raw ShellProtocol |
| 44 | unsafe { |
| 45 | let proto: &ShellProtocol = core::mem::transmute(shell.get().unwrap()); |
| 46 | // Leak to get 'static lifetime - protocol stays valid while shell is running |
| 47 | core::mem::forget(shell); |
| 48 | proto |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | /// Returns true when the execution break was requested, false otherwise |
| 53 | pub fn shell_get_execution_break_flag() -> bool { |
no test coverage detected