diff options
author | Luca Barbato <lu_zero@gentoo.org> | 2017-05-02 13:52:33 +0200 |
---|---|---|
committer | Luca Barbato <lu_zero@gentoo.org> | 2017-06-19 20:10:57 +0200 |
commit | 4ee5113d1ebd0fa1318da63c6fd0f5d6972604a3 (patch) | |
tree | 83d815eda390e471b908b96f5785cca89616d0b4 | |
parent | ab5435e8bc9b10ed3dc05787c10d28bb8957a42a (diff) | |
download | nix-4ee5113d1ebd0fa1318da63c6fd0f5d6972604a3.zip |
Support powerpc64
The test_ioctl values are computed using ioctl-test.c
-rw-r--r-- | src/sys/ioctl/platform/linux.rs | 3 | ||||
-rw-r--r-- | src/sys/syscall.rs | 2 | ||||
-rw-r--r-- | test/sys/test_ioctl.rs | 19 |
3 files changed, 17 insertions, 7 deletions
diff --git a/src/sys/ioctl/platform/linux.rs b/src/sys/ioctl/platform/linux.rs index aacea459..efdd17bb 100644 --- a/src/sys/ioctl/platform/linux.rs +++ b/src/sys/ioctl/platform/linux.rs @@ -1,7 +1,7 @@ pub const NRBITS: u32 = 8; pub const TYPEBITS: u32 = 8; -#[cfg(any(target_arch = "mips", target_arch = "powerpc"))] +#[cfg(any(target_arch = "mips", target_arch = "powerpc", target_arch = "powerpc64"))] mod consts { pub const NONE: u8 = 1; pub const READ: u8 = 2; @@ -15,6 +15,7 @@ mod consts { target_arch = "x86", target_arch = "arm", target_arch = "x86_64", + target_arch = "powerpc64", target_arch = "aarch64")))] use this_arch_not_supported; diff --git a/src/sys/syscall.rs b/src/sys/syscall.rs index 692b4cef..cff2cc99 100644 --- a/src/sys/syscall.rs +++ b/src/sys/syscall.rs @@ -54,7 +54,7 @@ mod arch { pub static MEMFD_CREATE: Syscall = 354; } -#[cfg(target_arch = "powerpc")] +#[cfg(any(target_arch = "powerpc", target_arch = "powerpc64"))] mod arch { use libc::c_long; diff --git a/test/sys/test_ioctl.rs b/test/sys/test_ioctl.rs index b68622d1..55b61fd7 100644 --- a/test/sys/test_ioctl.rs +++ b/test/sys/test_ioctl.rs @@ -20,7 +20,7 @@ ioctl!(readwrite buf readwritebuf_test with 0, 0; u32); mod linux { #[test] fn test_op_none() { - if cfg!(any(target_arch = "mips", target_arch="powerpc")){ + if cfg!(any(target_arch = "mips", target_arch="powerpc", target_arch="powerpc64")){ assert_eq!(io!(b'q', 10), 0x2000710A); assert_eq!(io!(b'a', 255), 0x200061FF); } else { @@ -31,7 +31,7 @@ mod linux { #[test] fn test_op_write() { - if cfg!(any(target_arch = "mips", target_arch="powerpc")){ + if cfg!(any(target_arch = "mips", target_arch="powerpc", target_arch="powerpc64")){ assert_eq!(iow!(b'z', 10, 1), 0x80017A0A); assert_eq!(iow!(b'z', 10, 512), 0x82007A0A); } else { @@ -43,12 +43,17 @@ mod linux { #[cfg(target_pointer_width = "64")] #[test] fn test_op_write_64() { - assert_eq!(iow!(b'z', 10, (1 as u64) << 32), 0x40007A0A); + if cfg!(any(target_arch="powerpc64")){ + assert_eq!(iow!(b'z', 10, (1 as u64) << 32), 0x80007A0A); + } else { + assert_eq!(iow!(b'z', 10, (1 as u64) << 32), 0x40007A0A); + } + } #[test] fn test_op_read() { - if cfg!(any(target_arch = "mips", target_arch="powerpc")){ + if cfg!(any(target_arch = "mips", target_arch="powerpc", target_arch="powerpc64")){ assert_eq!(ior!(b'z', 10, 1), 0x40017A0A); assert_eq!(ior!(b'z', 10, 512), 0x42007A0A); } else { @@ -60,7 +65,11 @@ mod linux { #[cfg(target_pointer_width = "64")] #[test] fn test_op_read_64() { - assert_eq!(ior!(b'z', 10, (1 as u64) << 32), 0x80007A0A); + if cfg!(any(target_arch="powerpc64")){ + assert_eq!(ior!(b'z', 10, (1 as u64) << 32), 0x40007A0A); + } else { + assert_eq!(ior!(b'z', 10, (1 as u64) << 32), 0x80007A0A); + } } #[test] |