File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change 1
1
#![ no_std]
2
2
3
3
pub extern crate os_bootinfo as bootinfo;
4
+
5
+ /// Defines the entry point function.
6
+ ///
7
+ /// The function must have the signature `fn(&'static BootInfo) -> !`.
8
+ ///
9
+ /// This macro just creates a function named `_start`, which the linker will use as the entry
10
+ /// point. The advantage of using this macro instead of providing an own `_start` function is
11
+ /// that the macro ensures that the function and argument types are correct.
12
+ #[ macro_export]
13
+ macro_rules! entry_point {
14
+ ( $path: path) => {
15
+ #[ export_name = "_start" ]
16
+ pub extern "C" fn __impl_start( boot_info: & ' static $crate:: bootinfo:: BootInfo ) -> ! {
17
+ // validate the signature of the program entry point
18
+ let f: fn ( & ' static $crate:: bootinfo:: BootInfo ) -> ! = $path;
19
+
20
+ f( boot_info)
21
+ }
22
+ } ;
23
+ }
You can’t perform that action at this time.
0 commit comments