File tree Expand file tree Collapse file tree 2 files changed +6
-14
lines changed
Expand file tree Collapse file tree 2 files changed +6
-14
lines changed Original file line number Diff line number Diff line change @@ -71,7 +71,7 @@ pub unsafe fn abort_with_code_and_message(code: &[u8], message_ptr: *const c_cha
7171/// over the abort sequence. For example, in the panic handler,
7272/// we have a message of unknown length that we want to stream
7373/// to the host, which requires sending the message in chunks
74- pub unsafe fn write_abort ( code : & [ u8 ] ) {
74+ pub fn write_abort ( code : & [ u8 ] ) {
7575 outb ( OutBAction :: Abort as u16 , code) ;
7676}
7777
Original file line number Diff line number Diff line change @@ -149,9 +149,7 @@ fn panic(info: &core::panic::PanicInfo) -> ! {
149149struct HyperlightAbortWriter ;
150150impl core:: fmt:: Write for HyperlightAbortWriter {
151151 fn write_str ( & mut self , s : & str ) -> core:: fmt:: Result {
152- unsafe {
153- write_abort ( s. as_bytes ( ) ) ;
154- }
152+ write_abort ( s. as_bytes ( ) ) ;
155153 Ok ( ( ) )
156154 }
157155}
@@ -161,23 +159,17 @@ fn _panic_handler(info: &core::panic::PanicInfo) -> ! {
161159 let mut w = HyperlightAbortWriter ;
162160
163161 // begin abort sequence by writing the error code
164- unsafe {
165- write_abort ( & [ ErrorCode :: UnknownError as u8 ] ) ;
166- }
162+ write_abort ( & [ ErrorCode :: UnknownError as u8 ] ) ;
167163
168164 let write_res = write ! ( w, "{}" , info) ;
169165 if write_res. is_err ( ) {
170- unsafe {
171- write_abort ( "panic: message format failed" . as_bytes ( ) ) ;
172- }
166+ write_abort ( "panic: message format failed" . as_bytes ( ) ) ;
173167 }
174168
175169 // write abort terminator to finish the abort
176170 // and signal to the host that the message can now be read
177- unsafe {
178- write_abort ( & [ 0xFF ] ) ;
179- unreachable ! ( ) ;
180- }
171+ write_abort ( & [ 0xFF ] ) ;
172+ unreachable ! ( ) ;
181173}
182174
183175// === Entrypoint ===
You can’t perform that action at this time.
0 commit comments