Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for MIPS targets #301

Merged
merged 1 commit into from
Mar 11, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion src/sched.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ mod cpuset_attribs {
}
}

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

#[cfg(all(any(target_arch = "arm", target_arch = "mips"), target_os = "linux"))]
mod cpuset_attribs {
use super::CpuMask;
pub const CPU_SETSIZE: usize = 1024;
pub const CPU_MASK_BITS: usize = 32;

#[inline]
pub fn set_cpu_mask_flag(cur: CpuMask, bit: usize) -> CpuMask {
cur | (1u32 << bit)
}

#[inline]
pub fn clear_cpu_mask_flag(cur: CpuMask, bit: usize) -> CpuMask {
cur & !(1u32 << bit)
}
}

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

Expand Down
9 changes: 9 additions & 0 deletions src/sys/syscall.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@ mod arch {
pub static MEMFD_CREATE: Syscall = 385;
}

#[cfg(target_arch = "mips")]
mod arch {
use libc::c_long;

pub type Syscall = c_long;

pub static SYSPIVOTROOT: Syscall = 216;
pub static MEMFD_CREATE: Syscall = 354;
}

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