xref: /dragonos-dsc/src/macros.rs (revision b972e64f1e063c040c8d4019858d2425712ef95f)
1 // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10 
11 #[macro_export]
12 macro_rules! syscall {
13     ($nr:ident)
14         => ( ::dsc::syscall0(
15                 ::dsc::nr::$nr) );
16 
17     ($nr:ident, $a1:expr)
18         => ( ::dsc::syscall1(
19                 ::dsc::nr::$nr,
20                 $a1 as usize) );
21 
22     ($nr:ident, $a1:expr, $a2:expr)
23         => ( ::dsc::syscall2(
24                 ::dsc::nr::$nr,
25                 $a1 as usize, $a2 as usize) );
26 
27     ($nr:ident, $a1:expr, $a2:expr, $a3:expr)
28         => ( ::dsc::syscall3(
29                 ::dsc::nr::$nr,
30                 $a1 as usize, $a2 as usize, $a3 as usize) );
31 
32     ($nr:ident, $a1:expr, $a2:expr, $a3:expr, $a4:expr)
33         => ( ::dsc::syscall4(
34                 ::dsc::nr::$nr,
35                 $a1 as usize, $a2 as usize, $a3 as usize,
36                 $a4 as usize) );
37 
38     ($nr:ident, $a1:expr, $a2:expr, $a3:expr, $a4:expr, $a5:expr)
39         => ( ::dsc::syscall5(
40                 ::dsc::nr::$nr,
41                 $a1 as usize, $a2 as usize, $a3 as usize,
42                 $a4 as usize, $a5 as usize) );
43 
44     ($nr:ident, $a1:expr, $a2:expr, $a3:expr, $a4:expr, $a5:expr, $a6:expr)
45         => ( ::dsc::syscall6(
46                 ::dsc::nr::$nr,
47                 $a1 as usize, $a2 as usize, $a3 as usize,
48                 $a4 as usize, $a5 as usize, $a6 as usize) );
49 
50     ($nr:ident, $a1:expr, $a2:expr, $a3:expr, $a4:expr, $a5:expr, $a6:expr, $a7:expr)
51         => ( ::dsc::syscall7(
52                 ::dsc::nr::$nr,
53                 $a1 as usize, $a2 as usize, $a3 as usize,
54                 $a4 as usize, $a5 as usize, $a6 as usize,
55                 $a7 as usize) );
56 }