Skip to content

Commit

Permalink
Add support for MIPS targets
Browse files Browse the repository at this point in the history
Closes #300
  • Loading branch information
gabrielesvelto committed Mar 7, 2016
1 parent 3f0c3e1 commit 86b3cfa
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
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

0 comments on commit 86b3cfa

Please sign in to comment.