Skip to content

Commit 1d5655d

Browse files
committed
sys: add MIPS R6 support
Currently R6 targets are almost identical to their R2/R5 counterparts.
1 parent e5b2df6 commit 1d5655d

File tree

9 files changed

+99
-14
lines changed

9 files changed

+99
-14
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ targets = [
2828
]
2929

3030
[dependencies]
31-
libc = { version = "0.2.147", features = ["extra_traits"] }
31+
libc = { version = "0.2.148", features = ["extra_traits"] }
3232
bitflags = "2.3.1"
3333
cfg-if = "1.0"
3434
pin-utils = { version = "0.1.0", optional = true }

src/sys/ioctl/linux.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ pub const TYPEBITS: ioctl_num_type = 8;
1919
cfg_if! {
2020
if #[cfg(any(
2121
target_arch = "mips",
22+
target_arch = "mips32r6",
2223
target_arch = "mips64",
24+
target_arch = "mips64r6",
2325
target_arch = "powerpc",
2426
target_arch = "powerpc64",
2527
target_arch = "sparc64"

src/sys/ptrace/linux.rs

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,42 +53,54 @@ libc_enum! {
5353
#[cfg(any(all(target_os = "android", target_pointer_width = "32"),
5454
all(target_os = "linux", any(target_env = "musl",
5555
target_arch = "mips",
56+
target_arch = "mips32r6",
5657
target_arch = "mips64",
58+
target_arch = "mips64r6",
5759
target_arch = "x86_64",
5860
target_pointer_width = "32"))))]
5961
PTRACE_GETREGS,
6062
#[cfg(any(all(target_os = "android", target_pointer_width = "32"),
6163
all(target_os = "linux", any(target_env = "musl",
6264
target_arch = "mips",
65+
target_arch = "mips32r6",
6366
target_arch = "mips64",
67+
target_arch = "mips64r6",
6468
target_arch = "x86_64",
6569
target_pointer_width = "32"))))]
6670
PTRACE_SETREGS,
6771
#[cfg(any(all(target_os = "android", target_pointer_width = "32"),
6872
all(target_os = "linux", any(target_env = "musl",
6973
target_arch = "mips",
74+
target_arch = "mips32r6",
7075
target_arch = "mips64",
76+
target_arch = "mips64r6",
7177
target_arch = "x86_64",
7278
target_pointer_width = "32"))))]
7379
PTRACE_GETFPREGS,
7480
#[cfg(any(all(target_os = "android", target_pointer_width = "32"),
7581
all(target_os = "linux", any(target_env = "musl",
7682
target_arch = "mips",
83+
target_arch = "mips32r6",
7784
target_arch = "mips64",
85+
target_arch = "mips64r6",
7886
target_arch = "x86_64",
7987
target_pointer_width = "32"))))]
8088
PTRACE_SETFPREGS,
8189
PTRACE_ATTACH,
8290
PTRACE_DETACH,
8391
#[cfg(all(target_os = "linux", any(target_env = "musl",
8492
target_arch = "mips",
93+
target_arch = "mips32r6",
8594
target_arch = "mips64",
95+
target_arch = "mips64r6",
8696
target_arch = "x86",
8797
target_arch = "x86_64")))]
8898
PTRACE_GETFPXREGS,
8999
#[cfg(all(target_os = "linux", any(target_env = "musl",
90100
target_arch = "mips",
101+
target_arch = "mips32r6",
91102
target_arch = "mips64",
103+
target_arch = "mips64r6",
92104
target_arch = "x86",
93105
target_arch = "x86_64")))]
94106
PTRACE_SETFPXREGS,
@@ -98,10 +110,14 @@ libc_enum! {
98110
PTRACE_GETSIGINFO,
99111
PTRACE_SETSIGINFO,
100112
#[cfg(all(target_os = "linux", not(any(target_arch = "mips",
101-
target_arch = "mips64"))))]
113+
target_arch = "mips32r6",
114+
target_arch = "mips64",
115+
target_arch = "mips64r6"))))]
102116
PTRACE_GETREGSET,
103117
#[cfg(all(target_os = "linux", not(any(target_arch = "mips",
104-
target_arch = "mips64"))))]
118+
target_arch = "mips32r6",
119+
target_arch = "mips64",
120+
target_arch = "mips64r6"))))]
105121
PTRACE_SETREGSET,
106122
#[cfg(target_os = "linux")]
107123
#[cfg_attr(docsrs, doc(cfg(all())))]
@@ -110,10 +126,14 @@ libc_enum! {
110126
#[cfg_attr(docsrs, doc(cfg(all())))]
111127
PTRACE_INTERRUPT,
112128
#[cfg(all(target_os = "linux", not(any(target_arch = "mips",
113-
target_arch = "mips64"))))]
129+
target_arch = "mips32r6",
130+
target_arch = "mips64",
131+
target_arch = "mips64r6"))))]
114132
PTRACE_LISTEN,
115133
#[cfg(all(target_os = "linux", not(any(target_arch = "mips",
116-
target_arch = "mips64"))))]
134+
target_arch = "mips32r6",
135+
target_arch = "mips64",
136+
target_arch = "mips64r6"))))]
117137
PTRACE_PEEKSIGINFO,
118138
#[cfg(all(target_os = "linux", target_env = "gnu",
119139
any(target_arch = "x86", target_arch = "x86_64")))]

src/sys/signal.rs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,10 @@ libc_enum! {
6666
/// Stack fault (obsolete)
6767
#[cfg(all(any(target_os = "android", target_os = "emscripten",
6868
target_os = "fuchsia", target_os = "linux"),
69-
not(any(target_arch = "mips", target_arch = "mips64",
69+
not(any(target_arch = "mips",
70+
target_arch = "mips32r6",
71+
target_arch = "mips64",
72+
target_arch = "mips64r6",
7073
target_arch = "sparc64"))))]
7174
SIGSTKFLT,
7275
/// To parent on child stop or exit
@@ -151,7 +154,9 @@ impl FromStr for Signal {
151154
),
152155
not(any(
153156
target_arch = "mips",
157+
target_arch = "mips32r6",
154158
target_arch = "mips64",
159+
target_arch = "mips64r6",
155160
target_arch = "sparc64"
156161
))
157162
))]
@@ -235,7 +240,9 @@ impl Signal {
235240
),
236241
not(any(
237242
target_arch = "mips",
243+
target_arch = "mips32r6",
238244
target_arch = "mips64",
245+
target_arch = "mips64r6",
239246
target_arch = "sparc64"
240247
))
241248
))]
@@ -328,7 +335,9 @@ const SIGNALS: [Signal; 28] = [
328335
),
329336
not(any(
330337
target_arch = "mips",
338+
target_arch = "mips32r6",
331339
target_arch = "mips64",
340+
target_arch = "mips64r6",
332341
target_arch = "sparc64"
333342
))
334343
))]
@@ -346,7 +355,13 @@ const SIGNALS: [Signal; 31] = [
346355
target_os = "emscripten",
347356
target_os = "fuchsia"
348357
),
349-
any(target_arch = "mips", target_arch = "mips64", target_arch = "sparc64")
358+
any(
359+
target_arch = "mips",
360+
target_arch = "mips32r6",
361+
target_arch = "mips64",
362+
target_arch = "mips64r6",
363+
target_arch = "sparc64"
364+
)
350365
))]
351366
#[cfg(feature = "signal")]
352367
const SIGNALS: [Signal; 30] = [

test/sys/test_aio.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,9 @@ mod aio_writev {
498498
any(
499499
all(target_env = "musl", target_arch = "x86_64"),
500500
target_arch = "mips",
501-
target_arch = "mips64"
501+
target_arch = "mips32r6",
502+
target_arch = "mips64",
503+
target_arch = "mips64r6"
502504
),
503505
ignore
504506
)]

test/sys/test_ioctl.rs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ mod linux {
3636
fn test_op_none() {
3737
if cfg!(any(
3838
target_arch = "mips",
39+
target_arch = "mips32r6",
3940
target_arch = "mips64",
41+
target_arch = "mips64r6",
4042
target_arch = "powerpc",
4143
target_arch = "powerpc64"
4244
)) {
@@ -54,7 +56,9 @@ mod linux {
5456
fn test_op_write() {
5557
if cfg!(any(
5658
target_arch = "mips",
59+
target_arch = "mips32r6",
5760
target_arch = "mips64",
61+
target_arch = "mips64r6",
5862
target_arch = "powerpc",
5963
target_arch = "powerpc64"
6064
)) {
@@ -69,7 +73,11 @@ mod linux {
6973
#[cfg(target_pointer_width = "64")]
7074
#[test]
7175
fn test_op_write_64() {
72-
if cfg!(any(target_arch = "mips64", target_arch = "powerpc64")) {
76+
if cfg!(any(
77+
target_arch = "mips64",
78+
target_arch = "mips64r6",
79+
target_arch = "powerpc64"
80+
)) {
7381
assert_eq!(
7482
request_code_write!(b'z', 10, 1u64 << 32) as u32,
7583
0x8000_7A0A
@@ -88,7 +96,9 @@ mod linux {
8896
fn test_op_read() {
8997
if cfg!(any(
9098
target_arch = "mips",
99+
target_arch = "mips32r6",
91100
target_arch = "mips64",
101+
target_arch = "mips64r6",
92102
target_arch = "powerpc",
93103
target_arch = "powerpc64"
94104
)) {
@@ -103,7 +113,11 @@ mod linux {
103113
#[cfg(target_pointer_width = "64")]
104114
#[test]
105115
fn test_op_read_64() {
106-
if cfg!(any(target_arch = "mips64", target_arch = "powerpc64")) {
116+
if cfg!(any(
117+
target_arch = "mips64",
118+
target_arch = "mips64r6",
119+
target_arch = "powerpc64"
120+
)) {
107121
assert_eq!(
108122
request_code_read!(b'z', 10, 1u64 << 32) as u32,
109123
0x4000_7A0A

test/sys/test_socket.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1678,7 +1678,9 @@ fn loopback_address(
16781678
qemu,
16791679
any(
16801680
target_arch = "mips",
1681+
target_arch = "mips32r6",
16811682
target_arch = "mips64",
1683+
target_arch = "mips64r6",
16821684
target_arch = "powerpc64",
16831685
)
16841686
),
@@ -1773,7 +1775,9 @@ pub fn test_recv_ipv4pktinfo() {
17731775
qemu,
17741776
any(
17751777
target_arch = "mips",
1778+
target_arch = "mips32r6",
17761779
target_arch = "mips64",
1780+
target_arch = "mips64r6",
17771781
target_arch = "powerpc64",
17781782
)
17791783
),
@@ -2065,7 +2069,9 @@ pub fn test_recvif_ipv6() {
20652069
qemu,
20662070
any(
20672071
target_arch = "mips",
2072+
target_arch = "mips32r6",
20682073
target_arch = "mips64",
2074+
target_arch = "mips64r6",
20692075
target_arch = "powerpc64",
20702076
)
20712077
),

test/sys/test_wait.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,12 @@ fn test_wait_signal() {
3333
//target_os = "haiku",
3434
all(target_os = "linux", not(target_env = "uclibc")),
3535
))]
36-
#[cfg(not(any(target_arch = "mips", target_arch = "mips64")))]
36+
#[cfg(not(any(
37+
target_arch = "mips",
38+
target_arch = "mips32r6",
39+
target_arch = "mips64",
40+
target_arch = "mips64r6"
41+
)))]
3742
fn test_waitid_signal() {
3843
let _m = crate::FORK_MTX.lock();
3944

@@ -76,7 +81,12 @@ fn test_wait_exit() {
7681
target_os = "haiku",
7782
all(target_os = "linux", not(target_env = "uclibc")),
7883
))]
79-
#[cfg(not(any(target_arch = "mips", target_arch = "mips64")))]
84+
#[cfg(not(any(
85+
target_arch = "mips",
86+
target_arch = "mips32r6",
87+
target_arch = "mips64",
88+
target_arch = "mips64r6"
89+
)))]
8090
fn test_waitid_exit() {
8191
let _m = crate::FORK_MTX.lock();
8292

test/test_mq.rs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,15 @@ fn test_mq_getattr() {
112112
// FIXME: Fix failures for mips in QEMU
113113
#[test]
114114
#[cfg_attr(
115-
all(qemu, any(target_arch = "mips", target_arch = "mips64")),
115+
all(
116+
qemu,
117+
any(
118+
target_arch = "mips",
119+
target_arch = "mips32r6",
120+
target_arch = "mips64",
121+
target_arch = "mips64r6"
122+
)
123+
),
116124
ignore
117125
)]
118126
fn test_mq_setattr() {
@@ -162,7 +170,15 @@ fn test_mq_setattr() {
162170
// FIXME: Fix failures for mips in QEMU
163171
#[test]
164172
#[cfg_attr(
165-
all(qemu, any(target_arch = "mips", target_arch = "mips64")),
173+
all(
174+
qemu,
175+
any(
176+
target_arch = "mips",
177+
target_arch = "mips32r6",
178+
target_arch = "mips64",
179+
target_arch = "mips64r6"
180+
)
181+
),
166182
ignore
167183
)]
168184
fn test_mq_set_nonblocking() {

0 commit comments

Comments
 (0)