1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
- // file at the top-level directory of this distribution and at
- // http://rust-lang.org/COPYRIGHT.
- //
- // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
- // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
- // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
- // option. This file may not be copied, modified, or distributed
- // except according to those terms.
- /// The macro to invoke a syscall.
- ///
- /// # Examples
- ///
- /// The following code will print `Hello, world!` to the screen with black background and white foreground.
- /// ```
- /// syscall!(SYS_PUTSTRING, "Hello, world!\n", 0x00ffffff, 0x00000000);
- /// ```
- ///
- /// # Note
- ///
- /// This macro is not meant to be used directly, but rather as a dependency for other crates.
- #[macro_export]
- macro_rules! syscall {
- ($nr:ident) => {
- ::dsc::syscall0(::dsc::nr::$nr)
- };
- ($nr:ident, $a1:expr) => {
- ::dsc::syscall1(::dsc::nr::$nr, $a1 as usize)
- };
- ($nr:ident, $a1:expr, $a2:expr) => {
- ::dsc::syscall2(::dsc::nr::$nr, $a1 as usize, $a2 as usize)
- };
- ($nr:ident, $a1:expr, $a2:expr, $a3:expr) => {
- ::dsc::syscall3(::dsc::nr::$nr, $a1 as usize, $a2 as usize, $a3 as usize)
- };
- ($nr:ident, $a1:expr, $a2:expr, $a3:expr, $a4:expr) => {
- ::dsc::syscall4(
- ::dsc::nr::$nr,
- $a1 as usize,
- $a2 as usize,
- $a3 as usize,
- $a4 as usize,
- )
- };
- ($nr:ident, $a1:expr, $a2:expr, $a3:expr, $a4:expr, $a5:expr) => {
- ::dsc::syscall5(
- ::dsc::nr::$nr,
- $a1 as usize,
- $a2 as usize,
- $a3 as usize,
- $a4 as usize,
- $a5 as usize,
- )
- };
- ($nr:ident, $a1:expr, $a2:expr, $a3:expr, $a4:expr, $a5:expr, $a6:expr) => {
- ::dsc::syscall6(
- ::dsc::nr::$nr,
- $a1 as usize,
- $a2 as usize,
- $a3 as usize,
- $a4 as usize,
- $a5 as usize,
- $a6 as usize,
- )
- };
- ($nr:ident, $a1:expr, $a2:expr, $a3:expr, $a4:expr, $a5:expr, $a6:expr, $a7:expr) => {
- ::dsc::syscall7(
- ::dsc::nr::$nr,
- $a1 as usize,
- $a2 as usize,
- $a3 as usize,
- $a4 as usize,
- $a5 as usize,
- $a6 as usize,
- $a7 as usize,
- )
- };
- }
|