remove all warnings (for now)

Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
Sean Cross 2023-12-31 16:44:49 +08:00
parent 1da46538e3
commit ac7f243847
2 changed files with 16 additions and 14 deletions

View File

@ -3438,7 +3438,7 @@ const INSTRUCTIONS: [Instruction; INSTRUCTION_NUM] = [
1 => PrivilegeMode::Supervisor, 1 => PrivilegeMode::Supervisor,
_ => panic!(), // Shouldn't happen _ => panic!(), // Shouldn't happen
}; };
println!("Updating privilege mode to {:?}", cpu.privilege_mode); // println!("Updating privilege mode to {:?}", cpu.privilege_mode);
cpu.mmu.update_privilege_mode(cpu.privilege_mode); cpu.mmu.update_privilege_mode(cpu.privilege_mode);
Ok(()) Ok(())
}, },

View File

@ -51,7 +51,7 @@ struct Memory {
free_pages: BTreeSet<usize>, free_pages: BTreeSet<usize>,
heap_start: u32, heap_start: u32,
heap_size: u32, heap_size: u32,
allocation_start: u32, // allocation_start: u32,
allocation_previous: u32, allocation_previous: u32,
l1_pt: u32, l1_pt: u32,
satp: u32, satp: u32,
@ -59,18 +59,18 @@ struct Memory {
enum WorkerCommand { enum WorkerCommand {
Start, Start,
MemoryRange(u32 /* address */, u32 /* size */), // MemoryRange(u32 /* address */, u32 /* size */),
} }
enum WorkerResponse { enum WorkerResponse {
Started, // Started,
Exited(u32), Exited(u32),
AllocateMemory( // AllocateMemory(
u32, /* phys */ // u32, /* phys */
u32, /* virt */ // u32, /* virt */
u32, /* size */ // u32, /* size */
u32, /* flags */ // u32, /* flags */
), // ),
} }
struct Worker { struct Worker {
@ -126,7 +126,7 @@ impl Memory {
heap_start: 0x6000_0000, heap_start: 0x6000_0000,
heap_size: 0, heap_size: 0,
allocation_previous: 0x4000_0000, allocation_previous: 0x4000_0000,
allocation_start: 0x4000_0000, // allocation_start: 0x4000_0000,
} }
} }
@ -375,13 +375,12 @@ impl riscv_cpu::cpu::Memory for Memory {
fn syscall(&mut self, args: [i64; 8]) -> [i64; 8] { fn syscall(&mut self, 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..]);
print!("Syscall: "); print!("Syscall: ");
match syscall { match syscall {
Syscall::IncreaseHeap(bytes, _flags) => { Syscall::IncreaseHeap(bytes, _flags) => {
println!("IncreaseHeap({} bytes, flags: {:02x})", bytes, _flags); println!("IncreaseHeap({} bytes, flags: {:02x})", bytes, _flags);
let heap_start = self.heap_start;
let heap_address = self.heap_start + self.heap_size; let heap_address = self.heap_start + self.heap_size;
match bytes { match bytes {
bytes if bytes < 0 => { bytes if bytes < 0 => {
@ -411,6 +410,10 @@ impl riscv_cpu::cpu::Memory for Memory {
} }
Syscall::MapMemory(phys, virt, size, _flags) => { Syscall::MapMemory(phys, virt, size, _flags) => {
println!(
"MapMemory(phys: {:08x}, virt: {:08x}, bytes: {}, flags: {:02x})",
phys, virt, size, _flags
);
if virt != 0 { if virt != 0 {
unimplemented!("Non-zero virt address"); unimplemented!("Non-zero virt address");
} }
@ -528,7 +531,6 @@ impl Machine {
let (tx, rx) = std::sync::mpsc::channel(); let (tx, rx) = std::sync::mpsc::channel();
let worker_tx = self.worker_response_tx.clone(); let worker_tx = self.worker_response_tx.clone();
let mem = self.memory.clone();
std::thread::spawn(move || Worker::new(cpu, rx, worker_tx).run()); std::thread::spawn(move || Worker::new(cpu, rx, worker_tx).run());
self.workers.push(WorkerHandle { tx }); self.workers.push(WorkerHandle { tx });