Skip to content

Commit

Permalink
sys: add MIPS R6 support (nix-rust#2138)
Browse files Browse the repository at this point in the history
Currently R6 targets are almost identical to their R2/R5
counterparts.
  • Loading branch information
chenx97 committed Mar 21, 2024
1 parent 08d8ba9 commit 2a22f0c
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/sys/ioctl/linux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ pub const TYPEBITS: ioctl_num_type = 8;

#[cfg(any(
target_arch = "mips",
target_arch = "mips32r6",
target_arch = "mips64",
target_arch = "mips64r6",
target_arch = "powerpc",
target_arch = "powerpc64",
target_arch = "sparc64"
Expand Down
28 changes: 24 additions & 4 deletions src/sys/ptrace/linux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,42 +53,54 @@ libc_enum! {
#[cfg(any(all(target_os = "android", target_pointer_width = "32"),
all(target_os = "linux", any(target_env = "musl",
target_arch = "mips",
target_arch = "mips32r6",
target_arch = "mips64",
target_arch = "mips64r6",
target_arch = "x86_64",
target_pointer_width = "32"))))]
PTRACE_GETREGS,
#[cfg(any(all(target_os = "android", target_pointer_width = "32"),
all(target_os = "linux", any(target_env = "musl",
target_arch = "mips",
target_arch = "mips32r6",
target_arch = "mips64",
target_arch = "mips64r6",
target_arch = "x86_64",
target_pointer_width = "32"))))]
PTRACE_SETREGS,
#[cfg(any(all(target_os = "android", target_pointer_width = "32"),
all(target_os = "linux", any(target_env = "musl",
target_arch = "mips",
target_arch = "mips32r6",
target_arch = "mips64",
target_arch = "mips64r6",
target_arch = "x86_64",
target_pointer_width = "32"))))]
PTRACE_GETFPREGS,
#[cfg(any(all(target_os = "android", target_pointer_width = "32"),
all(target_os = "linux", any(target_env = "musl",
target_arch = "mips",
target_arch = "mips32r6",
target_arch = "mips64",
target_arch = "mips64r6",
target_arch = "x86_64",
target_pointer_width = "32"))))]
PTRACE_SETFPREGS,
PTRACE_ATTACH,
PTRACE_DETACH,
#[cfg(all(target_os = "linux", any(target_env = "musl",
target_arch = "mips",
target_arch = "mips32r6",
target_arch = "mips64",
target_arch = "mips64r6",
target_arch = "x86",
target_arch = "x86_64")))]
PTRACE_GETFPXREGS,
#[cfg(all(target_os = "linux", any(target_env = "musl",
target_arch = "mips",
target_arch = "mips32r6",
target_arch = "mips64",
target_arch = "mips64r6",
target_arch = "x86",
target_arch = "x86_64")))]
PTRACE_SETFPXREGS,
Expand All @@ -98,10 +110,14 @@ libc_enum! {
PTRACE_GETSIGINFO,
PTRACE_SETSIGINFO,
#[cfg(all(target_os = "linux", not(any(target_arch = "mips",
target_arch = "mips64"))))]
target_arch = "mips32r6",
target_arch = "mips64",
target_arch = "mips64r6"))))]
PTRACE_GETREGSET,
#[cfg(all(target_os = "linux", not(any(target_arch = "mips",
target_arch = "mips64"))))]
target_arch = "mips32r6",
target_arch = "mips64",
target_arch = "mips64r6"))))]
PTRACE_SETREGSET,
#[cfg(target_os = "linux")]
#[cfg_attr(docsrs, doc(cfg(all())))]
Expand All @@ -110,10 +126,14 @@ libc_enum! {
#[cfg_attr(docsrs, doc(cfg(all())))]
PTRACE_INTERRUPT,
#[cfg(all(target_os = "linux", not(any(target_arch = "mips",
target_arch = "mips64"))))]
target_arch = "mips32r6",
target_arch = "mips64",
target_arch = "mips64r6"))))]
PTRACE_LISTEN,
#[cfg(all(target_os = "linux", not(any(target_arch = "mips",
target_arch = "mips64"))))]
target_arch = "mips32r6",
target_arch = "mips64",
target_arch = "mips64r6"))))]
PTRACE_PEEKSIGINFO,
#[cfg(all(target_os = "linux", target_env = "gnu",
any(target_arch = "x86", target_arch = "x86_64")))]
Expand Down
19 changes: 17 additions & 2 deletions src/sys/signal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ libc_enum! {
/// Stack fault (obsolete)
#[cfg(all(any(target_os = "android", target_os = "emscripten",
target_os = "fuchsia", target_os = "linux"),
not(any(target_arch = "mips", target_arch = "mips64",
not(any(target_arch = "mips",
target_arch = "mips32r6",
target_arch = "mips64",
target_arch = "mips64r6",
target_arch = "sparc64"))))]
SIGSTKFLT,
/// To parent on child stop or exit
Expand Down Expand Up @@ -144,7 +147,9 @@ impl FromStr for Signal {
),
not(any(
target_arch = "mips",
target_arch = "mips32r6",
target_arch = "mips64",
target_arch = "mips64r6",
target_arch = "sparc64"
))
))]
Expand Down Expand Up @@ -227,7 +232,9 @@ impl Signal {
),
not(any(
target_arch = "mips",
target_arch = "mips32r6",
target_arch = "mips64",
target_arch = "mips64r6",
target_arch = "sparc64"
))
))]
Expand Down Expand Up @@ -318,7 +325,9 @@ const SIGNALS: [Signal; 28] = [
),
not(any(
target_arch = "mips",
target_arch = "mips32r6",
target_arch = "mips64",
target_arch = "mips64r6",
target_arch = "sparc64"
))
))]
Expand All @@ -336,7 +345,13 @@ const SIGNALS: [Signal; 31] = [
target_os = "emscripten",
target_os = "fuchsia"
),
any(target_arch = "mips", target_arch = "mips64", target_arch = "sparc64")
any(
target_arch = "mips",
target_arch = "mips32r6",
target_arch = "mips64",
target_arch = "mips64r6",
target_arch = "sparc64"
)
))]
#[cfg(feature = "signal")]
const SIGNALS: [Signal; 30] = [
Expand Down

0 comments on commit 2a22f0c

Please sign in to comment.