Browse Source

hax to make this crate compilable for x86

needed to cargo publish
Jorge Aparicio 8 years ago
parent
commit
18420a875a
1 changed files with 6 additions and 0 deletions
  1. 6 0
      src/lib.rs

+ 6 - 0
src/lib.rs

@@ -114,6 +114,7 @@ pub mod nr;
 
 /// Performs a semihosting operation
 #[inline(always)]
+#[cfg(target_arch = "arm")]
 pub unsafe fn syscall<T>(mut nr: usize, arg: &T) -> usize {
     asm!("bkpt 0xAB"
          : "+{r0}"(nr)
@@ -122,3 +123,8 @@ pub unsafe fn syscall<T>(mut nr: usize, arg: &T) -> usize {
          : "volatile");
     nr
 }
+
+#[cfg(not(target_arch = "arm"))]
+pub unsafe fn syscall<T>(_nr: usize, _arg: &T) -> usize {
+    0
+}