Skip to content

Commit

Permalink
semihosting: add Safety docstring to syscall
Browse files Browse the repository at this point in the history
  • Loading branch information
newAM committed Oct 29, 2023
1 parent 7f6ff8f commit ee8db28
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions cortex-m-semihosting/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,23 @@ pub mod hio;
pub mod nr;

/// Performs a semihosting operation, takes a pointer to an argument block
///
/// # Safety
///
/// The syscall number must be a valid [semihosting operation],
/// and the arguments must be valid for the associated operation.
///
/// [semihosting operation]: https://developer.arm.com/documentation/dui0471/i/semihosting/semihosting-operations?lang=en
#[inline(always)]
pub unsafe fn syscall<T>(nr: usize, arg: &T) -> usize {
syscall1(nr, arg as *const T as usize)
}

/// Performs a semihosting operation, takes one integer as an argument
///
/// # Safety
///
/// Same as [`syscall`].
#[inline(always)]
pub unsafe fn syscall1(_nr: usize, _arg: usize) -> usize {
match () {
Expand Down

0 comments on commit ee8db28

Please sign in to comment.