Skip to content

Commit 4ee5113

Browse files
committed
Support powerpc64
The test_ioctl values are computed using ioctl-test.c
1 parent ab5435e commit 4ee5113

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

src/sys/ioctl/platform/linux.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
pub const NRBITS: u32 = 8;
22
pub const TYPEBITS: u32 = 8;
33

4-
#[cfg(any(target_arch = "mips", target_arch = "powerpc"))]
4+
#[cfg(any(target_arch = "mips", target_arch = "powerpc", target_arch = "powerpc64"))]
55
mod consts {
66
pub const NONE: u8 = 1;
77
pub const READ: u8 = 2;
@@ -15,6 +15,7 @@ mod consts {
1515
target_arch = "x86",
1616
target_arch = "arm",
1717
target_arch = "x86_64",
18+
target_arch = "powerpc64",
1819
target_arch = "aarch64")))]
1920
use this_arch_not_supported;
2021

src/sys/syscall.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ mod arch {
5454
pub static MEMFD_CREATE: Syscall = 354;
5555
}
5656

57-
#[cfg(target_arch = "powerpc")]
57+
#[cfg(any(target_arch = "powerpc", target_arch = "powerpc64"))]
5858
mod arch {
5959
use libc::c_long;
6060

test/sys/test_ioctl.rs

+14-5
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ ioctl!(readwrite buf readwritebuf_test with 0, 0; u32);
2020
mod linux {
2121
#[test]
2222
fn test_op_none() {
23-
if cfg!(any(target_arch = "mips", target_arch="powerpc")){
23+
if cfg!(any(target_arch = "mips", target_arch="powerpc", target_arch="powerpc64")){
2424
assert_eq!(io!(b'q', 10), 0x2000710A);
2525
assert_eq!(io!(b'a', 255), 0x200061FF);
2626
} else {
@@ -31,7 +31,7 @@ mod linux {
3131

3232
#[test]
3333
fn test_op_write() {
34-
if cfg!(any(target_arch = "mips", target_arch="powerpc")){
34+
if cfg!(any(target_arch = "mips", target_arch="powerpc", target_arch="powerpc64")){
3535
assert_eq!(iow!(b'z', 10, 1), 0x80017A0A);
3636
assert_eq!(iow!(b'z', 10, 512), 0x82007A0A);
3737
} else {
@@ -43,12 +43,17 @@ mod linux {
4343
#[cfg(target_pointer_width = "64")]
4444
#[test]
4545
fn test_op_write_64() {
46-
assert_eq!(iow!(b'z', 10, (1 as u64) << 32), 0x40007A0A);
46+
if cfg!(any(target_arch="powerpc64")){
47+
assert_eq!(iow!(b'z', 10, (1 as u64) << 32), 0x80007A0A);
48+
} else {
49+
assert_eq!(iow!(b'z', 10, (1 as u64) << 32), 0x40007A0A);
50+
}
51+
4752
}
4853

4954
#[test]
5055
fn test_op_read() {
51-
if cfg!(any(target_arch = "mips", target_arch="powerpc")){
56+
if cfg!(any(target_arch = "mips", target_arch="powerpc", target_arch="powerpc64")){
5257
assert_eq!(ior!(b'z', 10, 1), 0x40017A0A);
5358
assert_eq!(ior!(b'z', 10, 512), 0x42007A0A);
5459
} else {
@@ -60,7 +65,11 @@ mod linux {
6065
#[cfg(target_pointer_width = "64")]
6166
#[test]
6267
fn test_op_read_64() {
63-
assert_eq!(ior!(b'z', 10, (1 as u64) << 32), 0x80007A0A);
68+
if cfg!(any(target_arch="powerpc64")){
69+
assert_eq!(ior!(b'z', 10, (1 as u64) << 32), 0x40007A0A);
70+
} else {
71+
assert_eq!(ior!(b'z', 10, (1 as u64) << 32), 0x80007A0A);
72+
}
6473
}
6574

6675
#[test]

0 commit comments

Comments
 (0)