-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmain.rs
More file actions
70 lines (54 loc) · 1.48 KB
/
main.rs
File metadata and controls
70 lines (54 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#![no_std]
#![no_main]
#![feature(custom_test_frameworks)]
#![test_runner(gk::test_runner)]
#![reexport_test_harness_main = "test_main"]
#[macro_use]
extern crate gk;
use limine::BaseRevision;
use limine::request::{RequestsEndMarker, RequestsStartMarker};
use core::panic::PanicInfo;
#[used]
#[link_section = ".requests"]
static BASE_REVISION: BaseRevision = BaseRevision::new();
#[used]
#[link_section = ".requests_start_marker"]
static _START_MARKER: RequestsStartMarker = RequestsStartMarker::new();
#[used]
#[link_section = ".requests_end_marker"]
static _END_MARKER: RequestsEndMarker = RequestsEndMarker::new();
#[no_mangle]
unsafe extern "C" fn _start() -> ! {
assert!(BASE_REVISION.is_supported());
gk::init();
#[cfg(test)]
{
serial_info_ln!("!!! RUNNING BINARY TESTS !!!");
test_main();
}
// individual device output
fb0_info_ln!("hello framebuffer");
serial_info_ln!("hello serial");
// combined device output
info_ln!("information for all devices");
debug_ln!("debug for all devices");
warn_ln!("warning for all devices");
danger_ln!("danger for all devices");
gk::hlt_loop();
}
#[cfg(not(test))]
#[panic_handler]
fn rust_panic(info: &PanicInfo) -> ! {
serial_danger_ln!("{}", info);
gk::hlt_loop();
}
#[cfg(test)]
#[panic_handler]
fn rust_panic(info: &PanicInfo) -> ! {
serial_danger_ln!("{}", info);
gk::test_panic_handler(info);
}
#[test_case]
fn trivial_main_assertion() {
assert_eq!(1, 1);
}