Explorar o código

hax to make this crate compilable for x86

needed to cargo publish
Jorge Aparicio %!s(int64=8) %!d(string=hai) anos
pai
achega
18420a875a
Modificáronse 1 ficheiros con 6 adicións e 0 borrados
  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
+}