1
0
forked from Rativel/BurritOS

Lint: remove some warnings

This commit is contained in:
Quentin Legot
2023-04-06 13:46:59 +02:00
parent 9cc57e7f03
commit 66d6daf0b9
6 changed files with 16 additions and 68 deletions

View File

@@ -1,5 +1,3 @@
use std::rc::Rc;
use crate::simulator::{machine::{ExceptionType, Machine}, error::{MachineOk, MachineError}};
use super::system::System;
@@ -174,9 +172,9 @@ fn syscall(machine: &mut Machine, system: &mut System) -> Result<MachineOk, Mach
SC_V => todo!(),
SC_SEM_CREATE => {
let addr_name = machine.read_int_register(10);
let initial_count = machine.read_int_register((11));
let initial_count = machine.read_int_register(11);
let size = get_length_param(addr_name as usize, machine);
let name = get_string_param(addr_name, size, machine);
let _name = get_string_param(addr_name, size, machine);
if initial_count <0{
@@ -240,14 +238,13 @@ fn get_string_param(addr: i64, maxlen: usize, machine: &Machine) -> Vec<char>{
mod test {
use crate::kernel::exception::{SC_SHUTDOWN, SC_WRITE};
use crate::kernel::system::System;
use crate::simulator::instruction::Instruction;
use crate::simulator::machine::Machine;
#[test]
fn test_sc_shutdown() {
let mut machine = Machine::new(true);
machine.write_int_register(17, SC_SHUTDOWN as i64); // Set type to shutdown
let ecall = Instruction::new(0b000000000000_00000_000_00000_1110011);
// let ecall = Instruction::new(0b000000000000_00000_000_00000_1110011);
machine.write_memory(4, 0, 0b000000000000_00000_000_00000_1110011); // ecall
machine.write_memory(4, 4, 0b000000001010_00000_000_00001_0010011); // r1 <- 10
@@ -263,7 +260,7 @@ mod test {
fn test_sc_print() {
let mut machine = Machine::new(true);
let address = machine.read_int_register(10);
let _address = machine.read_int_register(10);
// Write string 'HELLO' in memory
machine.write_memory(1, 4000, 72);
machine.write_memory(1, 4001, 69);