aboutsummaryrefslogtreecommitdiff
path: root/cortex-m-semihosting/src/lib.rs
diff options
context:
space:
mode:
authorGravatar Alex Martens <alex@thinglab.org> 2023-10-29 15:48:29 -0700
committerGravatar Alex Martens <alex@thinglab.org> 2023-10-29 15:48:29 -0700
commitee8db28dcd51f4080784c0048c1da7a27be91065 (patch)
treec42f3acd3c21dacf0cd38cb0ebc51029de67b74f /cortex-m-semihosting/src/lib.rs
parent7f6ff8fb72eb333344c02147c06e7dc6801870c3 (diff)
downloadcortex-m-ee8db28dcd51f4080784c0048c1da7a27be91065.tar.gz
cortex-m-ee8db28dcd51f4080784c0048c1da7a27be91065.tar.zst
cortex-m-ee8db28dcd51f4080784c0048c1da7a27be91065.zip
semihosting: add Safety docstring to syscall
Diffstat (limited to '')
-rw-r--r--cortex-m-semihosting/src/lib.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/cortex-m-semihosting/src/lib.rs b/cortex-m-semihosting/src/lib.rs
index 8306307..e72dbe6 100644
--- a/cortex-m-semihosting/src/lib.rs
+++ b/cortex-m-semihosting/src/lib.rs
@@ -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 () {