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
#[macro_export]
macro_rules! kassert {
($test:expr) => ({
if !$test {
sprintln!("kassertion failed: {}, {}:{}:{}", stringify!($test), file!(), line!(), column!());
unsafe { x86test::outw(0xf4, 0x01); }
}
});
($test:expr, $($arg:tt)+) => ({
if !$test {
sprintln!("kassertion failed: {}, {}:{}:{}", format_args!($($arg)+), file!(), line!(), column!());
#[allow(unused_unsafe)]
unsafe { x86test::outw(0xf4, 0x01); }
}
});
}
#[macro_export]
macro_rules! kpanic {
($test:expr) => ({
sprintln!("kpanic: {}, {}:{}:{}", stringify!($test), file!(), line!(), column!());
unsafe { x86test::outw(0xf4, 0x02); }
});
($test:expr, $($arg:tt)+) => ({
if !$test {
sprintln!("kpanic: {}, {}:{}:{}", format_args!($($arg)+), file!(), line!(), column!());
#[allow(unused_unsafe)]
unsafe { x86test::outw(0xf4, 0x02); }
}
});
}
pub struct StaticTestFn(pub fn());
pub struct X86TestFn {
pub name: &'static str,
pub ignore: bool,
pub identity_map: bool,
pub physical_memory: (u64, u64),
pub ioport_enable: (u16, u32),
pub should_panic: bool,
pub should_halt: bool,
pub testfn: StaticTestFn,
}