Skip to content

Commit d53950a

Browse files
committed
Auto merge of #301 - gabrielesvelto:master, r=kamalmarhubi
Add support for MIPS targets Closes #300
2 parents 987dcf4 + 86b3cfa commit d53950a

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

src/sched.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ mod cpuset_attribs {
8787
}
8888
}
8989

90-
#[cfg(all(target_arch = "arm", any(target_os = "linux", target_os = "android")))]
90+
#[cfg(all(any(target_arch = "arm", target_arch = "mips"), target_os = "android"))]
9191
mod cpuset_attribs {
9292
use super::CpuMask;
9393
// bionic only supports up to 32 independent CPUs, instead of 1024.
@@ -105,6 +105,22 @@ mod cpuset_attribs {
105105
}
106106
}
107107

108+
#[cfg(all(any(target_arch = "arm", target_arch = "mips"), target_os = "linux"))]
109+
mod cpuset_attribs {
110+
use super::CpuMask;
111+
pub const CPU_SETSIZE: usize = 1024;
112+
pub const CPU_MASK_BITS: usize = 32;
113+
114+
#[inline]
115+
pub fn set_cpu_mask_flag(cur: CpuMask, bit: usize) -> CpuMask {
116+
cur | (1u32 << bit)
117+
}
118+
119+
#[inline]
120+
pub fn clear_cpu_mask_flag(cur: CpuMask, bit: usize) -> CpuMask {
121+
cur & !(1u32 << bit)
122+
}
123+
}
108124

109125
pub type CloneCb<'a> = Box<FnMut() -> isize + 'a>;
110126

src/sys/syscall.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@ mod arch {
4444
pub static MEMFD_CREATE: Syscall = 385;
4545
}
4646

47+
#[cfg(target_arch = "mips")]
48+
mod arch {
49+
use libc::c_long;
50+
51+
pub type Syscall = c_long;
52+
53+
pub static SYSPIVOTROOT: Syscall = 216;
54+
pub static MEMFD_CREATE: Syscall = 354;
55+
}
4756

4857
extern {
4958
pub fn syscall(num: Syscall, ...) -> c_int;

0 commit comments

Comments
 (0)