fix warnings
Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
parent
2e8e1bca84
commit
f54c3bdc6e
28
src/xous.rs
28
src/xous.rs
@ -249,17 +249,23 @@ impl XousHandler {
|
|||||||
|
|
||||||
impl XousHandler {
|
impl XousHandler {
|
||||||
fn syscall(&mut self, cpu: &mut riscv_cpu::Cpu, syscall: Syscall) -> [i64; 8] {
|
fn syscall(&mut self, cpu: &mut riscv_cpu::Cpu, syscall: Syscall) -> [i64; 8] {
|
||||||
|
print!("Syscall: ");
|
||||||
match syscall {
|
match syscall {
|
||||||
Syscall::IncreaseHeap(bytes, flags) => {
|
Syscall::IncreaseHeap(bytes, _flags) => {
|
||||||
|
println!("IncreaseHeap({} bytes, flags: {:02x})", bytes, _flags);
|
||||||
let heap_address = self.heap_start + self.heap_size;
|
let heap_address = self.heap_start + self.heap_size;
|
||||||
if bytes < 0 {
|
match bytes {
|
||||||
self.heap_size -= bytes.abs() as u32;
|
bytes if bytes < 0 => {
|
||||||
panic!("Reducing size not supported!");
|
self.heap_size -= bytes.unsigned_abs() as u32;
|
||||||
} else if bytes > 0 {
|
panic!("Reducing size not supported!");
|
||||||
for new_address in (heap_address..(heap_address + bytes as u32)).step_by(4096) {
|
},
|
||||||
self.ensure_page(cpu, new_address);
|
bytes if bytes > 0 => {
|
||||||
}
|
for new_address in (heap_address..(heap_address + bytes as u32)).step_by(4096) {
|
||||||
self.heap_size += bytes as u32;
|
self.ensure_page(cpu, new_address);
|
||||||
|
}
|
||||||
|
self.heap_size += bytes as u32;
|
||||||
|
},
|
||||||
|
_ => {},
|
||||||
}
|
}
|
||||||
[
|
[
|
||||||
SyscallResultNumber::MemoryRange as i64,
|
SyscallResultNumber::MemoryRange as i64,
|
||||||
@ -273,7 +279,7 @@ impl XousHandler {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
Syscall::Unknown(args) => {
|
Syscall::Unknown(args) => {
|
||||||
println!("Unknown syscall {:?}: {:?}", SyscallNumber::from(args[0]), args);
|
println!("Unhandled {:?}: {:?}", SyscallNumber::from(args[0]), &args[1..]);
|
||||||
[SyscallResultNumber::Unimplemented as _, 0, 0, 0, 0, 0, 0, 0]
|
[SyscallResultNumber::Unimplemented as _, 0, 0, 0, 0, 0, 0, 0]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -283,7 +289,7 @@ impl XousHandler {
|
|||||||
impl EventHandler for XousHandler {
|
impl EventHandler for XousHandler {
|
||||||
fn handle_event(&mut self, cpu: &mut riscv_cpu::Cpu, args: [i64; 8]) -> [i64; 8] {
|
fn handle_event(&mut self, cpu: &mut riscv_cpu::Cpu, args: [i64; 8]) -> [i64; 8] {
|
||||||
let syscall: Syscall = args.into();
|
let syscall: Syscall = args.into();
|
||||||
println!("Syscall {:?} with args: {:?}", syscall, &args[1..]);
|
// println!("Syscall {:?} with args: {:?}", syscall, &args[1..]);
|
||||||
self.syscall(cpu, syscall)
|
self.syscall(cpu, syscall)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#![allow(dead_code)]
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Debug, Copy, Clone)]
|
||||||
pub enum SyscallResultNumber {
|
pub enum SyscallResultNumber {
|
||||||
Ok = 0,
|
Ok = 0,
|
||||||
|
Loading…
Reference in New Issue
Block a user