/// AArch64 implementation of a syscall macro
#[macro_export]
macro_rules! syscall {
    ($num:expr $(,)?) => {{
        let mut res: usize;
        core::arch::asm!("svc #0", lateout("x0") res, in("x8") usize::from($num));
        res
    }};
    ($num:expr, $a0:expr $(,)?) => {{
        let mut res: usize = $a0;
        core::arch::asm!("svc #0",
             inlateout("x0") res,
             in("x8") usize::from($num));
        res
    }};
    ($num:expr, $a0:expr, $a1:expr $(,)?) => {{
        let mut res: usize = $a0;
        core::arch::asm!("svc #0",
             inlateout("x0") res, in("x1") $a1,
             in("x8") usize::from($num));
        res
    }};
    ($num:expr, $a0:expr, $a1:expr, $a2:expr $(,)?) => {{
        let mut res: usize = $a0;
        core::arch::asm!("svc #0",
             inlateout("x0") res, in("x1") $a1, in("x2") $a2,
             in("x8") usize::from($num));
        res
    }};
    ($num:expr, $a0:expr, $a1:expr, $a2:expr, $a3:expr $(,)?) => {{
        let mut res: usize = $a0;
        core::arch::asm!("svc #0",
             inlateout("x0") res, in("x1") $a1, in("x2") $a2,
             in("x3") $a3, in("x8") usize::from($num));
        res
    }};
    ($num:expr, $a0:expr, $a1:expr, $a2:expr, $a3:expr, $a4:expr $(,)?) => {{
        let mut res: usize = $a0;
        core::arch::asm!("svc #0",
             inlateout("x0") res, in("x1") $a1, in("x2") $a2,
             in("x3") $a3, in("x4") $a4, in("x8") usize::from($num));
        res
    }};
}
