impl_syscall

Macro impl_syscall 

Source
macro_rules! impl_syscall {
    ($sys_name:ident, $kernel:path, noreturn, ($t0:ty, $t1:ty, $t2:ty, $t3:ty, $t4:ty, $t5:ty)) => { ... };
    ($sys_name:ident, $kernel:path, noreturn, ()) => { ... };
    ($sys_name:ident, $kernel:path, noreturn, ($t0:ty)) => { ... };
    ($sys_name:ident, $kernel:path, noreturn, ($t0:ty, $t1:ty)) => { ... };
    ($sys_name:ident, $kernel:path, noreturn, ($t0:ty, $t1:ty, $t2:ty)) => { ... };
    ($sys_name:ident, $kernel:path, noreturn, ($t0:ty, $t1:ty, $t2:ty, $t3:ty)) => { ... };
    ($sys_name:ident, $kernel:path, noreturn, ($t0:ty, $t1:ty, $t2:ty, $t3:ty, $t4:ty)) => { ... };
    ($sys_name:ident, $kernel:path, ($t0:ty, $t1:ty, $t2:ty, $t3:ty, $t4:ty, $t5:ty)) => { ... };
    ($sys_name:ident, $kernel:path, ()) => { ... };
    ($sys_name:ident, $kernel:path, ($t0:ty)) => { ... };
    ($sys_name:ident, $kernel:path, ($t0:ty, $t1:ty)) => { ... };
    ($sys_name:ident, $kernel:path, ($t0:ty, $t1:ty, $t2:ty)) => { ... };
    ($sys_name:ident, $kernel:path, ($t0:ty, $t1:ty, $t2:ty, $t3:ty)) => { ... };
    ($sys_name:ident, $kernel:path, ($t0:ty, $t1:ty, $t2:ty, $t3:ty, $t4:ty)) => { ... };
}
Expand description

宏:实现系统调用函数的自动包装器

该宏会生成一个名为 sys_name 的函数,该函数签名固定为 (frame: &mut TrapFrame)

  1. 从TrapFrame中提取参数
  2. 调用对应的系统调用处理函数
  3. 将返回值写回TrapFrame