kernel: allow connection IDs to be u32

In an effort to homogonize platforms, we are moving away from `usize` in
favour of `u32`. Allow the `CID` type to be a `u32` in the kernel by
casting it to a `usize` as necessary.

Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
Sean Cross 2021-02-04 10:29:12 +08:00
parent 00ef495b09
commit 715e76bee0

View file

@ -1497,7 +1497,7 @@ impl SystemServices {
ArchProcess::with_inner(|process_inner| {
assert_eq!(crate::arch::process::current_pid(), process_inner.pid);
if cid >= process_inner.connection_map.len() {
if (cid as usize) >= process_inner.connection_map.len() {
// println!("KERNEL({}): CID {} > connection map len", crate::arch::process::current_pid(), cid);
return None;
}
@ -1505,7 +1505,7 @@ impl SystemServices {
// println!("KERNEL({}): CID {} doesn't exist in the connection map", crate::arch::process::current_pid(), cid + 2);
// println!("KERNEL({}): Process inner is: {:?}", crate::arch::process::current_pid(), process_inner);
// }
let mut server_idx = process_inner.connection_map[cid]?.get() as usize;
let mut server_idx = process_inner.connection_map[cid as usize]?.get() as usize;
if server_idx == 1 {
// println!("KERNEL({}): CID {} is no longer valid", crate::arch::process::current_pid(), cid + 2);
return None;