File tree Expand file tree Collapse file tree 1 file changed +21
-20
lines changed Expand file tree Collapse file tree 1 file changed +21
-20
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,25 @@ use alloc::ffi::CString;
1212use core:: ffi:: CStr ;
1313use core:: panic:: PanicInfo ;
1414
15+ #[ macro_export]
16+ #[ cfg_attr( not( test) , rustc_diagnostic_item = "print_macro" ) ]
17+ macro_rules! print {
18+ ( $( $arg: tt) * ) => { {
19+ $crate:: grub_lib:: print_fmt( format_args!( $( $arg) * ) ) ;
20+ } } ;
21+ }
22+
23+ #[ macro_export]
24+ #[ cfg_attr( not( test) , rustc_diagnostic_item = "println_macro" ) ]
25+ macro_rules! println {
26+ ( ) => {
27+ $crate:: print!( "\n " )
28+ } ;
29+ ( $( $arg: tt) * ) => { {
30+ $crate:: grub_lib:: print_fmt( format_args_nl!( $( $arg) * ) ) ;
31+ } } ;
32+ }
33+
1534extern "C" {
1635 static grub_xputs: extern "C" fn ( stri : * const c_char ) ;
1736 fn grub_abort ( ) ;
@@ -74,8 +93,9 @@ pub fn xputs(val: &str) {
7493
7594#[ panic_handler]
7695fn panic ( info : & PanicInfo ) -> ! {
96+ println ! ( "Rust runtime panicked {info:?}" ) ;
7797 unsafe {
78- grub_abort ( ) ; // TODO: Use grub_fatal and better error message
98+ grub_abort ( ) ;
7999 }
80100 loop { }
81101}
@@ -141,22 +161,3 @@ pub fn print_fmt(args: Arguments<'_>) {
141161 let mut w = PutsWriter ;
142162 let _ = fmt:: write ( & mut w, args) ;
143163}
144-
145- #[ macro_export]
146- #[ cfg_attr( not( test) , rustc_diagnostic_item = "print_macro" ) ]
147- macro_rules! print {
148- ( $( $arg: tt) * ) => { {
149- $crate:: grub_lib:: print_fmt( format_args!( $( $arg) * ) ) ;
150- } } ;
151- }
152-
153- #[ macro_export]
154- #[ cfg_attr( not( test) , rustc_diagnostic_item = "println_macro" ) ]
155- macro_rules! println {
156- ( ) => {
157- $crate:: print!( "\n " )
158- } ;
159- ( $( $arg: tt) * ) => { {
160- $crate:: grub_lib:: print_fmt( format_args_nl!( $( $arg) * ) ) ;
161- } } ;
162- }
You can’t perform that action at this time.
0 commit comments