Skip to content

Commit d01bdda

Browse files
Add __syscall assembly
1 parent 10b29d3 commit d01bdda

16 files changed

+10
-2
lines changed

asm/inline.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,13 @@ pub unsafe fn __wfi() {
175175
asm!("wfi");
176176
}
177177

178+
/// Semihosting syscall.
179+
#[inline(always)]
180+
pub unsafe fn __syscall(mut nr: u32, arg: u32) -> u32 {
181+
asm!("bkpt #0xab", inout("r0") nr, in("r1") arg);
182+
nr
183+
}
184+
178185
// v7m *AND* v8m.main, but *NOT* v8m.base
179186
#[cfg(any(armv7m, armv8m_main))]
180187
pub use self::v7m::*;

asm/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ macro_rules! shims {
4646
pub unsafe extern "C" fn $name(
4747
$($arg: $argty),*
4848
) $(-> $ret)? {
49-
crate::inline::$name($($arg)*)
49+
crate::inline::$name($($arg),*)
5050
}
5151
)+
5252
};
@@ -72,9 +72,10 @@ shims! {
7272
fn __udf();
7373
fn __wfe();
7474
fn __wfi();
75+
fn __syscall(nr: u32, arg: u32) -> u32;
7576
}
7677

77-
// v7m *AND* v8m.main, but *NOT* v8m.base
78+
// v7m *AND* v8m.main, but *NOT* v8m.base
7879
#[cfg(any(armv7m, armv8m_main))]
7980
shims! {
8081
fn __basepri_max(val: u8);

bin/thumbv6m-none-eabi-lto.a

608 Bytes
Binary file not shown.

bin/thumbv6m-none-eabi.a

640 Bytes
Binary file not shown.

bin/thumbv7em-none-eabi-lto.a

640 Bytes
Binary file not shown.

bin/thumbv7em-none-eabi.a

640 Bytes
Binary file not shown.

bin/thumbv7em-none-eabihf-lto.a

652 Bytes
Binary file not shown.

bin/thumbv7em-none-eabihf.a

640 Bytes
Binary file not shown.

bin/thumbv7m-none-eabi-lto.a

632 Bytes
Binary file not shown.

bin/thumbv7m-none-eabi.a

640 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)