123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143 |
- //! Capture 3. Binary Encoding
- pub use sbi_spec::binary::SbiRet;
- #[inline(always)]
- pub(crate) fn sbi_call_0(eid: usize, fid: usize) -> SbiRet {
- let (error, value);
- unsafe {
- core::arch::asm!(
- "ecall",
- in("a7") eid,
- in("a6") fid,
- lateout("a0") error,
- lateout("a1") value,
- );
- }
- SbiRet { error, value }
- }
- #[inline(always)]
- pub(crate) fn sbi_call_1(eid: usize, fid: usize, arg0: usize) -> SbiRet {
- let (error, value);
- unsafe {
- core::arch::asm!(
- "ecall",
- in("a7") eid,
- in("a6") fid,
- inlateout("a0") arg0 => error,
- lateout("a1") value,
- );
- }
- SbiRet { error, value }
- }
- #[inline(always)]
- pub(crate) fn sbi_call_2(eid: usize, fid: usize, arg0: usize, arg1: usize) -> SbiRet {
- let (error, value);
- unsafe {
- core::arch::asm!(
- "ecall",
- in("a7") eid,
- in("a6") fid,
- inlateout("a0") arg0 => error,
- inlateout("a1") arg1 => value,
- );
- }
- SbiRet { error, value }
- }
- #[inline(always)]
- pub(crate) fn sbi_call_3(eid: usize, fid: usize, arg0: usize, arg1: usize, arg2: usize) -> SbiRet {
- let (error, value);
- unsafe {
- core::arch::asm!(
- "ecall",
- in("a7") eid,
- in("a6") fid,
- inlateout("a0") arg0 => error,
- inlateout("a1") arg1 => value,
- in("a2") arg2,
- );
- }
- SbiRet { error, value }
- }
- #[inline(always)]
- pub(crate) fn sbi_call_4(
- eid: usize,
- fid: usize,
- arg0: usize,
- arg1: usize,
- arg2: usize,
- arg3: usize,
- ) -> SbiRet {
- let (error, value);
- unsafe {
- core::arch::asm!(
- "ecall",
- in("a7") eid,
- in("a6") fid,
- inlateout("a0") arg0 => error,
- inlateout("a1") arg1 => value,
- in("a2") arg2,
- in("a3") arg3,
- );
- }
- SbiRet { error, value }
- }
- #[inline(always)]
- pub(crate) fn sbi_call_5(
- eid: usize,
- fid: usize,
- arg0: usize,
- arg1: usize,
- arg2: usize,
- arg3: usize,
- arg4: usize,
- ) -> SbiRet {
- let (error, value);
- unsafe {
- core::arch::asm!(
- "ecall",
- in("a7") eid,
- in("a6") fid,
- inlateout("a0") arg0 => error,
- inlateout("a1") arg1 => value,
- in("a2") arg2,
- in("a3") arg3,
- in("a4") arg4,
- );
- }
- SbiRet { error, value }
- }
- #[cfg(target_pointer_width = "32")]
- #[inline(always)]
- pub(crate) fn sbi_call_6(
- eid: usize,
- fid: usize,
- arg0: usize,
- arg1: usize,
- arg2: usize,
- arg3: usize,
- arg4: usize,
- arg5: usize,
- ) -> SbiRet {
- let (error, value);
- unsafe {
- core::arch::asm!(
- "ecall",
- in("a7") eid,
- in("a6") fid,
- inlateout("a0") arg0 => error,
- inlateout("a1") arg1 => value,
- in("a2") arg2,
- in("a3") arg3,
- in("a4") arg4,
- in("a5") arg5,
- );
- }
- SbiRet { error, value }
- }
|