Skip to content

Commit acbdb6f

Browse files
authored
Merge pull request #491 from newAM/cortex-m-semihosting-safety
semihosting: add Safety docstring to syscall
2 parents 7cdf8c6 + ee8db28 commit acbdb6f

File tree

1 file changed

+11
-0
lines changed
  • cortex-m-semihosting/src

1 file changed

+11
-0
lines changed

cortex-m-semihosting/src/lib.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,12 +184,23 @@ pub mod hio;
184184
pub mod nr;
185185

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

192199
/// Performs a semihosting operation, takes one integer as an argument
200+
///
201+
/// # Safety
202+
///
203+
/// Same as [`syscall`].
193204
#[inline(always)]
194205
pub unsafe fn syscall1(_nr: usize, _arg: usize) -> usize {
195206
match () {

0 commit comments

Comments
 (0)