File tree Expand file tree Collapse file tree 2 files changed +48
-2
lines changed Expand file tree Collapse file tree 2 files changed +48
-2
lines changed Original file line number Diff line number Diff line change 1
1
#![ no_std]
2
2
#![ feature( alloc) ]
3
3
#![ feature( core_intrinsics) ]
4
+ #![ feature( lang_items) ]
4
5
#![ feature( prelude_import) ]
5
6
#![ feature( raw) ]
6
7
#![ feature( slice_concat_ext) ]
@@ -66,6 +67,7 @@ pub use alloc_crate::borrow;
66
67
pub use alloc_crate:: fmt;
67
68
pub use alloc_crate:: format;
68
69
pub use core:: pin;
70
+ pub use alloc_crate:: collections;
69
71
pub use alloc_crate:: slice;
70
72
pub use alloc_crate:: str;
71
73
pub use alloc_crate:: string;
@@ -81,13 +83,18 @@ pub use uefi_alloc;
81
83
82
84
pub mod io;
83
85
pub mod math;
86
+ pub mod panic;
84
87
pub mod rt;
85
88
86
89
#[ global_allocator]
87
90
static ALLOCATOR : uefi_alloc:: Allocator = uefi_alloc:: Allocator ;
88
91
89
- pub static mut HANDLE : uefi:: Handle = uefi:: Handle ( 0 ) ;
90
- pub static mut SYSTEM_TABLE : * mut uefi:: system:: SystemTable = 0 as * mut uefi:: system:: SystemTable ;
92
+ static mut HANDLE : uefi:: Handle = uefi:: Handle ( 0 ) ;
93
+ static mut SYSTEM_TABLE : * mut uefi:: system:: SystemTable = 0 as * mut uefi:: system:: SystemTable ;
94
+
95
+ pub fn handle ( ) -> uefi:: Handle {
96
+ unsafe { HANDLE }
97
+ }
91
98
92
99
pub fn system_table ( ) -> & ' static uefi:: system:: SystemTable {
93
100
unsafe { & * SYSTEM_TABLE }
Original file line number Diff line number Diff line change
1
+ // These functions are used by the compiler, but not
2
+ // for a bare-bones hello world. These are normally
3
+ // provided by libstd.
4
+ #[ lang = "eh_personality" ]
5
+ #[ no_mangle]
6
+ pub extern fn rust_eh_personality ( ) { }
7
+
8
+ // This function may be needed based on the compilation target.
9
+ #[ lang = "eh_unwind_resume" ]
10
+ #[ no_mangle]
11
+ pub extern fn rust_eh_unwind_resume ( ) {
12
+ loop { }
13
+ }
14
+
15
+ #[ panic_handler]
16
+ #[ no_mangle]
17
+ pub extern fn rust_begin_panic ( pi : & :: core:: panic:: PanicInfo ) -> ! {
18
+ print ! ( "SETUP PANIC: {}" , pi) ;
19
+
20
+ loop { }
21
+ }
22
+
23
+ #[ lang = "oom" ]
24
+ #[ no_mangle]
25
+ pub extern "C" fn rust_oom ( layout : :: core:: alloc:: Layout ) -> ! {
26
+ println ! (
27
+ "SETUP OOM: {} bytes aligned to {} bytes\n " ,
28
+ layout. size( ) ,
29
+ layout. align( )
30
+ ) ;
31
+
32
+ loop { }
33
+ }
34
+
35
+ #[ allow( non_snake_case) ]
36
+ #[ no_mangle]
37
+ pub extern fn _Unwind_Resume ( ) {
38
+ loop { }
39
+ }
You can’t perform that action at this time.
0 commit comments